From 5f915b4526e07ab11443a0a87092063ab5f38ca8 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 2 Nov 2020 21:16:51 +0100 Subject: [PATCH] fix --- conf/credentials.json | 2 +- conf/systemd.service | 1 + scripts/change_url | 7 +++---- scripts/restore | 9 --------- scripts/upgrade | 13 ++++--------- 5 files changed, 9 insertions(+), 23 deletions(-) diff --git a/conf/credentials.json b/conf/credentials.json index 94278b7..609603b 100644 --- a/conf/credentials.json +++ b/conf/credentials.json @@ -46,5 +46,5 @@ "password": "__PASSWORD__", "is_admin": true } - }, + } } diff --git a/conf/systemd.service b/conf/systemd.service index b4e603e..47d6b59 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,6 +6,7 @@ After=syslog.target network.target postgresql.service Type=simple User=__APP__ Group=__APP__ +WorkingDirectory=__FINALPATH__ Environment="NODE_ENV=production" Environment="__YNH_NODE_LOAD_PATH__" ExecStart=__FINALPATH__/node_modules/ep_etherpad-lite/node/server.js diff --git a/scripts/change_url b/scripts/change_url index 7d034bb..7e8b161 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -28,7 +28,6 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) -port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP @@ -68,14 +67,14 @@ fi #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=3 +ynh_script_progression --message="Stopping a systemd service..." --time --weight=1 ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2 +ynh_script_progression --message="Updating NGINX web server configuration..." --time --weight=1 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -106,7 +105,7 @@ fi #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=10 +ynh_script_progression --message="Starting a systemd service..." --time --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Your Etherpad version is" diff --git a/scripts/restore b/scripts/restore index fd6b148..dba7bd3 100644 --- a/scripts/restore +++ b/scripts/restore @@ -74,15 +74,6 @@ ynh_system_user_create --username=$app chown -R $app: $final_path chmod 600 $final_path/credentials.json -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=12 - -ynh_install_app_dependencies $pkg_dependencies - -ynh_install_nodejs --nodejs_version=$nodejs_version - #================================================= # RESTORE THE POSTQRESQL DATABASE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index c38edfb..d242040 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,15 +23,10 @@ is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) language=$(ynh_app_setting_get --app=$app --key=language) db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name -db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) -port=$(ynh_app_setting_get --app=$app --key=port) -password=$(ynh_app_setting_get --app=$app --key=password) #================================================= # CHECK VERSION #================================================= -ynh_script_progression --message="Checking version..." --weight=1 upgrade_type=$(ynh_check_app_version_changed) @@ -107,7 +102,7 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 +ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1 # Create a dedicated user (if not existing) ynh_system_user_create --username=$app @@ -154,7 +149,7 @@ chmod 600 $final_path/credentials.json #================================================= # SETUP SYSTEMD #================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 +ynh_script_progression --message="Upgrading systemd configuration..." --time --weight=1 # Create a dedicated systemd config ynh_add_systemd_config --others_var="ynh_node_load_PATH" @@ -162,14 +157,14 @@ ynh_add_systemd_config --others_var="ynh_node_load_PATH" #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=2 +ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1 yunohost service add $app --description "Etherpad-lite, the collaborative editor." --log "/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=10 +ynh_script_progression --message="Starting a systemd service..." --time --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Your Etherpad version is"