|
|
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
, b8 Y! P( _- H) W' S. \' v登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。5 z# }( n( o4 A; B6 f7 j! U
运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。1 ~9 F/ i9 M5 r
接着设置语言和本地化设置:
3 \. k n# H+ m4 }5 o* Xexport LC_ALL=en_US.UTF-8
! H( a$ n3 `( V' v! t+ kexport LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。8 }4 ^7 ?- n; k. Q' ]& |
但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?, n% T n- L% {: `" g4 W: k \: Q
于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:
. v& C+ J( F( N! JRecipe: gitlab::database_migrations
' ~4 v5 [1 g: \/ p; ^3 a1 T * ruby_block[check remote PG version] action nothing (skipped due to action :nothing). c, u: J8 m+ g& q7 q: Y
* rails_migration[gitlab-rails] action run
& l M( z$ H" |6 u- [! u * bash[migrate gitlab-rails database] action run
$ E! Q$ x# t, s' Z' w8 q/ r8 { 3 @. o: Y- L2 ^7 X0 C2 i2 D3 ]
================================================================================: s2 f3 B0 v, S" E7 ~' K
Error executing action `run` on resource 'bash[migrate gitlab-rails database]'# ^" r( @3 X" ~
================================================================================9 m8 F- ?! C' x; A' ^" X' W
( d2 J k( D6 ~: V Mixlib::ShellOut::ShellCommandFailed
; D* x6 c5 E& a8 H9 V. ]7 o ------------------------------------) Q# p; P* T4 ?0 P
Command execution failed. STDOUT/STDERR suppressed for sensitive resource+ d& ~6 B5 A" R8 G2 U9 z4 d
3 ?# I6 Z' K+ t7 w( Z
Resource Declaration:
& \8 j# d- M, {$ r. |9 ]: y ---------------------2 a- Q6 R% t% H
suppressed sensitive resource output0 @# `" w3 `6 H
$ b# f, _4 j" [
Compiled Resource:
2 }: K% Q+ Y4 n: o5 P3 j ------------------
' X) x5 N5 a: R Z9 l# } suppressed sensitive resource output6 x( o2 s- K% u4 R L7 X/ }
) p- T8 ]6 m) z
System Info:! ]2 g' [" i% j1 G* H R. H# V1 M9 w
------------
$ Z8 I! t+ L+ P8 C) x chef_version=15.17.4
# o/ R9 N" i% V+ `8 ~ platform=ubuntu4 j# y8 V* t! J) o6 T
platform_version=20.04# X- U& A8 Q" v) N; f) t
ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]: x* K: U# L( E! B0 f- q$ [1 z
program_name=/opt/gitlab/embedded/bin/chef-client) i. G5 K, o: |
executable=/opt/gitlab/embedded/bin/chef-client
# p$ O$ K! h/ }9 X% u. p( `$ p . r. L5 g" @1 a" h, B* T
" I: O* S. }/ Z3 h1 y1 ]! q' f ================================================================================
, C+ w, V9 O+ ^& g; u/ W7 p Error executing action `run` on resource 'rails_migration[gitlab-rails]'
# a+ c. i1 b7 f ================================================================================% ^ s2 |- p' z
" q* j, L7 ~+ p6 ?( _- N C, }: F8 b Mixlib::ShellOut::ShellCommandFailed
; J+ `. g; x8 i1 K0 x ------------------------------------1 Y6 C$ b+ T- F9 s
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. i6 G$ d# O( J# Q
- L) Z! L! J7 o2 |( d1 x4 x% p% B' \ Y
Resource Declaration:
" r4 X+ S+ v5 g, W ---------------------1 [: o. x4 ]' T% z7 n* _) m
# In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb
+ Z1 U& w8 V% G4 [ X0 l
; k; f- }7 S9 g. _2 R) `5 k 51: rails_migration "gitlab-rails" do
6 U/ f, _9 I( f+ T" i 52: rake_task 'gitlab:db:configure'
4 ~3 {# V k8 p+ X( q) h 53: logfile_prefix 'gitlab-rails-db-migrate'2 j/ O* Z! N. S+ T' x
54: helper migration_helper- p+ G. z9 {) c- o
55: m+ w: B& Z3 r; `
56: environment env_variables
# C4 h- y7 k p1 b. K7 i# ]4 B 57: dependent_services dependent_services
/ M: I8 ~1 m m1 [' K 58: notifies :run, "execute[clear the gitlab-rails cache]", :immediately7 e+ ~. s5 L0 F# [
59: notifies :run, "ruby_block[check remote PG version]", :immediately
( M' f" _4 D+ T o7 q 60:
2 d" t \. u x& C1 @ j+ G 61: only_if { migration_helper.attributes_node['auto_migrate'] }- g6 R! B! [. A& K
62: end
6 [, n- M( B7 Q, p! Q; a* h 0 D* a7 ~( `0 G% ~
Compiled Resource:
% x w2 o$ `8 t1 ~7 Q& r0 k ------------------
. g+ y! r, S( k4 U" Y) ^7 F # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'0 I2 M7 D8 P) K2 `
W9 V ~+ k. w9 L7 L
rails_migration("gitlab-rails") do6 ?' [$ W1 J! t4 s$ }5 S
action [:run]
2 H% Z* Q! y9 b3 f. l1 B default_guard_interpreter :default
5 x' j: B+ |( ~0 q% f declared_type :rails_migration' n+ ~" c" |* {. M- l
cookbook_name "gitlab"
+ b* x- l3 f Y! b recipe_name "database_migrations"
; U! z% Y/ u+ D3 W! g6 J! k rake_task "gitlab:db:configure"
2 C' n+ v; B$ h9 o logfile_prefix "gitlab-rails-db-migrate"8 M* c! j4 H& v( g! Z) o! T
helper "*sensitive value suppressed*"
" _7 x$ K: O/ i) p! W( C environment "*sensitive value suppressed*"
F ~, D% M$ Q# w, l* d; T5 ? dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]
3 j' v n! M2 m6 O7 h9 H) [3 b only_if { #code block }
9 X4 A* T& U3 ~9 z) u end* A7 A% p" M. q j3 d# X2 G
5 r' U% K4 A9 N$ f1 I w System Info:2 @7 @. U& V# x; G6 {5 g9 l
------------6 }0 E5 h3 }& V: j7 J2 E9 i4 T& m
chef_version=15.17.47 p. e' P/ }/ V; g7 H6 N) ~
platform=ubuntu* ^- x2 q* p1 }# n' F) }
platform_version=20.042 ?" }5 E$ _7 `6 {! g7 `3 z# b
ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux] b8 C4 @( K% o8 o, @: |" S
program_name=/opt/gitlab/embedded/bin/chef-client
' h- M% B+ s, X& c# W executable=/opt/gitlab/embedded/bin/chef-client
$ a" G3 K- W' w) Q9 Y2 a
' T$ [0 p7 O' X% T1 s Z% GRunning handlers:
3 Z1 y, N' _1 s4 P- }! Z% j. G! OThere was an error running gitlab-ctl reconfigure:& T4 l# F# X# ~' B0 I- T/ q$ d
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 resource8 G$ Q! A# I- u4 \# \% Z
Running handlers complete: ] _ b2 a. K7 r$ i+ @6 V
Chef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:
5 a8 R: P" H5 N7 s1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;
6 }0 M( x5 v* [* I. f7 [2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;
- X9 l9 ~: J/ D$ W. _& X# s s" x3. 再次运行 gitlab-rake db:migrate,确认不会再报错;
( f0 z& J* y$ I' v& L' Y2 t1 Y4. 运行 gitlab-ctl reconfigure;
0 p" o3 X- K/ a1 k$ V8 y. n- I5. 重启Gitlab:gitlab-ctl restart。
: g) t* o4 e. ~; \需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。
+ |2 m& f" `# s0 T Z" u2 ]参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated6 t$ g8 `& D& _1 l0 v. |, Y( O
2. gitlab-ctl reconfigure failing due to migration issue% J7 e. \5 _$ Q `% x8 U: p
AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2) |
|