|
|
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
) u, U, O+ E- y! E' T7 o3 @% r登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。: R- D2 p3 Y6 R+ g) s& V
运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。
3 g& |" a% }/ E1 i7 h0 M接着设置语言和本地化设置:
3 e" Z/ E9 R6 i4 R) V3 w0 Eexport LC_ALL=en_US.UTF-86 b7 d& ^; z1 B9 `$ l
export LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。
4 h% x' a$ f; h但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?
( t- n- \0 ^- j2 H6 U6 D' y- a$ W于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:+ _ w1 n& o( y- ^
Recipe: gitlab::database_migrations
: e) B, i+ K8 m2 G8 c0 |' v * ruby_block[check remote PG version] action nothing (skipped due to action :nothing): `& s5 O) K m ~# N3 v5 I# M, C
* rails_migration[gitlab-rails] action run% a# o1 F4 q3 f k( ~6 D
* bash[migrate gitlab-rails database] action run
; b/ r: [ G0 \' B9 x
' ~; H# t! e: u ================================================================================# @$ P7 k" a/ c8 W( t2 u: }1 w% s
Error executing action `run` on resource 'bash[migrate gitlab-rails database]'% v. x" c6 }! K Y
================================================================================
- D) d- O; ?, n: K' D% Q
9 _7 z4 m- i; K1 U" c Mixlib::ShellOut::ShellCommandFailed
; S {/ x6 s$ _5 v9 J; Z ------------------------------------2 A( }% Q$ z: m& ?
Command execution failed. STDOUT/STDERR suppressed for sensitive resource& B5 W* t" x; p$ s a
0 w! e# X8 Y3 Y- ~
Resource Declaration: M9 R+ F1 W1 m8 l7 t1 c' f
---------------------
) `, _* B- g" ? C5 n& c suppressed sensitive resource output
" E% r2 G& K7 {! p 2 i3 y! L, B' j* _+ d
Compiled Resource:% ^4 J; N6 b3 R, [1 y/ s
------------------
5 p" E( r! x$ S* z$ |8 x& X! D suppressed sensitive resource output
: i5 E6 j3 l) c9 I1 \6 @" N( M d4 _8 u " D' W; K& E. I) n8 s6 e& x
System Info:
; @1 h/ A8 y; @3 _! _. V( A- P ------------
% [8 F: e6 M4 [8 v; k7 d I chef_version=15.17.4( F& A( d% o" d* m5 F' h
platform=ubuntu
/ M+ P( r+ e- v' T7 n platform_version=20.04* A9 @3 r$ G" E2 n0 v9 K" B% O
ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]' s* u* [6 W0 ?, J, M9 i# b6 _/ t" m
program_name=/opt/gitlab/embedded/bin/chef-client
: q% T1 S4 [9 m+ r ?( m1 z2 A/ p executable=/opt/gitlab/embedded/bin/chef-client6 _$ V% ?+ \- H3 p9 p3 u
o) ^9 N+ `$ R9 v
7 n# j5 Y1 \$ J6 F3 v) X ================================================================================
8 x6 t/ f0 s4 r1 _ Error executing action `run` on resource 'rails_migration[gitlab-rails]'" K, H& u2 R, c+ `5 B2 g
================================================================================
9 Y- k* s7 e2 o; b' | w8 r9 {, }; U
Mixlib::ShellOut::ShellCommandFailed
6 i: i, A0 ^. h+ e a6 H& V ------------------------------------
! s# A+ T& |; A# O5 w 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( M% T/ V( b5 W, k % n; w$ W" p( M5 j& t
Resource Declaration:$ \8 Z* C$ q7 z3 X0 m
---------------------
# N5 _9 R: n& e- a6 O # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb
$ \, V- }: x% P* A6 [: @7 W" } t $ c* V3 Y; A( v+ F& t
51: rails_migration "gitlab-rails" do# L! z8 e7 S# E5 [2 H, b2 c
52: rake_task 'gitlab:db:configure'. V" H5 T% I, m% o& Z
53: logfile_prefix 'gitlab-rails-db-migrate'2 b7 m, `3 Y7 t& h( G
54: helper migration_helper
8 ]! h3 Y/ A1 B 55: ! R& Q, O0 D" a6 i$ p+ C" Z, p# Y
56: environment env_variables
4 ]; Z' A% H& G7 Q 57: dependent_services dependent_services: F& F' Z4 p0 p! `2 u3 j
58: notifies :run, "execute[clear the gitlab-rails cache]", :immediately5 W; ~: S5 X. o) f' \
59: notifies :run, "ruby_block[check remote PG version]", :immediately' I* b) q* i5 e$ @, s
60:
$ N7 _( D9 Z8 { 61: only_if { migration_helper.attributes_node['auto_migrate'] }
8 o! x& _7 i2 o- c- R& x$ l 62: end# R3 n' @4 p, M8 F7 [- v
( w7 P' m) |" Z2 @8 @ Compiled Resource:
1 W' x8 Z9 Y5 m# N/ A- N7 v ------------------2 w4 U& m' g1 T- O. L! i4 I! f
# Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'. j% l4 \: y6 g$ t3 A# A ]1 |6 ^3 l* r
) D+ V4 N5 I% l' Y; z
rails_migration("gitlab-rails") do( P9 f0 t( `9 J; T
action [:run]
8 B% o7 U) W/ B. i2 w1 X9 v default_guard_interpreter :default
+ O% a8 Q1 ]- k4 G4 |+ ]9 L- C declared_type :rails_migration7 K) b5 G" ~5 X
cookbook_name "gitlab": W! e4 o6 `4 Q" H8 [' D: N7 g
recipe_name "database_migrations"3 O1 \7 @& m& K& e8 s, L
rake_task "gitlab:db:configure"1 ^. s w4 N* f2 H
logfile_prefix "gitlab-rails-db-migrate"* [/ c6 h- W( D* e
helper "*sensitive value suppressed*"
8 ?( R- k' f; A) S environment "*sensitive value suppressed*"# w& b; @; p) z3 x/ l
dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]
& o( ?0 }; Q( e) t' @ X only_if { #code block }
2 |! F6 l4 D' \9 H$ q/ C* P end) [1 S. z* w y- C5 V3 y( j7 M i
|4 h/ L- @9 ]" d' T- s
System Info:
* g) V% ]5 \9 Q: s# Q0 ? ------------! T7 h. F1 K! q$ [( G5 y
chef_version=15.17.4
. r0 [. d( t0 E O! V! ] platform=ubuntu
0 E; j* @+ I/ W; _ platform_version=20.04+ Y3 \" m1 q. r3 h- M
ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]. }+ ?4 }, y: f3 A1 n6 d( Z
program_name=/opt/gitlab/embedded/bin/chef-client
0 ?6 ?: t! C) Q executable=/opt/gitlab/embedded/bin/chef-client& N: ^2 ?, I9 T
' v& h6 d& y4 X4 A
Running handlers:$ h# p0 d x) z9 h" S% |' d
There was an error running gitlab-ctl reconfigure:
& @; W% L) X" a5 E, B8 wrails_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
% o0 y2 R0 D m2 J) _Running handlers complete
; e" c3 z1 n$ G& wChef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:
/ m' H0 y' n" C6 I, E1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;4 C7 ~' E/ B9 f9 S% j0 S4 ^, _ v
2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;
* P/ s* n- D" @7 x! ?* ?3. 再次运行 gitlab-rake db:migrate,确认不会再报错;
* E4 I/ c/ M. u" l/ K4. 运行 gitlab-ctl reconfigure;, ]4 g$ ]$ c" b5 R
5. 重启Gitlab:gitlab-ctl restart。
% {- s4 p$ K. |1 d需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。
7 ~; H' ^9 ?7 L, O$ V参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated
& m" O4 R0 n8 ~5 l: E! Y; _2. gitlab-ctl reconfigure failing due to migration issue7 e5 F/ V( R5 l$ w9 |
AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2) |
|