From 5dc4ad2b355c09829899b9d5b24ebeafa8377d7f Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 3 Jul 2022 03:44:27 +0200 Subject: [PATCH 1/2] Fix #6 --- scripts/install | 1 + scripts/upgrade | 1 + 2 files changed, 2 insertions(+) diff --git a/scripts/install b/scripts/install index e5da697..03b09bb 100755 --- a/scripts/install +++ b/scripts/install @@ -83,6 +83,7 @@ ynh_script_progression --message="Setting up source files..." --weight=1 ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" +ynh_replace_string --match_string="https://sutom.nocle.fr" --replace_string="https://$domain$path_url" --target_file="$final_path/ts/finDePartiePanel.ts" chmod 750 "$final_path" chmod -R o-rwx "$final_path" diff --git a/scripts/upgrade b/scripts/upgrade index acf7b35..24b4f53 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -78,6 +78,7 @@ ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" +ynh_replace_string --match_string="https://sutom.nocle.fr" --replace_string="https://$domain$path_url" --target_file="$final_path/ts/finDePartiePanel.ts" chmod 750 "$final_path" chmod -R o-rwx "$final_path" From 74965fb125fbf3c5535a691b193544942a0d5a3d Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 3 Jul 2022 03:51:17 +0200 Subject: [PATCH 2/2] Apply last example_ynh --- check_process | 5 +---- conf/systemd.service | 4 ++-- scripts/remove | 1 + scripts/restore | 14 +++++++------- scripts/upgrade | 15 ++++++++------- 5 files changed, 19 insertions(+), 20 deletions(-) diff --git a/check_process b/check_process index 108685a..2264d36 100644 --- a/check_process +++ b/check_process @@ -15,11 +15,8 @@ upgrade=1 from_commit=3203df977e8ab92fb24968adcabbcd901ab84785 backup_restore=1 multi_instance=1 + port_already_use=0 change_url=1 ;;; Options Email= Notification=none -;;; Upgrade options - ; commit=CommitHash - name=Name and date of the commit. - manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& diff --git a/conf/systemd.service b/conf/systemd.service index 7dab18b..b418a8e 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -14,7 +14,7 @@ ExecStart=__YNH_NPM__ run start:prod Restart=always # Sandboxing options to harden security -# Depending on specificities of your service/app, you may need to tweak these +# Depending on specificities of your service/app, you may need to tweak these # .. but this should be a good baseline # Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html NoNewPrivileges=yes @@ -41,7 +41,7 @@ CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW -CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG +CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG [Install] WantedBy=multi-user.target diff --git a/scripts/remove b/scripts/remove index 42707a2..7385ab2 100755 --- a/scripts/remove +++ b/scripts/remove @@ -62,6 +62,7 @@ ynh_remove_nginx_config #================================================= ynh_script_progression --message="Removing dependencies..." --weight=1 +# Remove metapackage and its dependencies ynh_remove_nodejs #================================================= diff --git a/scripts/restore b/scripts/restore index 2dac620..3dd7457 100755 --- a/scripts/restore +++ b/scripts/restore @@ -41,13 +41,6 @@ test ! -d $final_path \ #================================================= # STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -75,6 +68,13 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=6 # Define and install dependencies ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + #================================================= # RESTORE SYSTEMD #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 24b4f53..e6a4bd7 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,6 +24,7 @@ port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # CHECK VERSION #================================================= +ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) @@ -84,6 +85,13 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" +#================================================= +# UPGRADE DEPENDENCIES +#================================================= +ynh_script_progression --message="Upgrading dependencies..." --weight=10 + +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version + #================================================= # NGINX CONFIGURATION #================================================= @@ -92,13 +100,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=10 - -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version - #================================================= # SPECIFIC UPGRADE #==============================================