Skip to content

From 3.1 to 4.0

randx edited this page Dec 23, 2012 · 11 revisions

Important changes

  • Support for SQLite was dropped
  • Projects are organized in namespaces
  • The GitLab post-receive hook needs to be updated
  • The configuration file needs to be updated
  • Availability of python2 executable

Most of projects has post-receive file as symlink to gitolite /home/git/.gitolite/hooks/post-receive. But some of them may have a real file. In this case you should rewrite it with symlink to gitolite hook.

I wrote a bash script which will do it automatically for you. Just make sure all path inside is valid for you


1. Stop GitLab & Resque

sudo service gitlab stop

2. Update GitLab

# Get latest code
sudo -u gitlab -H git fetch
sudo -u gitlab -H git checkout v4.0.0rc2

# Install gems for MySQL
sudo -u gitlab -H bundle install --without development test postgres

# Update repos permissions
sudo chmod -R ug+rwXs /home/git/repositories/
sudo chown -R git:git /home/git/repositories/

# Migrate db
sudo -u gitlab -H bundle exec rake db:migrate RAILS_ENV=production

# Enable namespaces (**Warning!** All projects in groups will be moved to subdirectories)
sudo -u gitlab -H bundle exec rake gitlab:enable_namespaces RAILS_ENV=production

3. Update post-receive hooks

For Gitolite v3

Step 1: Rewrite post-receive hook

# Rewrite hook for Gitolite 3
sudo cp ./lib/hooks/post-receive /home/git/.gitolite/hooks/common/post-receive
sudo chown git:git /home/git/.gitolite/hooks/common/post-receive

Step 2: Update project hooks to be symlinks to the Gitolite hook

# 1. Check paths in script
sudo -u gitlab -H vim lib/support/rewrite-hooks.sh

# 2. Run script
sudo -u git -H lib/support/rewrite-hooks.sh

For Gitolite v2

Step 1: rewrite the post-receive hook

sudo cp ./lib/hooks/post-receive /home/git/share/gitolite/hooks/common/post-receive
sudo chown git:git /home/git/share/gitolite/hooks/common/post-receive

Step 2: Replace symlinks in project to valid place

#!/bin/bash
src="/home/git/repositories"
for dir in `ls "$src/"`
do
  if [ -d "$src/$dir" ]; then

  if [ "$dir" = "gitolite-admin.git" ]
  then
    continue 
  fi
    
   project_hook="$src/$dir/hooks/post-receive"
   gitolite_hook="/home/git/share/gitolite/hooks/common/post-receive"
    
   ln -s -f $gitolite_hook $project_hook
  fi
done

4. Check GitLab's status

sudo -u gitlab -H bundle exec rake gitlab:check RAILS_ENV=production

5. Start GitLab & Resque

sudo service gitlab start
Clone this wiki locally