Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to migrate gitlab backups to new server which has latest gitlab version

I am trying to migrate my gitlab backups for my old server to new server. my old server has gitlab (gitlab-6.5.1-0) and my new server has gitlab version (gitlab 6.6.5-omnibus). i taken backup from my old server using the following command

bundle exec rake gitlab:backup:create RAILS_ENV=production

and when i try to restore this backup in new server using this command

gitlab-rake gitlab:backup:restore BACKUP=1395394855

I am getting the following output

Unpacking backup ... done
GitLab version mismatch:
  Your current GitLab version (6.6.5) differs from the GitLab version in the backup!
  Please switch to the following version and try again:
  version: 6f6f1588ba5123f156ee3b0635a061745b71fcde

I tried searching for solution . but in all documents its says The backup is already migrated to the previous version. but none of them describes how to migrate backups . Any solution regarding this is Appreciated !

like image 429
Naveen Subramani Avatar asked Mar 21 '14 11:03

Naveen Subramani


People also ask

Where do GitLab backups go?

All configuration for Omnibus GitLab is stored in /etc/gitlab . To backup your configuration, just run sudo gitlab-ctl backup-etc (introduced in GitLab 12.3). It creates a tar archive in /etc/gitlab/config_backup/ . Directory and backup files will be readable only to root.

How is GitLab backed up?

GitLab provides Rake tasks for backing up and restoring GitLab instances. An application data backup creates an archive file that contains the database, all repositories and all attachments. You can only restore a backup to exactly the same version and type (CE/EE) of GitLab on which it was created.

What is GitLab omnibus?

Omnibus GitLab is a downloadable package that contains all the components needed to run, configure, and scale a self-managed instance of GitLab on prem or in the cloud.


1 Answers

This error message is produced by lib/backup/manager.rb#L87-L92:

  settings = YAML.load_file("backup_information.yml")
  ENV["VERSION"] = "#{settings[:db_version]}" if settings[:db_version].to_i > 0

  # restoring mismatching backups can lead to unexpected problems
  if settings[:gitlab_version] != Gitlab::VERSION
    puts "GitLab version mismatch:".red

It seems to force an incremental backup, as described in this comment:

I have faced the same issue when restoring the backup to a new server.

backup.rake checks GITLAB commit number at time of backup is taken and when you are restoring to the same branch name from latest check out.

I have to:

  • delete 5-2-stable and
  • check out again 5-2-stable with the same commit hash ( git checkout -b 5-2-stable COMMIT-HASH),
  • ran all tasks as installing a fresh 5-2-stable release with same config/gitlab.yml, config/database.yml.
  • Then I have copied backup.tar file into default /home/git/gitlab/tmp/backups and ran restore rake task.

It worked without any problem. Then I have followed 5-2-stable to 5-3-stable upgrade and it went all well.

like image 177
VonC Avatar answered Sep 23 '22 15:09

VonC