|
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。& x( e% U5 g, u; W+ x: V0 ]; k
登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。
4 c, R d4 H4 G5 C I0 [运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。+ W, u' r; a( {5 o4 ]. X. m
接着设置语言和本地化设置:3 @: k$ e( v* D0 W A5 b
export LC_ALL=en_US.UTF-8
" X: Q- b. r w$ Nexport LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。
2 }8 O/ M; Y5 i* w1 N: O" u但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?) N ^& c" G! M# L1 [' V" m2 ]0 i
于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:
& _% A" g6 S) k7 I% H- HRecipe: gitlab::database_migrations
; W# \% U2 @8 H' p# y * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)1 W+ W* {) N# n. ] F4 G6 W
* rails_migration[gitlab-rails] action run8 @- W x% I/ S9 H W$ o
* bash[migrate gitlab-rails database] action run
9 B8 S5 u ]$ p( O) A
0 h7 P! ^( q& h8 y- A. ` ================================================================================
% J4 a! W( C8 |2 `# ?+ t* |3 x7 D- W Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
: {0 A# R/ M P: ]* ?( X% T ================================================================================: J4 _( X" j2 K
3 f2 P% `7 h( c) R9 j7 n Mixlib::ShellOut::ShellCommandFailed
+ a( h; R7 F2 k3 g) @ ------------------------------------
; `7 e" o& @! s Command execution failed. STDOUT/STDERR suppressed for sensitive resource' A. u% U- U3 r- D' X/ B9 u
3 k9 a! C4 i6 ^) C8 g0 J% u& M
Resource Declaration:
% `0 B, r! u1 g+ _. W ---------------------
9 N9 t) ^0 ~& o5 ?6 e8 t8 p3 f- w suppressed sensitive resource output
4 S2 k# m8 I+ H, ~/ z% N; U
; N; E3 `' Z5 ^( h8 p' u/ W Compiled Resource:- m4 X v: R' h5 a
------------------" K" m( O, a' ?1 O' p( r I
suppressed sensitive resource output
! G4 d7 A& }( \. H
2 D& S7 S1 S% D, ~5 V; Y System Info:
' F9 b+ Q; h4 d% W i* m/ U! g/ n ------------
$ g5 v" `7 D# D I9 o8 ^* o. X$ [, J chef_version=15.17.4
; M, \& w: K/ D( y platform=ubuntu
* l2 M: A( d( v4 x) ]: m platform_version=20.04
4 u. M3 y$ [+ ?+ f4 R+ Y: d4 o% \/ W+ E ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
4 J* |+ ~% ]/ ]; }+ w5 t; t/ ` program_name=/opt/gitlab/embedded/bin/chef-client% z* V. V2 [* F% H9 N
executable=/opt/gitlab/embedded/bin/chef-client
8 ]- D3 w% y; E) W
5 a4 h& V+ |5 v0 ~
8 y9 R& R# j$ ^' A/ o ================================================================================
/ c8 H6 n# i& H1 I, |" z Error executing action `run` on resource 'rails_migration[gitlab-rails]'" n0 a5 M( x3 y/ `9 V1 D" x
================================================================================9 _6 D6 Y x5 T7 j, Y, `
1 J% T3 E, [1 B P6 @ Mixlib::ShellOut::ShellCommandFailed% n5 f9 w* B: \9 Y
------------------------------------
1 x) d8 @' U" e# x 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
. O0 ?" E: @6 ~; c' S) Y5 ^ 1 c! H7 V4 T0 q5 \: C& X5 x& W
Resource Declaration:
0 l; b3 D1 I9 S5 W' B2 t. R ---------------------) ^! G2 `- ^) B! b$ C* F, d
# In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb1 b% F( }; N0 s5 r, a
( [+ d- L" g) [2 ~
51: rails_migration "gitlab-rails" do9 A) _$ A( b% f: R' }, Q6 e b) p
52: rake_task 'gitlab:db:configure'' i2 ?$ Q- h. v2 q b+ o$ [' n+ h5 u
53: logfile_prefix 'gitlab-rails-db-migrate'6 C+ \3 Q0 w. @2 k
54: helper migration_helper
% g. k2 c# u; V! z/ Z6 L 55: 3 w5 ]/ ]1 O) l* g9 e
56: environment env_variables- A# v& ~$ {' s, G, @ S2 Y
57: dependent_services dependent_services
- o/ K3 p2 y1 F9 X( Y7 n k+ i 58: notifies :run, "execute[clear the gitlab-rails cache]", :immediately! W: y& S+ g% g2 ?
59: notifies :run, "ruby_block[check remote PG version]", :immediately! B/ e% ]' {1 c/ o1 Y: _; o5 C
60: : j8 W1 ]* l3 G1 r2 H9 X7 y! J% }
61: only_if { migration_helper.attributes_node['auto_migrate'] }0 j7 R I- Z' Z' y) u
62: end% D! ~8 X( `; x, S3 K1 c! e
6 \# s; j, P8 {
Compiled Resource:
: ~, e! r$ G2 }4 D# a; N ------------------
7 V2 e2 ] x0 I # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'
4 ] s# a" _0 i" M/ Y! @ x/ x- d9 u& K- b9 y$ f7 C
rails_migration("gitlab-rails") do7 |6 w* x/ g! T6 i( X" M
action [:run]. H. g5 a# R d
default_guard_interpreter :default( K+ g) o! X/ ^" I: k- j
declared_type :rails_migration
) L! ?5 V& V% Y; A& u- Y- @ cookbook_name "gitlab"4 \5 J& j' J) q0 k/ H
recipe_name "database_migrations"
6 W' c- Q% I, b, o4 D' X rake_task "gitlab:db:configure"
/ i. G. W# \1 J/ D+ b logfile_prefix "gitlab-rails-db-migrate"
6 |1 P! Y1 D! f0 k1 S. G) Q* O+ `2 I helper "*sensitive value suppressed*"
" a) S& a/ h9 P" ~9 Q! S t environment "*sensitive value suppressed*"
; C# M/ r2 L( D' {) S% F dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]) R- j( o6 _! F o5 i: H
only_if { #code block }
& _* W! d8 ]7 T+ ~' R; T end6 ]" [0 i$ |1 v4 B1 `
/ t' `: Z- f) k7 ]* p System Info:
4 ?9 p) k7 S. }# V3 h7 T3 X0 A( r ------------* s& l1 u9 |% ?9 e- v: K5 |9 t
chef_version=15.17.4
8 _1 {* p# p: H- z platform=ubuntu/ @. f6 s3 K( M- z8 p2 l
platform_version=20.04
/ r8 R" H9 D% G6 z ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
! B1 L) _1 b2 U& M4 j( f program_name=/opt/gitlab/embedded/bin/chef-client" ^7 J) E, g# G5 z; i
executable=/opt/gitlab/embedded/bin/chef-client
: |/ S1 {* }& a) m( N4 _ 3 T t* I0 a+ c3 D
Running handlers:: }! \, @$ E( h( N! Q
There was an error running gitlab-ctl reconfigure:
( Y j( O+ [. p0 n' Jrails_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
( n% P; `1 H5 v7 P; \0 l, f; ~Running handlers complete+ X! [8 Y2 p r! g L
Chef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:3 B, t6 ^" I* G
1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;
5 t# ] _, o& g7 Q+ h1 E) Y' [( U2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;
2 Q I# h; w. l. g3. 再次运行 gitlab-rake db:migrate,确认不会再报错;- M, w4 r2 N5 X
4. 运行 gitlab-ctl reconfigure;
- d- ?( O- \: C( {4 n5. 重启Gitlab:gitlab-ctl restart。9 H& D' ^) g$ H
需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。5 Y2 k& k& F2 C3 U+ t1 ]- z
参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated
( @1 p! ^4 U+ W" v2. gitlab-ctl reconfigure failing due to migration issue P7 Q8 b7 v) b
AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2) |
|