扫一扫,微信登陆

 青浦修电脑 青浦笔记本维修 青浦手机维修 青浦电器维修

搜索
查看: 751|回复: 0

Gitlab升级14.10.0后运行出错 - 青浦海洋数码电脑城

[复制链接]

1万

主题

1万

帖子

5万

积分

论坛元老

Rank: 8Rank: 8

积分
56206
发表于 2022-9-11 20:40:14 | 显示全部楼层 |阅读模式
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
. o2 G/ I6 U& |  l% w! R' {登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。
6 }7 \* s! M0 j运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。
# P. s0 s5 @# l* k- l/ T0 {5 h% i: b接着设置语言和本地化设置:
+ X! F( h$ s" ]' }% {( t3 S' nexport LC_ALL=en_US.UTF-8  s& O& @  T% V6 @/ N7 |
export LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。# `0 A9 K* t% [5 {" ~5 S
但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?% M5 _9 ^  A3 E: l$ E: t
于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:
- G( }) e  w! v" ]Recipe: gitlab::database_migrations
$ L, [. {  I2 B6 L% S. [  * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)/ t1 D0 d  I3 N
  * rails_migration[gitlab-rails] action run
9 R5 c  H' ]$ u) Z1 G7 T    * bash[migrate gitlab-rails database] action run
1 t' R- o9 x5 X+ \( X* k5 s      
; h$ n6 _* P0 M' x7 p( b      ================================================================================
3 }5 N  z! J( @% t0 G( c      Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
1 s: q; [6 E% z. ^6 j9 ~/ q9 m      ================================================================================
' R" d& q9 W: \% l0 |8 w; U      
* k9 t8 `' w9 U  v( W. _      Mixlib::ShellOut::ShellCommandFailed5 g! P1 R2 D" a/ l
      ------------------------------------
& ], p7 Y% ]. J' E  Z      Command execution failed. STDOUT/STDERR suppressed for sensitive resource( f9 @5 k6 p# V
      
. N! G$ A+ @, \# N$ E" j9 G+ S      Resource Declaration:
0 g% ~2 L' a: S; ~$ b0 v8 w3 r      ---------------------
& N* q& }3 o  ?' r      suppressed sensitive resource output
3 H3 t. S9 j- ?: X      
; {- `* s6 v9 ^* V      Compiled Resource:9 @' Z, U4 D. V% e5 ?  j! d
      ------------------" d3 U, O- ]% Z, Q$ B% Z
      suppressed sensitive resource output
* t8 A* P2 E: Y      ' j4 K) u, {5 N7 L0 h  c& F0 \
      System Info:
  A3 ?6 J6 U9 I; L6 k      ------------
: p0 d/ _" S. f) ^9 N      chef_version=15.17.4
6 |) i) [( n- A7 B1 _1 D: j7 ~      platform=ubuntu5 |+ T4 \* r' R& ]
      platform_version=20.04' _+ G/ }$ ?. G1 T0 I
      ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]& H6 w/ J9 V1 O6 A" M) S
      program_name=/opt/gitlab/embedded/bin/chef-client4 `/ O5 S8 B/ ^' I
      executable=/opt/gitlab/embedded/bin/chef-client4 r7 o( r- M$ F. \4 l
      - v) s: o$ u# i9 P( l5 P# g
   
, T- ~: E9 X# L) a& v0 c& v6 w0 y    ================================================================================
- w; K  ^1 x" ?' V    Error executing action `run` on resource 'rails_migration[gitlab-rails]'
4 `+ R7 j) n$ D7 ], ]! k: r    ================================================================================
6 r+ S* A& r- o* m; l# }   
/ i0 Z# E1 w1 T" A$ ~# n8 N5 H0 e5 K    Mixlib::ShellOut::ShellCommandFailed8 k7 `  F/ d; r3 c
    ------------------------------------
, p) \5 n9 c3 w6 V: J) b. V* P    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
, q8 R& Y7 @+ H! g6 i- O8 r6 o   
( W/ L" Q1 W! N1 \' \    Resource Declaration:# s# {  z+ i9 E2 B2 M7 J
    ---------------------
" b! D3 }  E( V% a$ `    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb& q- J- R: H- Y! {5 k
    ' m* N" W- P- }. f  H- N
     51: rails_migration "gitlab-rails" do4 Z0 b% }- F8 v. @" z3 r4 f
     52:   rake_task 'gitlab:db:configure'
. C7 X& n! u" I     53:   logfile_prefix 'gitlab-rails-db-migrate'
% F" ?3 Z8 Y: X% v3 X1 I  @  C     54:   helper migration_helper& u- ]( G2 H8 A) t6 k& t
     55: * l9 @" b0 {5 \3 \1 `5 {2 d
     56:   environment env_variables
$ K4 H. B: X( ?4 Z. x5 b' ]     57:   dependent_services dependent_services% ^" P# t7 ~. }
     58:   notifies :run, "execute[clear the gitlab-rails cache]", :immediately
- @, u$ B' G" T) ], k! I0 C     59:   notifies :run, "ruby_block[check remote PG version]", :immediately
0 a* @- t- c5 S! P+ R7 p     60: 8 y+ D( b0 B# x  g/ C
     61:   only_if { migration_helper.attributes_node['auto_migrate'] }
# |" e5 l" P' R     62: end* r1 Z8 W+ v2 y' M* [3 |1 R9 Q
   
6 k; E. ^& ]5 o  ^# ?9 Y9 S! q  S    Compiled Resource:3 ~5 h8 P" ^6 ~$ j: d
    ------------------) |( e. t+ g& F* z+ O6 h" S" B$ k. K) k, I
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'. R+ h2 n" e8 g5 A% N
   
) u+ _$ B6 p1 y; z) K. b6 `    rails_migration("gitlab-rails") do
# T0 h+ s8 b, U, f+ M      action [:run]
* \% z, ^/ ?6 w      default_guard_interpreter :default
7 \0 V& D* Z/ U      declared_type :rails_migration
7 p9 D7 P2 d2 S) J3 N; f      cookbook_name "gitlab"
# y4 g/ ^0 ^- D) v' y6 T7 {, c# \' t      recipe_name "database_migrations"- z1 X$ r5 e& n: d
      rake_task "gitlab:db:configure"7 E5 i# f6 n* d( {8 Y" b  J# j
      logfile_prefix "gitlab-rails-db-migrate"
' P6 r) q- y- A* j: o5 Z" ]/ \      helper "*sensitive value suppressed*"
6 g9 C" ?3 w  }' z: J- i4 F; P      environment "*sensitive value suppressed*"
' W7 d1 _& p+ R4 i  D      dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]0 A5 |/ G" `- t' a. Q
      only_if { #code block }
0 Z1 O; Z; p9 _5 w    end
# t: B' B. v$ J" N      z0 @' f/ [" u
    System Info:7 q0 D7 e, h: b4 L
    ------------
! d6 J1 h6 M1 u0 g% Z. S  D) W, f* J    chef_version=15.17.41 W" U* u+ o+ g3 O
    platform=ubuntu3 J; r/ V4 }, `& m" U
    platform_version=20.04
8 C, d7 ^5 Z2 N4 U  @- \- C5 l8 p    ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]9 D6 j+ i0 f& g8 Y; y
    program_name=/opt/gitlab/embedded/bin/chef-client
; z( C6 X& O& @( D% E- T2 k' [, u    executable=/opt/gitlab/embedded/bin/chef-client
5 b2 K9 S: r4 y) \/ S6 p: D    * B+ s) i* ~/ |6 |; ]) H; K& S
Running handlers:- @- m3 S: P  ^) v- X5 L0 s- O
There was an error running gitlab-ctl reconfigure:
7 G& f' S8 w! E  @/ ^' |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 resource6 e) _( R7 {" J
Running handlers complete; }/ J4 R* }+ [3 d) q  t2 m
Chef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:3 C% v8 d* N0 e, V  T5 l  r& g
1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;
2 T: G% W& Z2 i, h8 _3 Q2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;
; y  ~  v4 {2 w+ A; s" Z3. 再次运行 gitlab-rake db:migrate,确认不会再报错;
4 `. s; b3 V8 O% ^1 i4. 运行 gitlab-ctl reconfigure;
3 J2 J& r* p+ l9 F" e5. 重启Gitlab:gitlab-ctl restart。$ K7 [) \8 a, W( }+ Q% |$ l5 u
需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。5 M+ D3 t  ]% d' _" l
参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated
8 m0 M- T/ T9 j0 n: l: Z2. gitlab-ctl reconfigure failing due to migration issue
% Q5 d# h1 M, q) ~- M# h3 hAD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2)
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Copyright © 2001-2013 Comsenz Inc.Powered by Discuz!X3.4( 沪ICP备18024137号 )
快速回复 返回顶部 返回列表