2019-12-14 15:15:25 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
source ./experimental_helper.sh
source ./_common.sh
2023-11-01 18:52:07 +01:00
source /usr/share/yunohost/helpers
2019-12-14 15:15:25 +01:00
2023-11-01 18:52:07 +01:00
# We stop the service
2024-04-27 01:21:40 +02:00
ynh_systemd_action --service_name="$app".service --action=stop
2019-12-14 15:15:25 +01:00
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# NGINX CONFIGURATION
#=================================================
2022-10-28 10:59:40 +02:00
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
2023-11-01 18:52:07 +01:00
configure_nginx
2019-12-14 15:15:25 +01:00
#=================================================
# UPDATE SYNAPSE CONFIG
#=================================================
2022-10-28 10:59:40 +02:00
ynh_script_progression --message="Updating Synapse config..." --weight=2
2024-06-04 21:00:22 +02:00
ynh_add_config --jinja --template="homeserver.yaml" --destination="/etc/matrix-$app/homeserver.yaml"
2024-04-05 01:02:47 +02:00
ynh_add_config --template="log.yaml" --destination="/etc/matrix-$app/log.yaml"
2019-12-14 15:15:25 +01:00
2022-02-21 21:03:01 +01:00
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
2023-11-01 18:52:07 +01:00
ynh_script_progression --message="Protecting directories..." --weight=3
set_permissions
2022-02-21 21:03:01 +01:00
2019-12-14 15:15:25 +01:00
#=================================================
# RELOAD SERVICES
#=================================================
2022-10-28 10:59:40 +02:00
ynh_script_progression --message="Restarting Synapse services..." --weight=5
2019-12-14 15:15:25 +01:00
2024-04-27 01:21:40 +02: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
2024-02-20 21:18:09 +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