2017-06-10 10:10:31 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-12-24 16:25:49 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2017-06-10 10:10:31 +02:00
|
|
|
|
|
|
|
# Source YunoHost helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2018-12-24 16:25:49 +01:00
|
|
|
# Load common variables and helpers
|
2018-12-24 18:16:01 +01:00
|
|
|
source ../settings/scripts/_common.sh
|
2018-12-24 16:25:49 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# MANAGE SCRIPT FAILURE
|
|
|
|
#=================================================
|
2017-06-10 10:10:31 +02:00
|
|
|
|
2018-12-25 20:55:11 +01:00
|
|
|
ynh_clean_setup () {
|
|
|
|
|
|
|
|
rm /var/opt/gitlab/backups/*_gitlab_backup.tar
|
|
|
|
true
|
|
|
|
}
|
|
|
|
|
2018-12-24 16:25:49 +01:00
|
|
|
# Exit if an error occurs during the execution of the script
|
|
|
|
ynh_abort_if_errors
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
2017-06-10 10:10:31 +02:00
|
|
|
|
|
|
|
# Copy NGINX configuration
|
|
|
|
domain=$(ynh_app_setting_get "$app" domain)
|
|
|
|
|
2018-12-24 16:25:49 +01:00
|
|
|
#=================================================
|
|
|
|
# STANDARD BACKUP STEPS
|
|
|
|
#=================================================
|
|
|
|
# BACKUP THE NGINX CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
|
|
|
|
|
|
#=================================================
|
2018-12-25 20:55:11 +01:00
|
|
|
# BACKUP GITLAB DATABASE
|
2018-12-24 16:25:49 +01:00
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# Use gitlab-rake to backup
|
|
|
|
gitlab-rake gitlab:backup:create
|
|
|
|
|
2018-12-24 19:31:51 +01:00
|
|
|
ynh_backup "/var/opt/$app/backups/"
|
2018-12-25 20:55:11 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# BACKUP CONF FILES
|
|
|
|
#=================================================
|
|
|
|
|
2018-12-24 19:10:30 +01:00
|
|
|
ynh_backup "$config_path/gitlab-secrets.json"
|
|
|
|
ynh_backup "$config_path/gitlab.rb"
|