1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/synapse_ynh.git synced 2024-09-03 20:26:38 +02:00
synapse_ynh/scripts/change_url

63 lines
2.1 KiB
Text
Raw Normal View History

2019-12-14 15:15:25 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
source ./experimental_helper.sh
source ./_common.sh
source /usr/share/yunohost/helpers
2019-12-14 15:15:25 +01:00
path=$new_path
domain=$new_domain
2019-12-14 15:15:25 +01:00
# Check if the new path stay /_matrix if not exit
2023-10-31 22:19:40 +01:00
if [[ $path != "/_matrix" ]]
2019-12-14 15:15:25 +01:00
then
ynh_die --message "You can't use an other path than '/_matrix'. You can only change the domain."
fi
# We stop the service
ynh_systemd_action --service_name=$app.service.service --action=stop
2019-12-14 15:15:25 +01:00
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Updating NGINX configuration..."
2019-12-14 15:15:25 +01:00
2023-10-31 22:19:40 +01:00
ynh_change_url_nginx_config
configure_nginx
2019-12-14 15:15:25 +01:00
#=================================================
# UPDATE SYNAPSE CONFIG
#=================================================
ynh_script_progression --message="Updating Synapse config..." --weight=2
2019-12-14 15:15:25 +01:00
configure_synapse
2019-12-14 15:15:25 +01:00
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Protecting directories..." --weight=3
set_permissions
2019-12-14 15:15:25 +01:00
#=================================================
# RELOAD SERVICES
#=================================================
ynh_script_progression --message="Restarting Synapse services..." --weight=5
2019-12-14 15:15:25 +01:00
ynh_systemd_action --service_name=$app-coturn.service --action=restart
ynh_systemd_action --service_name=$app.service --action=restart --line_match="Synapse now listening on TCP port $port_synapse_tls" --log_path="/var/log/matrix-$app/homeserver.log" --timeout=300
2019-12-14 15:15:25 +01:00
if ! yunohost --output-as plain domain list | grep -q "^$server_name"'$'; then
ynh_print_warn "Note yunohost won't be able to manage the required config for $server_name. So please add the needed DNS config as described on the documentation"
fi
2019-12-14 15:15:25 +01:00
ynh_script_progression --message="Change of URL completed for $app" --last