1
0
Fork 0
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:
Pierre Bourré 2018-12-24 19:10:30 +01:00
parent 67d1961ce6
commit 1bc5173c78
2 changed files with 25 additions and 12 deletions

View file

@ -16,10 +16,6 @@ source ../settings/scripts/_common.sh
# MANAGE SCRIPT FAILURE # 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 # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
@ -37,6 +33,7 @@ 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"
ynh_backup "$final_path"
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
@ -45,5 +42,5 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
# Use gitlab-rake to backup # Use gitlab-rake to backup
gitlab-rake gitlab:backup:create gitlab-rake gitlab:backup:create
ynh_backup "$config_path/gitlab-secrets.json" "gitlab-secrets.json" ynh_backup "$config_path/gitlab-secrets.json"
ynh_backup "$config_path/gitlab.rb" "gitlab.rb" ynh_backup "$config_path/gitlab.rb"

View file

@ -16,10 +16,6 @@ source ../settings/scripts/_common.sh
# MANAGE SCRIPT FAILURE # 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 # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
@ -29,6 +25,16 @@ ynh_abort_if_errors
# Copy NGINX configuration # Copy NGINX configuration
domain=$(ynh_app_setting_get "$app" domain) domain=$(ynh_app_setting_get "$app" domain)
path_url=$(ynh_app_setting_get "$app" path_url)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_webpath_available $domain $path_url \
|| ynh_die "Path not available: ${domain}${path_url}"
test ! -d $final_path \
|| ynh_die "There is already a directory: $final_path "
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
@ -42,6 +48,16 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_restore_file "$final_path"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_install_app_dependencies openssh-server
gitlab-ctl stop unicorn gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq gitlab-ctl stop sidekiq
@ -52,8 +68,8 @@ last_backup="${filename%_gitlab_backup.tar}"
# 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
ynh_backup "$config_path/gitlab-secrets.json" "gitlab-secrets.json" ynh_restore_file "$config_path/gitlab-secrets.json"
ynh_backup "$config_path/gitlab.rb" "gitlab.rb" ynh_restore_file "$config_path/gitlab.rb"
gitlab-ctl restart gitlab-ctl restart
gitlab-rake gitlab:check SANITIZE=true gitlab-rake gitlab:check SANITIZE=true