先看官方升级文档说明
官方文档链接
![在这里插入图片描述](https://img-blog.csdnimg.cn/999d915940624bc59e8df2adf4d9651c.png)
升级
# 停止服务
sudo gitlab-ctl stop
# 创建数据备份,防止更新失败
sudo gitlab-rake gitlab:backup:create
# 升级包下载链接(记得修改版本号):
wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-10.1.0-ce.0.el7.x86_64.rpm/download.rpm
# 首先停止gitlab现有服务
sudo gitlab-ctl stop
# 防止在升级过程中报错【错误-1】,执行以下命令
sudo gitlab-ctl start postgresql
rpm -Uvh [rpm包名]
错误
- 一、 停止gitlab服务后未单独启动 postgresql,会报以下错误
Dumping database ...
Dumping PostgreSQL database gitlabhq_production ... pg_dump: [archiver (db)] connection to database "gitlabhq_production" failed: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
[FAILED]
Backup failed
- 二、在安装gitlab进行gitlab-ctl reconfigure的时候,碰到问题bash[migrate gitlab-rails database] (gitlab::database_migrations line 55) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received ‘1’ 报错database_migrations问题涉及数据库。使用gitlab-ctl stop停止gitlab服务,执行如下命令后重启gitlab即可。
chmod 0755 /var/opt/gitlab/postgresql
systemctl restart gitlab-runsvdir
#重启gitlab
gitlab-ctl reconfigure
gitlab-ctl restart
- 三、如果垮大版本升级时报 :Your version of PostgreSQL is no longer supported. Please upgrade your PostgreSQL version to 11. 数据库版本错误,则升级PostgreSQL即可
sudo gitlab-ctl pg-upgrade
- 四、如果报以下错误: gitLab-unicorn[‘port‘] has been deprecated since 13.10 and was removed in 14.0, 直接修改配置文件,重新配置即可
原因是 14.x 后版本,不再使用 unicorn ,改为使用 puma 作为web服务器。所以如果是升级操作,需要修改配置,按如下步骤。
修改 gitlab.rb 配置文件
-
vim /etc/gitlab/gitlab.rb
-
注释掉所有 unicorn
-
按需打开 puma (删除前面的#,修改后面的值,一般是设置过端口,需要重新设置)
![在这里插入图片描述](https://img-blog.csdnimg.cn/112c8a72272a40d88a5a6b51b004283d.png)
gitlab-ctl reconfigure
- 五、更新Gitlab后,gitlab-ctl reconfigure报错:
Running handlers:
There was an error running gitlab-ctl reconfigure:
rails_migration[gitlab-rails] (gitlab::database_migrations line 51) had an error: Mixlib::ShellOut::ShellCommandFailed: bash[migrate gitlab-rails database ] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/resources/rails_migration.rb line 16) had an error: Mixlib::ShellOut::ShellCommandFailed: Command execution failed. STDOUT/STDERR suppressed for sensitive resource
执行了一下:
sudo gitlab-rake db:migrate
执行完成后,我这边返回的结果是让我执行以下命令(每个版本返回的可能不一样)
sudo gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']
显示执行成功后,再执行
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
升级完成后的效果
![在这里插入图片描述](https://img-blog.csdnimg.cn/9f81b854a1b342b4ad83fb3038805d8f.png)