Skip to content

Instantly share code, notes, and snippets.

@nanusdad
Last active July 22, 2023 06:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nanusdad/ad0f6c5715d9dd40a83c9c2755233d14 to your computer and use it in GitHub Desktop.
Save nanusdad/ad0f6c5715d9dd40a83c9c2755233d14 to your computer and use it in GitHub Desktop.
Gitlab backup and restore notes

Gitlab backup and restore notes

Backup (on old server)

sudo gitlab-backup create
#backup is available in
cd /var/opt/gitlab/backups
cp 1643*.tar /tmp
cd /tmp
gzip 1643*.tar

Copied files to local (as stop gap, can copy directly between source and target, if available)

scp -i keyfile.pem user@source_host:/tmp/1643*.tar.gz  .

Copied backup file to new Gitlab (Debian)

scp -i keyfile.pem 1643*.tar.gz user@target_host:/tmp

Downgrade Gitlab

Might be required if Gitlab versions don't match.

sudo apt-get remove gitlab-ce
rm -rf /var/opt/gitlab
pkill -f gitlab
rm -rf /opt/gitlab
rm -rf /etc/gitlab
rm -rf /var/opt/gitlab

Restore backup

cd /tmp
gzip -d 1643*tar.gz
cp 1643*.tar /var/opt/gitlabl/backups
sudo gitlab-backup restore BACKUP=1643041414_2022_01_24_12.5.0

Upgrade Gitlab

sudo apt install gitlab-ce=14.7.0-ce.0
sudo gitlab-ctl restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment