From 8e58a5e6cd2e49d4f7a5fa94d3f80eb801c54ddd Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 30 May 2020 17:05:03 +0200 Subject: [PATCH] Apply last example_ynh --- README.md | 16 ++++++++-------- check_process | 3 +++ manifest.json | 4 ++-- scripts/backup | 47 ++++++++++++++++------------------------------ scripts/change_url | 15 +++++++-------- scripts/install | 46 ++++++++++++++++++++++----------------------- scripts/remove | 39 +++++++++++++++++++------------------- scripts/restore | 33 ++++++++++++++++---------------- scripts/upgrade | 41 ++++++++++++++++++++-------------------- 9 files changed, 114 insertions(+), 130 deletions(-) diff --git a/README.md b/README.md index 8e9efa9..9be4c9e 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # Discourse for YunoHost -[![Integration level](https://dash.yunohost.org/integration/discoursediscourse.svg)](https://dash.yunohost.org/appci/app/discourse) +[![Integration level](https://dash.yunohost.org/integration/discourse.svg)](https://dash.yunohost.org/appci/app/discourse) ![](https://ci-apps.yunohost.org/ci/badges/discourse.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/discourse.maintain.svg) [![Install Discourse with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=discourse) -> *This package allows you to install discourse quickly and simply on a YunoHost server. -If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* +> *This package allows you to install Discourse quickly and simply on a YunoHost server. +If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* ## Disclaimer @@ -45,7 +45,7 @@ To learn more about the philosophy and goals of the project, [visit **discourse. ## Configuration -Use the admin panel of your discourse to configure this app. +Use the admin panel of your Discourse to configure this app. ### Configuring "Reply-By-Email" @@ -89,7 +89,7 @@ Discourse can now receive mail from `foo@theirexternalmail.com` and give it to t * private mode: Forum only accessible by YunoHost users * public mode: Visible by anyone -#### Multi-users support +#### Multi-user support Supported, with LDAP and SSO. @@ -107,7 +107,7 @@ When disabling Local Login and other authentication services, clicking the `Logi #### Supported architectures -* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/discourse%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/discourse/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/discourse%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/discourse/) * ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/discourse%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/discourse/) ## Limitations @@ -139,10 +139,10 @@ systemctl restart discourse --- -Developers info +Developer info ---------------- -Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/discourse_ynh/tree/testing). +Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/discourse_ynh/tree/testing). To try the testing branch, please proceed like that. ``` diff --git a/check_process b/check_process index 38ddf86..1948c6d 100644 --- a/check_process +++ b/check_process @@ -13,6 +13,7 @@ setup_public=1 upgrade=1 upgrade=1 from_commit=de467cfa38791f43215ffea88d4b85460e5c0457 + upgrade=1 from_commit=086de718f49a506c66498d2f7610f5fd0ce07d50 backup_restore=1 # Activate multi-instance test only if you have more than 2Gb RAM! multi_instance=1 @@ -30,3 +31,5 @@ Notification=none ; commit=de467cfa38791f43215ffea88d4b85460e5c0457 name=Upgrade to 2.2.3 (fixes #16) manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1& + ; commit=086de718f49a506c66498d2f7610f5fd0ce07d50 + name=2.3.10~ynh1 diff --git a/manifest.json b/manifest.json index 6f7a28d..99b0585 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Discussion platform", "fr": "Plateforme de discussion" }, - "version": "2.3.10~ynh1", + "version": "2.3.10~ynh2", "url": "http://Discourse.org", "license": "GPL-2.0", "maintainer": { @@ -15,7 +15,7 @@ "url": "" }, "requirements": { - "yunohost": ">= 2.7.12" + "yunohost": ">= 3.5" }, "multi_instance": true, "services": [ diff --git a/scripts/backup b/scripts/backup index da46623..65f40d0 100644 --- a/scripts/backup +++ b/scripts/backup @@ -13,7 +13,6 @@ source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= -ynh_print_info --message="Managing script failure..." ynh_clean_setup () { # Clean remainings not handled by remove script @@ -35,28 +34,37 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) unicorn_workers=$(ynh_app_setting_get --app=$app --key=unicorn_workers) #================================================= -# STANDARD BACKUP STEPS +# DECLARE DATA AND CONF FILES TO BACKUP #================================================= -# STOP SYSTEMD SERVICE -#================================================= -ynh_print_info --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action="stop" --log_path="$final_path/log/unicorn.stderr.log" +ynh_print_info --message="Declaring files to be backed up..." #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_print_info --message="Backing up the main app directory..." ynh_backup --src_path="$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_print_info --message="Backing up nginx web server configuration..." ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +#================================================= +# SPECIFIC BACKUP +#================================================= +# BACKUP LOGROTATE +#================================================= + +ynh_backup --src_path="/etc/logrotate.d/$app" + +#================================================= +# BACKUP SYSTEMD +#================================================= + +ynh_backup --src_path="/etc/systemd/system/$app.service" + #================================================= # BACKUP THE POSTGRESQL DATABASE #================================================= @@ -64,29 +72,6 @@ ynh_print_info --message="Backing up the PostgreSQL database..." ynh_psql_dump_db --database="$db_name" > db.sql -#================================================= -# SPECIFIC BACKUP -#================================================= -# BACKUP LOGROTATE -#================================================= -ynh_print_info --message="Backing up logrotate configuration..." - -ynh_backup --src_path="/etc/logrotate.d/$app" - -#================================================= -# BACKUP SYSTEMD -#================================================= -ynh_print_info --message="Backing up systemd configuration..." - -ynh_backup --src_path="/etc/systemd/system/$app.service" - -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_print_info --message="Starting a systemd service..." - -ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/log/unicorn.stderr.log" --line_match="INFO -- : worker=$((unicorn_workers-1)) ready" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/change_url b/scripts/change_url index 7b2c35e..b0ce5af 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -12,7 +12,6 @@ source /usr/share/yunohost/helpers #================================================= # RETRIEVE ARGUMENTS #================================================= -ynh_print_info --message="Retrieve arguments from the manifest" old_domain=$YNH_APP_OLD_DOMAIN old_path=$YNH_APP_OLD_PATH @@ -25,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) @@ -39,7 +38,7 @@ unicorn_workers=$(ynh_app_setting_get --app=$app --key=unicorn_workers) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_print_info --message="Backing up the app before changing its url (may take a while)..." +ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." # Backup the current version of the app ynh_backup_before_upgrade @@ -74,14 +73,14 @@ fi #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_print_info --message="Stopping a systemd service..." +ynh_script_progression --message="Stopping a systemd service..." ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_print_info --message="Updating nginx web server configuration..." +ynh_script_progression --message="Updating nginx web server configuration..." nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -146,7 +145,7 @@ $rake_exec posts:rebake #================================================= # START SYSTEMD SERVICE #================================================= -ynh_print_info --message="Starting a systemd service..." +ynh_script_progression --message="Starting a systemd service..." # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/log/unicorn.stderr.log" --line_match="INFO -- : worker=$((unicorn_workers-1)) ready" @@ -154,7 +153,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/ #================================================= # RELOAD NGINX #================================================= -ynh_print_info --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -162,4 +161,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_print_info --message="Change of URL completed for $app" +ynh_script_progression --message="Change of URL completed for $app" diff --git a/scripts/install b/scripts/install index 1d2e44a..9ce0aa9 100644 --- a/scripts/install +++ b/scripts/install @@ -12,7 +12,6 @@ source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= -ynh_print_info --message="Managing script failure..." ynh_clean_setup () { # Clean remainings not handled by remove script @@ -24,7 +23,6 @@ ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -ynh_print_info --message="Retrieving arguments from the manifest..." domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH @@ -36,7 +34,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_print_info --message="Validating installation parameters..." +ynh_script_progression --message="Validating installation parameters..." final_path=/var/www/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" @@ -50,7 +48,7 @@ check_memory_requirements #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_print_info --message="Storing installation settings..." +ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url @@ -62,14 +60,14 @@ ynh_app_setting_set --app=$app --key=is_public --value=$is_public #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_print_info --message="Installing dependencies..." +ynh_script_progression --message="Installing dependencies..." ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE A POSTGRESQL DATABASE #================================================= -ynh_print_info --message="Creating a PostgreSQL database..." +ynh_script_progression --message="Creating a PostgreSQL database..." db_name=$(ynh_sanitize_dbid --db_name=$app) db_user=$db_name @@ -85,7 +83,7 @@ ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --datab #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_print_info --message="Setting up source files..." +ynh_script_progression --message="Setting up source files..." # Specific actions on ARM architecture if [ -n "$(uname -m | grep arm)" ] ; then @@ -107,14 +105,14 @@ ynh_setup_source --dest_dir="$final_path/plugins/discourse-ldap-auth" --source_i #================================================= # INSTALL RUBY #================================================= -ynh_print_info --message="Installing Ruby..." +ynh_script_progression --message="Installing Ruby..." ynh_install_ruby --ruby_version=$RUBY_VERSION #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info --message="Configuring nginx web server..." +ynh_script_progression --message="Configuring nginx web server..." # Create a dedicated nginx config ynh_add_nginx_config @@ -128,7 +126,7 @@ ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # CREATE DEDICATED USER #================================================= -ynh_print_info --message="Configuring system user..." +ynh_script_progression --message="Configuring system user..." # Create a system user ynh_system_user_create --username=$app --home_dir=$final_path --use_shell @@ -138,7 +136,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path --use_shell #================================================= # CONFIGURE DISCOURSE #================================================= -ynh_print_info --message="Configuring Discourse..." +ynh_script_progression --message="Configuring Discourse..." # Configure database discourse_config_file="$final_path/config/discourse.conf" @@ -188,7 +186,7 @@ echo "svgo: false" > $final_path/.image_optim.yml #================================================= # SETUP UNICORN, A RUBY SERVER #================================================= -ynh_print_info --message="Setting up Unicorn..." +ynh_script_progression --message="Setting up Unicorn..." unicorn_config_file="$final_path/config/unicorn.conf.rb" # Use socket connection @@ -236,7 +234,7 @@ fi #================================================= # PREPARE THE DATABASE #================================================= -ynh_print_info --message="Preparing the database..." +ynh_script_progression --message="Preparing the database..." rake_exec="exec_login_as $app RAILS_ENV=production bin/rake" $rake_exec db:migrate @@ -245,7 +243,7 @@ $rake_exec assets:precompile #================================================= # POPULATE THE DATABASE #================================================= -ynh_print_info --message="Populating the database..." +ynh_script_progression --message="Populating the database..." #Set default data (especially to have correct image URLs for subfolder install) ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name <<< "INSERT INTO site_settings (name, data_type, value, created_at, updated_at) VALUES ('title', 1, 'YunoHost Forum', 'NOW()', 'NOW()'); @@ -265,7 +263,7 @@ INSERT INTO site_settings (name, data_type, value, created_at, updated_at) VALUE #================================================= # CREATE DISCOURSE ADMIN USER #================================================= -ynh_print_info --message="Creating Discourse admin user..." +ynh_script_progression --message="Creating Discourse admin user..." # Create a random password admin_pwd=$(ynh_string_random) @@ -278,7 +276,7 @@ y #================================================= # CONFIGURE PLUGINS #================================================= -ynh_print_info --message="Configuring plugins..." +ynh_script_progression --message="Configuring plugins..." # Patch ldap-auth plugin dependency (omniauth-ldap) to fix it when using domain subfolder # (Can only do that now because we are patching dependencies which have just been downloaded) @@ -289,7 +287,7 @@ patch -p1 < $YNH_CWD/../conf/ldap-auth-fix-subfolder.patch) #================================================= # SETUP SYSTEMD #================================================= -ynh_print_info --message="Configuring a systemd service..." +ynh_script_progression --message="Configuring a systemd service..." ynh_replace_string --match_string="__RBENVROOT__" --replace_string="$RBENV_ROOT" --target_file="../conf/systemd.service" @@ -313,7 +311,7 @@ ynh_add_systemd_config #================================================= # SECURE FILES AND DIRECTORIES #================================================= -ynh_print_info --message="Securing files and directories..." +ynh_script_progression --message="Securing files and directories..." # Add a pids and socket directory for the systemd script. mkdir -p "$final_path/tmp/pids" @@ -336,7 +334,7 @@ chmod g-w $final_path/log #================================================= # SETUP LOGROTATE #================================================= -ynh_print_info --message="Configuring log rotation..." +ynh_script_progression --message="Configuring log rotation..." # Use logrotate to manage application logfile(s) ynh_use_logrotate --logfile="$final_path/log/unicorn.stderr.log" @@ -346,14 +344,14 @@ ynh_use_logrotate --logfile="$final_path/log/production.log" #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_print_info --message="Integrating service in YunoHost..." +ynh_script_progression --message="Integrating service in YunoHost..." yunohost service add $app --log "$final_path/log/unicorn.stderr.log" "$final_path/log/unicorn.stdout.log" "$final_path/log/production.log" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_print_info --message="Starting a systemd service..." +ynh_script_progression --message="Starting a systemd service..." # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/log/unicorn.stderr.log" --line_match="INFO -- : worker=$((unicorn_workers-1)) ready" @@ -361,7 +359,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/ #================================================= # SETUP SSOWAT #================================================= -ynh_print_info --message="Configuring SSOwat..." +ynh_script_progression --message="Configuring SSOwat..." # Make app public if necessary if [ $is_public -eq 1 ] @@ -373,7 +371,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_print_info --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -381,4 +379,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_print_info --message="Installation of $app completed" +ynh_script_progression --message="Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index 4d7c878..805f6f7 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -27,19 +27,18 @@ redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) #================================================= # REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= -ynh_print_info --message="Removing service integration in YunoHost..." # Remove the service from the list of services known by Yunohost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null then - ynh_print_info --message="Removing $app service..." + ynh_script_progression --message="Removing $app service..." yunohost service remove $app fi #================================================= # STOP AND REMOVE SERVICE #================================================= -ynh_print_info --message="Stopping and removing the systemd service..." +ynh_script_progression --message="Stopping and removing the systemd service..." # Remove the dedicated systemd config ynh_remove_systemd_config @@ -47,37 +46,37 @@ ynh_remove_systemd_config #================================================= # REMOVE THE POSTGRESQL DATABASE #================================================= -ynh_print_info --message="Removing the PostgreSQL database..." +ynh_script_progression --message="Removing the PostgreSQL database..." # Remove a database if it exists, along with the associated user ynh_psql_remove_db --db_user=$db_user --db_name=$db_name -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_print_info --message="Removing dependencies..." - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - #================================================= # REMOVE RUBY #================================================= -ynh_print_info --message="Removing Ruby..." +ynh_script_progression --message="Removing Ruby..." ynh_remove_ruby #================================================= # REMOVE THE REDIS DATABASE #================================================= -ynh_print_info --message="Removing the redis database..." +ynh_script_progression --message="Removing the redis database..." ynh_redis_remove_db "$redis_db" +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_script_progression --message="Removing dependencies..." + +# Remove metapackage and its dependencies +ynh_remove_app_dependencies + #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_print_info --message="Removing app main directory..." +ynh_script_progression --message="Removing app main directory..." # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -85,7 +84,7 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_print_info --message="Removing nginx web server configuration..." +ynh_script_progression --message="Removing nginx web server configuration..." # Remove the dedicated nginx config ynh_remove_nginx_config @@ -93,7 +92,7 @@ ynh_remove_nginx_config #================================================= # REMOVE LOGROTATE CONFIGURATION #================================================= -ynh_print_info --message="Removing logrotate configuration..." +ynh_script_progression --message="Removing logrotate configuration..." # Remove the app-specific logrotate config ynh_remove_logrotate @@ -103,7 +102,7 @@ ynh_remove_logrotate #================================================= # REMOVE DEDICATED USER #================================================= -ynh_print_info --message="Removing the dedicated system user..." +ynh_script_progression --message="Removing the dedicated system user..." # Delete a system user ynh_system_user_delete --username=$app @@ -112,4 +111,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_print_info --message="Removal of $app completed" +ynh_script_progression --message="Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index 994dd54..8317aed 100644 --- a/scripts/restore +++ b/scripts/restore @@ -13,7 +13,6 @@ source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= -ynh_print_info --message="Managing script failure..." ynh_clean_setup () { # Clean remainings not handled by remove script @@ -25,7 +24,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading settings..." +ynh_script_progression --message="Loading settings..." app=$YNH_APP_INSTANCE_NAME @@ -38,7 +37,7 @@ db_user=$db_name #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_print_info --message="Validating restoration parameters..." +ynh_script_progression --message="Validating restoration parameters..." ynh_webpath_available --domain=$domain --path_url=$path_url \ || ynh_die --message="Path not available: ${domain}${path_url}" @@ -53,21 +52,21 @@ check_memory_requirements #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_print_info --message="Restoring 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 THE APP MAIN DIR #================================================= -ynh_print_info --message="Restoring the app main directory..." +ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file --origin_path="$final_path" #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_print_info --message="Recreating the dedicated system user..." +ynh_script_progression --message="Recreating the dedicated system user..." # Create the dedicated user (if not existing) ynh_system_user_create --username=$app --home_dir=$final_path --use_shell @@ -75,7 +74,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path --use_shell #================================================= # RESTORE USER RIGHTS #================================================= -ynh_print_info --message="Restoring user rights..." +ynh_script_progression --message="Restoring user rights..." # Restore permissions on app files chown -R $app: $final_path @@ -85,7 +84,7 @@ chown -R $app: $final_path #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_print_info --message="Reinstalling dependencies..." +ynh_script_progression --message="Reinstalling dependencies..." # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies @@ -93,14 +92,14 @@ ynh_install_app_dependencies $pkg_dependencies #================================================= # INSTALL RUBY #================================================= -ynh_print_info --message="Install Ruby..." +ynh_script_progression --message="Install Ruby..." ynh_install_ruby --ruby_version=$RUBY_VERSION #================================================= # REINSTALL BUNDLE GEM #================================================= -ynh_print_info --message="Reinstall Bundle Gem..." +ynh_script_progression --message="Reinstall Bundle Gem..." (cd "$final_path" gem install bundler) @@ -108,7 +107,7 @@ gem install bundler) #================================================= # RESTORE THE POSTGRESQL DATABASE #================================================= -ynh_print_info --message="Restoring the PostgreSQL database..." +ynh_script_progression --message="Restoring the PostgreSQL database..." db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) ynh_psql_test_if_first_run @@ -122,7 +121,7 @@ ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name" #================================================= # RESTORE SYSTEMD #================================================= -ynh_print_info --message="Restoring the systemd configuration..." +ynh_script_progression --message="Restoring the systemd configuration..." ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl daemon-reload @@ -131,14 +130,14 @@ systemctl enable $app.service #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_print_info --message="Integrating service in YunoHost..." +ynh_script_progression --message="Integrating service in YunoHost..." yunohost service add $app --log "$final_path/log/unicorn.stderr.log" "$final_path/log/unicorn.stdout.log" "$final_path/log/production.log" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_print_info --message="Starting a systemd service..." +ynh_script_progression --message="Starting a systemd service..." if [ -n "$(uname -m | grep arm)" ] ; then unicorn_workers=2 @@ -151,7 +150,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/ #================================================= # RESTORE THE LOGROTATE CONFIGURATION #================================================= -ynh_print_info --message="Restoring logrotate configuration..." +ynh_script_progression --message="Restoring logrotate configuration..." ynh_restore_file --origin_path="/etc/logrotate.d/$app" @@ -160,7 +159,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= # RELOAD NGINX #================================================= -ynh_print_info --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -168,4 +167,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_print_info --message="Restoration completed for $app" +ynh_script_progression --message="Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index c9faf0e..6f354da 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -32,7 +32,7 @@ check_memory_requirements_upgrade #================================================= # CHECK VERSION #================================================= -ynh_print_info --message="Checking version..." +ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) @@ -58,7 +58,7 @@ fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_print_info --message="Backing up the app before upgrading (may take a while)..." +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." # Backup the current version of the app ynh_backup_before_upgrade @@ -72,7 +72,7 @@ ynh_abort_if_errors #================================================= # ENABLE MAINTENANCE MODE #================================================= -ynh_print_info --message="Enabling maintenance mode..." +ynh_script_progression --message="Enabling maintenance mode..." ynh_maintenance_mode_ON @@ -81,14 +81,14 @@ ynh_maintenance_mode_ON #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_print_info --message="Stopping a systemd service..." +ynh_script_progression --message="Stopping a systemd service..." ynh_systemd_action --service_name=$app --action="stop" --log_path="$final_path/log/unicorn.stderr.log" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_print_info --message="Downloading..." +ynh_script_progression --message="Upgrading source files..." # Specific actions on ARM architecture if [ -n "$(uname -m | grep arm)" ] ; then @@ -147,7 +147,7 @@ ynh_setup_source --dest_dir="$final_path/plugins/discourse-ldap-auth" --source_i #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info --message="Upgrading nginx web server configuration..." +ynh_script_progression --message="Upgrading nginx web server configuration..." # Create a dedicated nginx config ynh_add_nginx_config @@ -161,21 +161,21 @@ ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_print_info --message="Upgrading dependencies..." +ynh_script_progression --message="Upgrading dependencies..." ynh_install_app_dependencies "$pkg_dependencies" #================================================= # INSTALL RUBY #================================================= -ynh_print_info --message="Installing Ruby..." +ynh_script_progression --message="Installing Ruby..." ynh_install_ruby --ruby_version=$RUBY_VERSION #================================================= # CREATE DEDICATED USER #================================================= -ynh_print_info --message="Making sure dedicated system user exists..." +ynh_script_progression --message="Making sure dedicated system user exists..." # Create a dedicated user (if not existing) ynh_system_user_create --username=$app @@ -185,7 +185,7 @@ ynh_system_user_create --username=$app #================================================= # CONFIGURE DISCOURSE #================================================= -ynh_print_info --message="Configuring Discourse..." +ynh_script_progression --message="Configuring Discourse..." # Make a backup of the original config file if modified ynh_backup_if_checksum_is_different --file="$final_path/config/discourse.conf" @@ -237,7 +237,7 @@ echo "svgo: false" > $final_path/.image_optim.yml #================================================= # SETUP UNICORN, A RUBY SERVER #================================================= -ynh_print_info --message="Setting up Unicorn..." +ynh_script_progression --message="Setting up Unicorn..." unicorn_config_file="$final_path/config/unicorn.conf.rb" # Use socket connection @@ -282,7 +282,7 @@ fi #================================================= # PREPARE THE DATABASE #================================================= -ynh_print_info --message="Preparing the database..." +ynh_script_progression --message="Preparing the database..." rake_exec="exec_login_as $app RAILS_ENV=production bin/rake" $rake_exec db:migrate @@ -291,7 +291,7 @@ $rake_exec assets:precompile #================================================= # CONFIGURE PLUGINS #================================================= -ynh_print_info --message="Configuring plugins..." +ynh_script_progression --message="Configuring plugins..." # Patch ldap-auth plugin dependency (omniauth-ldap) to fix it when using domain subfolder # (Can only do that now because we are patching dependencies which have just been downloaded) @@ -302,7 +302,7 @@ patch -p1 < $YNH_CWD/../conf/ldap-auth-fix-subfolder.patch) #================================================= # SETUP SYSTEMD #================================================= -ynh_print_info --message="Configuring a systemd service..." +ynh_script_progression --message="Configuring a systemd service..." ynh_replace_string --match_string="__RBENVROOT__" --replace_string="$RBENV_ROOT" --target_file="../conf/systemd.service" @@ -316,7 +316,7 @@ ynh_add_systemd_config #================================================= # SECURE FILES AND DIRECTORIES #================================================= -ynh_print_info --message="Securing files and directories..." +ynh_script_progression --message="Securing files and directories..." # Add a pids and socket directory for the systemd script. mkdir -p "$final_path/tmp/pids" @@ -338,7 +338,7 @@ chmod g-w $final_path/log #================================================= # SETUP SSOWAT #================================================= -ynh_print_info --message="Upgrading SSOwat configuration..." +ynh_script_progression --message="Upgrading SSOwat configuration..." # If app is public, add url to SSOWat conf as skipped_uris if [ $is_public -eq 1 ] @@ -350,7 +350,7 @@ fi #================================================= # START SYSTEMD SERVICE #================================================= -ynh_print_info --message="Starting a systemd service..." +ynh_script_progression --message="Starting a systemd service..." # Wait for discourse to be fully started ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/log/unicorn.stderr.log" --line_match="INFO -- : worker=$((unicorn_workers-1)) ready" @@ -358,13 +358,14 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/ #================================================= # DISABLE MAINTENANCE MODE #================================================= +ynh_script_progression --message="Disabling maintenance mode..." ynh_maintenance_mode_OFF #================================================= # RELOAD NGINX #================================================= -ynh_print_info --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -372,4 +373,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_print_info --message="Upgrade of $app completed" +ynh_script_progression --message="Upgrade of $app completed"