📜  备份还原和升级 Gitlab - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:51:37.662000             🧑  作者: Mango

代码示例1
#Assuming Instance1 is the production instance and Instance2 is the newly set-up test instance

#From Instance1 
sudo gitlab-backup create

#copy the crearted backup to Instance2
# The backup can be found at /var/opt/gitlab/backups
scp "specific"_gitlab_backup.tar root@Instance2/opt/gitlab/backups

In the 2nd instance
#change ownership of backup file to git user
sudo chown git.git /var/opt/gitlab/backups/"specific"_gitlab_backup.tar
#stop puma and sidekiq
sudo gitlab-ctl stop puma
sudo gitlab-ctl stop sidekiq
#ncase you have only one backup you dont need to specify
sudo gitlab-backup restore BACKUP="specific"_gitlab_backup.tar

#From Instance1 
#Copy /etc/gitlab directory to Instance2
scp -r /etc/gitlab root@Instance2:/etc/gitlab

#In Instance2 
#Reconfigure, restart and check GitLab:
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
sudo gitlab-rake gitlab:check SANITIZE=true

#In Instance2 
#Upgrading from 13.11.3 to 13.12.15
sudo apt-get install  gitlab-ee=13.12.15-ee.0

#From Instance1 
#Copy /etc/gitlab directory to Instance2
scp -r /etc/gitlab root@Instance2:/etc/gitlab

#In Instance2 
#Reconfigure, restart and check GitLab:
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
sudo gitlab-rake gitlab:check SANITIZE=true

Proceed to login with your 13.11.3 password and username