|
|
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。' y1 }3 G# B! i I7 f9 k
登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。
, ~3 M4 x/ A- P& N# i8 a/ J1 m8 R+ ]运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。+ j; ]/ \8 K5 s# A9 X
接着设置语言和本地化设置:
, U( G* f+ k0 x6 T* W4 Pexport LC_ALL=en_US.UTF-8
- ]; N; U* x1 ?2 E: kexport LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。% v' t' V( ~2 H* g: `
但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?
7 b; e: V( m6 a5 V+ e于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:* o% u* u4 r. T% i1 ]1 w
Recipe: gitlab::database_migrations/ h% ^: H8 _8 l6 e7 c. K( X
* ruby_block[check remote PG version] action nothing (skipped due to action :nothing)
! V0 M8 H: p3 _- E7 J6 [: u * rails_migration[gitlab-rails] action run
3 M8 [, r* Y" S* B# z$ H: _) W0 {1 a * bash[migrate gitlab-rails database] action run M: S, t2 o& A& Q$ e
* T2 G0 b' q4 q" x- O ================================================================================
5 r' _& r; k7 G- e* f3 j Error executing action `run` on resource 'bash[migrate gitlab-rails database]'$ w4 B Y9 U1 K3 V( x
================================================================================
; X# \$ O# Q1 w8 _( d * z$ ?/ W0 Q8 r: [+ D# G n; E$ P9 b
Mixlib::ShellOut::ShellCommandFailed. n5 A# A* K6 f. H
------------------------------------
& K R+ m9 r6 S } Command execution failed. STDOUT/STDERR suppressed for sensitive resource
' h# t: O8 M8 }3 m% U6 ?/ i , Y' h* B, V; A
Resource Declaration:4 o- ^( N5 w$ U! l) ?
---------------------
) ~6 B2 e4 b. O5 V. P2 B suppressed sensitive resource output
5 b( K: z V+ z; t ' D' g) U5 u, k" C" r; R7 P
Compiled Resource:& M$ K' F9 e8 Y$ D) e; G* Y
------------------1 D. T. A- p2 m$ T6 n; U
suppressed sensitive resource output
4 |; J c/ _- k x! S5 V ' w0 I% {: _9 z: z, P- Y
System Info:
- w% F4 P) ~; Z% g; \% u( s6 | ------------
8 n5 t6 Y" @- T# I9 g chef_version=15.17.43 y8 K* ~" C; K& z
platform=ubuntu
. m7 |! ^: S" t7 _2 I1 r6 s F q platform_version=20.04
" a4 B7 O; d1 M( Z6 v ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
5 `/ S8 x. X4 F3 [, _ program_name=/opt/gitlab/embedded/bin/chef-client
$ {* F2 B D6 G5 w& G9 t executable=/opt/gitlab/embedded/bin/chef-client! U# d. \ G g1 E. I+ A
" {3 W6 {0 Z' B6 S1 h% A" ^5 k# `
" }- ^' J8 r* _
================================================================================
" _ h; R# F+ h( ^% O6 g# [ Error executing action `run` on resource 'rails_migration[gitlab-rails]'
) Q* [/ \/ Z% O+ @ C M: C& F+ J ================================================================================
; @! D% [( R' q m " Y% Y1 I1 J- h% B$ a# K
Mixlib::ShellOut::ShellCommandFailed) p2 G2 L8 p* |6 N, ~/ ^
------------------------------------
9 i; n5 M' U% W4 w s. b+ H; f 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
% s3 g6 _- L% f K
5 i+ s' K- s: C% F2 L* ?( B Resource Declaration:( p( A7 A8 b/ n/ U
---------------------& H) b. \0 u+ P: x' k% L
# In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb
8 ]$ H+ R* K! x3 w+ k1 t & F$ \1 A9 N. z
51: rails_migration "gitlab-rails" do6 Y4 y7 z3 u8 Q/ i! [) f
52: rake_task 'gitlab:db:configure'9 N; T8 `% Q, \, g7 v% T" w9 I
53: logfile_prefix 'gitlab-rails-db-migrate'1 Y. d: p/ Z) [5 `. ?8 Y6 D
54: helper migration_helper% `0 f2 q' o' m# l6 g! a. g
55:
* i( S/ C$ V+ q0 `9 _ 56: environment env_variables. s2 j# `3 v+ m2 u3 O
57: dependent_services dependent_services
! ]: A/ r, H$ C; m! H( Y9 \" p 58: notifies :run, "execute[clear the gitlab-rails cache]", :immediately
1 Q5 a( M" Y7 x9 p$ x, c 59: notifies :run, "ruby_block[check remote PG version]", :immediately
! Z$ |9 Z; }) x' W% \1 n7 W 60:
3 m/ V ], I3 P/ ^ 61: only_if { migration_helper.attributes_node['auto_migrate'] }0 \& E* p# G- k( L- K" {( H1 F$ v
62: end2 n) \8 k5 a6 c8 c' L
4 J t ?& ]8 R! p+ G: \ Compiled Resource:+ y: m n& ?9 Q' T; @: G
------------------9 u3 W7 m# r2 a3 F! f0 d) I9 X
# Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'- w$ b: D4 t/ r+ ?+ Z
2 J5 y: R1 E1 I5 `! @2 a
rails_migration("gitlab-rails") do A) ?3 ?* A: l" H; U! D2 S% _
action [:run]
/ M, Y; a" E1 N6 Q2 P$ D default_guard_interpreter :default
- J( f; l: n# V" i* K declared_type :rails_migration
: r D3 A" |+ {0 C- V cookbook_name "gitlab"- X3 `, b# ~. y* k' s! v0 l
recipe_name "database_migrations"3 c s6 s/ _; r. }& R; l
rake_task "gitlab:db:configure"9 g* U# R( C \
logfile_prefix "gitlab-rails-db-migrate"; O! `2 o# I2 T7 m7 m
helper "*sensitive value suppressed*"
6 s X5 h7 s/ P( Q6 ~ environment "*sensitive value suppressed*"
8 d, c ~' b& k1 \# i; [7 j6 I dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]
( F. v2 k2 d) r( A3 ^% U only_if { #code block }: P% l/ h: d7 O
end
& h* Q1 c/ p) D. {! S
6 o& t' O& _4 |8 a# [' N3 o9 p System Info:
m B. Q3 Y7 ]9 H ------------
- z3 a7 I4 U+ p. u9 M chef_version=15.17.4
/ f0 s# c0 {4 O4 G. o platform=ubuntu
% i& ^) H- Z* S+ S platform_version=20.04. _/ \* C0 x6 u: d: q
ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]' p2 K4 V; p2 a; w% L( W
program_name=/opt/gitlab/embedded/bin/chef-client
. P1 i" H1 m' [9 I- I7 u, R executable=/opt/gitlab/embedded/bin/chef-client
( {2 O, v4 M: c
- J) B. U+ _* [% f, l% fRunning handlers:
# Q- w3 ?: o: n% S* YThere was an error running gitlab-ctl reconfigure:% A+ { R) b5 Y0 {* j* I- k) p
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 resource4 q$ O1 x# @# I7 {; {
Running handlers complete1 }# J ^$ T, p9 L
Chef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:
, l, q# R* K1 ^3 A ^& y' z o3 v1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;
) o! c" W- O6 `5 X/ G$ F2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;6 a' S8 `- H4 d" }% R, c3 J* z
3. 再次运行 gitlab-rake db:migrate,确认不会再报错;
+ Y* S1 ]3 b9 i9 M% D6 F4. 运行 gitlab-ctl reconfigure;' t1 C4 D8 o0 Z' ~+ R
5. 重启Gitlab:gitlab-ctl restart。/ B/ }8 o: T* O' C" g2 a( R# k
需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。3 O4 G1 q& ^5 J3 ^
参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated
( V r+ O, `7 S' I% b2. gitlab-ctl reconfigure failing due to migration issue+ ], d* \- K& z0 ~/ X8 R M
AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2) |
|