aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authoryalh76 <yalh@yahoo.com>2019-05-15 12:18:39 +0200
committeryalh76 <yalh@yahoo.com>2019-05-15 12:18:39 +0200
commitcd046117a5b300ba67faf4d6b25bb1c44fb774d2 (patch)
tree01dbb6ee818e4ea0588ffa81529d730e834e3d46 /scripts
parentf6bf3f01c9bbe6862cb8360e05245672e33963e5 (diff)
downloadmastodon_ynh-cd046117a5b300ba67faf4d6b25bb1c44fb774d2.tar.gz
mastodon_ynh-cd046117a5b300ba67faf4d6b25bb1c44fb774d2.tar.bz2
mastodon_ynh-cd046117a5b300ba67faf4d6b25bb1c44fb774d2.zip
example_ynh corrections
Diffstat (limited to 'scripts')
-rw-r--r--scripts/backup2
-rw-r--r--scripts/change_url1
-rw-r--r--scripts/install6
-rw-r--r--scripts/remove6
-rw-r--r--scripts/upgrade32
5 files changed, 28 insertions, 19 deletions
diff --git a/scripts/backup b/scripts/backup
index fdee95f..62ac387 100644
--- a/scripts/backup
+++ b/scripts/backup
@@ -61,7 +61,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
ynh_script_progression --message="Backing up the PostgreSQL database..." --weight=4
-ynh_psql_dump_db "$db_name" > db.sql
+ynh_psql_dump_db --database="$db_name" > db.sql
#=================================================
# SPECIFIC BACKUP
diff --git a/scripts/change_url b/scripts/change_url
index 24b21fc..9d88f37 100644
--- a/scripts/change_url
+++ b/scripts/change_url
@@ -33,7 +33,6 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#db_user=$db_name
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
-admin_mail=$(ynh_app_setting_get --app=$app --key=admin_mail)
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
diff --git a/scripts/install b/scripts/install
index ff03433..28c136f 100644
--- a/scripts/install
+++ b/scripts/install
@@ -77,8 +77,8 @@ ynh_app_setting_set --app=$app --key=language --value=$language
ynh_script_progression --message="Configuring firewall..." --weight=1
# Find a free port
-port_web=$(ynh_find_port 3000)
-port_stream=$(ynh_find_port 4000)
+port_web=$(ynh_find_port --port=3000)
+port_stream=$(ynh_find_port --port=4000)
# Open this port
ynh_app_setting_set --app=$app --key=port_web --value=$port_web
ynh_app_setting_set --app=$app --key=port_stream --value=$port_stream
@@ -245,7 +245,7 @@ ynh_add_systemd_config --service="$app-streaming" --template="mastodon-streaming
ynh_script_progression --message="Storing the config file checksum..." --weight=1
# Calculate and store the config file checksum into the app settings
-ynh_store_file_checksum "${final_path}/live/.env.production"
+ynh_store_file_checksum --file="${final_path}/live/.env.production"
#=================================================
# GENERIC FINALIZATION
diff --git a/scripts/remove b/scripts/remove
index bd6c9c6..d5a3a55 100644
--- a/scripts/remove
+++ b/scripts/remove
@@ -54,9 +54,9 @@ fi
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=27
# Remove the dedicated systemd config
-ynh_remove_systemd_config "$app-web"
-ynh_remove_systemd_config "$app-sidekiq"
-ynh_remove_systemd_config "$app-streaming"
+ynh_remove_systemd_config --service="$app-web"
+ynh_remove_systemd_config --service="$app-sidekiq"
+ynh_remove_systemd_config --service="$app-streaming"
#=================================================
# REMOVE THE POSTGRESQL DATABASE
diff --git a/scripts/upgrade b/scripts/upgrade
index 7562d85..1d35159 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -38,6 +38,12 @@ vapid_private_key=$(ynh_app_setting_get --app=$app --key=vapid_private_key)
vapid_public_key=$(ynh_app_setting_get --app=$app --key=vapid_public_key)
#=================================================
+# CHECK VERSION
+#=================================================
+
+upgrade_type=$(ynh_check_app_version_changed)
+
+#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
@@ -140,19 +146,23 @@ ynh_systemd_action --service_name=${app}-streaming --action="stop" --log_path=sy
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
-ynh_script_progression --message="Upgrading source files..." --weight=14
-# Download Mastodon
-mv "$final_path/live" "$final_path/live_back"
-ynh_setup_source --dest_dir="$final_path/live"
-if [ -z $final_path/live_back/public/system ]; then
- rsync -a "$final_path/live_back/public/system" "$final_path/live_back/public/."
-fi
-rsync -a "$final_path/live_back/.env.production" "$final_path/live/."
-rm -Rf "$final_path/live_back"
+if [ "$upgrade_type" == "UPGRADE_APP" ]
+then
+ ynh_script_progression --message="Upgrading source files..." --weight=14
-# Clean files which are not needed anymore
-ynh_secure_remove --file="$final_path/live/config/initializers/timeout.rb"
+ # Download Mastodon
+ mv "$final_path/live" "$final_path/live_back"
+ ynh_setup_source --dest_dir="$final_path/live"
+ if [ -z $final_path/live_back/public/system ]; then
+ rsync -a "$final_path/live_back/public/system" "$final_path/live_back/public/."
+ fi
+ rsync -a "$final_path/live_back/.env.production" "$final_path/live/."
+ rm -Rf "$final_path/live_back"
+
+ # Clean files which are not needed anymore
+ ynh_secure_remove --file="$final_path/live/config/initializers/timeout.rb"
+fi
#=================================================
# NGINX CONFIGURATION