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:
- backup/restore mysql data (tools: mysqldump / mysql < backup.sql.txt)
- copy all gitlab www to new machine (scp, rsync)
- 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