mirror of
https://github.com/YunoHost-Apps/gitlab_ynh.git
synced 2024-09-03 18:36:35 +02:00
fix restore
This commit is contained in:
parent
38d9632d8c
commit
ce8aeddb0d
2 changed files with 39 additions and 3 deletions
|
@ -16,6 +16,12 @@ source ../settings/scripts/_common.sh
|
||||||
# MANAGE SCRIPT FAILURE
|
# 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
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
@ -35,12 +41,17 @@ domain=$(ynh_app_setting_get "$app" domain)
|
||||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP GITLAB DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Use gitlab-rake to backup
|
# Use gitlab-rake to backup
|
||||||
gitlab-rake gitlab:backup:create
|
gitlab-rake gitlab:backup:create
|
||||||
|
|
||||||
ynh_backup "/var/opt/$app/backups/"
|
ynh_backup "/var/opt/$app/backups/"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP CONF FILES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
ynh_backup "$config_path/gitlab-secrets.json"
|
ynh_backup "$config_path/gitlab-secrets.json"
|
||||||
ynh_backup "$config_path/gitlab.rb"
|
ynh_backup "$config_path/gitlab.rb"
|
||||||
|
|
|
@ -26,6 +26,12 @@ source _common.sh
|
||||||
# MANAGE SCRIPT FAILURE
|
# 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
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
@ -55,14 +61,22 @@ test ! -d $final_path \
|
||||||
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# REINSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_install_app_dependencies openssh-server
|
ynh_install_app_dependencies openssh-server
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE CONF FILES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
ynh_restore_file "$config_path/gitlab-secrets.json"
|
ynh_restore_file "$config_path/gitlab-secrets.json"
|
||||||
ynh_restore_file "$config_path/gitlab.rb"
|
ynh_restore_file "$config_path/gitlab.rb"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE APP MAIN DIR
|
||||||
|
#=================================================
|
||||||
|
|
||||||
setup_source $architecture
|
setup_source $architecture
|
||||||
|
|
||||||
ynh_restore_file "/var/opt/$app/backups/"
|
ynh_restore_file "/var/opt/$app/backups/"
|
||||||
|
@ -70,7 +84,7 @@ ynh_restore_file "/var/opt/$app/backups/"
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORATION
|
# SPECIFIC RESTORATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# REINSTALL DEPENDENCIES
|
# RESTORE GITLAB DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
fullfile=$(ls /var/opt/gitlab/backups/*_gitlab* --file -c1 | head -1)
|
fullfile=$(ls /var/opt/gitlab/backups/*_gitlab* --file -c1 | head -1)
|
||||||
|
@ -78,8 +92,19 @@ basename="/var/opt/gitlab/backups/"
|
||||||
filename=$(basename -- "$fullfile")
|
filename=$(basename -- "$fullfile")
|
||||||
last_backup="${filename%_gitlab_backup.tar}"
|
last_backup="${filename%_gitlab_backup.tar}"
|
||||||
|
|
||||||
|
gitlab-ctl stop unicorn
|
||||||
|
gitlab-ctl stop sidekiq
|
||||||
|
|
||||||
# Use gitlab-rake to backup
|
# Use gitlab-rake to backup
|
||||||
gitlab-rake gitlab:backup:restore force=yes BACKUP=$last_backup
|
gitlab-rake gitlab:backup:restore force=yes BACKUP=$last_backup
|
||||||
|
|
||||||
gitlab-ctl restart
|
gitlab-ctl restart
|
||||||
gitlab-rake gitlab:check SANITIZE=true
|
gitlab-rake gitlab:check SANITIZE=true
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
|
#=================================================
|
||||||
|
# RELOAD NGINX
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
systemctl reload nginx
|
Loading…
Add table
Reference in a new issue