Update your GitLab instance to 7.1+ (which requires Ruby 2.*) on a Debian 7 (Wheezy) server
Content on this page is probably outdated and represents my personal knowledge, feelings and understading of things at that time .
So, you installed your GitLab instance as I
described in my previous blog post
but now you can’t update to GitLab 7.1 because it officially requires “latest
stable Ruby” which is not packaged for Debian Wheezy.
Warning: Using this method you will not be able to copy and paste the commands from the Upgrade docs anymore, but it’s still preatty straightforward if you know basics of Linux systems.
First we need to update RubyLet's execute some (untrusted) script directly from web! What could go wrong?
I can't tell you how bad this is, but it looks like the whole Ruby community is rolling with it, so it can't be that bad, right? right?!. I suggest you download and check the script before you execute it...
root # cd /home/git root # su git git # \curl -sSL https://get.rvm.io -o rvm-installer git # cat rvm-installer git # bash < ./rvm-install git # source /home/git/.rvm/scripts/rvm git # rvm autolibs disable
This installs the latest stable RVM version. Now we’ll install the latest ruby
git # rvm list known
lists all the available ruby versions, look for the latest stable release (in
our case that’s ruby-2.1.2). Let’s install it:
git # rvm install 2.1.2
git # rvm use 2.1.2
Now you have to check if some Ruby requirements are not met with:
git # rvm requirements
If some are not met (there were none on my setup), install them with apt-get after getting out of git user:
git # exit
root # apt-get install …
root # su git
Looks like Debian and RVM need a fix to play nicely together, namely add:
[[ -s “$HOME/.rvm/scripts/rvm” ]] && . “$HOME/.rvm/scripts/rvm"
to the end off (/home/git/.bashrc), exit and su back and now everything should
be ok. You can check with:
git # ruby –version
That’s it, now off to actual GitLab stuff.
Make your current GitLab instance happy with new RubyWe'll need to install the libs again for this ruby version (ofcourse beware of the postgres/mysql difference):
root # service gitlab stop root # su git git # cd /home/git/gitlab git # bundle install --without development test postgres --deploymentNow you can start GitLab and check the ruby version in /admin
git # exit root # service gitlab startIf everything went as planned, GitLab reports the installed Ruby version correctly. There's one unfortune consequence of using RVM as single user install. Namely sudo by default doesen't source .bashrc and therefore the standard commands in GitLab upgrade docs fail. One solution is to simply su to git user and just execute commands there (the ones previously executed with sudo).
Upgrade GitLabFoolowing the docs at https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/update/6.9-to-7.0.md.
root # su git git # cd /home/git/gitlab git # git stash git # git checkout 7-0-stable git # cd /home/git/gitlab-shell git # git fetch git # git checkout v1.9.6 git # cd /home/git/gitlab git # bundle install --without development test postgres --deployment git # bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production git # git diff origin/6-9-stable:config/gitlab.yml.example origin/7-0-stable:config/gitlab.yml.example git # exit root # cp /home/git/gitlab/lib/support/init.d/gitlab /etc/init.d/gitlab root # chmod +x /etc/init.d/gitlab root # service gitlab start root # service nginx restartFor further upgrades I used the GitLab Upgrader. That I run manually when logged in as git user.
root # su git git # cd /home/git/gitlab git # ruby bin/upgrade.rb
That's it!So that's a quick and dirty writeup of what I did (at 3 in the morning :/) to get my Debian GitLab instance up to date.
A lot more in depth documentation is available: