1.编辑配置文件
进入/home/git/gitlab/conf目录并编辑gitlab.yml文件。
更改配置如下:
1 2 3 4
| backup: path: "tmp/backups" # Relative paths are relative to Rails.root (default: tmp/backups/) gitaly_backup_path: "/home/git/gitaly/gitaly-backup" # Path of the gitaly-backup binary (default: searches $PATH) ...
|
2.备份
1 2 3
| cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
|
3.停止GitLab服务
4.升级Git
1 2 3 4 5 6
| apt-get install -y libcurl4-openssl-dev libexpat1-dev gettext libz-dev libssl-dev libpcre2-dev build-essential
git clone https://gitlab.com/gitlab-org/gitaly.git -b <X-Y-stable> /tmp/gitaly
cd /tmp/gitaly make git GIT_PREFIX=/usr/local
|
5.获取最新代码
1 2 3 4 5 6 7
| cd /home/git/gitlab
sudo -u git -H git fetch --all --prune sudo -u git -H git checkout -- Gemfile.lock db/structure.sql locale
sudo -u git -H git checkout BRANCH
|
6.更新配置文件
1 2 3 4 5 6 7 8 9 10 11 12 13
| cd /home/git/gitlab
git diff origin/PREVIOUS_BRANCH:config/gitlab.yml.example origin/BRANCH:config/gitlab.yml.example
git diff origin/PREVIOUS_BRANCH:lib/support/nginx/gitlab-ssl origin/BRANCH:lib/support/nginx/gitlab-ssl
git diff origin/PREVIOUS_BRANCH:lib/support/nginx/gitlab origin/BRANCH:lib/support/nginx/gitlab
cp lib/support/init.d/gitlab /etc/init.d/gitlab
|
7.安装库、迁移数据等
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| cd /home/git/gitlab
sudo -u git -H bundle config set --local deployment 'true' sudo -u git -H bundle config set --local without 'development test mysql aws kerberos'
sudo -u git -H bundle install
sudo -u git -H bundle clean
sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production
sudo -u git -H bundle exec rake gettext:compile RAILS_ENV=production
sudo -u git -H bundle exec rake yarn:install gitlab:assets:clean gitlab:assets:compile RAILS_ENV=production NODE_ENV=production NODE_OPTIONS="--max_old_space_size=4096"
sudo -u git -H bundle exec rake cache:clear RAILS_ENV=production
|
8.升级GitLab Shell
1 2 3 4 5
| cd /home/git/gitlab-shell
sudo -u git -H git fetch --all --tags --prune sudo -u git -H git checkout v$(</home/git/gitlab/GITLAB_SHELL_VERSION) sudo -u git -H make build
|
9.升级GitLab Workhorse
1 2 3
| cd /home/git/gitlab
sudo -u git -H bundle exec rake "gitlab:workhorse:install[/home/git/gitlab-workhorse]" RAILS_ENV=production
|
10.升级Gitaly
1 2 3 4
| cd /home/git/gitaly sudo -u git -H git fetch --all --tags --prune sudo -u git -H git checkout v$(</home/git/gitlab/GITALY_SERVER_VERSION) sudo -u git -H make
|
11.升级GitLab Pages
1 2 3 4 5
| cd /home/git/gitlab-pages
sudo -u git -H git fetch --all --tags --prune sudo -u git -H git checkout v$(</home/git/gitlab/GITLAB_PAGES_VERSION) sudo -u git -H make
|
12.启动GitLab
13.检查GitLab状态
1 2 3 4 5
| cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
|
如果所有项目都是绿色,升级成功。
其它问题可查询官方文档。