diff --git a/check_process b/check_process deleted file mode 100644 index 968e499..0000000 --- a/check_process +++ /dev/null @@ -1,21 +0,0 @@ -;; Test complet - ; Manifest - domain="domain.tld" - path="/path" - is_public=1 - ; Checks - pkg_linter=1 - setup_sub_dir=1 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - # 20220606~ynh1 - upgrade=1 from_commit=009f956487d1580b71a2bd250418854d8e094185 - backup_restore=1 - multi_instance=1 - change_url=1 -;;; Options -Email= -Notification=none diff --git a/scripts/config b/scripts/config index 91c2de7..a829923 100644 --- a/scripts/config +++ b/scripts/config @@ -9,8 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -ynh_abort_if_errors - #================================================= # RETRIEVE ARGUMENTS #================================================= diff --git a/scripts/install b/scripts/install index adab104..ed77d68 100644 --- a/scripts/install +++ b/scripts/install @@ -17,6 +17,14 @@ fpm_footprint="low" fpm_free_footprint=0 fpm_usage="low" +#================================================= +# STORE SETTINGS FROM MANIFEST +#================================================= + +ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint +ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint +ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= diff --git a/scripts/restore b/scripts/restore index c938385..d57dcaa 100644 --- a/scripts/restore +++ b/scripts/restore @@ -20,6 +20,23 @@ ynh_restore_file --origin_path="$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" +#================================================= +# RESTORE THE PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=50 + +ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" + +# Recreate a dedicated php-fpm config +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion + +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the NGINX web server configuration..." + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + #================================================= # RESTORE THE POSTGRESQL DATABASE #================================================= @@ -28,29 +45,33 @@ ynh_script_progression --message="Restoring the PostgreSQL database..." --weight ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql #================================================= -# RESTORE SYSTEM CONFIGURATIONS +# RESTORE SYSTEMD #================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 - -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_script_progression --message="Restoring the systemd configuration..." --weight=2 ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet +#================================================= +# INTEGRATE SERVICE IN YUNOHOST +#================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 + yunohost service add $app --description="News feed reader and aggregator" --log="/var/log/$app/$app.log" +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Starting a systemd service..." + +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" + #================================================= # GENERIC FINALIZATION #================================================= -# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE +# RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 - -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" +ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=2 ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index 867e0aa..bf47995 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -30,19 +30,19 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" ynh_script_progression --message="Ensuring downward compatibility..." --weight=2 # If fpm_footprint doesn't exist, create it -if [ -z "$fpm_footprint" ]; then +if [ -z "${fpm_footprint:-}" ]; then fpm_footprint=low ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint fi # If fpm_free_footprint doesn't exist, create it -if [ -z "$fpm_free_footprint" ]; then +if [ -z "${fpm_free_footprint:-}" ]; then fpm_free_footprint=0 ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint fi # If fpm_usage doesn't exist, create it -if [ -z "$fpm_usage" ]; then +if [ -z "${fpm_usage:-}" ]; then fpm_usage=low ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage fi diff --git a/tests.toml b/tests.toml index 91daf17..ee39c34 100644 --- a/tests.toml +++ b/tests.toml @@ -2,6 +2,9 @@ test_format = 1.0 [default] - # ------------ - # Tests to run - # ------------ \ No newline at end of file + # ------------------------------- + # Commits to test upgrade from + # ------------------------------- + + test_upgrade_from.009f9564.name = "Upgrade from 20220606" +