1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gitlab_ynh.git synced 2024-09-03 18:36:35 +02:00
gitlab_ynh/scripts/backup
2019-01-26 14:30:58 +01:00

61 lines
1.6 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Source YunoHost helpers
source /usr/share/yunohost/helpers
# Load common variables and helpers
source ../settings/scripts/_common.sh
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
rm /var/opt/gitlab/backups/*_gitlab_backup.tar
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
# Copy NGINX configuration
domain=$(ynh_app_setting_get "$app" domain)
#=================================================
# STANDARD BACKUP STEPS
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP GITLAB DATABASE
#=================================================
ynh_print_info "Backuping of Gitlab..."
# Use gitlab-rake to backup
gitlab-rake gitlab:backup:create
ynh_backup "/var/opt/$app/backups/"
#=================================================
# BACKUP CONF FILES
#=================================================
ynh_print_info "Backuping configuration files of Gitlab..."
ynh_backup "$config_path/gitlab-secrets.json"
ynh_backup "$config_path/gitlab.rb"