2017-02-13 20:43:41 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-07-21 22:28:49 +02:00
|
|
|
# Source YunoHost helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
2017-02-13 20:43:41 +01:00
|
|
|
|
2017-07-21 22:28:49 +02:00
|
|
|
# Stop script if errors
|
|
|
|
ynh_abort_if_errors
|
2017-02-13 20:43:41 +01:00
|
|
|
|
2017-07-21 22:28:49 +02:00
|
|
|
# Import common cmd
|
|
|
|
source ../settings/scripts/_common.sh
|
|
|
|
source ../settings/scripts/psql.sh
|
2017-02-13 20:43:41 +01:00
|
|
|
|
|
|
|
# Retrieve arguments
|
2017-07-21 22:28:49 +02:00
|
|
|
domain=$(ynh_app_setting_get $app special_domain)
|
2018-01-19 22:05:39 +01:00
|
|
|
final_path="/opt/yunohost/matrix-$app"
|
2017-02-13 20:43:41 +01:00
|
|
|
|
|
|
|
# Copy Nginx config
|
|
|
|
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf"
|
|
|
|
|
|
|
|
# Backup synapse config
|
2018-01-19 22:05:39 +01:00
|
|
|
ynh_backup "/etc/matrix-$app" "synapse_config"
|
2017-02-13 20:43:41 +01:00
|
|
|
|
|
|
|
# Backup coturn server
|
|
|
|
ynh_backup "/etc/turnserver.conf" "coturn_config"
|
2017-02-16 22:54:57 +01:00
|
|
|
ynh_backup "/etc/default/coturn" "coturn_config_default"
|
2017-02-13 20:43:41 +01:00
|
|
|
|
|
|
|
# Backup synapse database
|
2018-01-19 22:05:39 +01:00
|
|
|
ynh_backup "/var/lib/matrix-$app" "data" 1
|
2017-07-21 22:28:49 +02:00
|
|
|
|
|
|
|
# Backup Postgresql database
|
|
|
|
sudo su -c "pg_dump $synapse_db_name" postgres > ${YNH_CWD}/dump.sql
|
2017-02-13 20:43:41 +01:00
|
|
|
|
2017-10-21 01:31:04 +02:00
|
|
|
# Copy the logs
|
2018-01-19 22:05:39 +01:00
|
|
|
ynh_backup "/var/log/matrix-$app" "log"
|
2017-10-21 01:31:04 +02:00
|
|
|
|
2017-07-21 22:28:49 +02:00
|
|
|
# Backup systemd service
|
2018-01-19 22:05:39 +01:00
|
|
|
ynh_backup "/etc/default/matrix-$app"
|
|
|
|
ynh_backup "/etc/systemd/system/matrix-$app.service"
|
|
|
|
ynh_backup "/etc/default/coturn-$app"
|
|
|
|
ynh_backup "/etc/systemd/system/coturn-$app.service"
|
2017-10-21 01:31:04 +02:00
|
|
|
|
|
|
|
# Backup synapse binary
|
|
|
|
ynh_backup "$final_path" "bin"
|