From e827fbe4a89c0dcd51308457e5f00a9fc5dcc18b Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Thu, 21 Aug 2025 10:42:04 +0200 Subject: convert to helpers v2.1 and try to upgrade to latest version --- tests.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests.toml') diff --git a/tests.toml b/tests.toml index c983544..a084d02 100644 --- a/tests.toml +++ b/tests.toml @@ -27,4 +27,5 @@ test_format = 1.0 test_upgrade_from.43504e6.args.admin="john" test_upgrade_from.43504e6.args.language="fr_FR" - test_upgrade_from.8102fffa52a4e3279bba9fbdafb3a0e5b1fe3e17.name = "Upgrade from 4.2.13~ynh1" + test_upgrade_from.8102fffa52a4e3279bba9fbdafb3a0e5b1fe3e17.name = "4.2.13~ynh1" + test_upgrade_from.38e8436dd8489140af8921c81d9d891bfa92349e.name = "4.3.9 - Helpers v1" -- cgit v1.2.3-70-g09d2 From 5593f9befe248490113e2b0030aa293ca604dfec Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 26 Aug 2025 08:51:51 +0200 Subject: remove upgrade from 4.2.8 -> ynh_die in the place --- scripts/upgrade | 38 +++++++++----------------------------- tests.toml | 8 +------- 2 files changed, 10 insertions(+), 36 deletions(-) (limited to 'tests.toml') diff --git a/scripts/upgrade b/scripts/upgrade index 648c316..769b47c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -6,21 +6,21 @@ source /usr/share/yunohost/helpers config="$install_dir/live/.env.production" +if ynh_app_upgrading_from_version_before 4.2.8~ynh2; then + ynh_die "Your installation is to old to update to this version. \ + \nPlease first manually update with 4.4.3~ynh1 with the following command: \ + \n's\0u\0d\0o yunohost app upgrade $app -u https://github.com/YunoHost-Apps/mastodon_ynh/commit/8fb1c6c7818430e8ac49f3ae589c6575614f5e4b' \ + \nOnce done you can upgrade to the latest version." +fi + #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression "Stopping $app's systemd service..." -if ynh_app_upgrading_from_version_before 4.2.8~ynh2; then - # Workaround for pre-packagingv2 versions - ynh_systemctl --service=${app}-web --action="stop" --log_path="systemd" --wait_until="Goodbye" - ynh_systemctl --service=${app}-sidekiq --action="stop" --log_path="systemd" --wait_until="Bye" - ynh_systemctl --service=${app}-streaming --action="stop" --log_path="systemd" -else +ynh_script_progression "Stopping $app's systemd service..." ynh_systemctl --service=${app}-web --action="stop" --log_path=/var/log/$app/$app-web.log --wait_until="Goodbye" ynh_systemctl --service=${app}-sidekiq --action="stop" --log_path=/var/log/$app/$app-sidekiq.log --wait_until="Bye" ynh_systemctl --service=${app}-streaming --action="stop" --log_path=/var/log/$app/$app-streaming.log -fi #================================================= # ENSURE DOWNWARD COMPATIBILITY @@ -30,26 +30,6 @@ ynh_script_progression "Ensuring downward compatibility..." # Set `service` settings to support `yunohost app shell` command ynh_app_setting_set_default --key=service --value="$app-web.service" -if ynh_app_upgrading_from_version_before 4.2.8~ynh2; then - # Rename legacy database - if ynh_psql_database_exists --database="${app}_production"; then - db_name=$(ynh_sanitize_dbid --db_name="$app") - ynh_app_setting_set --key="db_name" --value="$db_name" - - # Remove the newly created db by resources, and rename legacy db - ynh_psql_db_shell <<< "DROP DATABASE IF EXISTS $db_name;" - ynh_psql_db_shell <<< "ALTER DATABASE ${app}_production RENAME TO $db_name;" - fi - # Same with user - if ynh_psql_user_exists --user="${app}_production"; then - db_user="$db_name" - ynh_app_setting_set --key="db_user" --value="$db_user" - - ynh_psql_db_shell <<< "DROP USER IF EXISTS $db_user;" - ynh_psql_db_shell <<< "ALTER USER ${app}_production RENAME $db_user;" - fi -fi - #================================================= # ADD SWAP IF NEEDED #================================================= @@ -171,7 +151,7 @@ pushd "$install_dir/live" # Apply redis namespace migration (https://github.com/mastodon/redis_namespace_migration) ynh_hide_warnings ynh_exec_as_app RAILS_ENV=production COREPACK_ENABLE_DOWNLOAD_PROMPT=0 $ld_preload bin/rails runner rename.rb - redis_namespace="$(ynh_app_setting_get --app=$app --key=redis_namespace)" + redis_namespace="$(ynh_app_setting_get --key=redis_namespace)" if [ $redis_namespace ]; then if [ ynh_app_setting_get --key=es_enabled == "true" ] && [ ynh_app_setting_get --key=es_prefix == "" ]; then ynh_app_setting_set --key=es_prefix --value=$redis_namespace diff --git a/tests.toml b/tests.toml index a084d02..b34a3e6 100644 --- a/tests.toml +++ b/tests.toml @@ -20,12 +20,6 @@ test_format = 1.0 # ------------------------------- # Commits to test upgrade from # ------------------------------- - - test_upgrade_from.43504e6.name = "Upgrade from 4.2.5~ynh1" - test_upgrade_from.43504e6.args.domain="domain.tld" - test_upgrade_from.43504e6.args.is_public=1 - test_upgrade_from.43504e6.args.admin="john" - test_upgrade_from.43504e6.args.language="fr_FR" - + test_upgrade_from.8102fffa52a4e3279bba9fbdafb3a0e5b1fe3e17.name = "4.2.13~ynh1" test_upgrade_from.38e8436dd8489140af8921c81d9d891bfa92349e.name = "4.3.9 - Helpers v1" -- cgit v1.2.3-70-g09d2 From 9d34db18df100918645c7f839d2d62bf44fc4d2d Mon Sep 17 00:00:00 2001 From: eric_G <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 1 Sep 2025 10:12:59 +0200 Subject: cleaning --- manifest.toml | 1 - scripts/_common.sh | 4 ++-- scripts/remove | 14 +++----------- scripts/restore | 4 ---- scripts/upgrade | 13 ++++--------- tests.toml | 2 +- 6 files changed, 10 insertions(+), 28 deletions(-) (limited to 'tests.toml') diff --git a/manifest.toml b/manifest.toml index 7f0b634..3575af5 100644 --- a/manifest.toml +++ b/manifest.toml @@ -25,7 +25,6 @@ architectures = "all" multi_instance = true ldap = true - sso = false disk = "2G" diff --git a/scripts/_common.sh b/scripts/_common.sh index 182e391..acc9c4b 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,8 +5,8 @@ #================================================= memory_needed="2560" -ruby_version=3.4.5 -nodejs_version=20 +ruby_version="3.4.5" +nodejs_version="20" case $YNH_ARCH in amd64) diff --git a/scripts/remove b/scripts/remove index 297786f..d2c0cb5 100644 --- a/scripts/remove +++ b/scripts/remove @@ -7,26 +7,18 @@ source /usr/share/yunohost/helpers #================================================= # REMOVE SYSTEM CONFIGURATIONS #================================================= -# REMOVE SYSTEMD SERVICE -#================================================= ynh_script_progression "Removing system configurations related to $app..." # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) -if ynh_hide_warnings yunohost service status "$app-web" >/dev/null -then - ynh_script_progression "Removing $app-web service integration..." +if ynh_hide_warnings yunohost service status "$app-web" >/dev/null; then yunohost service remove "$app-web" fi -if ynh_hide_warnings yunohost service status "$app-sidekiq" >/dev/null -then - ynh_script_progression "Removing $app-sidekiq service integration..." +if ynh_hide_warnings yunohost service status "$app-sidekiq" >/dev/null; then yunohost service remove "$app-sidekiq" fi -if ynh_hide_warnings yunohost service status "$app-streaming" >/dev/null -then - ynh_script_progression "Removing $app-streaming service integration..." +if ynh_hide_warnings yunohost service status "$app-streaming" >/dev/null; then yunohost service remove "$app-streaming" fi diff --git a/scripts/restore b/scripts/restore index 0becd6c..03f0dce 100644 --- a/scripts/restore +++ b/scripts/restore @@ -5,8 +5,6 @@ source ../settings/scripts/_common.sh source ../settings/scripts/ynh_add_swap source /usr/share/yunohost/helpers -#================================================= -# STANDARD RESTORATION STEPS #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -61,8 +59,6 @@ popd #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= ynh_script_progression "Restoring system configurations related to $app..." ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" diff --git a/scripts/upgrade b/scripts/upgrade index 769b47c..3b8f6e8 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -16,11 +16,11 @@ fi #================================================= # STOP SYSTEMD SERVICE #================================================= - ynh_script_progression "Stopping $app's systemd service..." - ynh_systemctl --service=${app}-web --action="stop" --log_path=/var/log/$app/$app-web.log --wait_until="Goodbye" - ynh_systemctl --service=${app}-sidekiq --action="stop" --log_path=/var/log/$app/$app-sidekiq.log --wait_until="Bye" - ynh_systemctl --service=${app}-streaming --action="stop" --log_path=/var/log/$app/$app-streaming.log + +ynh_systemctl --service=${app}-web --action="stop" --log_path=/var/log/$app/$app-web.log --wait_until="Goodbye" +ynh_systemctl --service=${app}-sidekiq --action="stop" --log_path=/var/log/$app/$app-sidekiq.log --wait_until="Bye" +ynh_systemctl --service=${app}-streaming --action="stop" --log_path=/var/log/$app/$app-streaming.log #================================================= # ENSURE DOWNWARD COMPATIBILITY @@ -54,12 +54,9 @@ ynh_script_progression "Upgrading Ruby and NodeJS..." ynh_ruby_install ynh_nodejs_install -#================================================= -# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...) #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= - ynh_script_progression "Upgrading source files..." # Download, check integrity, uncompress and patch the source from manifest.toml @@ -114,8 +111,6 @@ ynh_config_add --template="cron" --destination="/etc/cron.d/$app" mkdir -p /var/log/$app ynh_config_add_logrotate -#================================================= -# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...) #================================================= # UPDATE A CONFIG FILE #================================================= diff --git a/tests.toml b/tests.toml index b34a3e6..588a0db 100644 --- a/tests.toml +++ b/tests.toml @@ -21,5 +21,5 @@ test_format = 1.0 # Commits to test upgrade from # ------------------------------- - test_upgrade_from.8102fffa52a4e3279bba9fbdafb3a0e5b1fe3e17.name = "4.2.13~ynh1" + #test_upgrade_from.8102fffa52a4e3279bba9fbdafb3a0e5b1fe3e17.name = "4.2.13~ynh1" test_upgrade_from.38e8436dd8489140af8921c81d9d891bfa92349e.name = "4.3.9 - Helpers v1" -- cgit v1.2.3-70-g09d2