|
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
4 ?3 p, Y( g& E2 Q' v& l9 z登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。0 S0 J3 X2 q: a, t* j
运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。
, Y A: `2 D+ ^# {: M: K8 J接着设置语言和本地化设置:9 }0 X& O8 ?' I0 T9 Z. r6 [
export LC_ALL=en_US.UTF-8
2 |. i# h3 G0 N' dexport LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。
4 X$ M/ m J e但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?5 U+ u0 [* D6 I7 d8 Q' A: Y
于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:
: h' ?/ O* d/ e' PRecipe: gitlab::database_migrations) _6 Q# L, l( }- w% `
* ruby_block[check remote PG version] action nothing (skipped due to action :nothing)
' [8 g+ P: X. A. [6 m * rails_migration[gitlab-rails] action run- {6 n% e# ?; I3 c2 n8 W% Z
* bash[migrate gitlab-rails database] action run* z* P" D+ \* ?* p9 G0 [
; c* p; C9 q3 j& R! t
================================================================================
& J' Q& H$ e* v" w Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
# z( x! ^0 P" i \1 D% W m2 i ================================================================================
# U' n. M$ ?3 B2 N* ` [ b6 G# T4 L) ?6 I- p2 f
Mixlib::ShellOut::ShellCommandFailed7 j- k" y9 x- a: s Z) l. L
------------------------------------
7 `" B/ m3 F! R* c5 I- w; [ Command execution failed. STDOUT/STDERR suppressed for sensitive resource
6 R" ] Y, R7 S 8 f+ d3 p" }* ?$ |
Resource Declaration:' i/ f8 c& ^$ P+ M4 P
---------------------
) {, k0 e+ X6 o9 f1 Y* c/ z+ _2 v6 l suppressed sensitive resource output, _' ]) P$ p, F7 N0 ~$ K. I
2 F* Q4 X5 n. V, l5 h# H% d: `# ~ Compiled Resource:1 W, {6 ~0 Q* Q' e
------------------
4 {# }' L9 I9 {2 R* a5 g3 v/ L7 m suppressed sensitive resource output' P6 P; f' b& o4 h3 ~
0 ?; ~$ t9 b+ a2 V L
System Info:
4 x" w* L& T9 ?( I; ?! q1 n ------------
1 \. W, x) ^" {& Q. {/ b- h chef_version=15.17.4
8 F' h. j. e8 K" P( ] platform=ubuntu: \1 o' s. K4 h$ U3 n0 O4 t$ d: Y
platform_version=20.04 S5 h4 o) @% i$ t+ g3 O6 R
ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
5 O) W2 w0 H; E- N @' j4 ], `$ n, X program_name=/opt/gitlab/embedded/bin/chef-client; Y( x8 D5 K* D( [# D# N5 E. d7 S2 N
executable=/opt/gitlab/embedded/bin/chef-client+ Y7 F& Z7 q8 s8 i4 _1 t
( J# {' O. ~! l4 [" ]% Z" | 9 v" B2 _# ~" ], a
================================================================================7 h9 x& [5 W2 R3 z- h( }7 n8 R
Error executing action `run` on resource 'rails_migration[gitlab-rails]'
9 O$ E" x6 I. N( ?" B/ a ================================================================================0 l9 {& J! `/ n, H: f* ?
3 Q( W# G# m* m6 a( n
Mixlib::ShellOut::ShellCommandFailed
# K9 Y+ ~$ n% f9 D ------------------------------------9 R8 A7 O! n6 m) @9 ~
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
% ]4 I6 h q6 W. \8 ^- @ ) ^9 _, W* K0 E0 z- u
Resource Declaration:
+ M9 x2 F. I( i, A- p- }* j ---------------------
* [8 J; J, t7 q: D, f1 h! t! ~4 @7 R # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb
+ N& f3 a/ _7 C ( e7 T+ T- x1 z% r
51: rails_migration "gitlab-rails" do
% s$ X E$ [+ C: @ @ 52: rake_task 'gitlab:db:configure'
4 ], R. I' D5 f: t 53: logfile_prefix 'gitlab-rails-db-migrate'
& X0 i2 e1 n' h- f, f3 I 54: helper migration_helper# ~! B' J4 q% H( F
55: # j. N9 T1 W) H1 P1 [# l
56: environment env_variables( _8 V; Y' t# Q: x, J9 {
57: dependent_services dependent_services4 R: u; [- k1 _
58: notifies :run, "execute[clear the gitlab-rails cache]", :immediately
& d+ B2 D0 R; g/ Q2 Z 59: notifies :run, "ruby_block[check remote PG version]", :immediately" e/ v$ {2 B, Y' t8 T
60:
2 U9 k( D& e* s& S3 c2 N- Q 61: only_if { migration_helper.attributes_node['auto_migrate'] }6 R' V( Z- }1 b
62: end6 _& t) K" b4 M0 M* {; N( K
) E5 B% ^0 ^9 B& M: ` Compiled Resource:7 ?: t# C5 w+ f
------------------
0 a5 K' `) o' w& G # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'
4 r- \$ ~& m$ T$ U- t, o @ Q- G; K7 B
rails_migration("gitlab-rails") do
' b$ c8 t, n# L/ ` action [:run]5 a0 }& e* z& {! F
default_guard_interpreter :default h$ ]; s! ?- {. H: @
declared_type :rails_migration1 [! |0 S8 M2 S7 ^' ~( T( j
cookbook_name "gitlab"
* T- \0 g9 O8 Q" |5 Z+ K ` recipe_name "database_migrations"8 q7 Y& F5 i) F& E; z/ D
rake_task "gitlab:db:configure"
( K o) A; ~* U% L: G5 W+ L logfile_prefix "gitlab-rails-db-migrate"
6 Q" X3 K0 F/ Q) Z' T7 T0 ?& p helper "*sensitive value suppressed*", X7 X0 \; z2 h3 L6 q
environment "*sensitive value suppressed*"
* R6 P! \' d5 n dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]8 ]1 M" J* `9 ?% ^& E% x* W
only_if { #code block }* `% y/ t. z- ? b% `
end
" t6 @ a/ R$ A4 X' b& R
* b4 I$ a6 H. ?: ]1 X9 o System Info:
, Z5 s* E$ E, f- R, M) B ------------
9 W9 I( K( d$ n; S chef_version=15.17.4
1 K4 a- i& l% Q$ E0 e1 J platform=ubuntu
8 {- S0 y! c" F0 r platform_version=20.04
0 \; t* F8 E! L, U- o, m6 o. o/ u0 ~ _ ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]' Q: N. G/ u$ r, L
program_name=/opt/gitlab/embedded/bin/chef-client
1 P0 j% C0 `9 e! }* S, A executable=/opt/gitlab/embedded/bin/chef-client/ u) ?6 {6 f' a+ V
8 G% p' r8 ^+ a6 Q) T6 s# z! sRunning handlers:
; d9 ?; z1 B8 YThere was an error running gitlab-ctl reconfigure:" h X' o0 a6 \! J/ {6 e9 T0 K/ b 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
+ O. \$ n) b. T" Z" ?* @Running handlers complete
& v4 p8 X' {, v; V# `# m. EChef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:
( g, {: `+ [: M0 Z8 u1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;+ P0 H7 a3 h1 o7 ^$ |
2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;
. ~: B0 A7 B, }0 {3. 再次运行 gitlab-rake db:migrate,确认不会再报错;5 m$ y! H& C, t) t+ c2 j
4. 运行 gitlab-ctl reconfigure;6 t/ f V/ Q) L6 Y; ^8 q( b+ U. X
5. 重启Gitlab:gitlab-ctl restart。- ]0 d! a# f* e
需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。% N7 L3 t% |! R" m
参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated( |. p% R3 E, S: K
2. gitlab-ctl reconfigure failing due to migration issue. p2 u$ X, B" z
AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2) |
|