|
|
发表于 2022-9-11 20:40:14
|
查看: 2031 |
回复: 0
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。( K9 ] L: t) g$ @
登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。. A3 @7 G. z3 Z0 Q U
运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。: s9 |/ S: Q8 n+ X- l4 I
接着设置语言和本地化设置:/ ?# i* Q- q& [& y( ~; _
export LC_ALL=en_US.UTF-8& }) {: l+ q* v6 X- c
export LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。% x% l" ?) S3 E% c7 b
但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?
. h2 H6 ]5 o3 s0 i5 g/ B于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:1 M$ _: Q/ A! g! U! L5 ~
Recipe: gitlab::database_migrations- |6 q. C6 b1 J. L' |% T
* ruby_block[check remote PG version] action nothing (skipped due to action :nothing)
, I B% N9 |( P2 b: A0 G: F1 f( o * rails_migration[gitlab-rails] action run3 L* h6 z9 A3 w0 b9 K6 o
* bash[migrate gitlab-rails database] action run4 Z- p$ h1 o7 ]% _
, D9 Q3 _; X5 V0 m$ R- Y- M
================================================================================' @" ^. ~0 N9 ]0 L. k
Error executing action `run` on resource 'bash[migrate gitlab-rails database]': a9 D3 n7 A% \* t, g
================================================================================
% J8 c% K) V: ~! o4 _1 N. @ # `! ]! S: b1 _" g; G4 T
Mixlib::ShellOut::ShellCommandFailed9 y+ a) V# H4 ?, S& }
------------------------------------3 y$ J7 f. O/ e/ }' e1 f. E; F
Command execution failed. STDOUT/STDERR suppressed for sensitive resource' M8 h& N" y2 K3 }( A" [
7 c' L( c7 x8 G. x! ?5 p/ T5 ?" t1 N Resource Declaration:
' \) M* C9 c F9 {: \' E6 T0 I/ Q3 y ---------------------( X' g& c: e" q) X2 k0 ?/ p$ ^
suppressed sensitive resource output
4 v/ J1 L5 V. O) U9 k! `# `: }4 S + u3 Z6 h2 ~5 u/ E( ^
Compiled Resource:* u% y! L. M* c k0 I( o" Y ]# {
------------------; h4 Y2 U# f! j6 |
suppressed sensitive resource output
4 d% R6 r" x' h' t; E
+ l/ C2 I4 i: [- j8 O System Info:
+ y/ c5 Y0 _ i6 C' X3 j ------------
' I5 l, H! F: a+ } chef_version=15.17.4
) \( q& s' E1 q* G& y platform=ubuntu I) U% C: Q8 {0 V
platform_version=20.04
: T) s/ p$ \8 Q0 S4 A+ F ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux], J5 V; c3 E: O& K E
program_name=/opt/gitlab/embedded/bin/chef-client+ y8 Y# p, T& [1 v3 q3 R' L
executable=/opt/gitlab/embedded/bin/chef-client: c9 t; i. H( h5 `- I1 e0 b1 ^
8 j2 g! p( a* }0 a: a
u. t# i$ ]* J ================================================================================
; t$ Y. o+ D2 Q. u g9 b' b Error executing action `run` on resource 'rails_migration[gitlab-rails]', ^; a8 K( t/ `. z
================================================================================ Z n4 x% b8 ?" i9 q
* C/ u2 N5 }" h Mixlib::ShellOut::ShellCommandFailed
3 l9 ^) [" A8 E, o ------------------------------------
0 a( V- N" _2 v% `8 t' I 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
& }8 }9 B8 a9 `6 X2 ?# H" G 4 ?' l' m# m* q
Resource Declaration:
6 U0 B4 Q$ p- |( C ---------------------2 I: ^! B$ q" C# W1 o
# In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb
: i# C1 A* }5 A0 @# `
) }+ C! ~* U r% O% V, F 51: rails_migration "gitlab-rails" do
, \$ d) R( b( B N" `# v5 w 52: rake_task 'gitlab:db:configure'
7 a& L( z# D: a 53: logfile_prefix 'gitlab-rails-db-migrate'7 Z7 A @+ C. E
54: helper migration_helper+ f* Z" ?6 U7 U8 C3 M. k5 C5 }
55: + n( z1 j$ ^3 O% ?+ o+ Z
56: environment env_variables
x4 O+ c- n! K+ | 57: dependent_services dependent_services
3 y9 M( z, G$ `( y 58: notifies :run, "execute[clear the gitlab-rails cache]", :immediately
& ~# D' a9 E- j& g 59: notifies :run, "ruby_block[check remote PG version]", :immediately
& _9 ^ T! U+ a3 O6 k0 E 60:
* u, F5 Y, t( N' y5 D( U4 Z 61: only_if { migration_helper.attributes_node['auto_migrate'] }4 s1 n) E' h+ p/ ]! @
62: end5 ?3 K9 @/ M- Q* K' Y
J- H9 r/ d; S Compiled Resource:$ a4 T5 {. S* k( O" y" m! x
------------------! [2 G9 b9 m4 b" P
# Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file' f& v* b( C' O# @, K- h# D
* b: K& q* t# N2 s- V# p
rails_migration("gitlab-rails") do
; U+ x" b i# ^ action [:run]
2 s i# O1 |6 b* b2 z default_guard_interpreter :default" T/ C2 I8 I! E7 ?- n) [. @
declared_type :rails_migration
' W2 j2 A5 H5 r# G1 K cookbook_name "gitlab"
( g7 `6 }/ o3 ?& g& W0 Z$ { recipe_name "database_migrations"
- c7 n/ q4 P! R3 Q rake_task "gitlab:db:configure"
7 F& }: v/ [1 c logfile_prefix "gitlab-rails-db-migrate", U& X U! v0 f
helper "*sensitive value suppressed*"" a: G$ Z7 }; P @' G% D/ H* G
environment "*sensitive value suppressed*"% M ~2 h( Q. ?. }" x
dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]+ y8 p$ A8 u4 j, k/ r9 B
only_if { #code block }
% u' P4 J3 v( x. p9 b# |7 U end9 Y/ V- V2 _: J u3 I9 M* {! z5 ?
. H6 e4 E7 U$ M J/ q6 y, E6 X- E, N System Info:$ T' [3 U: c' k- J/ F6 P
------------
) E8 z3 o1 \ } chef_version=15.17.4$ B; h( t1 C0 \5 r- A
platform=ubuntu+ n/ c! b: Y* g* i: e
platform_version=20.04
; \9 W1 V/ n* L2 n7 \1 b8 P ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
# c6 T) v( H# L' Z program_name=/opt/gitlab/embedded/bin/chef-client! I' P) d# O* p! P9 G f
executable=/opt/gitlab/embedded/bin/chef-client- }6 J! Y1 c: r4 B
1 n) y4 M& ] e1 z! _0 tRunning handlers:
( D3 |/ o! ]1 _4 P5 X$ m: L; PThere was an error running gitlab-ctl reconfigure:" O2 z1 ?6 @: _' R N
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
1 H3 a" A" J3 j% m! YRunning handlers complete# ~: X5 s6 _1 ^( }9 x6 t [! g
Chef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:+ n Z2 G# L# V1 b, }* ^: z9 m
1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;4 M7 \7 u, z0 f; Q" W
2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;
' i7 t0 P, H/ l+ a3. 再次运行 gitlab-rake db:migrate,确认不会再报错;) r7 }/ Z4 r ?! `5 D* R
4. 运行 gitlab-ctl reconfigure;
/ K/ |* \7 |# K. H9 Q5. 重启Gitlab:gitlab-ctl restart。
) S8 g0 x* z4 q$ q+ m# k( N- `需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。
8 Y4 C6 E( \: a) J* C) `参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated; x1 {" Z% I9 Z: P. O. w1 k
2. gitlab-ctl reconfigure failing due to migration issue
& x r. C0 p( ~3 q' B d/ }% K, xAD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2) |
|