How to upgrade Gitlab 5.4 to 6.0 on CentOS 6 or RHEL6

Last modified: [last-modified]

The upgrade instructions found on Gitlab’s official website are what I followed to upgrade my installation of Gitlab.

The only alterations I’ve made are to match my unique configuration from earlier articles on this website.

If you haven’t already upgrade your Gitlab to 5.4 before proceeding with these instructions. I never wrote a 5.2 -> 5.3 or a 5.3 -> 5.4 upgrade guide. The procedure was fairly straight forward and I just followed the official documents offered by Gitlab and referred to my earlier upgrade posts for 5.0 -> 5.1 and 5.1 -> 5.2.

1. Backup all of your Gitlab Data first. I ran these commands but ended up with an error. I run other separate backups so I wasn’t concerned. You may have better luck.

[[email protected] ~]# su - sa_gitlab
[[email protected] ~]$ cd ~/gitlab
[[email protected] gitlab]$ RAILS_ENV=production bundle exec rake gitlab:backup:create

 

2. Switch back to root and install a missing dependency and shutdown Gitlab and then switch back to sa_gitlab

[[email protected] gitlab]$ exit

[[email protected] ~]# yum install python-docutils

[[email protected] ~]# service gitlab stop
# Wait 1-2 minutes for everything to shut down

[[email protected] ~]# su - sa_gitlab

 

3. Download the latest code

[[email protected] ~]$ cd ~/gitlab
[[email protected] gitlab]$ git fetch
[[email protected] gitlab]$ git stash
[[email protected] gitlab]$ git checkout 6-0-stable

 

4. Update Gitlab Shell

[[email protected] gitlab]$ cd ~/gitlab-shell/
[[email protected] gitlab-shell]$ git fetch
[[email protected] gitlab-shell]$ git checkout v1.7.0

 

5. Update Gitlab

[[email protected] ~]$ cd ~/gitlab
[[email protected] gitlab]$ bundle install --without development test postgres --deployment
[[email protected] gitlab]$ bundle exec rake db:migrate RAILS_ENV=production
[[email protected] gitlab]$ bundle exec rake migrate_groups RAILS_ENV=production
# When prompted choose 'Yes'

[[email protected] gitlab]$ bundle exec rake migrate_global_projects RAILS_ENV=production
[[email protected] gitlab]$ bundle exec rake migrate_keys RAILS_ENV=production
# When prompted choose 'Yes'

[[email protected] gitlab]$ bundle exec rake migrate_inline_notes RAILS_ENV=production
[[email protected] gitlab]$ bundle exec rake assets:precompile RAILS_ENV=production

 

6. Backup your old configuration files

[[email protected] gitlab]$ cd config
[[email protected] config]$ mv gitlab.yml gitlab.yml.54
[[email protected] config]$ mv unicorn.rb unicorn.rb.54

 

7. Create new configuration files

[[email protected] config]$ cp gitlab.yml.example gitlab.yml
[[email protected] config]$ cp unicorn.rb.example unicorn.rb

# Now move all of your settings from the .54 backups we just made into the new files
# There are a lot of new lines in the unicorn.rb that need to be changed from '/home/git' to '/data/apps/sa_gitlab'
# There is no longer a need to comment out the socket line in unicorn.rb

 

8. Update the init script

[[email protected] config]$ exit

[[email protected] ~]# cd /etc/init.d/
[[email protected] init.d]# mv gitlab gitlab.54
[[email protected] init.d]# curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlabhq/master/lib/support/init.d/gitlab
[[email protected] init.d]# chmod +x /etc/init.d/gitlab
[[email protected] init.d]# vim gitlab

# -------- Make the following edits --------

APP_ROOT="/data/apps/sa_gitlab/gitlab"
APP_USER="sa_gitlab"

# -------- Save and close the file --------

 

9. Start-up Gitlab 6!

[[email protected] init.d]# service gitlab start

# The start-up took a few minutes on my system

 

That’s it!

6 thoughts on “How to upgrade Gitlab 5.4 to 6.0 on CentOS 6 or RHEL6

  1. getting weird error when starting?

    Starting the GitLab Unicorn web server…

     

    /etc/init.d/gitlab: line 131: script/web: No such file or directory

     

    Starting the GitLab Sidekiq event dispatcher…

     

    /etc/init.d/gitlab: line 139: script/background_jobs: No such file or directory

     

    GitLab is not running.

     

    line 131   RAILS_ENV=$RAILS_ENV script/web start

    fi

    line 139:   RAILS_ENV=$RAILS_ENV script/background_jobs start

    • I’m guessing you might have goofed up the app_root in the /etc/init.d/gitlab script. Check out line 23: app_root=”/data/apps/sa_gitlab/gitlab”

  2. I have followed the instructions above to upgrade to 6.0 and everything went smooth. Yet when I try to access gitlab on http it gives me error 503 as per below:
    Service Temporarily Unavailable
    The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

    Apache/2.2.15 (CentOS) Server at gitlab.gzero.local Port 80 I have run the bundle exec rake gitlab:check RAILS_ENV=production and it all checks fine apart from the init script that I believe is an issue since the above script compares it against debian version and I am on CentOS. I thought I will upgrade to 6.1 just in case but teh issue remains teh same. Any thoughts would be appreciated. Thanks

    • Check your error log. Chances are it will tell you what’s wrong. I’m guessing Unicorn isn’t starting properly. I just ran into a similar problem going to the latest version of Gitlab.

      Error log is: /data/apps/sa_gitlab/gitlab/log/unicorn.stderr.log

  3. I had to revert to the previous snapshot to have gitlab running so i had no chance lookin gon the unicorn.stderr.log. However on another attempt what seems to have sorted it out is upgrading to ruby 2.0.0-p247

    Thanks for your help

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.