How to upgrade Gitlab 5.0 to 5.1 on CentOS 6 or RHEL6

Last modified: [last-modified]

These are instructions on how to upgrade Gitlab 5.0 to 5.1 on CentOS 6.

This guide assumes you already followed my How to install Gitlab 5.0 on CentOS 6 or RHEL6 post.

  1. As the root user stop the Gitlab service
    [[email protected] ~] service gitlab stop
    # Wait a few moments before continuing. Shutting down Gitlab took 30sec-1min on my system.

     

  2. Switch to the ‘sa_gitlab’ user account and move into your gitlab directory
    [[email protected] ~] su - sa_gitlab
    [[email protected]~] cd gitlab

     

  3. Update Gitlab source from 5.0 to 5.1
    [[email protected]~] git fetch
    [[email protected]~] git checkout 5-1-stable

     

  4. Configure Puma which is replacing Unicorn
    [[email protected]~] cp config/puma.rb.example config/puma.rb
    [[email protected]~] vim config/puma.rb
    
    # -------- Make the following edits --------
    
      application_path = '/data/apps/sa_gitlab/gitlab'
      bind 'tcp://127.0.0.1:65527'
    
    # -------- Save and close the file --------

     

  5. Redeploy Gitlab (I think that’s what this does anyway)
    # You may not need to do this. I ran into some errors during my upgrade but my ISP was having problems at the time. It won't hurt to run these commands either way.
    [[email protected]~] gem install sanitize -v '2.0.3'
    [[email protected]~] gem install jquery-rails -v '2.1.3'
    
    # These commands you DO need to run
    [[email protected]~] bundle install --without development test postgres --deployment
    [[email protected]~] bundle exec rake db:migrate RAILS_ENV=production
    [[email protected]~] bundle exec rake migrate_merge_requests RAILS_ENV=production
    # When prompted choose 'Yes'

     

  6. Switch back to root and update the Gitlab start-up script
    [[email protected]~] exit
    
    [[email protected] ~] mv /etc/init.d/gitlab /etc/init.d/gitlab.50
    [[email protected] ~] curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/5-1-stable/init.d/gitlab
    [[email protected] ~] vim /etc/init.d/gitlab
    
    # -------- Make the following edits --------
    # The lines with a + are lines you need to add to the script
    
      APP_ROOT="/data/apps/sa_gitlab/gitlab"
    + APP_USER="sa_gitlab"
    
    # Search/Replace "sudo -u git" with "sudo -u $APP_USER"
    
    # -------- Save and close the file --------
    
    [[email protected] ~] chmod +x /etc/init.d/gitlab

     

  7. Start up Gitlab and then restart Apache if your using mod_proxy
    [[email protected]ost ~] service gitlab start
    [[email protected] ~] service httpd restart

     

  8. Update Gitlab Shell
    [[email protected] ~] su - sa_gitlab
    [[email protected]~] cd gitlab-shell
    [[email protected]~] git pull
    [[email protected]~] bin/install
    [[email protected]~] bin/check

All done! Hopefully this went slightly more smoothly for you then it did me. I noticed the first time loading Gitlab after the upgrade as a bit slow but things were nice and quick after that.

Updated April 26th, 2013 – Added instructions for updating Gitlab shell.

Updated May 22nd, 2013 – Wrote an article on How to go from 5.1 to 5.2

7 thoughts on “How to upgrade Gitlab 5.0 to 5.1 on CentOS 6 or RHEL6

  1. 1. I used your 50 install instructions, worked great. So came back for the 51 upgrade. Wondering why you left out the gitlab-shell step 1.2.0 -> 1.3.0
    2. After the migration steps I could not login with admin, new or default values. But my initial gitlab install was last night, so I just reran the gitlab:setup to get the default admin account created. I’m sure there was a better way but it’s day #2 with git & gitlab so clumsy brute force was quick.
    3. Thanks for the nice write-up.

    • I didn’t realize there had been an update to Gitshell. I was following the instructions I found on the Gitlab site. I’ll have to update the article.

      Strange your admin account disappeared. I did not have this happen with mine.

      You’re welcome :)

  2. These are very good instructions. Was able to follow them to the T and upgrade to 5.1
    Thanks soooo very much!

Leave a Reply

Your email address will not be published. Required fields are marked *

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