|
|
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
9 L8 _ j' x$ }, R( f; q登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。* S, r+ ]% w: W
运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。5 g6 e! c7 i3 v" e- _" U
接着设置语言和本地化设置:+ T; O4 W. s& e4 E. e+ c C! u
export LC_ALL=en_US.UTF-8
1 E0 g$ N0 _9 \# r' bexport LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。; ~" Q) j* J. r0 f/ E0 x
但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?- C* n2 G6 \( @/ C/ K5 r w) U, g
于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:- @* o" v' K+ k' f) T' s k( S
Recipe: gitlab::database_migrations
5 y, Z. t: p$ }/ i) v1 z * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)
3 V, A: E" A+ y; ?/ b9 E * rails_migration[gitlab-rails] action run
- e6 O1 x' G I m * bash[migrate gitlab-rails database] action run
! e1 C& E! b. y ' B3 X; c2 ?- I8 j1 o" v
================================================================================# B+ i4 l, f# T" E: d! r4 h- k5 ?
Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
! Y9 V' {) V- @5 Z ================================================================================- T, n; s; `# H2 P$ r. o
* h$ U' K; \5 `& J" D O% g3 `% w Mixlib::ShellOut::ShellCommandFailed
( x( X, w: J4 {+ B ------------------------------------/ F& F! _8 a* I, D( R- X) f
Command execution failed. STDOUT/STDERR suppressed for sensitive resource
% F1 I! X9 l: K. q. n1 I 2 a* Y! I7 j7 o8 ~# L3 E
Resource Declaration:+ |' Q; P8 N" U! e8 J/ N' F( @
---------------------6 A7 L# W1 e: O
suppressed sensitive resource output& x9 h' x2 I- g: C0 o5 o
! v5 T" w6 U9 F! I9 \
Compiled Resource:
' Z% R- c2 U2 N# R ------------------9 f4 \ R6 O/ R* o& y6 w
suppressed sensitive resource output# p8 h4 u! f. W1 p' x) b
5 N' [) a8 T5 O( R System Info:5 N3 V2 z( @& T/ s. V8 C
------------
- d3 t9 P# _1 H chef_version=15.17.43 S( E5 C2 p A3 ?4 t0 t
platform=ubuntu
* J) H& p% {- i8 c9 L platform_version=20.04: n. L7 m* P% d; S
ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]0 T; W U- c* Q) u5 Y% G6 R
program_name=/opt/gitlab/embedded/bin/chef-client8 y: [1 C9 O1 G; d
executable=/opt/gitlab/embedded/bin/chef-client; S Z8 B7 b& ~9 d2 S2 p6 {
" P# `& c1 M9 |: Y8 ?
; q$ W& Q/ r, W A# B, W4 f' z
================================================================================
& x; \$ _ r4 ^' l9 r; N6 {3 I Error executing action `run` on resource 'rails_migration[gitlab-rails]'4 O! M' k r4 u' W. k
================================================================================3 c6 o' z9 O+ {+ }; l( v; \0 Q
1 D) U C6 Z. _" L* P
Mixlib::ShellOut::ShellCommandFailed9 Y+ k( h3 J" F! p4 o$ M* E
------------------------------------
4 C. z2 Q' i- v! \- k 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
! L- H7 o& G! w5 x+ Y Y 6 u+ n9 F4 P+ d' c* {
Resource Declaration:- n. C# ?% F9 x$ z: M# \
---------------------
6 v7 Z4 g5 |: L4 _# E! |0 U # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb
) ]( f$ m* ]8 M1 m7 g& R# J6 E
8 N1 k6 S! B6 g4 w 51: rails_migration "gitlab-rails" do
+ ]: V& D0 G" r6 q 52: rake_task 'gitlab:db:configure'
0 F# Q5 f" ~6 T, a- b 53: logfile_prefix 'gitlab-rails-db-migrate'
( k8 W% E V- O2 G; L% v" ? 54: helper migration_helper
# @; u) @. Q% ?4 w 55:
1 ]+ _0 X0 p% w( D 56: environment env_variables
8 R* J& s! d" D4 o3 Y/ K8 Q 57: dependent_services dependent_services
4 {. {5 q5 s+ _8 `9 f4 q" n 58: notifies :run, "execute[clear the gitlab-rails cache]", :immediately
" P$ u0 Z q+ P9 P4 h U; G 59: notifies :run, "ruby_block[check remote PG version]", :immediately
! ~( v- J+ A' {" H8 Q+ ` 60: , c( m8 ` m* v- a- b+ U
61: only_if { migration_helper.attributes_node['auto_migrate'] }
8 v2 s. G9 {6 S2 @4 C+ _. N2 _ 62: end
, A( [2 \ ^4 t
" y/ d% L! T+ K8 T Compiled Resource:4 D# G% Q# s3 }! [- R5 E0 R* l
------------------
& M* r% {" L$ M, s, a5 D6 C7 P # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'
+ O, F+ h5 v" y, N" G+ f3 ~
, z5 B# ~& k: V# j rails_migration("gitlab-rails") do' p Q/ s, a( D/ a( N. o( U/ k
action [:run]
1 m7 `& B2 T: v( |& X- V default_guard_interpreter :default
( }' X2 }. s6 O5 F declared_type :rails_migration
" P! k+ y( j. l. d& b cookbook_name "gitlab"; N+ \4 v; M! Y5 q9 o! L
recipe_name "database_migrations"
) l+ N6 x3 w5 i+ _: T rake_task "gitlab:db:configure"" H. p; {" I, l! [$ r) d
logfile_prefix "gitlab-rails-db-migrate"0 S- Q! U+ T' s
helper "*sensitive value suppressed*"
, L; \# [. z" m. f* ~5 N environment "*sensitive value suppressed*"
( e' L3 }+ z: {' E dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]
; K% g$ l3 ]0 m; {6 z7 _ only_if { #code block }7 A- Q% `+ B! e) F/ O( N$ A
end
! ^2 P. z \: c* M6 B# ?& f1 Y
3 H# N5 J" r2 @# ?. k System Info:- Y4 v+ c9 M/ G1 s% [- c
------------
1 x8 a3 u# ]7 W9 W- |" d9 q! I% { chef_version=15.17.4+ D; z+ F- Z1 n5 e6 `( G4 I1 Q
platform=ubuntu
0 \% G( m, q Z platform_version=20.040 D9 Q+ L- I: d. w' r; R
ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
# _8 e4 p; j% f$ c- U program_name=/opt/gitlab/embedded/bin/chef-client1 X- H+ c+ g3 ^. }
executable=/opt/gitlab/embedded/bin/chef-client
9 H- {# e: f) N# p' @, j 6 n8 @+ }" p5 t" v1 L' M8 V3 r
Running handlers:' `- c& a0 N* ~: L0 f
There was an error running gitlab-ctl reconfigure:, v4 J- I- s% K v" a4 f% U6 [
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# P+ H* G) ~# t8 B0 k N: I1 g
Running handlers complete
8 x, X$ v% g' U/ P# Z/ X( @5 SChef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:8 m0 y; L8 o! E$ H6 ^
1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;3 W) Y. ^/ H& ^% J" {! P' a# L6 g4 _
2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;5 |& l+ w x2 o3 `
3. 再次运行 gitlab-rake db:migrate,确认不会再报错;
+ _9 y) J6 V6 i8 K% A, D1 g' }4. 运行 gitlab-ctl reconfigure;" _; I& q8 \/ t3 G' [ L) C# D
5. 重启Gitlab:gitlab-ctl restart。' _7 b S( ~6 P! d3 h" u2 @# ?
需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。1 [# _ k# T9 h6 C/ C, y% R5 W
参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated
- {5 t# U# k# J$ m% P. l7 _2. gitlab-ctl reconfigure failing due to migration issue( w' p d# Q! Q; z: P
AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2) |
|