Terry : Upgrade GitLab From 5.0 To 5.1

GitLab 5.1

Major changes

  • unicorn replaced with puma (reduce memory consumption)
  • Notification settings
  • Backup functionality was refactored (now it backups attachments, write hooks in restored projects and updated ssh permissions on restore)
  • Login with username
  • File history now tracks renames
  • Admin has access to all projects now

Improved

  • Dashboard performance
  • Merge Request diff dump
  • Backup tools
  • Project transfer

Upgrade Steps

1. Stop GitLab Server

sudo service gitlab stop

2. Get latest code

su git
cd /home/git/gitlab
git pull
git checkout 5-1-stable 

3. Update gitlab-shell

su git
cd /home/git/gitlab-shell
git pull
git checkout v1.3.0

4. Install libs and do migration

cd /home/git/gitlab
sudo rm tmp/sockets/gitlab.socket
sudo -u git -H cp config/puma.rb.example config/puma.rb
 
su git
bundle install --without development test postgres --deployment
bundle exec rake db:migrate RAILS_ENV=production
bundle exec rake migrate_merge_requests RAILS_ENV=production

5. Update init.d script

# backup the old one
cp /etc/init.d/gitlab{,.5-0-stable}
 
sudo rm /etc/init.d/gitlab
sudo wget --no-check-certificate -O gitlab https://raw.github.com/gitlabhq/gitlab-recipes/5-1-stable/init.d/gitlab
sudo chmod +x /etc/init.d/gitlab

6. MySQL

Grant privileges

mysql -u root -p
mysql> GRANT LOCK TABLES ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
mysql> \q

7. Start GitLab 5.1  

sudo service gitlab start

Reference

https://github.com/gitlabhq/gitlabhq/blob/master/doc/update/5.0-to-5.1.md