Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Now, I have gitlab and gitolite running on my ubuntu server. However, this server is too slow and my company wish to move the server to another machine. Are there any way to move gitlab and gitolite server( the whole files, users and setting) to another machine?

Installing and creating all users and repositories again would be my last choice. Thank you in advance.

share|improve this question

migrated from stackoverflow.com Oct 16 '12 at 8:18

This question came from our site for professional and enthusiast programmers.

2 Answers 2

I am constantly doing this by hourly crontab job for faster local deployment. (which creates an exact copy of the original server, serves as a read-only mirror, personally I call it a puppet machine).

All you need to do is:

  1. backup/restore mysql data (tools: mysqldump / mysql < backup.sql.txt)
  2. copy all gitlab www to new machine (scp, rsync)
  3. copy all gitolite dir to new machine (rsync)

You can always run the following command to test if the puppet is running successful.

bundle exec rake gitlab:app:status RAILS_ENV=production

Some detailed procedure:

I have mime setup done by using ubuntu 12.04 gitolite apt-get install, rest by official guide and I have also made myself some notes:

SSH private/public keys are needed for automated (passwordless) rsync/scp process, if you don't understand plz read http://troy.jdmz.net/rsync/index.html

All you need to setup is some cron jobs after original machine is working: this is online mirror too. (you don't need to restart any webserver/machine)

crontab on mirror machine:

58 * * * * rsync -zav root@my_remote_server.com:/home/git /home
11 * * * * rsync -zav root@my_remote_server.com:/root/mysql_hourly_dump.txt /root
15 * * * * mysql -u root -p"secure password" gitlabhq_production < mysql_hourly_dump.txt
20 * * * * rsync -zav --delete my_remote_server.com:/www/ /www

crontab on server:

7 * * * * mysqldump -p"secure password" gitlabhq_production -u root > /root/mysql_hourly_dump.txt
share|improve this answer
    
Can you tell me how to do it somehow? I am new to gitlab and gitolite server. Database I am using is sqlite, how can I move that database to another machine? Right now I am access gitlab via Hostname:3000 which is for local uses only so I really have no idea how to do this. –  Sam Mie Oct 16 '12 at 8:45
    
I forgot to say, thank you. –  Sam Mie Oct 16 '12 at 8:48
    
ok i put up some extra info. plz vote up and mark correct answer if you feel helpful. –  c2h2 Oct 16 '12 at 9:05
    
Let me try that, Thank you :) –  Sam Mie Oct 16 '12 at 9:10
    
if you use SQLite, this should be even easier. skip the mysql part and rsync the SQLite db file. –  c2h2 Oct 16 '12 at 9:11

Moving gitolite seems easy:

  • you need to make sure the public keys it references are still in the ~/.ssh/authorized_keys of the new home (so you mainly need to copy that file over)
  • And you need to move the repositories, .gitolite and .gitolite.rc files (check the paths in that last one)

The "users" are only declared in the gitolite file and the gitlab database.

GitLab should be reinstalled (because of all the gems it is using, which could be using on fixed path based on the first installation) and its database updated/replaced with the one from the Ubuntu server (either through a file copy, or through an sql export/import).

share|improve this answer
    
I tried to copy and place repositories and gitlab database. But when I want to start the server it's not working. Git repositories aren't imported to gitlab anyway. I don't know where I have to change the config files. Thank you anyway. –  Sam Mie Oct 16 '12 at 8:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.