Terry : Upgrade GitLab From 5.2 To 5.3

GitLab 5.3

3 Most Important Improvements
  1. Repository Graph
  2. HipChat/Campfire Services integration with your projects
  3. Code Snippets now available for personal use. Create own snippets. Share public snippets with your colleagues
Changes

New Features

  • Repository Graph
  • HipChat/Campfire services integration
  • Advanced snippets: public/private, project/personal
  • Rename repository

Security

  • Generate the Rails secret token on first run

Fixed

  • Fixed bug with LDAP + git over http
  • Fixed bug with google analytics code being ignored
  • Respect newlines in wall messages
  • Fix project events duplicate on project page
  • Fix postgres error when displaying network graph.
  • Fix dashboard event filter when navigate via turbolinks
  • Fix dashboard lost if comment on commit
  • Fix bug with team assignation on project from #4109
  • Init.d: remove gitlab.socket on service start
  • Fixes issue with —depth option

API

  • Api: Prevent blob content being escaped
  • Api: added teams api
  • Api: Smart deploy key add behaviour
  • Api: projets/owned.json return user owned project

Upgrade Steps

0. Backup

Backup saves lives.

NOTE: With MySQL, this may require granting "LOCK TABLES" privileges to the GitLab user on the database version.

cd /home/git/gitlab
sudo -u git -H RAILS_ENV=production bundle exec rake gitlab:backup:create

1. Stop the server

sudo service gitlab stop

2. Get the latest code

su git
cd /home/git/gitlab
# git fetch
git pull
git checkout 5-3-stable

3. Install libraries, migration, etc.

cd /home/git/gitlab

# MySQL
bundle install --without development test postgres --deployment
# PostgreSQL
bundle install --without development test mysql --deployment

# Migration
bundle exec rake db:migrate RAILS_ENV=production

bundle exec rake assets:precompile RAILS_ENV=production

4. Update config files

5. Update init script

# Backup the old init script
sudo cp /etc/init.d/gitlab{,.old}
sudo rm /etc/init.d/gitlab
# Download the new init script
sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlabhq/5-3-stable/lib/support/init.d/gitlab
# OR
# cd /etc/init.d && sudo wget --no-check-certificate -O gitlab https://raw.github.com/gitlabhq/gitlabhq/5-3-stable/lib/support/init.d/gitlab
sudo chmod +x /etc/init.d/gitlab

6. Update nginx config file - OPTIONAL

# backup old config file
cp /etc/nginx/sites-available/gitlab{,.5-2}
rm -f /etc/nginx/sites-available/gitlab
# download the latest config file
sudo wget --no-check-certificate -O /etc/nginx/sites-available https://raw.github.com/gitlabhq/gitlabhq/5-3-stable/lib/support/nginx/gitlab
sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab

7. Start the application

sudo service gitlab start
sudo service nginx restart

8. Check application status

Check if GitLab and its environment are configured correctly

su git
cd /home/git/gitlab && bundle exec rake gitlab:env:info RAILS_ENV=production

To make sure nothing is missed, run a more thorough check with

su git
cd /home/git/gitlab && bundle exec rake gitlab:check RAILS_ENV=production

If all items are GREEN, then congratulations upgrade complete!

Revert to previous version - 5.2

If upgrade goes pear shaped, revert to previous version is easy.

1. Revert the code to the previous version

Follow the upgrade guide from 5.1 to 5.2, except for the database migration (The backup is already migrated to the previous version).

2. Restore from the backup

cd /home/git/gitlab
RAILS_ENV=production
bundle exec rake gitlab:backup:restore

Reference

ChangeLog

5.2 to 5.3 Upgrade Guide