1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/glitchsoc_ynh.git synced 2024-09-03 19:15:59 +02:00

Merge pull request #144 from YunoHost-Apps/example_ynh

example_ynh corrections
This commit is contained in:
yalh76 2019-05-15 23:26:46 +02:00 committed by GitHub
commit 0486d088e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 19 deletions

View file

@ -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

View file

@ -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

View file

@ -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
@ -230,7 +230,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

View file

@ -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

View file

@ -37,6 +37,12 @@ otp_secret=$(ynh_app_setting_get --app=$app --key=otp_secret)
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
#=================================================
@ -143,19 +149,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/."
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
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"
# Clean files which are not needed anymore
ynh_secure_remove --file="$final_path/live/config/initializers/timeout.rb"
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"
#=================================================
# NGINX CONFIGURATION