From 219301790e7d34cbc4272c6993a5952299c1dd47 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 29 Jun 2022 02:17:46 +0200 Subject: [PATCH 1/8] Apply last example_ynh --- check_process | 9 ++++--- conf/app.src | 2 ++ conf/config.js | 65 +++++++++++++++++++++++++++++++++++++++++++++ doc/.DS_Store | Bin 6148 -> 0 bytes manifest.json | 2 +- scripts/_common.sh | 5 +++- scripts/backup | 3 ++- scripts/change_url | 8 +++--- scripts/install | 61 +++++++++++++++++++++++------------------- scripts/remove | 22 ++++++++------- scripts/restore | 20 +++++++------- scripts/upgrade | 58 ++++++++++++++++++++++------------------ 12 files changed, 172 insertions(+), 83 deletions(-) delete mode 100644 doc/.DS_Store diff --git a/check_process b/check_process index d02340b..b1ea4c6 100644 --- a/check_process +++ b/check_process @@ -10,13 +10,14 @@ setup_private=1 setup_public=1 upgrade=1 + # 3.4.14~ynh1 upgrade=1 from_commit=6e2eba4a9b6b455b35ce9d8e558c454a001bfacf + # 3.4.18~ynh1 + upgrade=1 from_commit=674f8d3211ba98b10f169deea3127a8b378c6c3c backup_restore=1 multi_instance=1 + port_already_use=0 change_url=1 ;;; Options Email= -;;; Upgrade options - ; commit=6e2eba4a9b6b455b35ce9d8e558c454a001bfacf - name=3.4.14 - manifest_arg=domain=DOMAIN&is_public=1& \ No newline at end of file +Notification=none diff --git a/conf/app.src b/conf/app.src index 80810f7..3541b63 100644 --- a/conf/app.src +++ b/conf/app.src @@ -3,3 +3,5 @@ SOURCE_SUM=d8b485383f5f2fdca98501e1abdacec158b2eb04a7a8a4dabae2a0d4f542c6e4 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true +SOURCE_FILENAME= +SOURCE_EXTRACT=true diff --git a/conf/config.js b/conf/config.js index f1e57bc..805dae7 100644 --- a/conf/config.js +++ b/conf/config.js @@ -1,8 +1,11 @@ const convict = require('convict'); +const convict_format_with_validator = require('convict-format-with-validator'); const { tmpdir } = require('os'); const path = require('path'); const { randomBytes } = require('crypto'); +convict.addFormats(convict_format_with_validator); + convict.addFormat({ name: 'positive-int-array', coerce: ints => { @@ -239,6 +242,68 @@ const conf = convict({ format: String, default: 'https://github.com/timvisee/send', env: 'SEND_FOOTER_SOURCE_URL' + }, + ui_color_primary: { + format: String, + default: '#0a84ff', + env: 'UI_COLOR_PRIMARY' + }, + ui_color_accent: { + format: String, + default: '#003eaa', + env: 'UI_COLOR_ACCENT' + }, + ui_custom_assets: { + android_chrome_192px: { + format: String, + default: '', + env: 'UI_CUSTOM_ASSETS_ANDROID_CHROME_192PX' + }, + android_chrome_512px: { + format: String, + default: '', + env: 'UI_CUSTOM_ASSETS_ANDROID_CHROME_512PX' + }, + apple_touch_icon: { + format: String, + default: '', + env: 'UI_CUSTOM_ASSETS_APPLE_TOUCH_ICON' + }, + favicon_16px: { + format: String, + default: '', + env: 'UI_CUSTOM_ASSETS_FAVICON_16PX' + }, + favicon_32px: { + format: String, + default: '', + env: 'UI_CUSTOM_ASSETS_FAVICON_32PX' + }, + icon: { + format: String, + default: '', + env: 'UI_CUSTOM_ASSETS_ICON' + }, + safari_pinned_tab: { + format: String, + default: '', + env: 'UI_CUSTOM_ASSETS_SAFARI_PINNED_TAB' + }, + facebook: { + format: String, + default: '', + env: 'UI_CUSTOM_ASSETS_FACEBOOK' + }, + twitter: { + format: String, + default: '', + env: 'UI_CUSTOM_ASSETS_TWITTER' + }, + wordmark: { + format: String, + default: '', + env: 'UI_CUSTOM_ASSETS_WORDMARK' + } } }); diff --git a/doc/.DS_Store b/doc/.DS_Store deleted file mode 100644 index 89d6be550c959cabe5cee10f79099a460aff7eae..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK-)mGy6h7Z(HM?eQCehX(t?X)O3@S0D7F5vQCQ+hBlqNCj4~)BeC&{fh_lBLD zP4H=@s4qU0QhgP%zDlw7Q43YUr$V7n8tfn7Kj4E;p1CtY($v=?GH03j=FB(e%)K9X zW_E}O{d4|jM1qKNTr_6aaP=Rid0kdm#`b7LnnO}Vil!;1WW{LL;S_KRylV>RwcEyP zwnlZ5{Cl&0Rj3-X)iACSWo}ew!$2i{eT&GnWLK?j&E?m$71kDqjtm_wbeDr#9E}8* zlv)#ETc8LJ=(;^=fa zkqgOEqGeS1jEd{YK$>hqh&d&{mYgeS$U)A?sXFy+CuVgTbxPJ1W0&U{wex>}&@MVU z*RB8XqYb4`cl3U~_dtKS7SGJcC{gEqPB2_i$%$DRN&lR7kH>y68A$)Eb_VK_YkySn zGmnLpstiXj29ZDBFtdzCl^OZx#!Z_){$xv`IL3@z7@H6LWcqYP)nw!c(bRY&P(d}6 zqO}9N^0{>M)@{Y2$cbk;<92T^76imExqQm*+|F#qa=ZJOYY`R8?fIfm6sv@96Ybky zD2S|3c@uf?OJ-M#W0oBlWR^PcDxc4FEq#1lUXN*}51;4VeG7HdUh-&^CVBI|OxNia zJ)np5i2k5OdOp894K5-<1M^tG zWqgY(xQc7|4&UPk+`vuT!fo8akGP9__zCy%Gald}e#LKij3;=C-|-ion`g}M(URJ* zMGN?c8*lk^8zc27jH4+Yu@t>L*m-ZH$+bB(oB~b(r@+4y&|7DTi$>34(_p%*a+P6M z^I47BxUKIJ8cP;Ei%o;fu)%~fno!s)2242jm+UytV$+}rC!{lT9y>Ga4F&1!++RwE z6Fh^ib_zHJmMhR=T%phZLvO$TFAs8_Q@|/dev/null then - ynh_script_progression --message="Removing $app service..." --weight=1 + ynh_script_progression --message="Removing $app service integration..." --weight=1 yunohost service remove $app fi @@ -49,13 +49,6 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight= # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=1 - -ynh_remove_nodejs - #================================================= # REMOVE THE REDIS DATABASE #================================================= @@ -76,9 +69,18 @@ ynh_secure_remove --file="$final_path" #================================================= ynh_script_progression --message="Removing NGINX web server configuration..." --weight=5 -# Remove the dedicated nginx config +# Remove the dedicated NGINX config ynh_remove_nginx_config +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_script_progression --message="Removing dependencies..." --weight=1 + +# Remove metapackage and its dependencies +ynh_remove_app_dependencies +ynh_remove_nodejs + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index 1911c37..0658d8a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -6,6 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -40,13 +41,6 @@ test ! -d $final_path \ #================================================= # STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX configuration..." - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -74,9 +68,17 @@ chmod +x "$final_path/server/bin/prod.js" #================================================= ynh_script_progression --message="Reinstalling dependencies..." --weight=7 -# Install Nodejs +# Define and install dependencies +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the NGINX configuration..." + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + #================================================= # RESTORE SYSTEMD #================================================= @@ -104,7 +106,7 @@ yunohost service add $app --description="Simple, private file sharing" --log="/v #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index d65b7d7..431fd9b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,9 +24,25 @@ port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # CHECK VERSION #================================================= +ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=10 + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + ynh_clean_check_starting + # Restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -36,20 +52,6 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up $app before upgrading (may take a while)..." --weight=10 - -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - # restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - #================================================= # CREATE DEDICATED USER #================================================= @@ -75,6 +77,14 @@ chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" chmod +x "$final_path/server/bin/prod.js" +#================================================= +# UPGRADE DEPENDENCIES +#================================================= +ynh_script_progression --message="Upgrading dependencies..." --weight=18 + +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version + #================================================= # NGINX CONFIGURATION #================================================= @@ -83,19 +93,11 @@ 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=18 - -# Install Nodejs -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version - #================================================= # SPECIFIC UPGRADE -#================================================ +#================================================= # INSTALL SEND -#================================================ +#================================================= if [ "$upgrade_type" == "UPGRADE_APP" ] then @@ -105,17 +107,21 @@ then ynh_use_nodejs ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run build + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm ci --production + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm cache clean --force popd fi #================================================= # SETUP SYSTEMD #================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=2 +ynh_script_progression --message="Upgrading systemd configuration..." --weight=2 # Create a dedicated systemd config ynh_add_systemd_config +#================================================= +# GENERIC FINALIZATION #================================================= # SETUP LOGROTATE #================================================= @@ -136,7 +142,7 @@ yunohost service add $app --description="Simple, private file sharing" --log="/v #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started" #================================================= # RELOAD NGINX From f5ab837f1380ef4c2cdfc9bbc0722310c69740a7 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 29 Jun 2022 02:18:28 +0200 Subject: [PATCH 2/8] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index a07089d..b1d7f08 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "File sharing which allows to send encrypted files", "fr": "Partage de fichiers qui permet d'envoyer des fichiers chiffrés" }, - "version": "3.4.20~ynh1", + "version": "3.4.20~ynh2", "url": "https://github.com/timvisee/send", "upstream": { "license": "MPL-2.0", From 4e3ba75cd7c2353b3c21e312de99897a379fc649 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Wed, 29 Jun 2022 00:18:33 +0000 Subject: [PATCH 3/8] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b688adb..daf61aa 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ A fork of Mozilla's Firefox Send. Mozilla discontinued Send, this fork is a comm Send is a file sharing experiment which allows you to send encrypted files to other users. -**Shipped version:** 3.4.20~ynh1 +**Shipped version:** 3.4.20~ynh2 **Demo:** https://send.vis.ee/ diff --git a/README_fr.md b/README_fr.md index c35150f..5858fb4 100644 --- a/README_fr.md +++ b/README_fr.md @@ -19,7 +19,7 @@ Un fork du Firefox Send de Mozilla. Mozilla a arrêté Send, et ce fork est un e Send est une expérience de partage de fichiers qui permet d'envoyer des fichiers chiffrés à d'autres utilisateurs. -**Version incluse :** 3.4.20~ynh1 +**Version incluse :** 3.4.20~ynh2 **Démo :** https://send.vis.ee/ From aa44a41477f8ddb57eca497c94ab4239b0ea5640 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 1 Jul 2022 01:08:17 +0200 Subject: [PATCH 4/8] Fix upgrade from same version --- scripts/install | 2 -- scripts/upgrade | 2 -- 2 files changed, 4 deletions(-) diff --git a/scripts/install b/scripts/install index c9670b5..c512970 100644 --- a/scripts/install +++ b/scripts/install @@ -117,8 +117,6 @@ pushd "$final_path" ynh_use_nodejs ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run build - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm ci --production - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm cache clean --force popd #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 431fd9b..232bc73 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -107,8 +107,6 @@ then ynh_use_nodejs ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run build - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm ci --production - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm cache clean --force popd fi From e624704d269f00ce1179570244077372f2b20cdc Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 1 Jul 2022 01:13:09 +0200 Subject: [PATCH 5/8] Remove /var/log There is no `/var/log` --- scripts/backup | 6 ------ scripts/change_url | 2 +- scripts/install | 10 +--------- scripts/remove | 8 -------- scripts/restore | 9 +-------- scripts/upgrade | 17 ++++++++--------- 6 files changed, 11 insertions(+), 41 deletions(-) diff --git a/scripts/backup b/scripts/backup index 889bc9c..65e96c1 100644 --- a/scripts/backup +++ b/scripts/backup @@ -47,12 +47,6 @@ ynh_backup --src_path="$final_path" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# BACKUP LOGROTATE -#================================================= - -ynh_backup --src_path="/etc/logrotate.d/$app" - #================================================= # BACKUP SYSTEMD #================================================= diff --git a/scripts/change_url b/scripts/change_url index 114e437..4048293 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -71,7 +71,7 @@ fi #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="stop" #================================================= # MODIFY URL IN NGINX CONF diff --git a/scripts/install b/scripts/install index c512970..78378f3 100644 --- a/scripts/install +++ b/scripts/install @@ -137,20 +137,12 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=1 # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." --weight=1 - -# Use logrotate to manage application logfile(s) -ynh_use_logrotate - #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description="Simple, private file sharing" --log="/var/log/$app/$app.log" +yunohost service add $app --description="Simple, private file sharing" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/remove b/scripts/remove index cbf5a33..c9f2b99 100644 --- a/scripts/remove +++ b/scripts/remove @@ -41,14 +41,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 - -# Remove the app-specific logrotate config -ynh_remove_logrotate - #================================================= # REMOVE THE REDIS DATABASE #================================================= diff --git a/scripts/restore b/scripts/restore index 0658d8a..eb12d4b 100644 --- a/scripts/restore +++ b/scripts/restore @@ -87,19 +87,12 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/logrotate.d/$app" - #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description="Simple, private file sharing" --log="/var/log/$app/$app.log" +yunohost service add $app --description="Simple, private file sharing" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index 232bc73..57b1f50 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -52,6 +52,13 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_script_progression --message="Ensuring downward compatibility..." + +ynh_remove_logrotate + #================================================= # CREATE DEDICATED USER #================================================= @@ -120,20 +127,12 @@ ynh_add_systemd_config #================================================= # GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 - -# Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append - #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description="Simple, private file sharing" --log="/var/log/$app/$app.log" +yunohost service add $app --description="Simple, private file sharing" #================================================= # START SYSTEMD SERVICE From 109734146c0430441d024065fb5283118d671f25 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 1 Jul 2022 01:13:52 +0200 Subject: [PATCH 6/8] better start --- scripts/change_url | 2 +- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 4048293..08e6228 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -123,7 +123,7 @@ chown $app:$app "$final_path/server/config.js" ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #================================================= # RELOAD NGINX diff --git a/scripts/install b/scripts/install index 78378f3..5ccc2cd 100644 --- a/scripts/install +++ b/scripts/install @@ -150,7 +150,7 @@ yunohost service add $app --description="Simple, private file sharing" ynh_script_progression --message="Starting a systemd service..." --weight=2 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #================================================= # SETUP SSOWAT diff --git a/scripts/restore b/scripts/restore index eb12d4b..bcce26f 100644 --- a/scripts/restore +++ b/scripts/restore @@ -99,7 +99,7 @@ yunohost service add $app --description="Simple, private file sharing" #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 57b1f50..618bdab 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -139,7 +139,7 @@ yunohost service add $app --description="Simple, private file sharing" #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Started" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #================================================= # RELOAD NGINX From a2a077707fe6d7399ee8322cc78bf608a5a27d92 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 1 Jul 2022 21:12:12 +0200 Subject: [PATCH 7/8] Fix upgrade --- scripts/upgrade | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 618bdab..1f489b5 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -75,8 +75,23 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=10 + # Create a temporary directory + tmpdir="$(mktemp -d)" + + # Backup the config file in the temp dir + cp -a "$final_path/server/config.js" "$tmpdir/config.js" + + # Remove the app directory securely + ynh_secure_remove --file=$final_path + # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir=$final_path --keep="$final_path/server/config.js" + ynh_setup_source --dest_dir=$final_path + + #Copy the admin saved settings from tmp directory to final path + cp -a "$tmpdir/config.js" "$final_path/server/config.js" + + # Remove the tmp directory securely + ynh_secure_remove --file="$tmpdir" fi chmod 750 "$final_path" @@ -103,12 +118,12 @@ ynh_add_nginx_config #================================================= # SPECIFIC UPGRADE #================================================= -# INSTALL SEND +# BUILD APP #================================================= if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=16 + ynh_script_progression --message="Building app... (this will take some time and resources!)" --weight=16 pushd "$final_path" ynh_use_nodejs From 5657b471cd6fbd1aca69ebf882daca15f7e06491 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 2 Jul 2022 03:55:18 +0200 Subject: [PATCH 8/8] Fix upgrade --- scripts/upgrade | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 1f489b5..29a1208 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,6 +20,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) +redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) #================================================= # CHECK VERSION @@ -132,6 +133,16 @@ then popd fi +#================================================= +# UPDATE A CONFIG FILE +#================================================= +ynh_script_progression --message="Updating a configuration file..." + +ynh_add_config --template="../conf/config.js" --destination="$final_path/server/config.js" + +chmod 400 "$final_path/server/config.js" +chown $app: "$final_path/server/config.js" + #================================================= # SETUP SYSTEMD #=================================================