Im using gitlab ce 7.11.4 on a ubuntu 14.04 server with desktop on our VPN at the moment and would like to move it to another ubuntu 14.04 headless server on a subdomain, and add LDAP integration.
Linux and Ruby are very much not in my wheelhouse, so I’d like to be very prepared before I begin!
Are SSH details carried as well in a backup_restore?
** For the subdoman**
After the omnibus install on the new server, I just need to edit the URL settings in gitlab.rb right? Then run sudo gitlab-ctl reconfigure after?
So I started off by updating to 7.12.1 as I noted that was released (including moving from manual download the apt-get install) and began following the instructions at https://gitlab.com/gitlab-org/omnibus-gitlab/blob/7.12.1.omnibus/README.md, though I do see that while this document has a Backup section it does not have a Restore section.
I cleared the backup directory in /var/opt/gitlab/backups and ran the backup command sudo gitlab-rake gitlab:backup:create
I attempted to backup my configuration from /etc/gitlab as well, using the recommended command sudo sh -c 'umask 0077; tar -cf $(date "+etc-gitlab-%s.tar") -C / etc/gitlab' but this failed on two fronts. The first being that date returned invalid date probably due to me being on GMT + summer time. The second more annoying one, being that the command attempted to back up my entire / directory into a file called -C … not a great result as my machine then completely ran out of space!!
After some messing about I just cd'd to /etc switched to sudo shell (sudo sh) and used tar -cf etc-gitlab.tar ./gitlab
At this point the next thing to backup is my SSH keys I think. Is there any point in doing this if the install is moving to another domain? If there is, do I just wholesale copy and replace the entire /etc/ssh directory? (n00b at SSH details as well!). I have read the SE answer linked to in the documentation, but this only provides minimal information :\
I continued ahead, copied the tar archives of /etc/gitlab/, /etc/ssh/ and the backup from sudo gitlab-rake gitlab:backup:restore to the new server on which I had a fresh install of 7.12.1 using the apt-get method (after sorting out some DNS crapola!)
I ran sudo gitlab-ctl reconfigure first. Then extracted the /etc/gitlab/ backup and found that the newer version of gitlab.rb has a whole load more stuff in it, my older one only had the external_url so I just copied over that value (the URL and IP are staying the same). I wasn’t sure about gitlab-secrets.json, so I left it as it was without overwriting it.
Ran sudo gitlab-ctl reconfigure again. Then copied the sudo gitlab-rake gitlab:backup:restore backup to the /var/opt/gitlab/backups directory and ran sudo gitlab-rake gitlab:backup:restore. There was a heart stopping moment where I saw it start printing out WARNINGs and REVOKE errors, but I let it run and seems appeared OK.
Ran sudo gitlab-ctl reconfigure again. tried a login on the web interface to find login (with my old login deets) works fine. Yay!
Finally I extracted the /etc/ssh/ backup and copied all the ssh_host_* files from the backup to the new /etc/ssh/ directory, overwriting the files in there. It was important to check the permissions and ownership on these files where still as they had been on the old install. After this I ran sudo gitlab-ctl reconfigure again one final time, just to be sure.
Then I tried a few git remote operations from my local command line, et voila! A working perfectly GitLab install
The next planned move is to another server with external subdomain and adding LDAP… Hope that goes as easy!