chore(gitlab-package): create configuration backups

This commit is contained in:
Michele Cereda
2024-06-10 22:52:36 +02:00
parent bde73759ef
commit e95bcc8d6b
2 changed files with 22 additions and 0 deletions

View File

@@ -150,6 +150,10 @@ sudo gitlab-backup create BACKUP='prefix_override' STRATEGY='copy'
sudo gitlab-backup create … \
SKIP='db,repositories,uploads,builds,artifacts,pages,lfs,terraform_state,registry,packages,ci_secure_files'
# Create backups of the configuration.
sudo gitlab-ctl backup-etc
sudo gitlab-ctl backup-etc && ls -t '/etc/gitlab/config_backup/' | head -n '1'
# Restore backups.
sudo aws s3 cp 's3://backups/gitlab/gitlab-secrets.json' '/etc/gitlab/gitlab-secrets.json' \
&& sudo aws s3 cp 's3://backups/gitlab/gitlab.rb' '/etc/gitlab/gitlab.rb' \

View File

@@ -82,12 +82,30 @@ gitlab-rails runner '
# --------------------------------------
##
# Check services
sudo gitlab-ctl status
# Get logs
sudo gitlab-ctl tail
sudo gitlab-ctl tail 'prometheus'
# Backup data
sudo gitlab-backup create
sudo gitlab-backup create STRATEGY=copy
# Backup configuration
sudo gitlab-ctl backup-etc \
&& ls -t '/etc/gitlab/config_backup/' \
| head -n '1' \
| xargs -pI '{}' aws s3 cp '/etc/gitlab/config_backup/'{} 's3://backups/gitlab/'
# Package upgrade
sudo yum check-update
sudo yum info 'gitlab-ee' # informational
sudo rpm -qa | grep 'gitlab-ee' # informational
sudo yum --showduplicates list available 'gitlab-ee'
sudo gitlab-backup create # not strictly necessary: the upgrade will create a partial one
sudo gitlab-ctl backup-etc
tmux new-session -A -s 'gitlab-upgrade' "sudo yum update 'gitlab-ee'" # 'gitlab-ee-16.11.3' if version-specific
sudo gitlab-rake 'gitlab:check'