|
|
发表于 2022-9-11 20:40:14
|
查看: 2100 |
回复: 0
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
+ C" H& _7 R6 ]8 L/ q& D登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。
4 i0 y* f& F# x( g运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。
A4 X7 w3 K H接着设置语言和本地化设置:
V% l% l% h2 [export LC_ALL=en_US.UTF-8" `/ M' d( B4 Q4 Y6 ]* I
export LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。
' W0 z! N, g6 s/ I7 n; V但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?$ [, I. z( i: x
于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:1 J8 G1 }# J6 h3 ?# ~
Recipe: gitlab::database_migrations' }2 l+ G8 e# r- a- B
* ruby_block[check remote PG version] action nothing (skipped due to action :nothing)
5 |3 k* n2 H, |3 @* a; F * rails_migration[gitlab-rails] action run6 s1 r- j2 O r7 V1 v2 Q7 ]
* bash[migrate gitlab-rails database] action run
; m% y; q4 \1 `1 t- X
+ M) [. c- H: s* i3 c ================================================================================
: ^) V$ v% h$ Q. I Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
& p3 c2 Z5 i8 k! r4 O1 ` ================================================================================
+ t {# F3 ~) b4 Y8 ?
% P7 p' \: @+ w0 N: p Mixlib::ShellOut::ShellCommandFailed2 Q! u9 n/ B& b1 g
------------------------------------
" b4 D' T# L9 t% q% W7 ` Command execution failed. STDOUT/STDERR suppressed for sensitive resource9 T' C7 k) }1 o9 ?0 M+ n u
! x% L" u0 n( n) d& ]2 X
Resource Declaration:
7 P& U2 o3 y. O$ J5 U9 ~6 N5 o ---------------------
( O* A- o, I2 K: Z; a: ~ suppressed sensitive resource output
5 z+ O+ P2 |, I% l) b ; h& {4 X& k) P# H! p
Compiled Resource:8 n3 j. r% U, J1 L3 h$ |8 N( h
------------------ P2 i- ^1 p1 d7 c$ o
suppressed sensitive resource output9 j" |( z% n, |4 v- k
4 x& C8 X- m, A: X3 ^/ q4 p3 R2 I System Info:8 X1 j; ]! m h& y2 ~' s
------------
# }0 [! g( |# w chef_version=15.17.4
9 A3 Z* h! E5 }2 n platform=ubuntu" l y* s" Z1 H c& H( O. z) O2 }
platform_version=20.04: k+ {6 S* [' G( d6 l& Z- _3 }
ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
; x: R8 n: P7 |. q program_name=/opt/gitlab/embedded/bin/chef-client
) g$ n; ^0 L4 _. u& R) [8 z5 q executable=/opt/gitlab/embedded/bin/chef-client
) v" V0 d, A) u/ x3 i# {4 l 6 p: ~1 {! l/ k+ ?! k9 Q9 h
' u7 s$ J2 h4 k7 j, ^# S4 O: E
================================================================================( M: a" K+ N/ ?( ]9 ~
Error executing action `run` on resource 'rails_migration[gitlab-rails]'5 V" y( t: ?7 f
================================================================================
T% d. l* F0 G' a, X$ R
+ U0 L! b8 k& r% F7 y1 \7 O( w5 A Mixlib::ShellOut::ShellCommandFailed
1 m( m1 s' N6 x t e; u0 h7 T ------------------------------------1 J# `3 n2 t; V N1 g0 R* `( n9 y" u
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
5 N) Q+ Z4 W, `* w3 n( `
# z+ J+ a1 d, l# j Resource Declaration:
0 T. o' p( w# F! L ---------------------# J5 e8 j5 |; L) }
# In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb; \! ~/ ]. i9 ~3 x
9 y. r; A% ]$ h 51: rails_migration "gitlab-rails" do
' w; r9 x/ u0 o* {" X& s 52: rake_task 'gitlab:db:configure'' y& I$ {8 ~5 @$ m) ]3 j5 q
53: logfile_prefix 'gitlab-rails-db-migrate'4 s1 f" b7 K- A% a1 F0 \$ m
54: helper migration_helper
5 V/ y# v, x4 Z6 Z2 s- U 55: : D' [+ o5 W- }8 Z3 l6 o
56: environment env_variables. g: [2 U, c2 f( j3 N7 P
57: dependent_services dependent_services
# X. m8 u P: @: x; g5 g 58: notifies :run, "execute[clear the gitlab-rails cache]", :immediately9 ?2 X- D6 v0 r1 {0 Q7 f+ X! k
59: notifies :run, "ruby_block[check remote PG version]", :immediately
8 S; k" F. R+ m$ R0 c/ M* s8 o H2 z 60: 4 A7 d1 w4 [; H ?
61: only_if { migration_helper.attributes_node['auto_migrate'] }
; B; J7 t4 W0 f3 z' P& _4 M* M) K 62: end: l' q; Z) Y- j) o( D% d
0 w2 X/ s% T" ~. Y" K8 \) H Compiled Resource:
% x, e# m- u+ J4 N, c) v ------------------- _4 m" c% W x0 f/ M4 s. X$ C% n
# Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'
% M3 G4 s3 U& A! |6 Z
# v* I) _$ c0 O8 s rails_migration("gitlab-rails") do
+ l' ?7 N9 U2 A5 u action [:run]0 r- |0 T4 j9 b% t9 {& s' h* E
default_guard_interpreter :default
; n6 L$ Z* W9 A C: H. s declared_type :rails_migration
% \6 @5 V# s' ]/ b6 A0 [9 p L E cookbook_name "gitlab"* W# P V! p) y
recipe_name "database_migrations"2 m7 S9 @! I& o9 Q8 H
rake_task "gitlab:db:configure"
% w, F8 m n. \, a: T logfile_prefix "gitlab-rails-db-migrate"
' J- z& L) L) x0 p helper "*sensitive value suppressed*"
3 w6 d4 Z) \' N: g! Q environment "*sensitive value suppressed*"" O( e- _. a$ k! P; Y4 R
dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]
1 v9 R: j; M% Z; j, X) c only_if { #code block }$ N, s( G" F) d3 y, R
end
) d$ X# F1 R; [8 z ! V6 s: ?* v, h+ u; y1 [, f
System Info:' @2 b1 @, Y1 }9 w/ b* |
------------9 ?: h4 W, O6 b) m& ^
chef_version=15.17.4
! K- s' e: o, t3 I+ i platform=ubuntu( z# o# {, ^; T
platform_version=20.040 ]; b; n& R7 c
ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]" ~- K. g+ t5 Q5 m" p( z( E+ s
program_name=/opt/gitlab/embedded/bin/chef-client
3 X: ]4 O. e: K executable=/opt/gitlab/embedded/bin/chef-client
* ?+ d. ]0 ?9 `( b5 R
0 w, m8 n/ ~, @2 YRunning handlers:
8 P7 Z2 c- a! x8 FThere was an error running gitlab-ctl reconfigure:( Y5 i+ s# u0 B- G4 Q' h
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
: ?9 _) L- \+ p% f+ ZRunning handlers complete2 r/ R: B9 x; z3 i" n: F! v
Chef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:
& K( G6 R8 J1 \* Z% n+ C k1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;
r7 d" |+ K2 l ^: Q. f0 _5 L7 u+ C2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;' [% {- I3 X' m0 r
3. 再次运行 gitlab-rake db:migrate,确认不会再报错;
# T0 G! @. b2 p' b% e4. 运行 gitlab-ctl reconfigure;
- l( N9 s, H1 J7 B3 W1 `3 P5. 重启Gitlab:gitlab-ctl restart。% ? }7 K. S H6 }( W
需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。
3 J1 O H5 d( t( ^5 W6 }参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated
- n: E Z* r4 P2. gitlab-ctl reconfigure failing due to migration issue
7 M0 \; M, L' wAD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2) |
|