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
    [root@localhost ~] 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
    [root@localhost ~] su - sa_gitlab
    [sa_gitlab@localhost~] cd gitlab

     

  3. Update Gitlab source from 5.0 to 5.1
    [sa_gitlab@localhost~] git fetch
    [sa_gitlab@localhost~] git checkout 5-1-stable

     

  4. Configure Puma which is replacing Unicorn
    [sa_gitlab@localhost~] cp config/puma.rb.example config/puma.rb
    [sa_gitlab@localhost~] 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.
    [sa_gitlab@localhost~] gem install sanitize -v '2.0.3'
    [sa_gitlab@localhost~] gem install jquery-rails -v '2.1.3'
    
    # These commands you DO need to run
    [sa_gitlab@localhost~] bundle install --without development test postgres --deployment
    [sa_gitlab@localhost~] bundle exec rake db:migrate RAILS_ENV=production
    [sa_gitlab@localhost~] 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
    [sa_gitlab@localhost~] exit
    
    [root@localhost ~] mv /etc/init.d/gitlab /etc/init.d/gitlab.50
    [root@localhost ~] curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/5-1-stable/init.d/gitlab
    [root@localhost ~] 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 --------
    
    [root@localhost ~] chmod +x /etc/init.d/gitlab

     

  7. Start up Gitlab and then restart Apache if your using mod_proxy
    [root@localhost ~] service gitlab start
    [root@localhost ~] service httpd restart

     

  8. Update Gitlab Shell
    [root@localhost ~] su - sa_gitlab
    [sa_gitlab@localhost~] cd gitlab-shell
    [sa_gitlab@localhost~] git pull
    [sa_gitlab@localhost~] bin/install
    [sa_gitlab@localhost~] 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.

    Reply
    • 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 :)

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

    Reply

Leave a comment

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