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

Last modified: [last-modified]

This document assumes you’ve followed my previous post for deploying Gitlab on CentOS 6/RHEL6 and have already upgraded that deployment from 5.0 to 5.1.

If you haven’t already switched from the default version (1.7.1) of git that comes with CentOS 6 / RHEL6 to git 1.8.2.3 please follow this post first before continuing with these instructions. Even if you don’t care about that error message follow the instructions so you’re using git 1.8.2.3 instead of 1.7.1.

Now then. Lets get to it.

1. Stop gitlab and switch to sa_gitlab

[root@localhost ~] service gitlab stop
[root@localhost ~] ps aux |grep git
[root@localhost ~] su - sa_gitlab

 

2. Get the latest code for Gitlab and Gitlab-shell

[sa_gitlab@localhost ~] cd gitlab
[sa_gitlab@localhost gitlab] git fetch

# If you get an error about schema.rb run these two commands and then re-run 'git checkout 5-2-stable'. Otherwise skip these two commands (it won't hurt anything if you run them though)
[sa_gitlab@localhost gitlab] cp db/schema.rb db/schema.rb.current
[sa_gitlab@localhost gitlab] git stash

[sa_gitlab@localhost gitlab] git checkout 5-2-stable
[sa_gitlab@localhost gitlab] cd ..
[sa_gitlab@localhost ~] cd gitlab-shell/
[sa_gitlab@localhost gitlab-shell] git fetch
[sa_gitlab@localhost gitlab-shell] git checkout v1.4.0

 

3. Install libs, migrations, etc? (I stole this from the Gitlab guys)

[sa_gitlab@localhost gitlab-shell] cd ..
[sa_gitlab@localhost ~] cd gitlab
[sa_gitlab@localhost gitlab] bundle install --without development test postgres --deployment
[sa_gitlab@localhost gitlab] bundle exec rake db:migrate RAILS_ENV=production

 

4. Switch back to root and update the init script

[sa_gitlab@localhost gitlab] exit
[root@localhost ~] mv /etc/init.d/gitlab /etc/init.d/gitlab.51
[root@localhost ~] wget "https://raw.github.com/gitlabhq/gitlabhq/5-2-stable/lib/support/init.d/gitlab" -O /etc/init.d/gitlab
[root@localhost ~] vim /etc/init.d/gitlab

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

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

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

[root@localhost ~] chmod 755 /etc/init.d/gitlab

 

5. Start up Gitlab

[root@localhost ~] service gitlab start

 

You should be good to go at this point. The first load took a while for me after the update.

 

References

4 thoughts on “How to upgrade Gitlab 5.1 to 5.2 on CentOS 6 or RHEL6”

  1. Always something…
    This Gitlab is taking too much of my time.
    I decided to put my comment here, as I have already upgraded Gitlab to 5.2.

    So, recently I make the Gitlab webpage working under https, but broke down git commands to Gitlab repositories, e.g.:

    git fetch
    /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/http.rb:800:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate A: excessive message size (OpenSSL::SSL::SSLError)
    from /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/http.rb:800:in `block in connect'
    from /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/timeout.rb:55:in `timeout'
    from /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/timeout.rb:100:in `timeout'
    from /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/http.rb:800:in `connect'
    from /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/http.rb:756:in `do_start'
    from /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/http.rb:745:in `start'
    from /home/sa_gitlab/gitlab-shell/lib/gitlab_net.rb:56:in `get'
    from /home/sa_gitlab/gitlab-shell/lib/gitlab_net.rb:17:in `allowed?'
    from /home/sa_gitlab/gitlab-shell/lib/gitlab_shell.rb:51:in `validate_access'
    from /home/sa_gitlab/gitlab-shell/lib/gitlab_shell.rb:21:in `exec'
    from /home/sa_gitlab/gitlab-shell/bin/gitlab-shell:16:in `'
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.

    I’ve got self-signed cert, did a lot of things (one of them was updating openssl, second downgrading ruby from 2.0.0. to 1.9.3) but without success.
    I updated the cert.pem for rvm, as many people advised but nothing is changing…
    Any ideas?

    Reply
  2. Sometimes it’s just better to go sleep and try another day. ;)

    The error above was caused by a bad certificate put in Apache config.
    The error I had later was:

    /usr/local/rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/net/http.rb:800:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)

    It’s a typical error when using gitlab-shell with self-signed certificate.

    However, it has been solved by Gitlab team:

    https://github.com/gitlabhq/gitlabhq/issues/3292

    All I had to do was add in /home/sa_gitlab/gitlab-shell/config.yml two lines:

    http_settings:
    self_signed_cert: true

    All available options are shown in /home/sa_gitlab/gitlab-shell/config.yml.example

    I hope somebody will gain some time because of my mistakes. ;)

    Reply
  3. Hi,

    After upgradingto 5.2, having problems pushing anything to Gitlab. It worked before with no issue but after the upgrade, it no longer works.

    What could be the problem?

    TIA

    /TESTING> mkdir decrumple
    /TESTING> cd decrumple/
    TESTING/decrumple> git init
    Initialized empty Git repository in .git/
    TESTING/decrumple> touch README
    TESTING/decrumple> git add README
    TESTING/decrumple> git commit -m ‘first commit’
    Created initial commit 86e4811: first commit
    0 files changed, 0 insertions(+), 0 deletions(-)
    create mode 100644 README
    TESTING/decrumple> git remote add origin [email protected]:srvimg/decrumple.git
    TESTING/decrumple> git push -u origin master
    usage: git-push [–all] [–tags] [–receive-pack=] [–repo=all] [-f | –force] [-v] [ …]
    TESTING/decrumple> git push origin master
    fatal: ‘srvimg/decrumple.git’ does not appear to be a git repository
    fatal: The remote end hung up unexpectedly
    error: failed to push to ‘[email protected]:srvimg/decrumple.git’

    Reply

Leave a comment

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