From 1b1b5ccefa2ec5c322691023b59684a50dcef9bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Wed, 28 Feb 2024 13:33:07 +0100 Subject: [PATCH] Fix install_dir/sources --- conf/nginx.conf | 2 +- conf/systemd.service | 4 ++-- scripts/install | 10 +++++----- scripts/upgrade | 12 ++++++------ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 932d6d1..768fe0c 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -2,7 +2,7 @@ location __PATH__/ { # Path to source - alias __INSTALL_DIR__/; + alias __INSTALL_DIR__/sources/; proxy_pass http://localhost:__PORT__; proxy_set_header X-Real-IP $remote_addr; diff --git a/conf/systemd.service b/conf/systemd.service index dc7fe1b..4155733 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -5,11 +5,11 @@ After=network.target [Service] Type=simple Environment=NODE_ENV=production -Environment=NODE_CONFIG_DIR=__INSTALL_DIR__/config +Environment=NODE_CONFIG_DIR=__INSTALL_DIR__/sources/config User=__APP__ Group=__APP__ ExecStart=__YNH_NPM__ start -WorkingDirectory=__INSTALL_DIR__/ +WorkingDirectory=__INSTALL_DIR__/sources/ StandardOutput=syslog StandardError=syslog SyslogIdentifier=__APP__ diff --git a/scripts/install b/scripts/install index 83248a6..5864c1c 100644 --- a/scripts/install +++ b/scripts/install @@ -38,10 +38,10 @@ chown -R "$app:$app" "$install_dir" #================================================= ynh_script_progression --message="Building..." -pushd "$install_dir" +pushd "$install_dir/sources" ynh_use_nodejs ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn install --pure-lockfile - ynh_exec_as "$app" mkdir -p "$install_dir/dist" + ynh_exec_as "$app" mkdir -p "dist" ynh_exec_as "$app" env "$ynh_node_load_PATH" "$ynh_npm" run build popd @@ -50,10 +50,10 @@ popd #================================================= ynh_script_progression --message="Adding a config file..." -ynh_add_config --template="default.yaml" --destination="$install_dir/config/production.yaml" +ynh_add_config --template="default.yaml" --destination="$install_dir/sources/config/production.yaml" -chmod 400 "$install_dir/config/production.yaml" -chown "$app:$app" "$install_dir/config/production.yaml" +chmod 400 "$install_dir/sources/config/production.yaml" +chown "$app:$app" "$install_dir/sources/config/production.yaml" #================================================= # SYSTEM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index c9d2c2b..44cc1aa 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -39,7 +39,7 @@ ynh_script_progression --message="Ensuring downward compatibility..." # Move git repository one step lower if [ -d "$install_dir/.git" ]; then mkdir "${install_dir}__tmp__" - mv "$install_dir" "${install_dir}__tmp__" + mv "$install_dir" "${install_dir}__tmp__/sources" mv "${install_dir}__tmp__" "$install_dir" fi @@ -62,10 +62,10 @@ chown -R "$app:$app" "$install_dir" #================================================= ynh_script_progression --message="Building..." -pushd "$install_dir" +pushd "$install_dir/sources" ynh_use_nodejs ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn install --pure-lockfile - ynh_exec_as "$app" mkdir -p "$install_dir/dist" + ynh_exec_as "$app" mkdir -p "dist" ynh_exec_as "$app" env "$ynh_node_load_PATH" "$ynh_npm" run build popd @@ -74,10 +74,10 @@ popd #================================================= ynh_script_progression --message="Updating a config file..." -ynh_add_config --template="default.yaml" --destination="$install_dir/config/production.yaml" +ynh_add_config --template="default.yaml" --destination="$install_dir/sources/config/production.yaml" -chmod 400 "$install_dir/config/production.yaml" -chown "$app:$app" "$install_dir/config/production.yaml" +chmod 400 "$install_dir/sources/config/production.yaml" +chown "$app:$app" "$install_dir/sources/config/production.yaml" #================================================= # REAPPLY SYSTEM CONFIGURATIONS