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

Add appservice support

This commit is contained in:
Josué Tille 2020-07-24 23:33:53 +02:00
parent 4102871ef5
commit 2d14c10c53
No known key found for this signature in database
GPG key ID: 716A6C99B04194EF
5 changed files with 37 additions and 4 deletions

View file

@ -1017,8 +1017,8 @@ report_stats: __REPORT_STATS__
# A list of application service config files to use
#
#app_service_config_files:
# - app_service_1.yaml
# - app_service_2.yaml
#
## Managed by a specific config file in /etc/matrix-synapse/conf.d/app_service.yaml
# Uncomment to enable tracking of application service IP addresses. Implicitly
# enables MAU tracking for application service users.

View file

@ -381,14 +381,16 @@ ynh_script_progression --message="Configuring log rotation..." --weight=2
ynh_use_logrotate --logfile "/var/log/matrix-$app"
#=================================================
# ADD SCRIPT FOR COTURN CRON
# ADD SCRIPT FOR COTURN CRON AND APP SERVICE
#=================================================
# WARNING : theses command are used in INSTALL, UPGRADE
# For any update do it in all files
cp ../sources/Coturn_config_rotate.sh $final_path/
cp ../sources/update_synapse_for_appservice.sh $final_path/
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file="$final_path/Coturn_config_rotate.sh"
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file="$final_path/update_synapse_for_appservice.sh"
#=================================================
# GENERIC FINALIZATION
@ -419,6 +421,7 @@ ynh_replace_string __DOMAIN__ $domain ../hooks/post_cert_update
# For any update do it in all files
chown $synapse_user:root -R $final_path
chmod 770 $final_path/Coturn_config_rotate.sh
chmod 700 $final_path/update_synapse_for_appservice.sh
chown $synapse_user:root -R /var/lib/matrix-$app
chown $synapse_user:root -R /var/log/matrix-$app
chown $synapse_user:root -R /etc/matrix-$app

View file

@ -230,6 +230,7 @@ ynh_use_logrotate --logfile /var/log/matrix-$app
# For any update do it in all files
chown $synapse_user:root -R $final_path
chmod 770 $final_path/Coturn_config_rotate.sh
chmod 700 $final_path/update_synapse_for_appservice.sh
chown $synapse_user:root -R /var/lib/matrix-$app
chown $synapse_user:root -R /var/log/matrix-$app
chown $synapse_user:root -R /etc/matrix-$app

View file

@ -415,14 +415,16 @@ fi
ynh_store_file_checksum --file="$coturn_config_path"
#=================================================
# ADD SCRIPT FOR COTURN CRON
# ADD SCRIPT FOR COTURN CRON AND APP SERVICE
#=================================================
# WARNING : theses command are used in INSTALL, UPGRADE
# For any update do it in all files
cp ../sources/Coturn_config_rotate.sh $final_path/
cp ../sources/update_synapse_for_appservice.sh $final_path/
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file="$final_path/Coturn_config_rotate.sh"
ynh_replace_string --match_string=__APP__ --replace_string=$app --target_file="$final_path/update_synapse_for_appservice.sh"
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
@ -473,6 +475,7 @@ ynh_permission_url --permission main --url $domain/_matrix/cas_server.php/login
# For any update do it in all files
chown $synapse_user:root -R $final_path
chmod 770 $final_path/Coturn_config_rotate.sh
chmod 700 $final_path/update_synapse_for_appservice.sh
chown $synapse_user:root -R /var/lib/matrix-$app
chown $synapse_user:root -R /var/log/matrix-$app
chown $synapse_user:root -R /etc/matrix-$app

View file

@ -0,0 +1,26 @@
#!/bin/bash
app=__APP__
service_config_file=/etc/matrix-$app/conf.d/app_service.yaml
# Backup the previous config file
cp $service_config_file /tmp/app_service_backup.yaml
echo "app_service_config_files:" > $service_config_file
for f in $(ls /etc/matrix-$app/app-service/); do
echo " - /etc/matrix-synapse/$app" >> $service_config_file
done
# Set permissions
chown matrix-$app $service_config_file
chmod 600 $service_config_file
systemctl restart matrix-$app
if [ $? -eq 0 ]; then
rm /tmp/app_service_backup.yaml
exit 0
else
echo "Failed to restart synapse with the new config file. Restore the old config file !!"
cp /tmp/app_service_backup.yaml $service_config_file
fi