From ee3d1fee7955f2c92a995c93959d7e25028d35f7 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 4 Dec 2020 11:55:06 +0100 Subject: [PATCH 1/9] Fix linter warnings --- check_process | 2 -- manifest.json | 4 ++-- scripts/change_url | 8 +++++++- scripts/install | 2 +- scripts/restore | 4 ++-- scripts/upgrade | 2 +- 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/check_process b/check_process index d0be191..12788aa 100644 --- a/check_process +++ b/check_process @@ -24,8 +24,6 @@ multi_instance=1 port_already_use=0 change_url=1 -;;; Levels - Level 5=auto ;;; Options Email= Notification=none diff --git a/manifest.json b/manifest.json index 9aa487d..85a3abf 100644 --- a/manifest.json +++ b/manifest.json @@ -10,10 +10,10 @@ "url": "https://etherpad.org/", "license": "Apache-2.0", "maintainer": { - "name": "" + "name": "eric_G" }, "requirements": { - "yunohost": ">= 4.0.7" + "yunohost": ">= 4.0.8" }, "multi_instance": true, "services": [ diff --git a/scripts/change_url b/scripts/change_url index 860179c..d806ef0 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -102,7 +102,13 @@ then fi #================================================= -# GENERIC FINALISATION +# SETUP SYSTEMD +#================================================= +ynh_script_progression --message="Configuring a systemd service..." --weight=4 + +# Create a dedicated systemd config +ynh_add_systemd_config --others_var="ynh_node_load_PATH" + #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/install b/scripts/install index ee10f7e..5db351d 100644 --- a/scripts/install +++ b/scripts/install @@ -175,7 +175,7 @@ ynh_add_systemd_config --others_var="ynh_node_load_PATH" #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=3 -yunohost service add $app --description "Collaborative editor." --log "/var/log/$app/$app.log" +yunohost service add $app --description="Collaborative editor." --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/restore b/scripts/restore index 621fda3..888b4b6 100644 --- a/scripts/restore +++ b/scripts/restore @@ -101,14 +101,14 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig #ynh_restore_file --origin_path="/etc ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -systemctl enable $app.service +systemctl enable $app.service --quiet #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=3 -yunohost service add $app --description "Collaborative editor." --log "/var/log/$app/$app.log" +yunohost service add $app --description="Collaborative editor." --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index 483d986..87573d7 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -171,7 +171,7 @@ ynh_add_systemd_config --others_var="ynh_node_load_PATH" #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=2 -yunohost service add $app --description "Collaborative editor." --log "/var/log/$app/$app.log" +yunohost service add $app --description="Collaborative editor." --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE From 873c25ee7f8057b33d83fcdf1ee3030e87f4cbad Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 4 Dec 2020 16:41:27 +0100 Subject: [PATCH 2/9] Update change_url --- scripts/change_url | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index d806ef0..f1ba4f9 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -101,21 +101,6 @@ then ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=4 - -# Create a dedicated systemd config -ynh_add_systemd_config --others_var="ynh_node_load_PATH" - -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=6 - -ynh_systemd_action --service_name=$app --action=restart --log_path="systemd" --line_match="Your Etherpad version is" - #================================================= # RELOAD NGINX #================================================= From ec320394c6816328fd78f5c0af8603dd8645ac80 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 4 Dec 2020 23:47:46 +0100 Subject: [PATCH 3/9] Add timeout --- scripts/change_url | 8 ++++++++ scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index f1ba4f9..85eb4b2 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -108,6 +108,14 @@ ynh_script_progression --message="Reloading NGINX web server..." --weight=2 ynh_systemd_action --service_name=nginx --action=reload +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Starting a systemd service..." --weight=6 + +# Start a systemd service +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Your Etherpad version is" --timeout="60" + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index 5db351d..453ec4a 100644 --- a/scripts/install +++ b/scripts/install @@ -183,7 +183,7 @@ yunohost service add $app --description="Collaborative editor." --log="/var/log/ ynh_script_progression --message="Starting a systemd service..." --weight=6 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Your Etherpad version is" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Your Etherpad version is" --timeout="60" #================================================= # SETUP SSOWAT diff --git a/scripts/restore b/scripts/restore index 888b4b6..ee8924d 100644 --- a/scripts/restore +++ b/scripts/restore @@ -115,7 +115,7 @@ yunohost service add $app --description="Collaborative editor." --log="/var/log/ #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=8 -ynh_systemd_action --service_name=$app --action=restart --log_path="systemd" --line_match="Your Etherpad version is" +ynh_systemd_action --service_name=$app --action=restart --log_path="systemd" --line_match="Your Etherpad version is" --timeout="60" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 87573d7..d5d1cc3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -178,7 +178,7 @@ yunohost service add $app --description="Collaborative editor." --log="/var/log/ #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=6 -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Your Etherpad version is" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Your Etherpad version is" --timeout="60" #================================================= # RELOAD NGINX From 6b1d4df3ca9279c9d93d33f05eb69a6ce934c01f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 5 Dec 2020 10:12:28 +0100 Subject: [PATCH 4/9] Update restore --- scripts/restore | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/scripts/restore b/scripts/restore index ee8924d..4bc1e20 100644 --- a/scripts/restore +++ b/scripts/restore @@ -58,21 +58,22 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$final_path" +#================================================= +# RESTORE THE POSTQRESQL DATABASE +#================================================= +ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=2 + +ynh_psql_test_if_first_run +ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd +ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name + #================================================= # RECREATE THE DEDICATED USER #================================================= ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app - -#================================================= -# RESTORE USER RIGHTS -#================================================= - -# Restore permissions on app files -chown -R $app: $final_path -chmod 600 $final_path/credentials.json +ynh_system_user_create --username=$app --home_dir=$final_path #================================================= # REINSTALL DEPENDENCIES @@ -86,13 +87,12 @@ ynh_install_app_dependencies $pkg_dependencies ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= -# RESTORE THE POSTQRESQL DATABASE +# RESTORE USER RIGHTS #================================================= -ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=2 -ynh_psql_test_if_first_run -ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd -ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name +# Restore permissions on app files +chown -R $app: $final_path +chmod 600 $final_path/credentials.json #================================================= # RESTORE SYSTEMD @@ -115,7 +115,7 @@ yunohost service add $app --description="Collaborative editor." --log="/var/log/ #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=8 -ynh_systemd_action --service_name=$app --action=restart --log_path="systemd" --line_match="Your Etherpad version is" --timeout="60" +ynh_systemd_action --service_name=$app --action=restart --log_path="systemd" --line_match="Your Etherpad version is" --timeout="120" #================================================= # GENERIC FINALIZATION From 8698bf16c2bef2d4a295fba8d1e3398967541af9 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 5 Dec 2020 14:57:03 +0100 Subject: [PATCH 5/9] Update change_url --- scripts/change_url | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/change_url b/scripts/change_url index 85eb4b2..c884916 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -114,7 +114,7 @@ ynh_systemd_action --service_name=nginx --action=reload ynh_script_progression --message="Starting a systemd service..." --weight=6 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Your Etherpad version is" --timeout="60" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Your Etherpad version is" --timeout="120" #================================================= # END OF SCRIPT From 264fa8cc5ef93604ebd13b142eecb766bafab651 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 5 Dec 2020 18:19:36 +0100 Subject: [PATCH 6/9] Update restore --- scripts/restore | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/restore b/scripts/restore index 4bc1e20..93eb6ed 100644 --- a/scripts/restore +++ b/scripts/restore @@ -58,6 +58,17 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$final_path" +#================================================= +# REINSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Reinstalling dependencies..." --weight=7 + +# Define and install dependencies +ynh_install_app_dependencies $pkg_dependencies + +# Install Nodejs +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version + #================================================= # RESTORE THE POSTQRESQL DATABASE #================================================= @@ -75,17 +86,6 @@ ynh_script_progression --message="Recreating the dedicated system user..." --wei # Create the dedicated user (if not existing) ynh_system_user_create --username=$app --home_dir=$final_path -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=7 - -# Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies - -# Install Nodejs -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version - #================================================= # RESTORE USER RIGHTS #================================================= From e21138e76cc749365e04652e485f34d25fbf1d6d Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 5 Dec 2020 23:34:24 +0100 Subject: [PATCH 7/9] Fix --- scripts/backup | 4 ---- scripts/change_url | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/scripts/backup b/scripts/backup index 7b33d39..f3d4699 100644 --- a/scripts/backup +++ b/scripts/backup @@ -13,10 +13,6 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= diff --git a/scripts/change_url b/scripts/change_url index c884916..8fed290 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -114,7 +114,7 @@ ynh_systemd_action --service_name=nginx --action=reload ynh_script_progression --message="Starting a systemd service..." --weight=6 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Your Etherpad version is" --timeout="120" +ynh_systemd_action --action=restart --log_path="systemd" --line_match="Your Etherpad version is" --timeout="120" #--service_name=$app #================================================= # END OF SCRIPT From 8b295c4b7f13b02ff1a4552fd8cd2fb108cff8b7 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 7 Dec 2020 13:03:43 +0100 Subject: [PATCH 8/9] Fix --- scripts/change_url | 2 +- scripts/restore | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 8fed290..e94cd80 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -114,7 +114,7 @@ ynh_systemd_action --service_name=nginx --action=reload ynh_script_progression --message="Starting a systemd service..." --weight=6 # Start a systemd service -ynh_systemd_action --action=restart --log_path="systemd" --line_match="Your Etherpad version is" --timeout="120" #--service_name=$app +ynh_systemd_action --action=restart --log_path="systemd" #--line_match="Your Etherpad version is" --timeout="120" #--service_name=$app #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index 93eb6ed..db2fac2 100644 --- a/scripts/restore +++ b/scripts/restore @@ -115,7 +115,7 @@ yunohost service add $app --description="Collaborative editor." --log="/var/log/ #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=8 -ynh_systemd_action --service_name=$app --action=restart --log_path="systemd" --line_match="Your Etherpad version is" --timeout="120" +ynh_systemd_action --service_name=$app --action=restart --log_path="systemd" #--line_match="Your Etherpad version is" --timeout="120" #================================================= # GENERIC FINALIZATION From f6e5ce6f2b2e9fa5db8a87272d39d806b2292e6a Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 7 Dec 2020 13:39:39 +0100 Subject: [PATCH 9/9] Fix --- scripts/change_url | 2 +- scripts/restore | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index e94cd80..8fed290 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -114,7 +114,7 @@ ynh_systemd_action --service_name=nginx --action=reload ynh_script_progression --message="Starting a systemd service..." --weight=6 # Start a systemd service -ynh_systemd_action --action=restart --log_path="systemd" #--line_match="Your Etherpad version is" --timeout="120" #--service_name=$app +ynh_systemd_action --action=restart --log_path="systemd" --line_match="Your Etherpad version is" --timeout="120" #--service_name=$app #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index db2fac2..dba8fb7 100644 --- a/scripts/restore +++ b/scripts/restore @@ -94,15 +94,6 @@ ynh_system_user_create --username=$app --home_dir=$final_path chown -R $app: $final_path chmod 600 $final_path/credentials.json -#================================================= -# RESTORE SYSTEMD -#================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=8 - -#ynh_restore_file --origin_path="/etc -ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -systemctl enable $app.service --quiet - #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= @@ -110,12 +101,20 @@ ynh_script_progression --message="Integrating service in YunoHost..." --weight=3 yunohost service add $app --description="Collaborative editor." --log="/var/log/$app/$app.log" +#================================================= +# RESTORE SYSTEMD +#================================================= +ynh_script_progression --message="Restoring the systemd configuration..." --weight=8 + +ynh_restore_file --origin_path="/etc/systemd/system/$app.service" +systemctl enable $app.service --quiet + #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=8 -ynh_systemd_action --service_name=$app --action=restart --log_path="systemd" #--line_match="Your Etherpad version is" --timeout="120" +ynh_systemd_action --service_name=$app --action=restart --log_path="systemd" --line_match="Your Etherpad version is" --timeout="120" #================================================= # GENERIC FINALIZATION