11

我正在研究将 GitLab 从旧服务器迁移到新服务器的过程。我需要做的第一件事是确定 GitLab 位于哪个安装中(综合与源),但我无法确定。

这篇文章(综合或来源 - 无法决定将哪个用于 gitllab 备份/恢复)提到在 GitLab 根文件夹(/home/git/gitlab)中寻找 .git 文件 - 我没有看到 .git文件在那里。因此,根据该评论,安装是 Omnibus。

但是,查看这篇文章(检查 GitLab 版本),我无法运行:

sudo gitlab-rake gitlab:env:info(显示为 Omnibus 安装)

但我可以运行:

bundle exec rake gitlab:env:info RAILS_ENV=production(显示为源安装)

我看到了相互矛盾的答案。我怎样才能知道 GitLab 在哪个安装中?

无论如何,当我运行最后一个命令时,我会得到以下结果(如果有帮助的话):

系统信息 系统:Debian 7.10 当前用户:git 使用 RVM:无 Ruby 版本:2.0.0p247 Gem 版本:2.0.3 Bundler 版本:1.7.2 Rake 版本:10.1.0

GitLab 信息 版本:6.0.2 修订:10b0b8f 目录:/home/git/gitlab 数据库适配器:mysql2 URL: http: //107.178.218.39 HTTP 克隆 URL: http: //107.178.218.39/some-project.git SSH 克隆URL:git@107.178.218.39:some-project.git 使用 LDAP:否 使用 Omniauth:否

GitLab Shell 版本:1.7.0 存储库:/home/git/repositories/ Hooks:/home/git/gitlab-shell/hooks/ Git:/usr/bin/git

4

1 回答 1

13

您应该检查此文件是否可用:

/etc/gitlab/gitlab.rb

如果没有,那么它是从源代码安装的。我的建议是将您的安装更改为综合安装,这样可以更轻松地升级。

阅读本文以获取有关升级到综合安装的更多信息:https ://docs.gitlab.com/omnibus/update/README.html#upgrading-from-a-non-omnibus-installation-to-an-omnibus-installation

更新 1

请注意,如果 MySQL 用作数据库,则必须进行转换,请参阅文档https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/update/mysql_to_postgresql.md

要从源升级安装,您有 2 个选项:

确保你有一个与你当前 GitLab 版本匹配的 omnibus-gitlab 包。(如果可能的话,我会最后一次从源代码升级)

1、在同一台服务器上安装gitlab和omnibus。

在开始之前,请从服务器制作快照,以确保您始终可以返回到工作点。还要确保关闭 gitlab。

您应该使用综合选项安装 gitlab:

sudo apt-get install curl openssh-server ca-certificates postfix
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash sudo apt-get install gitlab-ce

可以在服务器上同时安装omnibus en source install。如果出现问题,您可以随时更改源安装。

然后按照文档中的说明进行操作:https ://docs.gitlab.com/omnibus/update/README.html#upgrading-from-non-omnibus-postgresql-to-an-omnibus-installation-in-place

2.通过备份安装gitlab。

当您使用备份时,您甚至可以将 gitlab 安装转移到新服务器。我用过这个方法,很简单。

在进行备份之前,请关闭 gitlab,以确保备份和还原过程之间没有任何变化

首先,进行备份:

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

另请参阅此覆盖范围的文档以获取更多信息。

之后,您可以将备份移动到新的 gitlab 服务器或稍后使用它来导入它。

要在综合安装中导入它(简而言之,但请阅读文档):

sudo cp 1393513186_gitlab_backup.tar /var/opt/gitlab/backups/
sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop sidekiq
# Verify
sudo gitlab-ctl status

sudo gitlab-rake gitlab:backup:restore BACKUP=1393513186

sudo gitlab-ctl start
sudo gitlab-rake gitlab:check SANITIZE=true

既然你说它是关于一个生活环境。您可以执行以下操作,设置一个小型服务器/或在您的本地计算机上进行升级,以便您对它感到满意。之后,您可以在实时环境中执行相同的操作。

于 2016-10-22T19:58:16.430 回答