mirror of
https://github.com/YunoHost-Apps/synapse-admin_ynh.git
synced 2024-09-03 20:26:34 +02:00
fix upgrade synapse domain
This commit is contained in:
parent
8b62a08c31
commit
6a6b3c0a94
6 changed files with 42 additions and 13 deletions
|
@ -8,6 +8,25 @@
|
|||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# UPDATE SYNAPSE ENDPOINT
|
||||
#=================================================
|
||||
|
||||
_update_synapse_nginx_config() {
|
||||
# This helper fixes when synapse changes domain, shouldn't happen though...
|
||||
old_synapse_domain="$synapse_domain"
|
||||
synapse_domain=$(ynh_app_setting_get --app="$synapse_app" --key=domain)
|
||||
synapse_port=$(ynh_app_setting_get --app="$synapse_app" --key=synapse_port)
|
||||
ynh_app_setting_set --app=$app --key=synapse_domain --value="$synapse_domain"
|
||||
|
||||
if [[ "${synapse_domain}" != "${old_synapse_domain}" ]]; then
|
||||
ynh_backup_if_checksum_is_different --file="/etc/nginx/conf.d/${old_synapse_domain}.d/$app.endpoint.conf"
|
||||
ynh_delete_file_checksum --file="/etc/nginx/conf.d/${old_synapse_domain}.d/$app.endpoint.conf"
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/${old_synapse_domain}.d/$app.endpoint.conf"
|
||||
fi
|
||||
|
||||
ynh_add_config --template="endpoint.nginx.conf" --destination="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf"
|
||||
}
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -9,6 +9,13 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# UPDATE SYNAPSE ENDPOINT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration for Synapse..." --weight=2
|
||||
|
||||
_update_synapse_nginx_config
|
||||
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
|
@ -16,10 +23,6 @@ ynh_script_progression --message="Updating NGINX web server configuration..." --
|
|||
|
||||
ynh_change_url_nginx_config
|
||||
|
||||
synapse_domain=$(ynh_app_setting_get --app=$synapse_app --key=domain)
|
||||
synapse_port=$(ynh_app_setting_get --app=$synapse_app --key=synapse_port)
|
||||
ynh_add_config --template="endpoint.nginx.conf" --destination="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -9,6 +9,15 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# GET SYNAPSE SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Getting settings from Synapse..." --weight=2
|
||||
|
||||
synapse_domain=$(ynh_app_setting_get --app="$synapse_app" --key=domain)
|
||||
synapse_port=$(ynh_app_setting_get --app="$synapse_app" --key=synapse_port)
|
||||
ynh_app_setting_set --app=$app --key=synapse_domain --value="$synapse_domain"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
@ -29,8 +38,6 @@ ynh_script_progression --message="Adding system configurations related to $app..
|
|||
ynh_add_nginx_config
|
||||
|
||||
# Create NGINX config to access /_synapse/admin endpoint
|
||||
synapse_domain=$(ynh_app_setting_get --app="$synapse_app" --key=domain)
|
||||
synapse_port=$(ynh_app_setting_get --app="$synapse_app" --key=synapse_port)
|
||||
ynh_add_config --template="endpoint.nginx.conf" --destination="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf"
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -14,18 +14,12 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||
|
||||
ynh_exec_warn ls -lah "/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf"
|
||||
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
ynh_exec_warn ls -lah "/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf"
|
||||
|
||||
# Remove NGINX config that enabled /_synapse/admin endpoint
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf"
|
||||
|
||||
ynh_exec_warn ls -lah "/etc/nginx/conf.d/${synapse_domain}.d/$app.endpoint.conf"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -19,7 +19,6 @@ ynh_restore_file --origin_path="$install_dir"
|
|||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
|
|
|
@ -56,6 +56,13 @@ fi
|
|||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# UPDATE SYNAPSE ENDPOINT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration for Synapse..." --weight=2
|
||||
|
||||
_update_synapse_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REAPPLY SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue