|
|
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。/ K* Z" W% U! r+ O; M# u* L
登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。
) d1 A( @1 M5 D, U0 l/ d- x运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。
* X& j' h; p2 i1 M l6 s# W0 f接着设置语言和本地化设置:, r$ b% |' {! b3 l
export LC_ALL=en_US.UTF-8
& w `" c! S2 R5 {3 Wexport LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。, a/ Z* Z: H! P z
但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?5 j2 k& A; ^6 w2 t5 D2 c5 F0 w' \
于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:& g5 H# j. u% A0 @! T
Recipe: gitlab::database_migrations+ I r2 B; }& ], ^; l
* ruby_block[check remote PG version] action nothing (skipped due to action :nothing)0 \1 y7 M- R. N4 G( E
* rails_migration[gitlab-rails] action run
0 i3 h0 b3 l, u* a/ A * bash[migrate gitlab-rails database] action run5 V8 X& u" b' F/ Y& m
1 u0 G; O% h1 b& z1 R8 o C ================================================================================
3 c d1 Q; N5 w I Error executing action `run` on resource 'bash[migrate gitlab-rails database]'$ b9 C8 q3 p8 ? d8 y7 G& r/ f" m
================================================================================" d. T9 y# R- \. v: c9 A
+ W; P1 m: ?' m# W0 {
Mixlib::ShellOut::ShellCommandFailed
$ r! V0 a9 m( o) o2 Y" _ ------------------------------------
/ s" N0 O7 b) ~ Command execution failed. STDOUT/STDERR suppressed for sensitive resource
( k, k" P$ a6 ~; v5 F
& ^. H: O5 p& C Resource Declaration:
+ _1 @% G3 l; k) g ---------------------: H& T p, `) X1 ^
suppressed sensitive resource output2 e/ a1 H* h5 ?' n
5 b/ n' n) @. B# R# o5 v" e" W
Compiled Resource:
+ d4 h- ]; v% G' g4 a- i ------------------- G5 X# Z9 e; p, P+ x2 I
suppressed sensitive resource output
( R) m4 o5 ]# f' o7 n ]
+ k1 h, U; z4 B8 E& d System Info:
" ^. H& D" x, z& M ------------
# ~' {6 e" \' `0 [$ M; j& p chef_version=15.17.4
0 h5 Q' }: |5 ~5 e( H! | platform=ubuntu" P/ b5 A4 i* i
platform_version=20.04
9 S5 v6 s, W3 c; V/ d$ b( f3 s ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]/ z0 R% F! m9 a) l$ u0 q
program_name=/opt/gitlab/embedded/bin/chef-client' Q' G" y. t8 e
executable=/opt/gitlab/embedded/bin/chef-client
5 o* N- G t; {3 r # Z4 B$ @( p' a2 L+ C; O) W _& B
4 |8 h' E2 U7 l1 t. w$ l; T' | ================================================================================
& |( G7 y+ T7 J& X Error executing action `run` on resource 'rails_migration[gitlab-rails]'( L- z1 g1 A. V& B9 x
================================================================================
5 ~& Q/ a) S w , R8 O1 u1 K1 r% a) a+ y
Mixlib::ShellOut::ShellCommandFailed
/ j9 {; x0 {: O% _ ------------------------------------1 U8 C( N7 \& h$ T$ C7 N
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$ O- J! Y2 \( V2 E$ N" [- F. Y, N
2 C. L8 Z9 h3 p: e( s* I Resource Declaration:: L; \' G- ]7 @$ L
---------------------4 f7 {! P, b! h2 h$ U
# In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb$ j+ H5 u$ f& w# A- {( k( I
1 u2 z$ B. @( Q1 |, f# P
51: rails_migration "gitlab-rails" do! j* z, O$ h& p5 U7 J7 N& C/ l( J, R
52: rake_task 'gitlab:db:configure'
9 i# Y& {6 _2 G- N) {4 ~ 53: logfile_prefix 'gitlab-rails-db-migrate'
~( C& j+ m% R 54: helper migration_helper
/ t; Z( R0 F' O) h+ }% V 55:
$ D) u4 T9 g$ ?" p% q6 i4 t; U1 Y 56: environment env_variables1 i: Z# F' Q/ r/ C; d
57: dependent_services dependent_services+ k P/ n* M6 M9 W1 G: @* k1 ~
58: notifies :run, "execute[clear the gitlab-rails cache]", :immediately1 n6 { h3 k0 o# R
59: notifies :run, "ruby_block[check remote PG version]", :immediately$ g: w2 a, [+ T' Z0 a$ f
60: ; l4 |5 W- u) i8 J0 a* d: Y: g
61: only_if { migration_helper.attributes_node['auto_migrate'] }5 [% L3 q# G' Y# N/ G4 x
62: end
H6 _3 X( m7 H; H 9 Q% @; `% z( y* T3 X
Compiled Resource:
?6 e9 r& H/ b5 D ------------------
' L6 Q5 d1 A C9 \% q2 } # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'
e- m p- K( x2 i- V- l1 X$ { 9 C, ]2 N1 K% ^% d$ N! o) M
rails_migration("gitlab-rails") do
1 `' S, @7 \8 [7 ~* @& w, w2 H' T action [:run]
/ X! e# @' j. ?% }% v default_guard_interpreter :default
& o- W4 p* o( {- a- ~1 D declared_type :rails_migration
+ b5 M: E5 W& r& K1 o1 Q$ l- | cookbook_name "gitlab"6 a, U1 H) I# ^' d
recipe_name "database_migrations"4 V% V I! H p4 [9 Z
rake_task "gitlab:db:configure"
8 `: G& K) Q* F) L/ |0 Q- W logfile_prefix "gitlab-rails-db-migrate"& H2 ]0 t3 E, z$ ?# ^7 r" @* L
helper "*sensitive value suppressed*"
5 \1 v# ?% B5 ^; E environment "*sensitive value suppressed*"( X6 L6 B9 n6 e8 B8 P
dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]
1 m' m1 D& l4 S7 S only_if { #code block }
% \, i6 P) D' Y0 \ end1 b2 ^* ?" b( ^5 A
) D/ r& F: W- v, p' r/ _& M& M) U( E System Info:
5 e" I% q1 y, \, Q ------------$ G' V( v! H+ V0 p
chef_version=15.17.4& x9 r5 i1 K: i% ^% W( k: p
platform=ubuntu# \, n/ ?% U; U2 w3 A( s9 R8 S" E
platform_version=20.04# l) h. L5 T* B, }& |8 S# e. W
ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]6 ~- X- V7 p' `$ B" g5 D8 w
program_name=/opt/gitlab/embedded/bin/chef-client
2 ~) {- Z# o' x+ ~% o N executable=/opt/gitlab/embedded/bin/chef-client
+ S/ I6 v: o6 p% j/ j7 D/ p: x- ^
# Q. V ]& d' v* x8 `# {! p& d' \Running handlers:. e/ j; j7 Z! e9 x j
There was an error running gitlab-ctl reconfigure:
' l; q6 F1 R8 j) `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
' X9 z' u% o9 C/ O! G5 h3 oRunning handlers complete+ h n" _ C1 P
Chef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:- _, h5 u$ h3 D
1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;: _4 r, L1 I* c) S2 o
2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;
* g$ q S5 X! t) C; H \9 z1 i3. 再次运行 gitlab-rake db:migrate,确认不会再报错;
N' R1 U" f& X% R h/ B; F- D% E4. 运行 gitlab-ctl reconfigure;! L; W2 z& {. k: q# k
5. 重启Gitlab:gitlab-ctl restart。
* L$ U, U% V: y3 f9 ?5 j! u需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。3 E* h' r* N6 ?/ V _
参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated4 c+ Q3 E7 l0 W
2. gitlab-ctl reconfigure failing due to migration issue" A$ ?# C! Z, P2 p, M- z4 q q
AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2) |
|