|
|
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
) G: j6 ^$ ?; S; v4 Z( P' y7 ]登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。! e& M9 W6 ]* t/ g) X' e$ o7 ~# A5 B3 Y
运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。
5 r6 ?$ O4 D' Q9 o! V) o3 }接着设置语言和本地化设置:. O8 Z0 c! l' l6 L9 }1 Z
export LC_ALL=en_US.UTF-8% U$ S# K5 V8 k$ O6 I! I8 K
export LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。. p: @/ X/ r \! U4 S
但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?
% a" V2 u0 T7 T0 L于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:
$ `9 C' C ]3 Q$ LRecipe: gitlab::database_migrations6 \; z$ x9 [- r6 N
* ruby_block[check remote PG version] action nothing (skipped due to action :nothing)
3 B( s% @: Y! d8 U * rails_migration[gitlab-rails] action run; a* p# g& _1 @4 R
* bash[migrate gitlab-rails database] action run L: [; C% i. k& x
& R, I) D6 C- o7 D5 T" a; o/ e ================================================================================
5 F2 X5 e% k. p- D/ i1 O; I- ~! C Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
! I2 M9 u8 }1 G' D/ t0 X4 V ================================================================================
V2 t" E2 ^2 X. L% N, s
8 @: A2 t8 V7 P/ p; q Mixlib::ShellOut::ShellCommandFailed% {& p; N5 c! C+ ~
------------------------------------
, D$ r1 Y5 {6 o1 b Command execution failed. STDOUT/STDERR suppressed for sensitive resource
! [9 y( Q" m P; y3 Q 4 e6 P x* _+ M, H# `6 ?
Resource Declaration:7 x0 i* y7 H( O r8 Q* g$ N
---------------------: o' `" w2 a1 i! @% X5 I$ D6 t
suppressed sensitive resource output! N' t) g; l) C1 b: U
1 N! `5 g0 \9 X3 @! u( W
Compiled Resource:
. u/ y' H' t% @! Z/ v' X ------------------% [4 G6 U2 L A! X7 J, L
suppressed sensitive resource output
* n: z7 Z& R4 f3 I# z7 f
, H/ S. ^; E: @% ?$ | System Info:
- ^' @, H# N+ `3 F# t0 O' X) ^$ P ------------
4 E+ c: d8 x3 s chef_version=15.17.48 l9 V4 P/ y4 t( h: n
platform=ubuntu/ q" v6 p& C, N* N# _& c1 o# ?
platform_version=20.045 e- E1 v. b1 O# a$ L
ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
+ f/ s' W3 E' m, v program_name=/opt/gitlab/embedded/bin/chef-client
; ^5 Z& }6 H" O executable=/opt/gitlab/embedded/bin/chef-client1 c) _% m% N7 d7 X& y, g
: v" S* N! Z9 }- M& C. c2 b* a
6 S1 f; K+ s+ Q O1 b( E! X
================================================================================: ]4 I( ?$ S% ~
Error executing action `run` on resource 'rails_migration[gitlab-rails]'5 Y$ o; [2 f U; r, Q
================================================================================' B4 {* {7 M- d6 D" U
[) l; d' u- \5 O+ A5 T# f) A/ z
Mixlib::ShellOut::ShellCommandFailed
- H/ C e, M! e2 e7 N) _0 E8 Z ------------------------------------
3 c! z! Y- \4 j+ L8 J 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
! b, Y n" v7 F4 W 2 t& r+ X2 h3 E1 B0 y
Resource Declaration:
i( a1 \2 F. [6 P5 [ ---------------------
$ ?/ b) ?5 |/ V- h # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb" L4 n! K4 m) Q, L. k
3 h( s X1 }9 @3 X4 F& W) L
51: rails_migration "gitlab-rails" do# I) e: j: e% F! s/ P( H8 i8 k7 \1 } ^
52: rake_task 'gitlab:db:configure', x) M7 [* P: a# [
53: logfile_prefix 'gitlab-rails-db-migrate'
2 @) Y" O- @# Y4 e/ p 54: helper migration_helper; r! n8 i6 p) c1 K
55:
+ m3 N N+ a0 L, ] 56: environment env_variables
0 B9 O" y! _8 E b 57: dependent_services dependent_services
) z) t* {8 [; ~ 58: notifies :run, "execute[clear the gitlab-rails cache]", :immediately
5 E, u" |- P( x" A) L' W 59: notifies :run, "ruby_block[check remote PG version]", :immediately8 V0 i1 ?; C( X; s
60:
" Z- `" x) _2 c/ D: b3 ^, Z 61: only_if { migration_helper.attributes_node['auto_migrate'] }) k1 g% B9 G: K* h% L0 u4 m& C
62: end" Z5 ?# S; e2 h) m2 _+ q
2 i% _/ N" s0 O: K5 K) T8 A$ e: ~
Compiled Resource:
" `5 f/ a" ?8 ^( D- R; |, I ------------------9 C8 v# _1 G1 \ F+ Z
# Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'
' D* S# u" U7 D/ P9 A& \
- P1 z" n6 l* }/ T9 U @9 e rails_migration("gitlab-rails") do
" C$ h4 Q* \, m6 |; U0 @ H action [:run]
! I z5 U) l1 {8 ~ default_guard_interpreter :default
+ V% M+ C) }9 `% @- j declared_type :rails_migration
0 V1 j5 n- r% X1 X3 P8 h* M cookbook_name "gitlab"; v1 y7 z( X: o1 N$ K5 S- y" o
recipe_name "database_migrations"& F* }8 D) ~9 A2 u) A. l
rake_task "gitlab:db:configure"
" c. s7 B5 i/ Q" y! W logfile_prefix "gitlab-rails-db-migrate"
4 k6 d7 s4 a1 e& l8 X4 x2 ^+ q, } helper "*sensitive value suppressed*"! x2 ? r: @% l4 m# d1 a
environment "*sensitive value suppressed*"
' r7 k' o. c2 \ dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]1 i0 O$ E4 J. m& m# { f
only_if { #code block }" x7 @( E- l/ p* S5 c' T, }( _
end. b# Q/ X5 T+ m6 X2 C
f0 b+ K! i- P9 t9 u O0 W System Info:
4 @9 g! v% Q- f: h* [; F ------------& N8 z- T2 E$ m
chef_version=15.17.4
- ]% b+ A# O5 p' i+ N platform=ubuntu' W. Q& s! p3 w( v7 ]
platform_version=20.04& N' y- w/ u, n* K
ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]6 x) n2 E/ _% {; l( ?
program_name=/opt/gitlab/embedded/bin/chef-client: z4 b3 d- _' r
executable=/opt/gitlab/embedded/bin/chef-client
1 w7 \1 o* D" c. D$ @$ |* t" }* x * H" d |- ^# v* V- h$ X2 S
Running handlers:6 K4 C5 S9 g& w! i
There was an error running gitlab-ctl reconfigure:
n, e0 w5 {6 _: [$ [9 orails_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 Y7 Q) U$ {) ?4 [
Running handlers complete
# t' V, d: h/ P: e8 [2 p0 dChef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:. d/ t4 {7 u4 k) S
1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;
5 C, n- ]9 T! E4 P* g% G2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;
, m: c1 C9 F6 e" M8 z6 D/ |3. 再次运行 gitlab-rake db:migrate,确认不会再报错;
5 ?6 j+ D E3 r& ~0 s: p4. 运行 gitlab-ctl reconfigure;
1 ]- K$ m$ J. e* [5. 重启Gitlab:gitlab-ctl restart。
, }; M- a4 r% E7 I需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。+ B- |. W8 K" s! |
参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated; S& f; ]6 k; |% q' K/ R) V' S( Y
2. gitlab-ctl reconfigure failing due to migration issue9 u! [, t6 l2 Y3 ^0 F1 D
AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2) |
|