mirror of
https://github.com/YunoHost-Apps/gitlab_ynh.git
synced 2024-09-03 18:36:35 +02:00
59 lines
1.7 KiB
Bash
59 lines
1.7 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
# Source YunoHost helpers
|
|
source /usr/share/yunohost/helpers
|
|
|
|
# Load common variables and helpers
|
|
source ./_common.sh
|
|
|
|
#=================================================
|
|
# MANAGE SCRIPT FAILURE
|
|
#=================================================
|
|
|
|
ynh_clean_setup () {
|
|
### Remove this function if there's nothing to clean before calling the remove script.
|
|
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 RESTORATION STEPS
|
|
#=================================================
|
|
# RESTORE THE NGINX CONFIGURATION
|
|
#=================================================
|
|
|
|
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
|
|
#=================================================
|
|
# RESTORE THE APP MAIN DIR
|
|
#=================================================
|
|
|
|
gitlab-ctl stop unicorn
|
|
gitlab-ctl stop sidekiq
|
|
|
|
fullfile=$(ls /var/opt/gitlab/backups/*_gitlab* --file -c1 | head -1)
|
|
basename="/var/opt/gitlab/backups/"
|
|
last_backup="${filename%_gitlab_backup.tar}"
|
|
|
|
# Use gitlab-rake to backup
|
|
gitlab-rake gitlab:backup:restore force=yes BACKUP=$last_backup
|
|
|
|
ynh_backup "$config_path/gitlab-secrets.json" "gitlab-secrets.json"
|
|
ynh_backup "$config_path/gitlab.rb" "gitlab.rb"
|
|
|
|
gitlab-ctl restart
|
|
gitlab-rake gitlab:check SANITIZE=true
|