|
|
发表于 2022-9-11 20:40:14
|
查看: 2220 |
回复: 0
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。3 D" c0 C R7 u4 g! W5 f( q
登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。8 L* f9 j9 L4 t) W: V
运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。
6 O G' N1 c$ ] |接着设置语言和本地化设置:6 V& W) O J" U- j$ s8 I7 t
export LC_ALL=en_US.UTF-8, F$ k# \8 m, {+ u
export LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。( R. J2 c- m" B* z4 x- E$ n2 ]6 k
但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的? ^; o6 c- X8 e" B
于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:
: l$ B4 d, X7 C6 s5 k2 ?1 RRecipe: gitlab::database_migrations
& m- M( q* G. h, n: a9 I" N) T& n * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)6 u, t# `3 P8 V' @6 P: V
* rails_migration[gitlab-rails] action run
e' j4 r0 Z4 R7 t3 v% ]6 h * bash[migrate gitlab-rails database] action run
; t' c- Q9 Z0 a# c2 f4 E+ d5 M/ j
. b; C7 Y5 r3 F ================================================================================
+ n/ q( b( s; a' w% W Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
* E% @$ Y) d% t9 N9 u7 \ ================================================================================
, G- l/ i4 Q: B/ n3 g2 E! H8 _
8 y0 h6 y& U2 Q6 D; y Mixlib::ShellOut::ShellCommandFailed. W7 I6 V; W+ ~1 Z) v, N7 i& D5 [
------------------------------------
% j/ K5 g, ?7 l% ~: s: g5 Z Command execution failed. STDOUT/STDERR suppressed for sensitive resource5 o3 B9 m2 T- G+ E, ~; u
' [7 f$ \ w; G" I5 b1 {" U) l
Resource Declaration:
, N+ X6 G2 @# ]$ @2 P ---------------------; d6 f) b! x& {, d, c1 J2 V
suppressed sensitive resource output! f4 L8 s! M' F1 e, I& P" Z
' ~+ E0 R; P/ P4 o* v
Compiled Resource:; r7 @/ |0 C% d4 a+ f
------------------
i9 ~ E& M. t) P6 q suppressed sensitive resource output
5 K$ B* r& }! m. S7 Z
$ x( @2 w' F I* i8 [( }, D' D System Info:. w1 ?1 r2 U/ T3 C. k) J; |
------------
8 j0 M) X0 p p& t6 v/ ?2 [ chef_version=15.17.4
9 ^- ~6 a9 O8 y! y* H3 L: } platform=ubuntu' `, h, _4 {. |' j, A4 _
platform_version=20.04
& f7 ?+ D# v1 V( @( V/ E ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]" ~% H1 u" y! b5 \' O
program_name=/opt/gitlab/embedded/bin/chef-client
" ?5 o9 K! m* H4 g( W, _ executable=/opt/gitlab/embedded/bin/chef-client& ^( W9 F& X; [/ C. f2 W
, y0 ^8 w& L" B. ~' Z& M
5 ?# A$ F. N( D% h% H# v8 a
================================================================================
9 C2 B: ^1 d3 f Error executing action `run` on resource 'rails_migration[gitlab-rails]': V- y/ `- ~* _' h( q& T. }4 K1 _2 \
================================================================================
- e' z- s: j, s- B ' O4 e" c' s% G' j8 i% q+ H
Mixlib::ShellOut::ShellCommandFailed
% x" c1 h, e6 p0 D3 n ------------------------------------$ |2 `4 j3 T& z8 Z/ 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
. p* K8 v( r( |# B # {' `! k B, `& u5 B( s
Resource Declaration:3 A7 ?% N$ P9 V/ t3 V0 u/ Q
---------------------8 Y( x6 d( d$ R
# In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb% r3 N# g: c) Y+ Y7 Q
9 d; _! t1 D8 z' M) g7 H- B& X 51: rails_migration "gitlab-rails" do
" v" V6 _8 Y1 P# j {# K 52: rake_task 'gitlab:db:configure'
/ S8 }. K. v& s1 U: U 53: logfile_prefix 'gitlab-rails-db-migrate', ~. E# l9 h) n
54: helper migration_helper
5 n2 P& b @7 @3 \ y! x8 J 55: $ j, ?; T' s6 \/ O7 R! |
56: environment env_variables. q- J/ H5 o0 H2 k' x
57: dependent_services dependent_services8 u4 [" x2 @1 a# y. ^
58: notifies :run, "execute[clear the gitlab-rails cache]", :immediately
( e0 N7 ~" |% M2 @( q 59: notifies :run, "ruby_block[check remote PG version]", :immediately
+ p/ }3 i3 n; F% L t8 b 60:
' L* @/ d7 Q: n% @9 ~( n! C" P 61: only_if { migration_helper.attributes_node['auto_migrate'] }
) r4 z6 V! G' c& @2 F) i4 |; k 62: end7 }9 \, |7 x+ }+ p; s/ G3 k
4 c( p% ?* [0 L$ \5 s
Compiled Resource:
' j' S+ X! x, O/ r7 A1 d# P ------------------6 @$ w) k& Z2 ]3 P' g0 I' L. j
# Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'
^- ]1 _$ \: U, a6 N
0 d: ]+ H) |! y) i3 e+ o* c( M rails_migration("gitlab-rails") do H+ Q* o9 v3 U$ \( r
action [:run]
% G N* z/ C+ }: W% \ default_guard_interpreter :default- `' S; v4 u7 X
declared_type :rails_migration
2 d4 C- `# t! e cookbook_name "gitlab"
, ]/ @7 M, R( O1 w% v3 h" ] recipe_name "database_migrations"
. H2 K0 Z1 Y- `5 r rake_task "gitlab:db:configure"
7 K$ p" l+ C: Y8 f6 @ logfile_prefix "gitlab-rails-db-migrate"
2 ?4 _# d* d2 z# _' b- S helper "*sensitive value suppressed*"7 H, i3 V4 R( J
environment "*sensitive value suppressed*"1 Q4 q- F6 p/ F* t
dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]- u) C. o0 {' | X) c/ b
only_if { #code block }
4 ?: q5 `1 J9 U, a# b end- H, k* v1 W2 X+ @9 k2 R
; ~! V4 _3 B. E9 \- V2 t4 w1 ~ System Info:* [1 t% w9 h/ a/ q- G
------------9 x! K- h4 `0 X5 A
chef_version=15.17.4( `* _6 k6 D6 g2 Y
platform=ubuntu
" E+ ?( C! s4 ]. F& m platform_version=20.04
2 o6 V4 b+ H- g ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
) W% l* C' q* n. v( K( Q program_name=/opt/gitlab/embedded/bin/chef-client- O. |( i0 d4 L1 ]
executable=/opt/gitlab/embedded/bin/chef-client. I5 E1 @' t" K( h( ]
y5 I) Q+ l; K! @, z+ w# gRunning handlers:
; B$ o! R9 J% Z2 N( K* ~! v" \There was an error running gitlab-ctl reconfigure:
- Z i: O9 r. m- n3 y/ 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 resource7 |/ c3 z5 Y# Q4 v a
Running handlers complete$ @2 k7 B! F7 m& O! t
Chef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:* n$ k1 t+ u* h6 s) F- y0 i3 Q0 z% e
1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;1 ]& F, E0 M& x( x" M
2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;
% O& `7 w2 z7 |# k3. 再次运行 gitlab-rake db:migrate,确认不会再报错;9 `' U: k8 \# U. u L
4. 运行 gitlab-ctl reconfigure;( g7 G* ^+ L2 o' B: G% K7 O
5. 重启Gitlab:gitlab-ctl restart。$ _1 @+ S7 [6 `' a7 w
需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。
. c0 M0 p0 t; w" |' \3 q0 u4 v参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated
6 i+ c; Z5 F/ ~' I2. gitlab-ctl reconfigure failing due to migration issue9 Q0 l' B: g; K0 b6 W& _" R
AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2) |
|