|
|
发表于 2022-9-11 20:40:14
|
查看: 2287 |
回复: 0
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。$ u. p0 l# Z+ E ~
登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。7 W6 F2 D; I) j
运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。
4 _, M) }0 _, u z接着设置语言和本地化设置:
. [- N$ a( x, V) ^export LC_ALL=en_US.UTF-8
5 ]$ J& j4 [( O, lexport LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。
; n- O L# g# B; [ i但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?
: N4 r9 Q1 G: x. h于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:
% K6 F. ?, N6 ZRecipe: gitlab::database_migrations9 J$ b- L; q, g1 q7 p P& s# d
* ruby_block[check remote PG version] action nothing (skipped due to action :nothing)- h7 g6 A( f3 e& n
* rails_migration[gitlab-rails] action run: _& t- O' j9 G9 B2 k
* bash[migrate gitlab-rails database] action run
4 K# F n1 c5 v8 m. S" ?' [
' A- X. V/ G; E- @- C& j. i ================================================================================
; B# B0 |, Z, U1 G: q8 [5 \ Error executing action `run` on resource 'bash[migrate gitlab-rails database]'" |" S7 q# w) {1 z
================================================================================
& U0 r, T! Z9 V9 a y, \ 2 P+ L6 e" b9 a; ?( B
Mixlib::ShellOut::ShellCommandFailed
' Z1 J. v' X& M# D ------------------------------------
6 `/ Z' @+ ~( B) @ Command execution failed. STDOUT/STDERR suppressed for sensitive resource
9 ]: h) {5 o; A& k) c2 z8 w
( Q3 x* G9 t' ?7 E4 F2 ^" E$ w) p Resource Declaration:7 X, Q8 B! H# l0 @' J' V* P# C
---------------------
& \5 D; U! e6 _ suppressed sensitive resource output
$ S1 q2 d$ K/ E; O: L2 H J) X1 L 1 `& O/ X! s0 ^3 w% M( [
Compiled Resource:
6 h% j3 O+ Q2 N6 X0 u# K! R ------------------
% e# {/ `9 v9 |, J0 S& j suppressed sensitive resource output
" r( ?+ f& E) b9 @
3 p) }& L5 A, p System Info:
- n5 B6 w% ~8 v ------------
+ l8 b2 {' I/ [( x4 z& u chef_version=15.17.4
" Y% A4 d1 b- P# Z! ~9 p platform=ubuntu
+ [1 N* Y0 ]/ m0 m platform_version=20.048 m5 p0 U ]: Z4 i: r
ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
+ \; z- ~# m1 w3 [, V" x program_name=/opt/gitlab/embedded/bin/chef-client% r; p7 z& k: ?* A( m6 p% l
executable=/opt/gitlab/embedded/bin/chef-client. E0 S4 i* ~* j$ G
6 `3 z6 h& }9 i) L# k; m
1 D3 ~+ V0 N3 O! x; B, j6 @ ================================================================================8 V& |/ {' [6 l4 E
Error executing action `run` on resource 'rails_migration[gitlab-rails]'
% s( M( ^5 F; U' W1 x. } g ================================================================================: }- L& ~0 }1 C3 v, n
* P) b2 u$ r9 | ?* d' Y Mixlib::ShellOut::ShellCommandFailed; P' D- }# A! Y& G
------------------------------------# E0 W n* J0 K4 b+ G( ?6 r9 `
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
* O) R, g' o1 q8 u/ X 9 G& G) {. _2 {
Resource Declaration:- {' R' N6 g! M9 s
---------------------0 `( {( F, H) n: Y* l# G0 r
# In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb
) A6 o& C: [! |" L5 c3 |# C: J
8 G' G4 @: H' d2 @; z, |+ b' V# [. S 51: rails_migration "gitlab-rails" do9 o. b; c/ |' I
52: rake_task 'gitlab:db:configure' P0 @) P( r+ J
53: logfile_prefix 'gitlab-rails-db-migrate'& X" H( \# ~& Q
54: helper migration_helper
' s+ |3 g0 v, Y0 x0 b% L- g 55: 7 i6 x% Z' t5 f* p2 S z
56: environment env_variables& \+ P/ T; n9 d# g" f
57: dependent_services dependent_services
. E y7 @( F# f) X: t* F. p 58: notifies :run, "execute[clear the gitlab-rails cache]", :immediately- N8 f7 h/ |8 G
59: notifies :run, "ruby_block[check remote PG version]", :immediately
7 U& Z4 r* `4 h i- [6 j 60:
, W) L7 W) j/ f 61: only_if { migration_helper.attributes_node['auto_migrate'] }
8 G$ U7 u) r+ M, D Q1 I; r2 E4 p& V 62: end
" k: I: P- a$ Q( [; j6 | 9 H3 |/ b# N3 ], K2 `
Compiled Resource:
" ? ?5 h9 b* \) Y) k: O2 {6 H( | ------------------) g' W+ }9 N9 g( E0 N: `& Q- ~; N
# Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'5 s. {* R u% J( }8 a
" W) W" f: S; i rails_migration("gitlab-rails") do
) L/ m, q( p! U action [:run]- \5 k# s. k* S( c. e# i3 z
default_guard_interpreter :default
/ X3 a, t% T+ `/ q4 E declared_type :rails_migration. M) z% u2 H4 s" ?
cookbook_name "gitlab"
0 n0 {/ ^' K6 T. h recipe_name "database_migrations". E! Y7 C7 l" A( H
rake_task "gitlab:db:configure"
% B' }5 p% e1 m i0 H. H logfile_prefix "gitlab-rails-db-migrate"
2 ?% k# P& \3 P: }' e helper "*sensitive value suppressed*"( R! }! v9 i+ c3 P& K! P3 U( d
environment "*sensitive value suppressed*"# l% }! @0 D& V; z, ~) h) B( ?) c
dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]
0 ], Z! P) L7 Z6 L$ A* X7 [ only_if { #code block }& z9 \/ f& l; U3 l1 o) u' H
end
+ O) U2 K7 U& j# Q+ N, U$ a- ]
# |3 Q9 S- |1 m, y* _/ a5 G# X System Info:
/ H6 w, Y6 T/ M. h9 ?. A ------------
' R2 S$ z) ]' }" |0 g4 [6 J chef_version=15.17.4" p7 T* P( y* ^ k$ q
platform=ubuntu
4 X1 {$ r4 _; W7 J+ Z b. p4 s. q platform_version=20.04" I v9 ~% w- V, G* A0 [1 I
ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]3 h: Y) l5 N2 a( t8 o/ w- }& P
program_name=/opt/gitlab/embedded/bin/chef-client
8 B0 P6 |9 o$ j: _4 B executable=/opt/gitlab/embedded/bin/chef-client
, q# z' [- Z2 \6 ` : } @3 D7 F, c2 j7 o
Running handlers:
" o) Q: N C; ^1 EThere was an error running gitlab-ctl reconfigure:! I" f0 j7 q5 U( i
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 resource0 q3 L2 [7 ^ j4 M
Running handlers complete1 B1 p8 d6 |' {, \
Chef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:1 P9 M) Z/ U6 s, [- }7 R Q" Q
1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;- L( P! E7 M4 \% W9 `% d
2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;8 i8 z+ D# p+ q4 c& H8 s% G- A
3. 再次运行 gitlab-rake db:migrate,确认不会再报错;0 b; M+ j1 A! r- B$ h1 _
4. 运行 gitlab-ctl reconfigure;( g* `: x0 j5 t" `
5. 重启Gitlab:gitlab-ctl restart。# i9 @' T% n1 Y; T. E
需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。
, Z* w' `- y8 \2 s7 W" {参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated8 A3 T1 ^' n1 p# Z
2. gitlab-ctl reconfigure failing due to migration issue
. a% Y9 H3 }5 Q0 n! u& o* ^4 {5 aAD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2) |
|