2017-11-01 15:56:40 +00:00
---
comments: false
---
2015-09-22 19:56:51 +00:00
# GitLab Upgrader (deprecated)
2015-05-13 10:08:04 +00:00
*DEPRECATED* We recommend to [switch to the Omnibus package and repository server ](https://about.gitlab.com/update/ ) instead of using this script.
2015-05-13 12:16:05 +00:00
Although deprecated, if someone wants to make this script into a gem or otherwise improve it merge requests are welcome.
2015-05-13 10:08:04 +00:00
2016-03-09 07:26:39 +00:00
*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.*
2013-12-23 12:15:22 +00:00
2014-01-27 12:51:01 +00:00
GitLab Upgrader - a ruby script that allows you easily upgrade GitLab to latest minor version.
2014-04-24 22:48:22 +00:00
2014-01-27 12:51:01 +00:00
For example it can update your application from 6.4 to latest GitLab 6 version (like 6.6.1).
2014-04-24 22:48:22 +00:00
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.
2014-01-27 12:51:01 +00:00
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.
2013-12-23 12:15:22 +00:00
2014-04-24 22:48:22 +00:00
**GitLab Upgrader is available only for GitLab version 6.4.2 or higher.**
2013-12-23 14:41:06 +00:00
2014-11-29 10:01:32 +00:00
**This script does NOT update gitlab-shell, it needs manual update. See step 5 below.**
2014-04-24 22:48:22 +00:00
## 0. Backup
2013-12-23 12:15:22 +00:00
cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
2014-04-24 22:48:22 +00:00
## 1. Stop server
2013-12-23 12:15:22 +00:00
sudo service gitlab stop
2014-04-24 22:48:22 +00:00
## 2. Run GitLab upgrade tool
2013-12-23 12:15:22 +00:00
2015-05-13 10:08:04 +00:00
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 )
2014-08-22 14:33:36 +00:00
2013-12-23 12:15:22 +00:00
cd /home/git/gitlab
2015-05-13 10:08:04 +00:00
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'
2013-12-23 12:15:22 +00:00
2014-01-23 10:44:53 +00:00
# to perform a non-interactive install (no user input required) you can add -y
2015-05-13 10:08:04 +00:00
# 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
2013-12-23 12:15:22 +00:00
2014-04-24 22:48:22 +00:00
## 3. Start application
2013-12-23 12:15:22 +00:00
sudo service gitlab start
sudo service nginx restart
2014-02-14 04:50:02 +00:00
2014-04-24 22:48:22 +00:00
## 4. Check application status
2014-02-14 04:50:02 +00:00
2014-05-28 07:28:39 +00:00
Check if GitLab and its dependencies are configured correctly:
2014-02-14 04:50:02 +00:00
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
2014-05-27 12:25:34 +00:00
2014-02-14 04:50:02 +00:00
If all items are green, then congratulations upgrade is complete!
2014-04-04 08:19:40 +00:00
2014-11-02 23:13:30 +00:00
## 5. Upgrade GitLab Shell
2014-04-24 22:48:22 +00:00
2014-11-02 23:13:30 +00:00
GitLab Shell might be outdated, running the commands below ensures you're using a compatible version:
2014-05-27 12:25:34 +00:00
```
cd /home/git/gitlab-shell
sudo -u git -H git fetch
2014-11-02 23:13:30 +00:00
sudo -u git -H git checkout v`cat /home/git/gitlab/GITLAB_SHELL_VERSION`
2017-05-02 15:44:40 +00:00
sudo -u git -H sh -c 'if [ -x bin/compile ] ; then bin/compile ; fi'
2014-05-27 12:25:34 +00:00
```
2014-04-04 08:19:40 +00:00
2014-04-24 22:48:22 +00:00
## One line upgrade command
2014-04-04 08:19:40 +00:00
2014-05-28 07:28:39 +00:00
You've read through the entire guide and probably already did all the steps one by one.
2014-04-24 22:48:22 +00:00
2015-05-13 10:08:04 +00:00
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 ).
2014-04-04 08:19:40 +00:00
2014-04-22 04:22:55 +00:00
```bash
2014-11-02 23:13:30 +00:00
cd /home/git/gitlab; \
sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production; \
2014-06-02 07:48:55 +00:00
sudo service gitlab stop; \
2015-05-13 10:08:04 +00:00
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; \
2014-11-02 23:13:30 +00:00
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`; \
2017-05-02 15:44:40 +00:00
sudo -u git -H sh -c 'if [ -x bin/compile ] ; then bin/compile ; fi'; \
2014-11-02 23:13:30 +00:00
cd /home/git/gitlab; \
2014-06-02 07:48:55 +00:00
sudo service gitlab start; \
2015-04-22 19:09:40 +00:00
sudo service nginx restart; \
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
2015-05-07 12:24:18 +00:00
```