Gitlab Backup
Monday, June 21, 2021

GitLab Backup

Install the basic software on a new VM (Fedora Server 34)

  dnf install -y tmux htop vim git
  dnf install -y libxcrypt-compat nginx autossh

Install GitLab Community Edition

  # os=el dist=8 is required since Fedora is not officially supported but CentOS is 
  curl -s | os=el dist=8 bash
  dnf install -y gitlab-ce

These steps are to ensure that nginx can access Gitlab

  # To find these out, check journalctl -xe | grep nginx
  ausearch -c 'nginx' --raw | audit2allow -M my-nginx
  semodule -X 300 -i my-nginx.pp

Backup the files from the main host

  sudo cp 11493107454_2018_04_25_10.6.4-ce_gitlab_backup.tar /var/opt/gitlab/backups/
  sudo chown git:git /var/opt/gitlab/backups/11493107454_2018_04_25_10.6.4-ce_gitlab_backup.tar

  # Stop these, as these connect to the database
  sudo gitlab-ctl stop puma
  sudo gitlab-ctl stop sidekiq

  # Restore with the name of the backup (do not include gitlab_backup)
  sudo gitlab-backup restore BACKUP=11493107454_2018_04_25_10.6.4-ce

  sudo gitlab-ctl reconfigure
  sudo gitlab-ctl restart
  sudo gitlab-rake gitlab:check SANITIZE=true

There is a copy of this live right now here