Support #459
Updated by Daniel Curtis about 10 years ago
h2. Migrate Database In this case, I’m using MySQL. Use mysqldump to create dump of old database, then create a new database on the new server and import this: # On old: <pre> mysqldump gitlab | gzip > gitlab.sql.gz </pre> # On new: <pre> gunzip < gitlab.sql.gz | mysql gitlab </pre> # Run the db migrate command to make sure the schema is updated to the latest version. <pre> sudo -u gitlab -H bundle exec rake db:migrate RAILS_ENV=production </pre> h2. Migrate Repositories * Rather than creating a new SSH key on the new server, copy over the old SSH key pair to the new server. Also copy of the authorized_keys file. * Set up gitolite on the new server using the old SSH key * Copy contents of @/home/git/.gitolite/keydir/@ from old to new server so that users don’t have to add their SSH keys again and change ownership to git:git. * Copy repositories from old to new <pre> sudo chmod -R ug+rwXs,o-rwx /home/git/repositories/ sudo chown -R git:git /home/git/repositories/ sudo -u gitlab -H bundle exec rake gitlab:gitolite:update_keys RAILS_ENV=production sudo -u gitlab -H bundle exec rake gitlab:gitolite:update_repos RAILS_ENV=production </pre> * Update projects to use namespaces. This will move any projects that are in groups to a namespace. bundle exec rake gitlab:enable_namespaces RAILS_ENV=production * I could not get this working, easier to remove all projects from groups on the old install before migrating. * Run the @rake:check@ command and see if it complains about anything. You may need to run the create satellites command or the run the script to update the hooks. <pre> bundle exec rake gitlab:check RAILS_ENV=production sudo -u git -H /home/gitlab/lib/support/rewrite-hooks.sh </pre> h2. Troubleshooting * If you get <pre> > FATAL: split conf set, gl-conf not present for ‘gitolite-admin’ > fatal: The remote end hung up unexpectedly </pre> #* Then you need to re-run the gitolite setup. This I think is because gitolite-admin is still in version 2 format. * # If you get <pre> > Error “cannot load such file — rb-inotify” </pre> #* Add gem “ib-notify” to the bottom of the gemfile and run bundle install again. * # If you get <pre> > Error about invalid SSH keys </pre> #* Keep deleting the offending keys until the errors go away. h2. Resources * http://lboynton.com/2013/01/29/how-to-migrate-gitlab-repositories-to-a-new-server/