|
|
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
3 E* I: [$ X A5 c f( g登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。4 g+ P$ ?; b& T; I3 t/ C
运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。
3 M* x. |* |$ W: }# A: a( Z接着设置语言和本地化设置:- M& u( h) d" `& C0 c
export LC_ALL=en_US.UTF-8" ^ ]2 |) o2 W* ]) v) [, ]
export LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。6 j8 q& A8 m' n, R/ w# i: f
但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?
% l& y2 n: t) b4 w K; W于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:
- E1 _4 n! y! B) _Recipe: gitlab::database_migrations4 l) Z1 u; d) j( j
* ruby_block[check remote PG version] action nothing (skipped due to action :nothing)
+ e" Z' q' y( j0 ?: H1 z* b- j' l7 h * rails_migration[gitlab-rails] action run' N% n! i/ _1 N0 f. k6 O
* bash[migrate gitlab-rails database] action run
2 _& }4 G z; s' h% |, F 7 h% D; C+ ]/ ]
================================================================================. G6 D* [( c: r8 V, r
Error executing action `run` on resource 'bash[migrate gitlab-rails database]'4 M2 h2 i' p3 e. s- D3 ~
================================================================================
' j/ L% z% O/ }1 J6 J0 r
j' a* `3 ~) P Mixlib::ShellOut::ShellCommandFailed& h3 C8 ^7 D# `6 z t
------------------------------------
& c$ M: `$ o9 j% `+ n Command execution failed. STDOUT/STDERR suppressed for sensitive resource
# N ]5 W8 Y3 X" D" e1 ~6 U- s
& U- I6 X- f. Q, l* c' x3 o$ ] Resource Declaration:- w& a* Q/ D. ?; B, c2 p
---------------------3 ^% k4 q4 R0 U
suppressed sensitive resource output
; l% K( j' t8 V3 v
9 p9 \0 F& ~6 G7 _ Compiled Resource:
7 }7 J& p5 Q/ u& Y( @+ h: O ------------------
K% }7 ]$ m% i suppressed sensitive resource output
* N. z2 Z5 Z' i 7 h0 _7 z+ P& m% X: O# b
System Info:4 M% j# g7 z! y
------------
* Y, @5 [( X0 c4 s% j chef_version=15.17.4# Q3 _% K* M8 S- W/ C: U. h: j
platform=ubuntu. d6 l s$ p3 ], n, K, Y0 H1 `
platform_version=20.04
* A, |+ k( J; q+ ~ O- G+ |6 z3 { ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
: B' x j" C8 i. ~/ ^. v program_name=/opt/gitlab/embedded/bin/chef-client% @9 z. c, L! b4 r
executable=/opt/gitlab/embedded/bin/chef-client
! f: P4 o6 U9 x D 9 |* v+ I3 `' ]" a- V
7 J5 O5 `, X; g& r$ F. c
================================================================================7 w3 v0 Q' i& h1 W8 c- v
Error executing action `run` on resource 'rails_migration[gitlab-rails]'
7 ]- j5 b7 K. ? ================================================================================
) J! m! x z+ k 5 l+ D3 S. G! }+ b) I
Mixlib::ShellOut::ShellCommandFailed2 M% w/ N9 u ~; r
------------------------------------( G4 j; Q( [. C) b" O' X$ J% f
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
3 L) j3 u- S% P6 B6 b+ w * j+ A6 f0 G4 {% S3 d* K% X
Resource Declaration:
2 p8 D- l0 c- U+ Q0 P1 C. \ ---------------------
, J2 }& F2 n9 ?0 ^ # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb% ]! I6 H* s; k5 g
i$ |$ D' t/ N 51: rails_migration "gitlab-rails" do) }# [1 `' z9 g8 u! Y- C% g- U
52: rake_task 'gitlab:db:configure'
4 U# M' ?0 T9 }' D/ d 53: logfile_prefix 'gitlab-rails-db-migrate'. x- h% p4 ?) `
54: helper migration_helper
4 N/ b3 B+ V; [! c! M6 N6 ] 55: 4 V- p( U* |1 f4 q" l& F/ ^
56: environment env_variables
1 {, E! w3 i2 o 57: dependent_services dependent_services
- ~; k7 A d6 x. j* i; k* I, k 58: notifies :run, "execute[clear the gitlab-rails cache]", :immediately
& l1 H% `3 o; q) w( h) O6 p" Q 59: notifies :run, "ruby_block[check remote PG version]", :immediately
( u% M+ K; X0 L5 }! w+ | 60: 6 f0 J; b/ C" ?1 z* ? _
61: only_if { migration_helper.attributes_node['auto_migrate'] }
9 \3 C9 P% I. T0 ~ 62: end: E2 G) Q: G/ Y. z. P
/ ^9 n: [1 o5 F" K$ c6 ^9 w3 Z2 y
Compiled Resource:
) `6 N; i; n4 L ------------------
/ D" i) i; y' Q' y: ~/ \7 W* r # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'
9 t) y- m6 g3 z3 ~; o
! [( l! _( w" \5 o! u9 v/ z) \7 C rails_migration("gitlab-rails") do$ F" W: x5 ^' P0 v0 ~
action [:run]5 i: y( c3 I8 w* z4 P0 l
default_guard_interpreter :default6 j8 @- T( U) a; Z# r' X
declared_type :rails_migration8 S) K( |! z% e2 b3 M7 b
cookbook_name "gitlab"0 [6 f. `& A! U" d% h8 c+ W
recipe_name "database_migrations"8 X: G- Y! ?9 Y. I" J3 m% ?
rake_task "gitlab:db:configure"" Z) v* U; }7 o! [6 A% E8 Q( V
logfile_prefix "gitlab-rails-db-migrate"
1 D7 |! _* [$ ~+ ?9 h8 \" U: ? helper "*sensitive value suppressed*"$ d- j. {$ V( f& [; N4 S8 X/ m
environment "*sensitive value suppressed*"7 S" M/ Z" L: m7 U7 S
dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]
% }3 Z1 T- p/ O6 X0 y only_if { #code block }
+ q8 t1 I! {/ W q# x9 U end' @( [$ G4 V* W' {+ c6 R! C- M
( k% H p+ E p) } System Info:9 [4 Y6 G: r% `0 K1 Y
------------: }5 A0 T0 |; }% c
chef_version=15.17.4
2 n6 O2 x8 u; {+ T3 [' X platform=ubuntu& a; J/ y/ J$ x( m2 T- ^. W5 |( J
platform_version=20.04
4 b# U* Z v! ?# e ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
% j2 q" ^7 e, }/ g) f0 O program_name=/opt/gitlab/embedded/bin/chef-client
* ] z3 i: r8 ~$ x8 O6 K7 C' u& \ executable=/opt/gitlab/embedded/bin/chef-client( y/ O: r/ X M! u$ a5 R) K. Q
6 @0 [' E9 q9 P- b& yRunning handlers:8 }6 g8 U) Z! U1 z3 {, L" `
There was an error running gitlab-ctl reconfigure:8 r) v [2 e/ ?- N: s
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 resource0 c. v: j+ f2 S$ k2 S7 ~+ @
Running handlers complete, u1 L3 A+ {8 Q- E4 e/ y. V( _
Chef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:) S; p( @1 s, l3 G; q1 f7 G
1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;: h Y9 f) C7 O- e8 Z$ @
2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;2 D- I" f: B' h, `% W5 u' @- c
3. 再次运行 gitlab-rake db:migrate,确认不会再报错; A1 j J/ S! a1 x- O
4. 运行 gitlab-ctl reconfigure;
# v, y" y" W( [4 i: b( A B3 R+ Q7 c) R5. 重启Gitlab:gitlab-ctl restart。
( O/ J4 M" C$ n! U( T需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。
9 \4 h. i& ?4 s$ \参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated. c" x( V& s( w5 T: ^/ ?4 v
2. gitlab-ctl reconfigure failing due to migration issue, T% p; u% c0 I
AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2) |
|