Changes

1,808 bytes added ,  02:00, 24 February 2013
Line 186: Line 186:     
  touch /srv/gitorious/app/tmp/restart.txt
 
  touch /srv/gitorious/app/tmp/restart.txt
 +
 +
=== Hardware migration ===
 +
 +
'''Disable servers of both hosts.'''
 +
 +
mv /srv/gitorious/ssh/.ssh/authorized_keys{,.bak}
 +
 +
a2dissite git.sugarlabs.org
 +
a2dissite cgit.sugarlabs.org
 +
/etc/init.d/apache2 reload
 +
 +
/etc/init.d/gitorious-git stop
 +
/etc/init.d/gitorious-poller stop
 +
/etc/init.d/gitorious-sphinx stop
 +
/etc/init.d/gitorious-stomp stop
 +
 +
'''On old server.'''
 +
 +
* Dump MySQL database:
 +
 +
mysqldump -u root -h localhost -p gitorious | xz > dump.slq.xz
 +
 +
'''On new server.'''
 +
 +
* Create MySQL user and database for Gitorious:
 +
 +
GRANT ALL PRIVILEGES ON *.* TO 'gitorious'@'localhost' IDENTIFIED BY '<insert password>' WITH GRANT OPTION;
 +
FLUSH PRIVILEGES;
 +
CREATE DATABASE gitorious;
 +
 +
* Make preparations from root user:
 +
 +
useradd gitorious -d /srv/gitorious/ssh -m
 +
cat >> /srv/gitorious/ssh/.profile <<EOF
 +
export RAILS_ENV=production
 +
cd /srv/gitorious/app
 +
EOF
 +
xzcat dump.slq.xz | mysql -u root -p -D gitorious
 +
 +
* Make preparations from gitorious user:
 +
 +
su - gitorious
 +
 +
mkdir /srv/gitorious/repositories-mirror
 +
mkdir /srv/gitorious/repositories-mirror
 +
mkdir /srv/gitorious/tmp
 +
 +
git clone git://git.sugarlabs.org/sl-tweaks/gitorious.git /srv/gitorious/app
 +
 +
rsync --delete-after -PHAXhaxv $OLD_HOST_HERE:/srv/gitorious/repositories/ /srv/gitorious/repositories/
 +
rsync --delete-after -PHAXhaxv $OLD_HOST_HERE:/srv/gitorious/app/public/system/ /srv/gitorious/app/public/system/
 +
rsync --delete-after -PHAXhaxv $OLD_HOST_HERE:/srv/gitorious/ssh/.ssh/authorized_keys /srv/gitorious/ssh/.ssh/authorized_keys
 +
 +
cd /srv/gitorious/app
 +
rake db:migrate
 +
 +
* Start up Gitorious.
 +
 +
a2ensite git.sugarlabs.org
 +
a2ensite cgit.sugarlabs.org
 +
/etc/init.d/apache2 reload
 +
 +
/etc/init.d/gitorious-git start
 +
/etc/init.d/gitorious-poller start
 +
/etc/init.d/gitorious-sphinx start
 +
/etc/init.d/gitorious-stomp start
    
== Sources ==
 
== Sources ==