|
|
发表于 2022-9-11 20:40:14
|
查看: 2038 |
回复: 0
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
5 a6 [. y7 F! d登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。
: P9 M1 W* V0 n9 p! t% a% x运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。0 D5 `7 y" J2 R
接着设置语言和本地化设置:
* r/ g) ?7 `) }) ^export LC_ALL=en_US.UTF-8* g, }: }8 j* h! m# c) f
export LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。
3 C9 t' w3 A/ j6 j% V但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?" e, f5 U Q9 a0 \- C/ f( |
于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:) k; y4 \4 u3 x" {+ ~3 n4 v
Recipe: gitlab::database_migrations2 N4 u8 E8 K( t+ L
* ruby_block[check remote PG version] action nothing (skipped due to action :nothing)
0 b3 E% X# G' Y1 S; L6 S5 I * rails_migration[gitlab-rails] action run9 W6 w" q' z$ P% K% r0 {& u
* bash[migrate gitlab-rails database] action run
& W. O. x/ B L$ L! ?& @# a* n8 Y 4 N. c, F" S/ p, D
================================================================================
5 s: b+ q: b0 q8 i+ Q4 ]/ ] Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
, y( t' D$ H; x3 _ ================================================================================* e( S5 q9 f( X% ^" f
3 K. P1 l/ Z0 n Mixlib::ShellOut::ShellCommandFailed
' d, `( K7 p# B" e: ^( J8 \. D ------------------------------------0 l% u. Q8 w5 N0 h
Command execution failed. STDOUT/STDERR suppressed for sensitive resource
% t% e6 s+ `- |
) s5 }8 m9 x4 e! ?4 K5 T- \ Resource Declaration:
# h% F b: l. J, y4 g" o# [ ---------------------% ]1 W* G& n2 a0 D3 ]. @ }
suppressed sensitive resource output' t3 D3 [0 N x8 k' P. F$ O
- c K4 u9 u+ s* @$ A: w Compiled Resource:
4 I9 t9 V$ R+ H# e+ w* j ------------------1 z; S1 H& a8 ]
suppressed sensitive resource output
+ p8 c, J" s- \5 w! P2 u 7 K2 P" E. _: V; f* W! i0 @
System Info:
0 x5 L. \5 j) I( N ------------$ w" B) ]' }- d |" V+ r! X! Y
chef_version=15.17.40 ?% q' F, G/ A) M8 V$ ~- s8 z
platform=ubuntu9 ~! f; ~$ u9 g! T i8 [2 {
platform_version=20.04
2 ]& P. \ @1 F7 p4 j7 ~5 n" E ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
8 e6 N) G" v2 I& @2 q) p3 c y program_name=/opt/gitlab/embedded/bin/chef-client7 g/ A) M* G" |/ j" j
executable=/opt/gitlab/embedded/bin/chef-client
& k' s/ J6 c' [- H. L7 H2 X: } Q ' ~" n) {0 H( b% c. V
7 F! H* f I& \' G1 K1 ^ ================================================================================4 A( e! G, [; \0 N- [6 {- n: e9 R8 @' s
Error executing action `run` on resource 'rails_migration[gitlab-rails]'
, w5 [! t4 }8 A+ m: j5 X ================================================================================, B1 R% C6 d0 \' A9 {8 k% x
: h# X. w! Z2 E" T6 ~# J% Q Mixlib::ShellOut::ShellCommandFailed( F' F" c+ {* v+ |$ ]. F
------------------------------------! _ X0 f' Y" |; Q1 `
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 resource5 k" W" u: \+ h5 r8 u# I7 l
: z0 E) P9 O$ c; b Resource Declaration:$ U7 N9 k9 [7 P" E7 n
---------------------
* _* M2 @1 }$ x& q- y! [4 |! A; g7 I9 Q7 X # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb/ f. ^. I% k' Q# z8 \, U
2 ]- R8 J, x* r) M 51: rails_migration "gitlab-rails" do
! g M9 F+ z9 V& V 52: rake_task 'gitlab:db:configure'+ H, b7 P$ q; G/ K$ D2 M l6 l
53: logfile_prefix 'gitlab-rails-db-migrate'
( K% w$ `9 J: w( r8 n& ^/ M 54: helper migration_helper) m$ P* N, h# t: n
55:
& ?9 E9 u( v4 v' i' I1 j! Y! _ C 56: environment env_variables
* \- e: I! `/ M' \% F# f0 a 57: dependent_services dependent_services
4 ~5 O3 K1 u2 W; }8 ^% M' S 58: notifies :run, "execute[clear the gitlab-rails cache]", :immediately+ M' E# u$ I& x
59: notifies :run, "ruby_block[check remote PG version]", :immediately
3 [8 G+ \, I/ i0 l+ o8 X! g9 g 60:
/ ^. K; d+ r* q6 l5 y7 t/ B 61: only_if { migration_helper.attributes_node['auto_migrate'] }% I2 B0 w8 @8 s
62: end
2 I* V) b5 J" C h- c" [4 {1 D - N# m. U( |' F% J
Compiled Resource:
( |# `- P/ e9 T3 N/ L7 A. c ------------------
& k" o, {; G1 c2 m4 y # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'! G( U# g, r* \6 H7 n0 q! w1 T* V! m1 c
! ?6 a6 J; p# Q* @! K) F7 A rails_migration("gitlab-rails") do& f0 g6 F" [) w! W
action [:run]( ^5 ~" C! J" N/ q8 T2 P
default_guard_interpreter :default
7 R! A2 |6 i5 D6 } S* c4 T declared_type :rails_migration( A/ P& L0 S. s4 E$ b% h
cookbook_name "gitlab"
( N X2 V9 B: v recipe_name "database_migrations"2 m! ?- U' Y* \1 Y
rake_task "gitlab:db:configure"8 w5 ^: X7 y; o4 @! E
logfile_prefix "gitlab-rails-db-migrate"+ a2 f l0 h) P) b
helper "*sensitive value suppressed*"
( Z4 \5 P& h3 G, v) O" g6 c environment "*sensitive value suppressed*"
( F+ x7 X( B7 S R8 Z8 f dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]
. ?" d* W; @ g4 T. q/ r) S9 j only_if { #code block }; z+ P# @; M- `: v8 q: r* b& _( G/ V
end! q- g5 K( F E
* I1 T" \. o: j/ a3 r System Info:
9 B+ t" d9 L9 b" Z/ A' t ------------$ |" s) ?: H& K8 E! i z
chef_version=15.17.41 b' C a( q6 ~# Z
platform=ubuntu9 Q1 A; m& M' Y% Q( H3 T
platform_version=20.04, I& Y) N) A; @! V" Y( O
ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
U/ n: k s# K' c6 l program_name=/opt/gitlab/embedded/bin/chef-client
/ T6 v ~6 [1 b3 _4 _; a executable=/opt/gitlab/embedded/bin/chef-client
+ T" B+ ^. q( Y) a a: R/ I# l& R# B$ B! M! F0 j
Running handlers:
( t) o$ J7 r3 n+ D* j2 hThere was an error running gitlab-ctl reconfigure:
3 |$ |3 m6 E. [9 q' Prails_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
9 k) `* B7 g# G2 T& H0 s: eRunning handlers complete" o: D4 D* u7 s. v7 T* Q0 H$ S
Chef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:
* ]4 S& m# m$ U& I% K7 ^/ Y1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;
3 Y' z& Y% m& S7 w. I2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;# y. N( X( d+ I+ h2 Z. V
3. 再次运行 gitlab-rake db:migrate,确认不会再报错;8 g* t7 K' F! V) j4 z! Z; T
4. 运行 gitlab-ctl reconfigure;, ?# C4 s$ w0 k
5. 重启Gitlab:gitlab-ctl restart。9 A* @; y+ H: v: K
需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。
4 j2 `- V/ |/ e5 l5 j' N/ w! g6 F参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated
% l9 D4 Q c7 k. \4 k8 e/ s: k2. gitlab-ctl reconfigure failing due to migration issue m- B8 S5 {. M
AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2) |
|