|
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
7 e/ a# E! C. s登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。3 s, `# o0 Z& u3 @. K2 B- Z
运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。
6 I! J* T) ^5 w/ |2 B# F `! H0 {' |接着设置语言和本地化设置:
6 F& `1 L3 z4 b1 Zexport LC_ALL=en_US.UTF-8& J5 h8 ?- ^; Q" L
export LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。
: ^1 c' l2 a& X0 u4 k' z8 O& O8 f但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?
1 _; ~* P: w+ R! Q' A于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:
7 M; K2 }/ R5 cRecipe: gitlab::database_migrations
+ j& v9 w( D- V1 n# C * ruby_block[check remote PG version] action nothing (skipped due to action :nothing) V* {! t. g% ^, Z! T4 I
* rails_migration[gitlab-rails] action run
' E/ F: I* [8 t/ Q * bash[migrate gitlab-rails database] action run
- M1 r) q7 |( x6 _( o$ F
" X) a4 U4 T/ }& s ================================================================================
' d! d3 s- j7 U5 F* D. h4 b8 ] Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
3 ~* i! I9 [' k0 v* T/ z" ~ ================================================================================
( \4 r- i0 c' s& o% W0 G # d; ?* F3 ~# u' E9 x6 |5 i' z/ x
Mixlib::ShellOut::ShellCommandFailed0 h8 s& Z. [( {- I+ H" m5 q
------------------------------------
7 e3 r4 `0 F- | Command execution failed. STDOUT/STDERR suppressed for sensitive resource0 ^% ~' S9 O d4 u0 u+ J
, C8 W3 V6 P0 X L1 w Resource Declaration:( D$ B+ n S& F2 p5 q
---------------------' V# D& x7 d2 n# a% S: w. t$ x
suppressed sensitive resource output6 E M( Z8 U3 N _
4 D% j# }4 N' t( ?; H Compiled Resource:
; `/ \. @) o3 p; m. S ------------------
5 ~1 t. Y8 {$ n, ^( @2 O' y o suppressed sensitive resource output/ ?4 ^7 f; D, u$ o" {4 }6 d( V
6 h$ x% P& Y T, K6 W
System Info:
2 b7 R+ ]: u" m$ T ------------
3 m: y' j) M, \* H chef_version=15.17.4
- k3 _8 r4 G6 }0 ~ platform=ubuntu. A! j% b. S- m
platform_version=20.04
" `$ |& G5 Y# y7 Z& q, u8 j( W* U4 E ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
; f u! d" K! C4 ] program_name=/opt/gitlab/embedded/bin/chef-client( T3 I9 c& r W; m5 O
executable=/opt/gitlab/embedded/bin/chef-client
) j j$ |* _) W & A: r- j) {) }; W- G7 Y4 K
5 g9 P7 B2 G7 i" _/ P. { ================================================================================( Q" F6 Z1 Q% m9 H) T: S
Error executing action `run` on resource 'rails_migration[gitlab-rails]'
! N% Y2 u9 B* G$ ?: q ================================================================================
2 m# S7 v% O( A2 E3 X9 Z ; M: f" g; V" n# h& ^- z* B/ X: _
Mixlib::ShellOut::ShellCommandFailed, T: [) ]0 D; X- ` s: k
------------------------------------
0 p) c3 U) y. i& E 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 V9 M" ]" r1 @( i
9 B' t& A% C9 K7 t: x% v5 F
Resource Declaration:
& f+ h( }' |9 g9 t, P p! ^ ---------------------
/ r: O( x& z6 Q' F. O # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb
' B# t3 b; m: y4 H7 @+ p; Z/ \ 5 d3 M( ?- h* ?3 X; p- } n
51: rails_migration "gitlab-rails" do
3 l% h; R' R$ G( d# H. b- L 52: rake_task 'gitlab:db:configure'
: z: m' Y+ e+ D# P 53: logfile_prefix 'gitlab-rails-db-migrate'
& l3 o6 t" o5 O- ^/ j( N9 D& o3 }6 z 54: helper migration_helper
2 V6 F& q) E6 i& D5 z v8 }# ^ 55: , |. N# n; [: b
56: environment env_variables5 a6 [5 k7 d. I% y I1 @
57: dependent_services dependent_services8 l7 Y. c' a, Q2 j
58: notifies :run, "execute[clear the gitlab-rails cache]", :immediately5 | t+ W. X& I0 E. k9 E) w1 @
59: notifies :run, "ruby_block[check remote PG version]", :immediately
1 R3 P2 B% ~( W! w/ W2 ^ 60: + Z `3 C; I$ o
61: only_if { migration_helper.attributes_node['auto_migrate'] }* A$ M. {; X9 Y8 F
62: end A4 H5 Y9 K' g' D
. C, j4 S! f D! [ h7 F: ]( U
Compiled Resource:
" f. x. ~9 F3 \: r* n) F! s$ s ------------------* o: a* k4 d8 P9 y7 b6 I
# Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file' ]8 ~$ O9 S9 N# v* i7 _
, _! S9 a" n* G. J% b3 M4 K; O [
rails_migration("gitlab-rails") do2 x' d/ r' Y; I7 e
action [:run]
" Q% e/ R' u1 K( ]" X6 T" l0 d default_guard_interpreter :default2 M) E) d- l. [
declared_type :rails_migration, O5 ^9 G2 I Q. Y% D
cookbook_name "gitlab"4 S C( X9 Y$ K
recipe_name "database_migrations"$ w5 [2 l6 q0 X8 W0 ?
rake_task "gitlab:db:configure"
; l8 U" {3 [9 ]% q logfile_prefix "gitlab-rails-db-migrate"
. J# ]6 u; p! ^3 |. E" `" v' H helper "*sensitive value suppressed*"
# P( c. S- ?* ? environment "*sensitive value suppressed*"* u& {# W+ j* M; ^% W3 L
dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]
/ G8 F; u6 ]4 n5 @# | only_if { #code block }
# S3 o2 k6 f& x8 ~8 T0 e end3 e* k+ |* V; Y0 d) U$ K1 b) [
% g+ {9 c9 o0 p1 R+ [ System Info:% I9 u- ]$ ^5 w1 ^
------------
" Q9 L1 h3 G. \& `# q chef_version=15.17.4
9 `0 c+ Z9 }" U- Y% B) }; R platform=ubuntu
, ]3 A5 y$ h7 B5 h) b! t) H platform_version=20.04$ G* ]6 n; [& |7 } H# ?( g6 l
ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
$ s4 r+ l. }1 x: v program_name=/opt/gitlab/embedded/bin/chef-client9 @3 F) G/ O1 T- M
executable=/opt/gitlab/embedded/bin/chef-client9 i! M9 V/ s% k7 Z8 I) L( [
1 S7 K2 m) s+ k* r7 [. T4 D; x# GRunning handlers:
8 O: X1 B2 ]) P% c. L. m K) _There was an error running gitlab-ctl reconfigure:
4 O3 R$ s5 H" z8 x$ Zrails_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
& a! j) |; A4 h7 i3 qRunning handlers complete
9 h# N! }$ C" l. P' C' \' YChef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:
* A, ?" j! c( C3 Q1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;: d x/ O, v7 F* X
2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;' @" v" Y+ v A/ \6 y
3. 再次运行 gitlab-rake db:migrate,确认不会再报错;
! X5 S* q) h0 _. Y1 O6 _& K/ |4. 运行 gitlab-ctl reconfigure;" E; J4 {3 t$ Y/ _8 z
5. 重启Gitlab:gitlab-ctl restart。
$ C1 D) b3 c( R$ g# D需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。5 q* Z% ^0 a, k; O N
参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated
0 }, m y4 j8 Y. O& d4 j2. gitlab-ctl reconfigure failing due to migration issue
0 {( `0 f, Q8 J8 VAD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2) |
|