2016-10-05 19:44:08 +02:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
# Exit on command errors and treat unset variables as an error
|
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
|
|
# See comments in install script
|
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
|
|
|
|
|
|
# Source YunoHost helpers
|
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
|
|
# Backup sources & data
|
|
|
|
|
# Note: the last argument is where to save this path, see the restore script.
|
|
|
|
|
ynh_backup "/var/www/${app}" "sources"
|
|
|
|
|
|
2017-02-22 16:21:27 +01:00
|
|
|
|
# Backup of composer
|
|
|
|
|
#
|
|
|
|
|
# TO BE VALIDATED AND TESTED
|
|
|
|
|
ynh_backup "/opt/flarum_composer" "flarum_composer"
|
2017-02-22 16:24:00 +01:00
|
|
|
|
ynh_backup "/usr/local/bin/composer" "local_composer"
|
2017-02-22 16:21:27 +01:00
|
|
|
|
|
2016-10-05 19:44:08 +02:00
|
|
|
|
### MySQL ###
|
|
|
|
|
# If a MySQL database is used:
|
|
|
|
|
# # Dump the database
|
|
|
|
|
dbname=$app
|
|
|
|
|
dbuser=$app
|
|
|
|
|
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
|
|
|
|
mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./dump.sql
|
|
|
|
|
### MySQL end ###
|
|
|
|
|
|
|
|
|
|
# Copy NGINX configuration
|
|
|
|
|
domain=$(ynh_app_setting_get "$app" domain)
|
|
|
|
|
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf"
|
|
|
|
|
|
|
|
|
|
### PHP (remove if not used) ###
|
|
|
|
|
# If a dedicated php-fpm process is used:
|
|
|
|
|
# # Copy PHP-FPM pool configuration
|
|
|
|
|
ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "php-fpm.conf"
|
|
|
|
|
### PHP end ###
|