- 停止极狐GitLab服务器
- 获取稳定分支的最新代码
- 安装库并运行迁移
- 将极狐GitLab Workhorse 更新到新补丁版本
- 将 Gitaly 更新到新补丁版本
- 将极狐GitLab Shell 更新到新补丁版本
- 将极狐GitLab Pages 更新到新补丁版本(如果需要)
- 安装或更新
gitlab-elasticsearch-indexer
- 启动极狐GitLab
- 检查极狐GitLab及其环境
- 确保后台迁移已完成
{{< details >}}
- Tier: 基础版, 专业版, 旗舰版
- Offering: 私有化部署
{{< /details >}}
更新私有化部署的自编译安装至补丁版本。
先决条件:
- 您的私有化部署自编译安装的备份。
停止极狐GitLab服务器
要停止极狐GitLab服务器:
# For systems running systemd
sudo systemctl stop gitlab.target
# For systems running SysV init
sudo service gitlab stop
获取稳定分支的最新代码
在以下命令中,将 LATEST_TAG
替换为要更新到的极狐GitLab标签。例如,v8.0.3
。
-
检查您当前的版本:
cat VERSION
-
获取所有可用标签的列表:
git tag -l 'v*.[0-9]' --sort='v:refname'
- 为您当前的主版本和次版本选择一个补丁版本。
-
检出要使用的补丁版本代码:
cd /home/git/gitlab sudo -u git -H git fetch --all sudo -u git -H git checkout -- Gemfile.lock db/structure.sql locale sudo -u git -H git checkout LATEST_TAG -b LATEST_TAG
安装库并运行迁移
要安装库并运行迁移,执行以下命令:
cd /home/git/gitlab
# If you haven't done so during installation or a previous upgrade already
sudo -u git -H bundle config set --local deployment 'true'
sudo -u git -H bundle config set --local without 'development test kerberos'
# Update gems
sudo -u git -H bundle install
# Optional: clean up old gems
sudo -u git -H bundle clean
# Run database migrations
sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production
# Clean up assets and cache
sudo -u git -H bundle exec rake yarn:install gitlab:assets:clean gitlab:assets:compile cache:clear RAILS_ENV=production NODE_ENV=production NODE_OPTIONS="--max_old_space_size=4096"
将极狐GitLab Workhorse 更新到新补丁版本
要将极狐GitLab Workhorse 更新到新补丁版本:
cd /home/git/gitlab
sudo -u git -H bundle exec rake "gitlab:workhorse:install[/home/git/gitlab-workhorse]" RAILS_ENV=production
将 Gitaly 更新到新补丁版本
要将 Gitaly 更新到新补丁版本:
cd /home/git/gitlab
sudo -u git -H bundle exec rake "gitlab:gitaly:install[/home/git/gitaly,/home/git/repositories]" RAILS_ENV=production
将极狐GitLab Shell 更新到新补丁版本
要将极狐GitLab Shell 更新到新补丁版本:
cd /home/git/gitlab-shell
sudo -u git -H git fetch --all --tags
sudo -u git -H git checkout v$(</home/git/gitlab/GITLAB_SHELL_VERSION) -b v$(</home/git/gitlab/GITLAB_SHELL_VERSION)
sudo -u git -H make build
将极狐GitLab Pages 更新到新补丁版本(如果需要)
如果您使用极狐GitLab Pages,更新极狐GitLab Pages 到新补丁版本:
cd /home/git/gitlab-pages
sudo -u git -H git fetch --all --tags
sudo -u git -H git checkout v$(</home/git/gitlab/GITLAB_PAGES_VERSION)
sudo -u git -H make
安装或更新 gitlab-elasticsearch-indexer
{{< details >}}
- Tier: Premium, Ultimate
- Offering: GitLab Self-Managed
{{< /details >}}
要安装或更新 gitlab-elasticsearch-indexer
,请遵循安装说明。
启动极狐GitLab
要启动极狐GitLab,运行以下命令:
# For systems running systemd
sudo systemctl start gitlab.target
sudo systemctl restart nginx.service
# For systems running SysV init
sudo service gitlab start
sudo service nginx restart
检查极狐GitLab及其环境
要检查极狐GitLab及其环境是否配置正确,运行:
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
如果所有项目都是绿色的,那么恭喜您,升级完成!
确保后台迁移已完成
检查后台迁移的状态,确保它们已完成。