aboutsummaryrefslogtreecommitdiff
path: root/scripts/upgrade
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/upgrade')
-rw-r--r--scripts/upgrade51
1 files changed, 25 insertions, 26 deletions
diff --git a/scripts/upgrade b/scripts/upgrade
index 968045d..9be5f2f 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
-ynh_script_progression --message="Loading installation settings..."
+ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
@@ -41,19 +41,18 @@ config="$final_path/live/.env.production"
#=================================================
# CHECK VERSION
#=================================================
-ynh_script_progression --message="Checking version..."
+ynh_script_progression --message="Checking version..." --weight=1
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
-ynh_script_progression --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)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
- ynh_clean_check_starting
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
@@ -65,7 +64,7 @@ ynh_abort_if_errors
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
-ynh_script_progression --message="Stopping a systemd service..."
+ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=${app}-web --action="stop" --log_path=systemd --line_match="Stopped"
ynh_systemd_action --service_name=${app}-sidekiq --action="stop" --log_path=systemd --line_match="Stopped"
@@ -74,7 +73,7 @@ ynh_systemd_action --service_name=${app}-streaming --action="stop" --log_path=sy
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
-ynh_script_progression --message="Ensuring downward compatibility..."
+ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
@@ -156,7 +155,7 @@ ynh_remove_extra_repo
#=================================================
# CREATE DEDICATED USER
#=================================================
-ynh_script_progression --message="Making sure dedicated system user exists..."
+ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
@@ -167,7 +166,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
- ynh_script_progression --message="Upgrading source files..."
+ ynh_script_progression --message="Upgrading source files..." --weight=1
# Download Mastodon
tmpdir="$(mktemp -d)"
@@ -196,17 +195,9 @@ chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
-# NGINX CONFIGURATION
-#=================================================
-ynh_script_progression --message="Upgrading NGINX web server configuration..."
-
-# Create a dedicated NGINX config
-ynh_add_nginx_config
-
-#=================================================
# UPGRADE DEPENDENCIES
#=================================================
-ynh_script_progression --message="Upgrading dependencies..."
+ynh_script_progression --message="Upgrading dependencies..." --weight=1
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies
ynh_exec_warn_less ynh_install_ruby --ruby_version=$ruby_version
@@ -214,11 +205,19 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
#=================================================
+# NGINX CONFIGURATION
+#=================================================
+ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
+
+# Create a dedicated NGINX config
+ynh_add_nginx_config
+
+#=================================================
# SPECIFIC UPGRADE
#=================================================
# ADD SWAP IF NEEDED
#=================================================
-ynh_script_progression --message="Adding swap if needed..."
+ynh_script_progression --message="Adding swap if needed..." --weight=1
total_memory=$(ynh_get_ram --total)
swap_needed=0
@@ -234,7 +233,7 @@ ynh_add_swap --size=$swap_needed
#=================================================
# BUILD APP
#=================================================
-ynh_script_progression --message="Building app..."
+ynh_script_progression --message="Building app..." --weight=1
pushd "$final_path/live"
ynh_use_ruby
@@ -258,7 +257,7 @@ ynh_package_autoremove
#=================================================
# UPDATE A CONFIG FILE
#=================================================
-ynh_script_progression --message="Updating a config file..."
+ynh_script_progression --message="Updating a config file..." --weight=1
language="$(echo $language | head -c 2)"
@@ -270,7 +269,7 @@ chown $app:$app "$config"
#=================================================
# SETUP SYSTEMD
#=================================================
-ynh_script_progression --message="Upgrading systemd configuration..."
+ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
# Create a dedicated systemd config
ynh_add_systemd_config --service="$app-web" --template="mastodon-web.service"
@@ -280,7 +279,7 @@ ynh_add_systemd_config --service="$app-streaming" --template="mastodon-streaming
#=================================================
# SETUP THE CRON FILE
#=================================================
-ynh_script_progression --message="Setuping the cron file..."
+ynh_script_progression --message="Setuping the cron file..." --weight=1
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
@@ -289,7 +288,7 @@ ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
-ynh_script_progression --message="Integrating service in YunoHost..."
+ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add "$app-web" --description="$app web service"
yunohost service add "$app-sidekiq" --description="$app sidekiq service"
@@ -298,7 +297,7 @@ yunohost service add "$app-streaming" --description="$app streaming service"
#=================================================
# START SYSTEMD SERVICE
#=================================================
-ynh_script_progression --message="Starting a systemd service..."
+ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=${app}-web --action="start" --log_path=systemd --line_match="Listening on"
ynh_systemd_action --service_name=${app}-sidekiq --action="start" --log_path=systemd --line_match="Schedules Loaded"
@@ -307,7 +306,7 @@ ynh_systemd_action --service_name=${app}-streaming --action="start" --log_path=s
#=================================================
# RELOAD NGINX
#=================================================
-ynh_script_progression --message="Reloading NGINX web server..."
+ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
@@ -315,4 +314,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
-ynh_script_progression --message="Upgrade of $app completed"
+ynh_script_progression --message="Upgrade of $app completed" --last