|
|
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
9 N& h7 d( v$ K' S( Q' I登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。
; { D, y5 g5 l' J ~" H6 H运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。+ m) M( b, n/ C& ?7 }5 G
接着设置语言和本地化设置:2 ^3 z4 j8 |8 h8 b3 O) r0 _$ a
export LC_ALL=en_US.UTF-8% `6 o4 I0 U) X8 @9 \/ Z! o
export LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。
9 K$ k0 o4 h3 ]) [3 |2 J但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?' D' n5 l+ l) A
于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:
9 S* V2 F3 m( y) L; L, w+ uRecipe: gitlab::database_migrations
: g( a7 Y; s7 D) y: Y$ i+ o# t * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)
3 q; P- J6 \/ { * rails_migration[gitlab-rails] action run" V, u8 K ]- s a+ M! o
* bash[migrate gitlab-rails database] action run# e+ i6 ~, O" A3 ?' I0 ]
/ V3 e0 r8 \- K2 z$ K% D
================================================================================' U G( [8 @' i
Error executing action `run` on resource 'bash[migrate gitlab-rails database]'0 C9 h2 ]& G( j
================================================================================
U! r2 {# S# X
X1 y( u3 o! X: C Mixlib::ShellOut::ShellCommandFailed& e" j. U8 U& d2 Q
------------------------------------
* l, H7 N* m- j. x Command execution failed. STDOUT/STDERR suppressed for sensitive resource
1 K0 d% W8 o7 K k8 U
5 V+ p- _1 y$ ]% X' o) \ Resource Declaration:
1 A3 @! C/ t% \6 u' | J ---------------------
9 R1 y9 W& b! B$ x suppressed sensitive resource output
! x5 ]3 w8 W8 s2 H5 `, k
3 x8 o2 t7 {3 I+ O& f) | Compiled Resource:
2 k `% U" L. `5 W ------------------
8 [$ E! p! E$ z5 M9 J suppressed sensitive resource output n! a" L3 B$ y
! z: a' n8 m4 U( S9 D, ?! b
System Info:
; h! Y( p8 z( `+ A4 N ------------
, A/ Y2 Q- \ T6 o chef_version=15.17.4/ i$ b. r2 J8 H/ N) P
platform=ubuntu
& ?# a; b. U( G ?# w; h% [. u2 B3 y0 m platform_version=20.044 K" Z' e& W9 T- l9 S: ~
ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
& O( T+ l7 Z! [" |( M. Y program_name=/opt/gitlab/embedded/bin/chef-client
2 G" T! Y; M2 N executable=/opt/gitlab/embedded/bin/chef-client
9 v7 O! v3 G$ N( m' n8 C& C
+ N, g/ W/ j. W* ~3 U, [( l & C/ Q% \3 ^0 j5 z, K
================================================================================
) R) Q4 G) @' ?& ~: z( u8 `$ x. A Error executing action `run` on resource 'rails_migration[gitlab-rails]'
* D |8 R6 |/ t ================================================================================
( p- j8 y [% T" }) S ( a( l5 F0 N0 U* G6 O& j2 a0 ~
Mixlib::ShellOut::ShellCommandFailed0 s; N# }; O3 }$ R# J! f
------------------------------------
) ?* v" E) z) b2 f! h0 {0 W! ]) q 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 resource6 ~0 j! @1 q1 u. k* I
8 Y% K6 q% A4 j* ]6 [" x9 Z0 W# o4 @
Resource Declaration:
) p5 M: [" l. L ---------------------% z0 }2 N2 Y3 o! k3 G+ X% Z$ h. u5 Z
# In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb L. S1 m- @$ @( X
2 o7 G* h+ O+ d4 L V6 X
51: rails_migration "gitlab-rails" do
. ?* `9 @7 f8 V) e) F3 ~8 j# D 52: rake_task 'gitlab:db:configure'
6 Z/ Z2 K, S3 j. m6 [) W7 {0 g- G 53: logfile_prefix 'gitlab-rails-db-migrate'* h, e) T0 a& O) q/ N" D5 p. V$ R% X0 T' j
54: helper migration_helper/ t2 T+ R9 e# ~) S2 i& z5 |
55: / J5 F) b% Q1 k9 @! \
56: environment env_variables
9 h. ^% l% Q, t- c! @ 57: dependent_services dependent_services. y h" R+ D( Q7 ?/ O$ H
58: notifies :run, "execute[clear the gitlab-rails cache]", :immediately
$ @2 G: ?( X; {- @; ?5 y J 59: notifies :run, "ruby_block[check remote PG version]", :immediately: z& e6 v( x1 c
60:
5 f" @* @: g0 j6 \4 i$ B, | 61: only_if { migration_helper.attributes_node['auto_migrate'] }
+ w# X3 U2 E4 z; s% g 62: end
. y: ~; V6 T! X2 s% K- Q
# b, x9 D u2 v Compiled Resource:
3 q% ~6 W, E- b3 Q7 F- {, Q ------------------4 P! W: X% O5 V, X/ R
# Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'
7 g4 J5 \2 l" F& g, f & ?0 R5 e7 i1 J' G3 d
rails_migration("gitlab-rails") do
+ q; |5 n2 o/ Y& R s action [:run]
; O T# C8 t( Z9 B' @ default_guard_interpreter :default
: l, f7 W6 ^, m8 I" t declared_type :rails_migration+ j; S- L; F! i! J2 @) j" \6 ?1 g* v
cookbook_name "gitlab"
+ C: t- g/ c/ S# t3 ^7 w3 @% I recipe_name "database_migrations"' w% ~! `+ j! j- G
rake_task "gitlab:db:configure"' H9 }! N3 g5 t) }/ t
logfile_prefix "gitlab-rails-db-migrate"
/ y: ~1 x7 s6 Y. L$ Z, l helper "*sensitive value suppressed*": Y2 |2 o, w1 B+ ?8 Z+ [
environment "*sensitive value suppressed*"8 A# f) ^: o& V9 n" P. c* ?8 q
dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"], n- K4 m; m; ?/ a0 w' n5 ?
only_if { #code block }- e1 U9 ~: g$ P8 z# ~
end" R- i. k* z! y- i" B
& n& n2 }# Q( w3 u. ~
System Info:9 x9 u8 y% q- I7 ^6 N r" v+ z) |
------------# C* Q ~8 o, t
chef_version=15.17.4/ l" J0 {0 M! C4 Y7 j
platform=ubuntu* f" r# L; O1 b' j! k5 q7 z- Q
platform_version=20.04
# n9 f6 w% V. m, a1 @1 B4 \ ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
! ?5 S. Q8 x( _$ G* v. i; i program_name=/opt/gitlab/embedded/bin/chef-client
% j4 O: L( Q# C E- V" c- O executable=/opt/gitlab/embedded/bin/chef-client
- p" z/ S% Z- ]3 O# |" z 8 G) O8 P! v" N2 L
Running handlers:: K- n- J2 f' o" d7 a5 @) q
There was an error running gitlab-ctl reconfigure:4 X+ ?; K4 F! y# Y
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
3 s, }% h8 E3 }5 S/ ?Running handlers complete# J: i6 U# E2 }+ v+ i
Chef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:2 l+ m% h9 k& G' C
1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;' ?# [# I U6 i& a7 }
2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;
- g7 e& t, l' C# `8 ^4 `3. 再次运行 gitlab-rake db:migrate,确认不会再报错;6 w0 A. R7 ~# L2 O M1 U# g
4. 运行 gitlab-ctl reconfigure;
8 ^ i6 m' @: U0 y+ D5. 重启Gitlab:gitlab-ctl restart。
! k' H5 O D4 P$ b需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。
& ^0 I9 z$ E. t4 ]# [. \参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated
4 p4 ?3 w0 N5 }. r+ Q2. gitlab-ctl reconfigure failing due to migration issue
9 ?& j# D ^9 V) x9 u& n2 gAD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2) |
|