diff options
| author | yalh76 <yalh@yahoo.com> | 2020-06-02 18:34:04 +0200 |
|---|---|---|
| committer | yalh76 <yalh@yahoo.com> | 2020-06-02 18:34:04 +0200 |
| commit | 8fea96dcd81f40923ba2f599c3b7ab838429f2de (patch) | |
| tree | b93e9ffb74da537fc74a0a35541cfab943dd8d3d /scripts/upgrade | |
| parent | 960d1c7d65dea1730ddb50adf0953b70993c5141 (diff) | |
| download | mastodon_ynh-8fea96dcd81f40923ba2f599c3b7ab838429f2de.tar.gz mastodon_ynh-8fea96dcd81f40923ba2f599c3b7ab838429f2de.tar.bz2 mastodon_ynh-8fea96dcd81f40923ba2f599c3b7ab838429f2de.zip | |
apply last example_ynh for ynh_script_progression
Diffstat (limited to 'scripts/upgrade')
| -rw-r--r-- | scripts/upgrade | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/scripts/upgrade b/scripts/upgrade index e4295fe..8441307 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..." --weight=4 +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -40,14 +40,14 @@ vapid_public_key=$(ynh_app_setting_get --app=$app --key=vapid_public_key) #================================================= # CHECK VERSION #================================================= -ynh_script_progression --message="Checking version..." --weight=1 +ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +ynh_script_progression --message="Ensuring downward compatibility..." config="$final_path/live/.env.production" @@ -131,7 +131,7 @@ ynh_remove_extra_repo #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=442 +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 @@ -160,7 +160,7 @@ path_url=$(ynh_normalize_url_path --path_url=$path_url) #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=22 +ynh_script_progression --message="Stopping a systemd service..." 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" @@ -172,7 +172,7 @@ ynh_systemd_action --service_name=${app}-streaming --action="stop" --log_path=sy if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Upgrading source files..." --weight=14 + ynh_script_progression --message="Upgrading source files..." # Download Mastodon tmpdir="$(mktemp -d)" @@ -201,14 +201,14 @@ fi #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=3 +ynh_script_progression --message="Upgrading nginx web server configuration..." ynh_add_nginx_config 'port_web port_stream' #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=24 +ynh_script_progression --message="Upgrading dependencies..." ynh_remove_nodejs ynh_install_nodejs --nodejs_version=$NODEJS_VERSION @@ -218,7 +218,7 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=7 +ynh_script_progression --message="Making sure dedicated system user exists..." # Create a dedicated user (if not existing) ynh_system_user_create --username=$app --home_dir=$final_path @@ -228,7 +228,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path #================================================= # ADD SWAP IF NEEDED #================================================= -ynh_script_progression --message="Adding swap if needed..." --weight=7 +ynh_script_progression --message="Adding swap if needed..." total_memory=$(ynh_get_ram --total) swap_needed=0 @@ -238,13 +238,13 @@ if [ $total_memory -lt $MEMORY_NEEDED ]; then swap_needed=$(($MEMORY_NEEDED - $total_memory)) fi -ynh_script_progression --message="Adding $swap_needed Mo to swap..." --weight=1 +ynh_script_progression --message="Adding $swap_needed Mo to swap..." ynh_add_swap --size=$swap_needed #================================================= # INSTALLING RUBY AND BUNDLER #================================================= -ynh_script_progression --message="Installing Ruby..." --weight=424 +ynh_script_progression --message="Installing Ruby..." ynh_install_ruby --ruby_version=$RUBY_VERSION pushd "$final_path/live" @@ -255,7 +255,7 @@ popd #================================================= # MODIFY A CONFIG FILE #================================================= -ynh_script_progression --message="Modifying a config file..." --weight=1 +ynh_script_progression --message="Modifying a config file..." ynh_backup_if_checksum_is_different --file="$config" cp -f ../conf/.env.production.sample "$config" @@ -280,7 +280,7 @@ ynh_replace_string --match_string="__VAPID_PUBLIC_KEY__" --replace_string="$vapi #================================================= # UPGRADE MASTODON #================================================= -ynh_script_progression --message="Upgrading Mastodon..." --weight=2640 +ynh_script_progression --message="Upgrading Mastodon..." chown -R "$app": "$final_path" @@ -302,7 +302,7 @@ ynh_store_file_checksum --file="$config" #================================================= # SETUP THE CRON FILE #================================================= -ynh_script_progression --message="Setuping the cron file..." --weight=1 +ynh_script_progression --message="Setuping the cron file..." ynh_replace_string --match_string="__FINAL_PATH__" --replace_string="$final_path" --target_file="../conf/cron" cp -f ../conf/cron /etc/cron.d/$app @@ -310,7 +310,7 @@ cp -f ../conf/cron /etc/cron.d/$app #================================================= # SETUP SYSTEMD #================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --weight=13 +ynh_script_progression --message="Upgrading systemd configuration..." # Create a dedicated systemd config ynh_replace_string --match_string="__PORT_WEB__" --replace_string="$port_web" --target_file="../conf/mastodon-web.service" @@ -325,7 +325,7 @@ ynh_add_systemd_config --service="$app-streaming" --template="mastodon-streaming #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=3 +ynh_script_progression --message="Integrating service in YunoHost..." yunohost service add "$app-web" --description "$app web service" --log_type "systemd" yunohost service add "$app-sidekiq" --description "$app sidekiq service" --log_type "systemd" @@ -336,7 +336,7 @@ yunohost service add "$app-streaming" --description "$app streaming service" --l #================================================= # SECURE FILES AND DIRECTORIES #================================================= -ynh_script_progression --message="Securing files and directories..." --weight=9 +ynh_script_progression --message="Securing files and directories..." # Set permissions on app files chown -R $app: $final_path @@ -344,7 +344,7 @@ chown -R $app: $final_path #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=1 +ynh_script_progression --message="Upgrading SSOwat configuration..." # Make app public if necessary if [ $is_public -eq 1 ] @@ -356,7 +356,7 @@ fi #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=48 +ynh_script_progression --message="Starting a systemd service..." ynh_systemd_action --service_name=${app}-web --action="start" --log_path=systemd --line_match="Listening on tcp" ynh_systemd_action --service_name=${app}-sidekiq --action="start" --log_path=systemd --line_match="Starting processing" @@ -365,7 +365,7 @@ ynh_systemd_action --service_name=${app}-streaming --action="start" --log_path=s #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --weight=2 +ynh_script_progression --message="Reloading nginx web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -373,4 +373,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_script_progression --message="Upgrade of $app completed" |
