BigW Consortium Gitlab

3.0-to-3.1.md 2.65 KB
Newer Older
1
# From 3.0 to 3.1
2
*Make sure you view this [upgrade guide from the `master` branch](https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/update/3.0-to-3.1.md) for the most up to date instructions.*
3

4
**IMPORTANT!**
5

6
In this release **we moved Resque jobs under own gitlab namespace**
7

8
Despite a lot of advantages it requires from our users to **replace gitolite post-receive hook with new one**.
9

10
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.
11 12 13

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

14
## 1. Stop server & resque
15 16 17

    sudo service gitlab stop

18
## 2. Update GitLab
19 20 21 22 23 24 25 26 27

```bash
# Get latest code
sudo -u gitlab -H git fetch
sudo -u gitlab -H git checkout v3.1.0

# Install new charlock_holmes
sudo gem install charlock_holmes --version '0.6.9'

28 29 30 31 32
# The Modernizr gem was yanked from RubyGems. It is required for GitLab >= 2.8.0
# Edit `Gemfile` and change `gem "modernizr", "2.5.3"` to
# `gem "modernizr-rails", "2.7.1"``
sudo -u gitlab -H vim Gemfile

33 34 35 36 37 38 39 40 41
# Install gems for MySQL
sudo -u gitlab -H bundle install --without development test postgres sqlite


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

```

42
## 3. Update post-receive hooks
43

44
### Gitolite 3
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63

Step 1: Rewrite post-receive hook

```bash
# 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: Rewrite hooks in all projects to symlink gitolite hook

```bash
# 1. Check for valid path
sudo -u gitlab -H vim lib/support/rewrite-hooks.sh

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

64
### Gitolite v2
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92

Step 1: rewrite post-receive hook for gitolite 2

```
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

93
## 4. Check app status
94 95 96 97 98 99

```bash
# Check APP Status
sudo -u gitlab -H bundle exec rake gitlab:app:status RAILS_ENV=production
```

100
## 5. Start all
101 102

    sudo service gitlab start