|
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。1 W' ]: P5 x# v7 \
登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。3 k5 s& T) \( N+ w, G+ P
运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。
$ ~2 \) _3 ], \+ N, a. }接着设置语言和本地化设置:
' A$ I# k! Q2 M9 Q4 @: U5 X1 L1 Qexport LC_ALL=en_US.UTF-8
1 _; u7 g) N# q E3 B+ k) A3 \8 p lexport LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。0 a- A# V3 E. K- c0 L, @
但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?; B2 e& C/ n2 S# v; b( c
于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:
) F4 \4 g2 {7 I9 `! ?Recipe: gitlab::database_migrations
' `8 k3 S( h% c * ruby_block[check remote PG version] action nothing (skipped due to action :nothing); Z* V5 m) O$ X5 Y# k1 e# q
* rails_migration[gitlab-rails] action run- G% ?4 x: V4 n, d1 _9 S' m o
* bash[migrate gitlab-rails database] action run
1 v& r$ ^' p9 Q, \3 \; p# ^ $ C, E, Z+ e2 \8 z6 z
================================================================================
8 F* w z4 o# E9 O0 e+ A) Y Error executing action `run` on resource 'bash[migrate gitlab-rails database]'+ f) `6 Q) |3 P
================================================================================
3 m9 v- U1 Y+ U( T
" M b. v) r2 V" R9 B, @; m Mixlib::ShellOut::ShellCommandFailed
, ~, @+ v# \1 P- _6 G ------------------------------------
! m4 U2 r- s f% a* |% y Command execution failed. STDOUT/STDERR suppressed for sensitive resource% s/ [# e9 u2 w6 @2 u7 X
* ^/ h: _# U- |+ I2 G
Resource Declaration:% g% U3 l8 G$ b: a: N# B
---------------------
" Q4 @. G3 T2 ?8 o Y6 c0 s suppressed sensitive resource output
+ P/ x% Z* M& S! q" k( ?3 @! \
+ i6 X2 n/ p5 h2 H% H* s% D Compiled Resource:9 g/ A0 B: Z% @7 r1 C6 h
------------------
* s6 Y# o# T$ E! g! M1 a suppressed sensitive resource output0 M8 q8 x b ?1 C- `
3 _# V* z8 U! e System Info:
+ ^1 @( ~& {+ R: F1 I, ]- @9 B ------------
- ^' f: Z, y+ f& o1 \: `4 f chef_version=15.17.4
( t) a. ~3 D; r/ n% @* M9 U platform=ubuntu ?1 A8 S" W# Q9 m5 y
platform_version=20.04+ j* f4 v$ z9 j$ z7 |: a
ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]5 e& h5 I( H& ], y
program_name=/opt/gitlab/embedded/bin/chef-client. _+ U. d% I! ]# a% N& ^8 t
executable=/opt/gitlab/embedded/bin/chef-client
/ Y7 i" i# T$ {9 H6 @# y4 c - ?# j2 A6 [/ h5 b0 L3 H0 |/ z1 @) O+ [0 Q
. m6 d/ Z* z f2 V ================================================================================7 A5 _3 E7 o+ ? M
Error executing action `run` on resource 'rails_migration[gitlab-rails]'
% I8 V' C0 L( U: J; _- k ================================================================================
" }! o& Y, _ p9 o' _( n 1 |" {) I$ j( \2 }' s
Mixlib::ShellOut::ShellCommandFailed" O% ~; t4 e5 {
------------------------------------# o. O' j5 r" O; e- J) n. u
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# W- p& a' b0 q8 i
8 [7 i( Z( H+ l3 Y \6 a+ u; N8 A$ a Resource Declaration:$ A5 g& P. U- S$ u9 s7 x0 z+ Y& W
---------------------
0 {: p( d! K* ~ {" f* t( }; M # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb% b. L( J* n; e5 q7 Y* `6 |% V* I
. K/ _6 O9 q( u! Q: R7 R
51: rails_migration "gitlab-rails" do Z6 B) L5 p) w1 P
52: rake_task 'gitlab:db:configure'
/ F3 Q, T' l/ h7 J O Z9 g 53: logfile_prefix 'gitlab-rails-db-migrate'( C( \7 C" ] U
54: helper migration_helper
6 {4 c7 O+ q* v( T2 r 55: & f7 Y9 {* B, a. @
56: environment env_variables" V1 X7 e" g) P* s! H6 t# Z6 F
57: dependent_services dependent_services* [: ?) F9 }2 v# Q9 J4 n$ `) z7 l
58: notifies :run, "execute[clear the gitlab-rails cache]", :immediately
1 K; Q. K7 C) z 59: notifies :run, "ruby_block[check remote PG version]", :immediately4 S/ F+ Z/ g) \
60:
0 _) S0 ~0 |/ ]5 `1 g" @! ~ 61: only_if { migration_helper.attributes_node['auto_migrate'] }
, Y, p2 _8 E9 f6 r- s 62: end4 } p- s$ f6 L# X
6 U { s" Y5 D+ I; D* e1 A: g1 _ Compiled Resource:$ M* b7 b0 ~0 H
------------------$ K- f1 [' Q0 f6 F& I: J5 w9 I8 D
# Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'
9 z9 K* \/ X2 f6 _
+ x. I% y3 {, S6 ^+ s" ` rails_migration("gitlab-rails") do h1 o: F2 |1 I$ t2 d- ]6 b
action [:run]2 a" P6 n2 m4 e# Y$ E" y! E
default_guard_interpreter :default
$ ] a X0 n8 H) g" a$ u+ p declared_type :rails_migration: Y: o4 f- \5 M/ C; b- \
cookbook_name "gitlab"4 q% k! d2 a+ w5 K" a' z, G& v# z% q5 Z
recipe_name "database_migrations"+ v. v) H# O) r# q3 G
rake_task "gitlab:db:configure"# P" O/ C) D0 W# i5 \# j9 @ G2 x
logfile_prefix "gitlab-rails-db-migrate"# D, {: i& ?( M0 M/ {
helper "*sensitive value suppressed*"# P- o4 P: I1 B! j6 \4 J
environment "*sensitive value suppressed*"5 {2 d/ j* X# z, H3 e4 ^, q
dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]
1 F% r- [# o5 w only_if { #code block }* Z2 H6 E; X8 A# m. K+ E) f
end
. ]% Z* D4 G: L; P+ V' ] ( p4 D7 }! C; M7 ]0 C* ~
System Info:; P! r( K" X( m. I& e
------------
8 a$ ^/ s$ ?" l( y4 T/ D chef_version=15.17.4
; N4 u3 B; r7 w* F: G. |/ c platform=ubuntu
9 i, ]& T' d8 g5 _ platform_version=20.04
4 ^) l2 ~7 w* Z) ]6 Y ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]9 x% j: e4 l" h. s, H) ?2 Y
program_name=/opt/gitlab/embedded/bin/chef-client; z3 z, O# {; {1 T' Q" s# ?$ s
executable=/opt/gitlab/embedded/bin/chef-client# [- q6 O6 o9 _# E
* |$ i2 S" e S6 N
Running handlers:4 Y8 l7 b5 l1 R- X3 F
There was an error running gitlab-ctl reconfigure:1 X [" |+ K4 `/ w6 |+ M' I3 f
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
6 R% v6 M# d7 C. d, _3 D4 o* PRunning handlers complete! q4 n! G8 t( G' ^
Chef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:) S m' d3 @2 \8 p& a- R' p
1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;& W2 S; n& l6 v+ j# ~
2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;7 s8 H. n* P! ~
3. 再次运行 gitlab-rake db:migrate,确认不会再报错;
6 k5 r) {+ b. J) r. A9 _2 A4. 运行 gitlab-ctl reconfigure;
3 t4 V6 @; Y0 }* w) g5. 重启Gitlab:gitlab-ctl restart。
# d% L/ ~1 D" f' t2 l& F/ w3 w需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。
9 H* |8 s- N7 n$ j# O参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated
# w8 H: Y" X6 `( l6 R2. gitlab-ctl reconfigure failing due to migration issue
; A4 E: V# c9 D6 BAD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2) |
|