2017-12-24 14:28:25 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-01-31 16:08:58 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
|
2020-11-17 23:51:51 +01:00
|
|
|
# Import common cmd
|
|
|
|
source ./experimental_helper.sh
|
|
|
|
source ./_common.sh
|
|
|
|
|
2017-12-24 14:28:25 +01:00
|
|
|
# Source YunoHost helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
# Stop script if errors
|
|
|
|
ynh_abort_if_errors
|
|
|
|
|
|
|
|
# Retrive arguments
|
2019-06-06 22:39:49 +02:00
|
|
|
ynh_script_progression --message="Loading installation settings..."
|
2017-12-24 14:28:25 +01:00
|
|
|
old_domain=$YNH_APP_OLD_DOMAIN
|
2018-08-02 15:59:04 +02:00
|
|
|
domain=$YNH_APP_NEW_DOMAIN
|
2019-10-01 21:31:45 +02:00
|
|
|
path_url=$(ynh_normalize_url_path --path_url $YNH_APP_NEW_PATH)
|
2017-12-24 14:28:25 +01:00
|
|
|
|
2018-01-31 16:08:58 +01:00
|
|
|
#=================================================
|
2017-12-24 14:28:25 +01:00
|
|
|
# STANDARD MODIFICATIONS
|
2018-01-31 16:08:58 +01:00
|
|
|
#=================================================
|
|
|
|
|
2019-06-06 22:39:49 +02:00
|
|
|
ynh_script_progression --message="Updating configuration..."
|
2018-08-02 15:59:04 +02:00
|
|
|
# Update nginx config
|
|
|
|
if [ "$old_domain" != "$domain" ]
|
2017-12-24 14:28:25 +01:00
|
|
|
then
|
2018-08-02 15:59:04 +02:00
|
|
|
# Delete file checksum for the old conf file location
|
2019-06-11 22:27:54 +02:00
|
|
|
ynh_delete_file_checksum --file "/etc/nginx/conf.d/$old_domain.d/$app.conf"
|
2017-12-24 14:28:25 +01:00
|
|
|
|
2018-08-02 15:59:04 +02:00
|
|
|
mv "/etc/nginx/conf.d/$old_domain.d/$app.conf" "/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
|
|
|
|
|
|
# Store file checksum for the new config file location
|
2019-06-11 22:27:54 +02:00
|
|
|
ynh_store_file_checksum --file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
2017-12-24 14:28:25 +01:00
|
|
|
fi
|
2018-08-02 15:59:04 +02:00
|
|
|
ynh_add_nginx_config
|
2017-12-24 14:28:25 +01:00
|
|
|
|
|
|
|
# Update UWSGI Config
|
2019-06-06 22:39:49 +02:00
|
|
|
ynh_add_uwsgi_service 'pgadmin_user python_version'
|
2017-12-24 14:28:25 +01:00
|
|
|
|
|
|
|
# Reload services
|
2020-12-07 16:29:43 +01:00
|
|
|
ynh_script_progression --message="Restarting $app services..." --weight=3
|
2019-06-09 21:25:58 +02:00
|
|
|
ynh_systemd_action --service_name "uwsgi-app@$app.service" --action restart \
|
2020-12-07 16:29:43 +01:00
|
|
|
--line_match "WSGI app 0 \(mountpoint='[/[:alnum:]_-]*'\) ready in [[:digit:]]* seconds on interpreter" --log_path "/var/log/uwsgi/$app/$app.log"
|
2020-07-30 22:55:35 +02:00
|
|
|
sleep 10
|
2019-06-06 22:39:49 +02:00
|
|
|
|
2019-06-11 22:27:54 +02:00
|
|
|
ynh_script_progression --message="Change of URL completed for $app" --last
|