|
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。' L7 s( P/ C6 ~- F" T; K/ y
登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。2 H1 N5 s4 A, c. A4 W
运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。: e1 W5 R. j9 o9 B: }( r: n3 w& z
接着设置语言和本地化设置:* v& x7 R9 v% d% G" l4 e
export LC_ALL=en_US.UTF-8
% U4 o1 U4 Z: _( a2 a5 j1 y6 F) nexport LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。
& }, K( X- r9 z$ U3 D. u' K但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?2 ^! c1 S+ E d
于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:4 a( o' y* Q( j! I- w
Recipe: gitlab::database_migrations+ A7 L3 S- r! [4 H5 i
* ruby_block[check remote PG version] action nothing (skipped due to action :nothing)
$ b$ X% Y: m/ |8 [# d0 b * rails_migration[gitlab-rails] action run
- H/ B) Y8 |' g- n * bash[migrate gitlab-rails database] action run6 N7 R6 @3 C5 N. f+ q
; C# f+ f* |# @3 l& R
================================================================================( M, S0 u/ X6 a4 i y& C, t
Error executing action `run` on resource 'bash[migrate gitlab-rails database]'" F/ I4 q% y3 X( a6 d9 S) L
================================================================================) D/ J$ t! g$ F5 [' i2 _+ Q
3 k# @8 a; U @8 P* A1 E Mixlib::ShellOut::ShellCommandFailed
" b( X. V% M( j o; S$ q8 N ------------------------------------0 w' C; w& R9 m* Z5 i: i" J
Command execution failed. STDOUT/STDERR suppressed for sensitive resource
+ h; W/ `8 p* \4 ?& N2 Z $ f$ Y" R- e, E& \
Resource Declaration:
# b% U+ s8 N0 L ---------------------
6 d9 v3 o/ d7 W% n suppressed sensitive resource output
, ?( l Q0 R' J' ? / s0 m! n0 a+ Y2 n* h
Compiled Resource:4 c) \. E7 T2 ]9 h
------------------
2 H& d$ S1 z- }, G. n s% ^) E7 l# j, R suppressed sensitive resource output
( b0 Q) H( ~5 c . V( k2 [" z9 i8 ~) Q
System Info:% L9 r1 h* t* b1 e2 G0 u1 S, P
------------
X! k/ F# X9 U# x: T( s chef_version=15.17.4
$ O0 j5 a1 z. }# H3 z8 I) v platform=ubuntu
( Y8 l2 F! k c3 t platform_version=20.04: j) m1 G, t5 D( B! W2 a8 N% ~
ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]3 z, ^1 `5 z1 X: F4 x1 @
program_name=/opt/gitlab/embedded/bin/chef-client/ M+ y5 T9 @0 k$ ^9 c
executable=/opt/gitlab/embedded/bin/chef-client# x1 v' ?0 y! |0 {# t$ y
7 U$ `2 ^ F# ]. A
2 N0 l' l1 _& F o G1 I ================================================================================
# M& p( l& _8 a/ ]% L Error executing action `run` on resource 'rails_migration[gitlab-rails]'0 u. j; N( r, S$ S
================================================================================9 `" b: v3 q6 i
) G# t) L3 T$ Y9 n7 Y& Q
Mixlib::ShellOut::ShellCommandFailed6 H# G# h* [/ R; i
------------------------------------7 U% r& y- Y( |" t4 _4 W' ?, Q
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
& t- p6 l) C# `5 {+ m. {) J 7 T% a4 M# ^+ x! r" K4 s: N
Resource Declaration:
% M$ Q6 V9 N1 D& U/ S4 M4 T ---------------------
& t0 a" S/ M N4 p& P # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb3 Z3 L3 r+ j& x6 l3 k
( Q2 C4 B. i; _! z
51: rails_migration "gitlab-rails" do
% f! k& K) W1 K9 [9 K) {* J 52: rake_task 'gitlab:db:configure'
2 X/ F c# X# d0 M8 h0 @2 z% ] 53: logfile_prefix 'gitlab-rails-db-migrate': X; E+ [3 O8 @. X2 Z% w6 n5 f2 I
54: helper migration_helper% @8 H! t* d. \2 R4 }
55:
# r+ g: O" m" v 56: environment env_variables0 C$ v3 g% h- E9 w" {) T
57: dependent_services dependent_services% p3 q9 d8 b) z% n" I/ Y' j! _
58: notifies :run, "execute[clear the gitlab-rails cache]", :immediately" ~ h% g4 V! Q0 q: k% n
59: notifies :run, "ruby_block[check remote PG version]", :immediately$ D) k5 z* P6 g9 M
60: ?* R+ A4 e4 X
61: only_if { migration_helper.attributes_node['auto_migrate'] }
) j7 w0 G+ F* H o, E 62: end
c# ?2 Y6 N- |
1 A3 n P3 c. h: o. G Compiled Resource:
2 O4 x( B* }0 n7 x' z& I; W" V ------------------
4 X6 T+ G" a [ # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'& i' _2 O4 x" Y1 a; p$ f
* H7 ?% i' Q1 i! N8 T rails_migration("gitlab-rails") do
# z, `. X! t. d- w action [:run]" ~3 P2 U' r$ j7 ^% g8 n4 J4 W: g" L) y
default_guard_interpreter :default, z3 s0 p9 n7 K
declared_type :rails_migration! V; ]# k0 n. i9 u1 b2 C
cookbook_name "gitlab"
1 w9 N) _ T. G recipe_name "database_migrations"
* a/ j" i5 s5 o+ D- Z6 S' t) t6 i rake_task "gitlab:db:configure": @+ K! ?7 Z7 m6 ]' e* o
logfile_prefix "gitlab-rails-db-migrate"4 y1 }5 p8 [ W6 X" e7 q
helper "*sensitive value suppressed*" `8 c9 h- Y9 i" o- R
environment "*sensitive value suppressed*"6 j$ V' x2 Z8 E5 g3 B
dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]2 a% r) K b" c4 I
only_if { #code block } B0 r9 y J& L+ u
end" w- M# V8 p- \8 R
L% ]' u, g) G! t System Info:
* r, z0 U0 P ~. X0 X# S ------------0 ?1 V% ]$ r8 M
chef_version=15.17.4
" {" ~1 o7 F1 `4 f( j platform=ubuntu0 h; `) J5 ?5 e$ M0 K
platform_version=20.04: s' n- [+ V& K* W& }$ h
ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
7 e$ B: ?9 |# }6 s Z: G( j& z program_name=/opt/gitlab/embedded/bin/chef-client
( B3 o- w3 {2 p ?( ^" X) ?+ V# f executable=/opt/gitlab/embedded/bin/chef-client* p: }5 b: w+ m% ^+ G
4 t2 M4 r( u9 ^' h2 b" z
Running handlers:7 V& Q4 t% b {: f" g: t
There was an error running gitlab-ctl reconfigure:0 C3 i" v! m; H- ~' V* u
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
: t7 {# c U/ y+ TRunning handlers complete
; y! R- b- W0 \5 FChef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为: g9 E! _! k3 B1 C" ^" J0 x
1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;5 O+ j4 ?" e' Y/ j ?( x
2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;' E. J# l# I, ~& p% b
3. 再次运行 gitlab-rake db:migrate,确认不会再报错;: o% j+ S' @- y2 W4 U @* b# P
4. 运行 gitlab-ctl reconfigure;8 s; V" M% P) ?/ h
5. 重启Gitlab:gitlab-ctl restart。
& o' O ] y- { ~, m需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。
5 b( z6 Q$ v) Y. F参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated
9 F! b8 c0 a, q' h# B2. gitlab-ctl reconfigure failing due to migration issue' H% Y" Z7 V- H* f1 T
AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2) |
|