|
|
发表于 2022-9-11 20:40:14
|
查看: 1892 |
回复: 0
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
1 F& z: o; D/ C M登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。
5 W! W6 e* x# Z8 d- @* L. P3 q运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。2 d0 Z$ s9 s/ a) ] |
接着设置语言和本地化设置:, U! @1 L' V5 K" _& J
export LC_ALL=en_US.UTF-8' v, _4 [8 d6 R) v; r" N$ G
export LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。' L- h; n. j. J0 p
但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?
( O A8 ~9 d' P- F于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:
0 A E9 \3 y8 F7 G jRecipe: gitlab::database_migrations
" f$ }( _. ?/ q+ u * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)
7 F, v: b# G! Z* r) h+ O- {+ W * rails_migration[gitlab-rails] action run: D; j* W4 y8 u9 x1 Y; w. F
* bash[migrate gitlab-rails database] action run
0 U. `! |3 b/ @# ?: C0 {! E 8 q4 Q' ~) N0 ]* S V' z
================================================================================. S6 H! d9 r! v2 A% K# u h
Error executing action `run` on resource 'bash[migrate gitlab-rails database]'9 i$ k8 k B6 K& a! \' M
================================================================================
+ S+ J) t* N6 i8 { " ` y6 y/ M5 q
Mixlib::ShellOut::ShellCommandFailed0 X6 M% b+ s$ u/ s0 j) A+ `8 B
------------------------------------
4 O: ?5 j7 s, ~6 z7 A) i% \, U Command execution failed. STDOUT/STDERR suppressed for sensitive resource6 p0 Y9 Q$ K' K& j. A9 c
- n8 i. x" Q# L* P$ r Resource Declaration:" U C8 S# r5 Y6 R% g4 {
---------------------
- F( W' Y7 E n3 g! S3 H( J suppressed sensitive resource output, M9 W7 h4 C& m) V: B
5 L: z. e3 d. E+ F* X8 q: \/ E
Compiled Resource:1 L# u& T( C0 x+ w( A6 B
------------------
. ~1 w8 C0 I/ g+ q suppressed sensitive resource output
: w5 d& A t8 R7 |! U6 z+ D + G$ `# J8 A+ O! c+ n
System Info:
' f6 Q% `. P5 \1 A! n, G# n ------------: z$ Y/ G8 L0 {
chef_version=15.17.4/ N& m% U2 [! N1 b
platform=ubuntu% u* b: O7 g. y6 o5 T5 L, }
platform_version=20.04
; ? z1 Q$ X' s- Y; r* i ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]6 i* ^- x7 J& {' }' V
program_name=/opt/gitlab/embedded/bin/chef-client
! |* {! c7 r0 m$ q9 c) c4 \8 E executable=/opt/gitlab/embedded/bin/chef-client |: Y; B1 G; T. i4 S; T
" M3 J( ?9 o: q3 f
( J8 t+ u f0 ^; c/ N6 i ================================================================================2 _% L1 Y# f1 v' Z; g
Error executing action `run` on resource 'rails_migration[gitlab-rails]'' [$ Z/ z6 \6 z! \9 B
================================================================================
) k- N0 p9 }5 o# C8 D7 D X1 C
8 h3 {4 P4 t( @ y Mixlib::ShellOut::ShellCommandFailed3 H" v/ ?( }9 b) Q7 E3 J
------------------------------------* O- j# F5 f. l4 x# h' 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 resource# B1 i' T7 o3 |! W
$ L. g; _& |" b% w2 b5 F5 m6 n/ M- a Resource Declaration:
8 j# k) F, L5 _5 C3 ^' x ---------------------7 @$ s& ?! ^! p S; b, m
# In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb
: M* S+ i* I" E: ^% t" j
% ~. i/ k+ T7 g! M 51: rails_migration "gitlab-rails" do" `, B* \% ]1 N" ~4 Y
52: rake_task 'gitlab:db:configure'
& N9 m, n# @6 { 53: logfile_prefix 'gitlab-rails-db-migrate'9 m7 `7 A$ \0 ~) S, L' h6 E& u
54: helper migration_helper
6 ?8 Z0 [3 q8 O# f9 |0 ? 55: 0 [0 O1 d2 d+ p4 K( A
56: environment env_variables
" f' L y" Q' Z 57: dependent_services dependent_services$ \. z* s& M$ J1 q% D
58: notifies :run, "execute[clear the gitlab-rails cache]", :immediately- K2 h! Q9 X, G6 j/ c
59: notifies :run, "ruby_block[check remote PG version]", :immediately
7 V$ M4 J% a I {/ u" k 60:
8 \( M# o- q( j h- G8 k, C1 c) f 61: only_if { migration_helper.attributes_node['auto_migrate'] }
# c7 i" r1 ]3 X4 r1 p2 D 62: end$ m- P$ Y% H* {$ G2 R. Q$ Y
. N2 f" Q$ ]9 r0 e Compiled Resource:: `9 H/ M8 R2 v( ?# ?6 `7 z
------------------
% V4 ]( k% J/ [! ^7 d* u, a2 O # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'& h: @4 @ @8 e! I5 G g; }
: P8 ^' T* V- j' I) P) } rails_migration("gitlab-rails") do
/ f3 P) J) o& {4 h' w5 H$ L action [:run]
# o" m: M- l7 X1 l; r default_guard_interpreter :default7 T0 e' p% r/ {1 {0 y' Q! _- y
declared_type :rails_migration
& p0 M" |( e# N( |0 L: D cookbook_name "gitlab"
& q6 ~; Q; B% c: c3 `& O recipe_name "database_migrations"7 I$ Y$ L9 \ U
rake_task "gitlab:db:configure"! u: |% D0 k7 E9 n C; N7 I, W% w! |
logfile_prefix "gitlab-rails-db-migrate"
b' Z7 e! N) n% m) x helper "*sensitive value suppressed*"( Z0 l$ J% U3 I
environment "*sensitive value suppressed*"% c3 L# Q% X+ Z! z4 S
dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]
J" g$ E6 G- K- j4 E, e only_if { #code block }/ F& V; d. R0 E) t
end
: U* b5 G$ i; m' y6 k: g' K C3 q3 [5 n' P# }
System Info:& k- _6 @+ G$ j1 T6 C8 e
------------
; s9 o! W; ~; F; ~ chef_version=15.17.4# h f/ [" f# l6 O; j$ G
platform=ubuntu- ?0 h$ H6 s7 b- |$ _
platform_version=20.04+ |) [# G5 D4 X( J0 z% c: g
ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux], ^1 k! N+ p. z+ B1 G
program_name=/opt/gitlab/embedded/bin/chef-client
+ W- g' Y4 |2 Y7 U+ H executable=/opt/gitlab/embedded/bin/chef-client4 Q4 n* h/ ]7 `' ^9 e
5 c: `1 U3 X _+ a/ Z! U
Running handlers:
0 X( C4 _. ]! G) K+ \: o& hThere was an error running gitlab-ctl reconfigure:
0 \# ~2 H+ {' C5 a' O4 F9 mrails_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
+ ^/ l' B! k. NRunning handlers complete
0 t' i' N: m/ k* o5 vChef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为: f# o9 }) P/ v
1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;# Y! M1 k" G6 n# X, R6 V
2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;, |% j# C- G' _' Z4 G
3. 再次运行 gitlab-rake db:migrate,确认不会再报错;- R0 J+ r* F9 V- S% F
4. 运行 gitlab-ctl reconfigure;& C% s; b4 o, X6 {/ e+ u. V/ ~
5. 重启Gitlab:gitlab-ctl restart。
9 F0 \9 r( g/ I8 E( p: Q需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。
8 e/ u q- H$ s3 S& l参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated0 o6 F' t$ J* k6 ]4 N4 }3 r2 w* k9 ~
2. gitlab-ctl reconfigure failing due to migration issue
2 K% q1 H; n* b( e( E3 t" a: @AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2) |
|