2017-12-24 14:28:25 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-01-31 16:08:58 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
|
2017-12-24 14:28:25 +01:00
|
|
|
# Source YunoHost helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
# Stop script if errors
|
|
|
|
ynh_abort_if_errors
|
|
|
|
|
|
|
|
# Import common cmd
|
2018-01-31 16:08:58 +01:00
|
|
|
source ./experimental_helper.sh
|
2017-12-24 14:28:25 +01:00
|
|
|
source ./_common.sh
|
|
|
|
|
|
|
|
# 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-06-09 21:37:21 +02:00
|
|
|
path_url=$(ynh_normalize_url_path $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
|
2019-06-06 22:39:49 +02:00
|
|
|
ynh_script_progression --message="Reloading services..."
|
2017-12-24 14:28:25 +01:00
|
|
|
sudo systemctl reload nginx.service
|
2019-06-09 21:25:58 +02:00
|
|
|
ynh_systemd_action --service_name "uwsgi-app@$app.service" --action restart \
|
2019-06-06 22:39:49 +02:00
|
|
|
--line_match "WSGI app 0 (mountpoint='$path_url') ready in [[:digit:]]* seconds on interpreter" --log_path "/var/log/uwsgi/$app/pgadmin.log"
|
|
|
|
|
2019-06-11 22:27:54 +02:00
|
|
|
ynh_script_progression --message="Change of URL completed for $app" --last
|