|
|
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
* A0 c+ c" C" q9 n$ K, Y c" b登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。2 L1 G6 z k$ ]- E. g \* _0 o
运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。
8 K! I k( }4 @" U; y接着设置语言和本地化设置:1 l. h- K5 a$ Q# f6 X$ a' F
export LC_ALL=en_US.UTF-8+ o8 m7 Z M4 {1 M
export LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。7 x+ K. |1 I9 ^
但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?5 F8 P$ i: P$ S9 F' W
于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:1 Y+ y5 P0 x) u) B
Recipe: gitlab::database_migrations" d, |- k' x5 ~/ Y
* ruby_block[check remote PG version] action nothing (skipped due to action :nothing)6 q/ I; w6 E) c9 Y5 e
* rails_migration[gitlab-rails] action run
; y* y& c, a# |7 ?# }3 F0 _- K3 Z( g * bash[migrate gitlab-rails database] action run
5 p! `5 Y9 l: i" P9 B% J . [ g# Y5 f) X9 t6 |7 y6 ^
================================================================================
6 Z8 s0 B, F% z: ~% o+ D- } Error executing action `run` on resource 'bash[migrate gitlab-rails database]'2 |. ^8 M1 D+ J; u4 s+ o" q! y: r
================================================================================
, y- B* D+ `. t9 Y |2 S' ?7 R2 e4 M+ g
% e4 y0 ]( y7 O4 c C7 @! ? Mixlib::ShellOut::ShellCommandFailed% p5 i$ ?, a+ \! h7 a( r
------------------------------------& A! t% o3 ~, N& `
Command execution failed. STDOUT/STDERR suppressed for sensitive resource. ?5 |/ t+ M) Z7 H
. n/ y! M0 `+ S) w' \' s Resource Declaration:; R2 ?' F( G% j- o# ]
---------------------/ W" n0 X' M0 R, L( Z
suppressed sensitive resource output
' B9 @# ]% f$ @6 c& C+ }8 e+ E4 J % p, r9 B$ v/ m
Compiled Resource:
; N! H- y; o7 M- O X ------------------
6 ]( J: P2 ?4 G! q& q2 P suppressed sensitive resource output
; b: u g/ N. y 6 T: J7 K0 J4 B$ K& {" D/ O
System Info:
+ M$ {" Y/ h& M3 s9 j ------------
- \9 i% J& |8 x1 \1 Q9 B chef_version=15.17.4
* S. p9 Q" ^) s4 Q$ N2 E/ n( j platform=ubuntu8 ^, t5 @' y& e4 `
platform_version=20.04
3 c- O) }8 s0 Q ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]) c& j5 H. P `- t
program_name=/opt/gitlab/embedded/bin/chef-client
1 { p9 I6 M0 s; {6 p2 z executable=/opt/gitlab/embedded/bin/chef-client! F: }3 o# N+ P* L3 t0 U# ^- d
/ z) J2 i; o& ?6 B( }/ a) e7 n * T' I8 {* S5 p7 ^0 v( N
================================================================================' ~# G% c" u' N6 l6 ^. {4 n! V
Error executing action `run` on resource 'rails_migration[gitlab-rails]': U4 ]6 I: X, p; ^) @ t, _1 y
================================================================================- j% w0 w& {/ j* x$ J/ V% f5 M
8 ?+ M+ v: d" w9 E/ \ Mixlib::ShellOut::ShellCommandFailed7 Z% W; z0 O, q* ~1 s
------------------------------------
% X+ r# t# N9 _. U9 o 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 resource1 ~) i8 k7 M5 V( i6 q3 \; l
2 K6 I* ~7 k0 E8 I* R
Resource Declaration:; K7 [- E; N; i2 O6 D7 S
---------------------
/ [1 X& I8 G& c4 n # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb3 u n" ^8 V6 Y. t
9 E' E/ g% M6 R7 i 51: rails_migration "gitlab-rails" do6 P/ l! f: O0 s' m8 j; R( N8 c
52: rake_task 'gitlab:db:configure'
" m" }8 _* s' w& \7 l' ^* z 53: logfile_prefix 'gitlab-rails-db-migrate'" k7 l; Z( {/ f6 w
54: helper migration_helper: j. A- ]4 Y3 J; l
55: ; A" l3 [3 t, X, A% `' A( w
56: environment env_variables$ s3 x+ o4 S$ O2 N
57: dependent_services dependent_services
m5 |6 V# F* U( a8 B 58: notifies :run, "execute[clear the gitlab-rails cache]", :immediately
* A. s6 W( Y0 v* c- [ 59: notifies :run, "ruby_block[check remote PG version]", :immediately
& }3 G P3 a5 a5 c$ }/ S 60:
. m% u. {. p" c5 U 61: only_if { migration_helper.attributes_node['auto_migrate'] }
! Z2 J' ~- m1 M' M 62: end+ u4 R: M; E3 |, y5 `0 j
3 F0 a7 \8 n- N% d# x
Compiled Resource:7 m& N1 i8 y8 h. J, T) J4 E8 R
------------------
$ i3 e4 f' F% |' l$ P7 X # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file') @7 h1 {9 L$ }8 P/ Y+ o$ J7 }/ d# W
( V, u! G- i# B9 D' I# K) o
rails_migration("gitlab-rails") do
' j# X0 D2 G8 h# @0 I1 p0 z action [:run]
! @* N @1 h4 i4 N' c; a default_guard_interpreter :default
% a& A& L1 U# r Z+ m: L' P declared_type :rails_migration# k, M1 D% o7 @# `0 i2 i) M$ ?# r
cookbook_name "gitlab": m7 T7 F l$ ?$ L2 c
recipe_name "database_migrations"
! L! p6 H7 ^2 C rake_task "gitlab:db:configure"! T" s# l, k3 M' e: O+ ~. M* P; q' T
logfile_prefix "gitlab-rails-db-migrate"
8 u" \8 b; E- b helper "*sensitive value suppressed*"
3 C& W- T- D2 E; d% [8 @- [9 W environment "*sensitive value suppressed*"7 p1 w- j9 M2 f: x# g
dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]; E* U! {* h6 a* @+ o
only_if { #code block }
& f+ Z; N$ @. i* y end( @* m: h3 ]! d3 m
! S. g9 x- g* v+ B5 e1 G9 b( T System Info:
2 J! ]" a( v0 S) x) K ------------1 t `8 j0 g6 L5 |0 F' c b$ Q" X+ ?4 F
chef_version=15.17.4
0 ?8 R0 p# g2 e/ ~% E platform=ubuntu" U' H% u( s, I2 G* v+ t
platform_version=20.04" I4 j1 I; R- L6 j/ L
ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]& N! @: a L) `& h2 w; u$ o }
program_name=/opt/gitlab/embedded/bin/chef-client3 y( [( J q5 h9 V* o
executable=/opt/gitlab/embedded/bin/chef-client
- C5 b% @" f! U% b, D3 Y. h 5 w0 |8 r, b9 C$ V$ c
Running handlers:9 ^7 v& `! H" f0 E. H8 m
There was an error running gitlab-ctl reconfigure:! B4 }# G4 F& g) u6 k( `7 G& h
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
/ ?: k* m8 m& i: E4 I- eRunning handlers complete
; ] \' n! a6 s" SChef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:
. g5 \6 U% a( H# }& U1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;
# H n1 P( d2 i8 _5 Y& n2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;; l9 v; F+ D" v, q4 b' s: n! [
3. 再次运行 gitlab-rake db:migrate,确认不会再报错;8 B) | [. n* O5 K) j
4. 运行 gitlab-ctl reconfigure;
1 Z; W8 U0 M6 y0 n ?5. 重启Gitlab:gitlab-ctl restart。
3 [$ E% z* Z6 ?" v3 I+ [需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。# _0 f6 l: h( Z( f4 c
参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated* a2 W9 q2 A3 K
2. gitlab-ctl reconfigure failing due to migration issue
+ L* }6 _' {# Y0 b8 B& wAD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2) |
|