gitlab服务器转移,新服务器管理后台保存配置时提示500错误
gitlab为docker版本14.2.7-ee
进入gitlab Docker容器控制台
docker exec -it gitlab bash
以下是网上找到的教程
转自Gitlab 保存设置项目时提示500错误 – 若海の技术写真
1、输入
gitlab-rails console
等待进入rails控制台
2、输入
ApplicationSetting.current.reset_runners_registration_token!
但命令执行失败,提示
ApplicationSetting.current.reset_runners_registration_token! Traceback (most recent call last): 5: from (irb):1 4: from app/models/concerns/token_authenticatable.rb:53:in block in add_authentication_token_field' 3: from app/models/concerns/token_authenticatable_strategies/base.rb:44:in reset_token!' 2: from lib/gitlab/database.rb:370:in transaction' 1: from lib/gitlab/database.rb:371:in block in transaction' OpenSSL::Cipher::CipherError ()
参考官方文档
https://docs.gitlab.com/ee/raketasks/backup_restore.html#reset-runner-registration-tokens
重置后还是未解决,以下是本人摸索出来的方法,
执行
gitlab-rake gitlab:doctor:secrets VERBOSE=1
验证是否所有值都能被解密
显示以下错误
ApplicationSetting[1]: customers_dot_jwt_signing_key, runners_registration_token
进入数据库管理工具
sudo gitlab-rails dbconsole --database main
然后使用
SELECT * FROM application_settings;
查看数据表中提示错误的相关字段(customers_dot_jwt_signing_key, runners_registration_token)
找到“encrypted_customers_dot_jwt_signing_key”,“encrypted_customers_dot_jwt_signing_key_iv”,“runners_registration_token”,“runners_registration_token_encryp”4个相关的字段,
参照官方文档的做法,把值设置成null
UPDATE application_settings SET encrypted_customers_dot_jwt_signing_key = null;
UPDATE application_settings SET encrypted_customers_dot_jwt_signing_key_iv = null;
UPDATE application_settings SET runners_registration_token = null;
UPDATE application_settings SET runners_registration_token_encryp = null; (这个执行失败,实际不需要执行)
输入
exit
退出数据库管理工具
更新后再次执行验证是否所有值都能被解密
gitlab-rake gitlab:doctor:secrets VERBOSE=1
这次看到所有值都正常,设置也能正常保存