BigW Consortium Gitlab

3.1-to-4.0.md 2.76 KB
Newer Older
1
# From 3.1 to 4.0
2
*Make sure you view this [upgrade guide from the `master` branch](../../../master/doc/update/3.1-to-4.0.md) for the most up to date instructions.*
3 4 5

## Important changes

6 7 8 9 10 11
- Support for SQLite was dropped
- Support for Gitolite 2 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
12

13
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.
14 15 16

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

17
## 1. Stop GitLab & Resque
18 19 20

    sudo service gitlab stop

21
## 2. Update GitLab
22 23 24 25 26 27 28

```bash

# Get latest code
sudo -u gitlab -H git fetch
sudo -u gitlab -H git checkout 4-0-stable

29 30 31 32 33
# 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

34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
# 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

```

49
## 3. Update post-receive hooks  (Requires Gitolite v3 )
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67

Step 1: Rewrite post-receive hook

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

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

68
## 4. Replace config with new one
69 70 71 72 73 74 75 76 77 78

    # backup old one
    sudo -u gitlab -H cp config/gitlab.yml config/gitlab.yml.old

    # copy new one
    sudo -u gitlab -H cp config/gitlab.yml.example config/gitlab.yml

    # edit it
    sudo -u gitlab -H vim config/gitlab.yml

79
## 5. Disable ssh known_host check for own domain
80 81 82 83 84 85 86 87 88

    echo "Host localhost
       StrictHostKeyChecking no
       UserKnownHostsFile=/dev/null" | sudo tee -a /etc/ssh/ssh_config

    echo "Host YOUR_DOMAIN_NAME
       StrictHostKeyChecking no
       UserKnownHostsFile=/dev/null" | sudo tee -a /etc/ssh/ssh_config

89
## 6. Check GitLab's status
90 91 92

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

93
## 7. Start GitLab & Resque
94 95

    sudo service gitlab start