Help us learn about your current experience with the documentation. Take the survey.

将自编译的 CE 实例转换为 EE

  • Tier: 免费版、高级版、旗舰版
  • Offering: GitLab 自托管版本

您可以将现有的自编译实例从社区版(CE)升级到企业版(EE)。

这些说明假设您已经正确配置并测试了 GitLab CE 的自编译安装。

从 CE 升级到 EE

在以下说明中,请替换:

  • EE_BRANCH 为您所使用的版本的 EE 分支。EE 分支名称使用 major-minor-stable-ee 格式。 例如,17-7-stable-ee
  • CE_BRANCH 为社区版分支。CE 分支名称使用 major-minor-stable 格式。 例如,17-7-stable

备份

要备份 GitLab:

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

停止 GitLab 服务器

要停止 GitLab 服务器:

sudo service gitlab stop

获取 EE 代码

要获取 EE 代码:

cd /home/git/gitlab
sudo -u git -H git remote add -f ee https://gitlab.com/gitlab-org/gitlab.git
sudo -u git -H git checkout EE_BRANCH

安装库并运行迁移

要安装库并运行迁移:

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

# Update node dependencies and recompile assets
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"

# Clean up cache
sudo -u git -H bundle exec rake cache:clear RAILS_ENV=production

安装 gitlab-elasticsearch-indexer

  • Tier: 高级版、旗舰版
  • Offering: GitLab 自托管版本

要安装 gitlab-elasticsearch-indexer,请按照 安装说明 操作。

启动应用程序

要启动应用程序:

sudo service gitlab start
sudo service nginx restart

检查应用程序状态

检查 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

如果所有项目都显示绿色,那么恭喜您,升级完成!

回退到 CE

如果在转换为 EE 时遇到问题并希望回退到 CE:

  1. 将代码回退到之前的版本:

    cd /home/git/gitlab
    sudo -u git -H git checkout CE_BRANCH
  2. 从备份恢复:

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

有关将 EE 实例回退到 CE 的信息,请参阅 如何从 EE 回退到 CE