BigW Consortium Gitlab

upgrader.md 3.68 KB
Newer Older
1
# GitLab Upgrader (deprecated)
2 3 4

*DEPRECATED* We recommend to [switch to the Omnibus package and repository server](https://about.gitlab.com/update/) instead of using this script.

5
Although deprecated, if someone wants to make this script into a gem or otherwise improve it merge requests are welcome.
6

7
*Make sure you view this [upgrade guide from the 'master' branch](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/update/upgrader.md) for the most up to date instructions.*
8

dosire committed
9
GitLab Upgrader - a ruby script that allows you easily upgrade GitLab to latest minor version.
10

dosire committed
11
For example it can update your application from 6.4 to latest GitLab 6 version (like 6.6.1).
12 13 14

You still need to create a backup and manually restart GitLab after running the script but all other operations are done by this upgrade script.

dosire committed
15
If you have local changes to your GitLab repository the script will stash them and you need to use `git stash pop` after running the script.
16

17
**GitLab Upgrader is available only for GitLab version 6.4.2 or higher.**
18

19 20
**This script does NOT update gitlab-shell, it needs manual update. See step 5 below.**

21
## 0. Backup
22 23 24 25

    cd /home/git/gitlab
    sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production

26
## 1. Stop server
27 28 29

    sudo service gitlab stop

30
## 2. Run GitLab upgrade tool
31

32 33 34
Please replace X.X.X with the [latest GitLab release](https://packages.gitlab.com/gitlab/gitlab-ce).

GitLab 7.9 adds `nodejs` as a dependency. GitLab 7.6 adds `libkrb5-dev` as a dependency (installed by default on Ubuntu and OSX). GitLab 7.2 adds `pkg-config` and `cmake` as dependency. Please check the dependencies in the [installation guide.](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md#1-packages-dependencies)
35

36
    cd /home/git/gitlab
37
    sudo -u git -H ruby -Ilib -e 'require "gitlab/upgrader"' -e 'class Gitlab::Upgrader' -e 'def latest_version_raw' -e '"vX.X.X"' -e 'end' -e 'end' -e 'Gitlab::Upgrader.new.execute'
38

39
    # to perform a non-interactive install (no user input required) you can add -y
40
    # sudo -u git -H ruby -Ilib -e 'require "gitlab/upgrader"' -e 'class Gitlab::Upgrader' -e 'def latest_version_raw' -e '"vX.X.X"' -e 'end' -e 'end' -e 'Gitlab::Upgrader.new.execute' -- -y
41

42
## 3. Start application
43 44 45

    sudo service gitlab start
    sudo service nginx restart
46

47
## 4. Check application status
48

49
Check if GitLab and its dependencies are configured correctly:
50 51

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

53
If all items are green, then congratulations upgrade is complete!
54

55
## 5. Upgrade GitLab Shell
56

57
GitLab Shell might be outdated, running the commands below ensures you're using a compatible version:
58 59 60 61

```
cd /home/git/gitlab-shell
sudo -u git -H git fetch
62
sudo -u git -H git checkout v`cat /home/git/gitlab/GITLAB_SHELL_VERSION`
63
```
64

65
## One line upgrade command
66

67
You've read through the entire guide and probably already did all the steps one by one.
68

69 70 71
Below is a one line command with step 1 to 5 for the next time you upgrade.

Please replace X.X.X with the [latest GitLab release](https://packages.gitlab.com/gitlab/gitlab-ce).
72

73
```bash
74 75
cd /home/git/gitlab; \
  sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production; \
Marin Jankovski committed
76
  sudo service gitlab stop; \
77
  sudo -u git -H ruby -Ilib -e 'require "gitlab/upgrader"' -e 'class Gitlab::Upgrader' -e 'def latest_version_raw' -e '"vX.X.X"' -e 'end' -e 'end' -e 'Gitlab::Upgrader.new.execute' -- -y; \
78 79 80 81
  cd /home/git/gitlab-shell; \
  sudo -u git -H git fetch; \
  sudo -u git -H git checkout v`cat /home/git/gitlab/GITLAB_SHELL_VERSION`; \
  cd /home/git/gitlab; \
Marin Jankovski committed
82
  sudo service gitlab start; \
83 84
  sudo service nginx restart; \
  sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
85
```