|
|
发表于 2022-9-11 20:40:14
|
查看: 1893 |
回复: 0
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
8 L/ u$ t* K1 l+ f: I4 k# b0 O/ \4 j登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。
1 [+ x4 ?2 y$ R w, v运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。0 e- F( H& E5 c; l8 E5 ~# ?3 @" @
接着设置语言和本地化设置:
+ d7 S7 o- y8 P Zexport LC_ALL=en_US.UTF-8
9 J- U" U4 G# }7 Z! R& `- Gexport LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。
5 r* r4 ^% R8 o% b" K; F但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?
g' E, v3 C* ]1 s& w0 }; Y, x于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:. R& L8 T7 p9 V$ a+ @! j
Recipe: gitlab::database_migrations$ [$ c4 w! P/ f4 L
* ruby_block[check remote PG version] action nothing (skipped due to action :nothing)2 i; {3 ?6 `8 p! X+ ?! x
* rails_migration[gitlab-rails] action run
( D+ F4 o9 g0 l1 p. z* T S+ q * bash[migrate gitlab-rails database] action run+ |- Z/ B$ O& Z
, Z/ |. U) M5 |* K7 O ================================================================================( T: q/ Y2 U; z- o
Error executing action `run` on resource 'bash[migrate gitlab-rails database]'4 {& r( D2 P3 {$ p8 m
================================================================================
; Z0 E4 J# z( R% _; z
- `3 Y6 u" x# g% O$ s6 E/ Q" B Mixlib::ShellOut::ShellCommandFailed) K2 g. S6 q$ w8 F* E
------------------------------------
1 n# t& j$ v3 {0 E Command execution failed. STDOUT/STDERR suppressed for sensitive resource/ }! b3 O8 a# w. i
' H. a. V4 Q* k/ f3 R4 I Resource Declaration:" D# A; Y, |# `- F
---------------------
' {( |( b. X3 u8 k/ P# t; y" d suppressed sensitive resource output
) O. J0 Z% N' N* D3 s: o - Z2 L9 n; N4 n& u
Compiled Resource:% A0 @; l* p4 h& p. m4 Y' N+ D
------------------
- g6 m2 I1 b0 H suppressed sensitive resource output
* X7 @( t; _% i7 M
7 s+ a* t) Y0 E$ k; C/ h System Info:3 F3 M8 X% j/ \1 `5 t% X7 ]
------------* H# R$ J; W0 i
chef_version=15.17.4
* P+ h; J; _$ P m/ t X1 R5 R platform=ubuntu' R( h6 I# y5 p
platform_version=20.04
/ J/ I. G( N* {3 X& c& A, a ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
3 N3 S. [ m6 P% D program_name=/opt/gitlab/embedded/bin/chef-client0 W! m" b9 \3 x0 w6 d$ E' t
executable=/opt/gitlab/embedded/bin/chef-client
$ ^& C4 h& x( M& w5 K
6 `* ]& J5 C/ l1 Q/ A
- V; c! Q; n- Z h1 { W1 S$ M1 j: } ================================================================================
6 l- u* {/ U. @" C( [ Error executing action `run` on resource 'rails_migration[gitlab-rails]'. L; L" g; C7 ^0 M; T/ D
================================================================================# r$ w$ C+ |! `; L
+ S6 K. h, L3 b9 }) B/ Z; n Mixlib::ShellOut::ShellCommandFailed; X% O1 R0 n s; w1 t
------------------------------------: [+ ^1 Y8 ^1 g/ [9 m) K2 d
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
: x" E$ c4 B+ ], ^% X# I 0 n9 d! q# O9 `
Resource Declaration:9 \# W1 }. l0 S, N- z/ y
---------------------
6 S; T) A& R% Y1 }0 P. [% i9 Y& g1 a # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb
" i$ D' W2 K7 @9 T! p7 `' \ 9 c5 M4 ]& n7 ^/ k4 h0 j; k
51: rails_migration "gitlab-rails" do
7 \! |& t3 h- q3 |. e! @ 52: rake_task 'gitlab:db:configure'
( E+ D0 y. |7 u, D' N) L/ ~, Z0 |" w 53: logfile_prefix 'gitlab-rails-db-migrate'' ` j4 \- J- e/ v$ y e4 R
54: helper migration_helper3 P8 r; b$ W, O4 A* i, [; V
55:
1 i) ?3 P3 _9 u. P, o9 h 56: environment env_variables6 o# M' ^- c( X9 e& ~. z
57: dependent_services dependent_services" N, M0 m% t1 O1 D
58: notifies :run, "execute[clear the gitlab-rails cache]", :immediately
2 `) n Z4 }. d2 u( q! c 59: notifies :run, "ruby_block[check remote PG version]", :immediately: s% W- E" L# Z
60: / a4 S! R# h+ c
61: only_if { migration_helper.attributes_node['auto_migrate'] }
+ X, r0 E1 b. c( W5 X' w 62: end& I" x' }9 ~7 w) n
. o- l( F g% U
Compiled Resource:4 y7 I3 P8 }8 b3 Z$ w
------------------; V6 T- R9 S2 }; Z3 z% T! E7 z
# Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'
2 F2 R: [# ?/ {* `4 Y, e
0 D9 d1 e( N7 x- I w% N rails_migration("gitlab-rails") do( p5 _# @" V* M c$ ^
action [:run]
# t( i$ l8 Q# I8 N default_guard_interpreter :default
: W/ u4 k9 V! X+ l declared_type :rails_migration" g! G2 u* E! a7 @
cookbook_name "gitlab"
! ~. d) g& A; ]. V recipe_name "database_migrations"
. F: E( ?8 c" Q rake_task "gitlab:db:configure"
1 W: f Y3 m# W( {: P logfile_prefix "gitlab-rails-db-migrate"* m0 u- [* K) A9 E1 v* g& w
helper "*sensitive value suppressed*"% U1 j& ?9 y }) Z/ z
environment "*sensitive value suppressed*"
% A5 C1 r' w, @3 ~0 d2 F2 | dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]' v" r H$ V; O ?; `# H' r% |4 k
only_if { #code block }; v9 N) D% t5 P$ ~7 N
end% q3 W! [4 z- J! T. g$ r4 x0 V
* }. Z* X$ c+ Y9 \4 a7 ~' e System Info:
' F R2 M. z" u# M# M i K& Y1 Y ------------6 f5 f( X' h! T; G
chef_version=15.17.4' B" a ~* A5 Z
platform=ubuntu
5 P; S Q% D, ?3 W platform_version=20.04+ e* E7 T7 N4 F' C5 Q- r0 c8 k% \
ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]8 ~# \# u: x/ _8 t4 O
program_name=/opt/gitlab/embedded/bin/chef-client
7 z* W) I! ]5 `$ o/ i executable=/opt/gitlab/embedded/bin/chef-client
* N- R, L: |9 g1 ]* `, W 8 F& Z% P0 \* r& u% d& D& h
Running handlers:9 j) i; J6 F1 V& o+ O; b
There was an error running gitlab-ctl reconfigure:
( c- X$ x+ `, W* D. Frails_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* s/ n( P& p8 p( n" }" q: g8 D! F
Running handlers complete( J% h+ H4 Y6 |) ~& ^
Chef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:! p7 }3 l' f, V* n; ~: s
1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;4 x; v; H8 E V0 a9 g( b: o
2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;$ E/ e, {0 u# Y8 ~0 {
3. 再次运行 gitlab-rake db:migrate,确认不会再报错;4 i9 m% w: Q4 Y3 \& p, t4 t
4. 运行 gitlab-ctl reconfigure; w: r8 q; s2 W$ l
5. 重启Gitlab:gitlab-ctl restart。0 R5 j$ f, I) M; P
需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。
* b8 Z2 U- `5 ^- w4 K C3 y参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated
8 e) L! y) x! w2. gitlab-ctl reconfigure failing due to migration issue1 C6 r- l8 T0 T& f# f
AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2) |
|