Merge pull request 'refs #1687 changes symfony files to api directoty' (#7) from change-directories into main
testing/og-dhcp-API/pipeline/head There was a failure building this commit
Details
testing/og-dhcp-API/pipeline/head There was a failure building this commit
Details
Reviewed-on: #7new_files_placement
commit
6eac73bc69
|
@ -4,7 +4,7 @@
|
|||
# Put parameters here that don't need to change on each machine where the app is deployed
|
||||
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
|
||||
parameters:
|
||||
backup_dir: '%kernel.project_dir%/etc/kea/backup'
|
||||
backup_dir: '%kernel.project_dir%/../etc/kea/backup'
|
||||
services:
|
||||
# default configuration for services in *this* file
|
||||
_defaults:
|
||||
|
|
|
@ -34,6 +34,7 @@ function globalSetup() {
|
|||
# Directorios de instalación y destino de OpenGnsys.
|
||||
WORKDIR=/tmp/ogdhcp_installer
|
||||
INSTALL_TARGET=$(jq -r '.ogDhcp_Dir' "$CONFIG_FILE")
|
||||
SYMFONY_TARGET=$INSTALL_TARGET/api
|
||||
PATH=$PATH:$INSTALL_TARGET/bin
|
||||
|
||||
if command -v service &>/dev/null; then
|
||||
|
@ -138,10 +139,12 @@ function createDirs() {
|
|||
fi
|
||||
|
||||
local path_opengnsys_base="$1"
|
||||
local symfony_target="$path_opengnsys_base/api"
|
||||
|
||||
# Crear estructura de directorios.
|
||||
echoAndLog "${FUNCNAME}(): creating directory paths in $path_opengnsys_base"
|
||||
mkdir -p "$path_opengnsys_base"/{bin,config,docs,public,src,etc/kea/backup,templates,var/{cache,log},vendor}
|
||||
mkdir -p "$symfony_target"/{bin,config,docs,public,src,templates,var/{cache,log},vendor}
|
||||
mkdir -p "$path_opengnsys_base"/etc/kea/backup
|
||||
if [ $? -ne 0 ]; then
|
||||
errorAndLog "${FUNCNAME}(): error while creating dirs. Do you have write permissions?"
|
||||
return 1
|
||||
|
@ -149,13 +152,13 @@ function createDirs() {
|
|||
|
||||
# Mover el fichero de registro de instalación al directorio de logs.
|
||||
echoAndLog "${FUNCNAME}(): moving installation log file"
|
||||
mv "$LOG_FILE" "$path_opengnsys_base/var/log" && LOG_FILE="$OGLOGFILE"
|
||||
mv "$LOG_FILE" "$symfony_target/var/log" && LOG_FILE="$OGLOGFILE"
|
||||
usermod -aG $OPENGNSYS_CLIENT_USER _kea
|
||||
|
||||
|
||||
# Mover el fichero de registro de instalación al directorio de logs.
|
||||
echoAndLog "${FUNCNAME}(): moving installation log file"
|
||||
touch "$path_opengnsys_base/var/log/dev.log"
|
||||
touch "$symfony_target/var/log/dev.log"
|
||||
|
||||
echoAndLog "${FUNCNAME}(): directory paths created"
|
||||
return 0
|
||||
|
@ -170,7 +173,8 @@ function create_ogdhcp_project {
|
|||
# Crea el usuario ogdhcp si no existe
|
||||
echo "Creating ogdhcp user..."
|
||||
local path_opengnsys_base="$1"
|
||||
echo $path_opengnsys_base
|
||||
local symfony_target="$path_opengnsys_base/api"
|
||||
echo $symfony_target
|
||||
# Verificar si el usuario OPENGNSYS_CLIENT_USER existe
|
||||
if id -u "$OPENGNSYS_CLIENT_USER" &>/dev/null; then
|
||||
# Salida de getent passwd -> opengnsys:x:1001:1001::/opt/opengnsys:/bin/sh
|
||||
|
@ -219,13 +223,14 @@ function copyServerFiles() {
|
|||
fi
|
||||
|
||||
local path_opengnsys_base="$1"
|
||||
local symfony_target="$path_opengnsys_base/api"
|
||||
local etc_target="$path_opengnsys_base/etc"
|
||||
|
||||
# Lista de ficheros y directorios origen y de directorios destino.
|
||||
local SOURCES=(
|
||||
config
|
||||
#public
|
||||
src
|
||||
etc
|
||||
.env
|
||||
composer.json
|
||||
composer.lock
|
||||
|
@ -236,7 +241,6 @@ function copyServerFiles() {
|
|||
config
|
||||
#public
|
||||
src
|
||||
etc
|
||||
.env
|
||||
composer.json
|
||||
composer.lock
|
||||
|
@ -256,15 +260,22 @@ function copyServerFiles() {
|
|||
local i
|
||||
for (( i = 0; i < ${#SOURCES[@]}; i++ )); do
|
||||
if [ -f "${SOURCES[$i]}" ]; then
|
||||
echoAndLog "Copying ${SOURCES[$i]} to $path_opengnsys_base/${TARGETS[$i]}"
|
||||
cp -a "${SOURCES[$i]}" "$path_opengnsys_base/${TARGETS[$i]}"
|
||||
echoAndLog "Copying ${SOURCES[$i]} to $symfony_target/${TARGETS[$i]}"
|
||||
cp -a "${SOURCES[$i]}" "$symfony_target/${TARGETS[$i]}"
|
||||
elif [ -d "${SOURCES[$i]}" ]; then
|
||||
echoAndLog "Copying content of ${SOURCES[$i]} to $path_opengnsys_base/${TARGETS[$i]}"
|
||||
cp -a "${SOURCES[$i]}"/* "$path_opengnsys_base/${TARGETS[$i]}"
|
||||
echoAndLog "Copying content of ${SOURCES[$i]} to $symfony_target/${TARGETS[$i]}"
|
||||
cp -a "${SOURCES[$i]}"/* "$symfony_target/${TARGETS[$i]}"
|
||||
else
|
||||
warningAndLog "Unable to copy ${SOURCES[$i]} to $path_opengnsys_base/${TARGETS[$i]}"
|
||||
warningAndLog "Unable to copy ${SOURCES[$i]} to $symfony_target/${TARGETS[$i]}"
|
||||
fi
|
||||
done
|
||||
# Copiar el directorio etc
|
||||
echoAndLog "Copying etc directory to $path_opengnsys_base"
|
||||
cp -a etc "$path_opengnsys_base"
|
||||
if [ $? -ne 0 ]; then
|
||||
errorAndLog "Error while copying etc directory to $path_opengnsys_base"
|
||||
return 1
|
||||
fi
|
||||
echoAndLog "Changing user permission"
|
||||
chown -R "$OPENGNSYS_CLIENT_USER:$OPENGNSYS_CLIENT_USER" "$INSTALL_TARGET"
|
||||
|
||||
|
@ -275,7 +286,8 @@ function copyServerFiles() {
|
|||
function runComposer() {
|
||||
echoAndLog "Running composer.phar to install dependencies..."
|
||||
local path_opengnsys_base="$1"
|
||||
pushd $path_opengnsys_base
|
||||
local symfony_target="$path_opengnsys_base/api"
|
||||
pushd $symfony_target
|
||||
pwd
|
||||
# Ejecutar composer.phar
|
||||
sudo -u "$OPENGNSYS_CLIENT_USER" composer --no-interaction install
|
||||
|
@ -383,7 +395,8 @@ add_write_permission_apparmor() {
|
|||
# Función para configurar Nginx
|
||||
setup_nginx() {
|
||||
local path_opengnsys_base="$1"
|
||||
local public_dir="$path_opengnsys_base/public"
|
||||
local symfony_target="$path_opengnsys_base/api"
|
||||
local public_dir="$symfony_target/public"
|
||||
#ip_address_server=$(get_ip_address "$DEFAULTDEV")
|
||||
if [[ ! -f "$CONFIG_FILE" ]]; then
|
||||
echo "Error: El archivo de configuración no se encontró."
|
||||
|
|
Loading…
Reference in New Issue