扫一扫,微信登陆

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

搜索
查看: 1508|回复: 0

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

[复制链接]

1万

主题

1万

帖子

5万

积分

论坛元老

Rank: 8Rank: 8

积分
56206
发表于 2022-9-11 20:40:14 | 显示全部楼层 |阅读模式
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
  ^: b% T$ d8 j. r登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。, V8 J+ b' M9 b1 n
运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。) R3 m) u. B/ ?- Z8 p9 E$ z5 a
接着设置语言和本地化设置:
# H; H  R% E5 z1 ~/ T/ _) v  pexport LC_ALL=en_US.UTF-8
4 w2 L8 A. v) k. c+ H( Yexport LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。
' s) L9 @: W) c但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?" O# ~# ^$ A1 y4 j# x9 b0 o
于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:
- k. S( X6 Q  a3 V& b+ I( A' URecipe: gitlab::database_migrations
$ r- `& X2 H; m& X6 r8 e  * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)- w! i. ~# G  b) q7 }
  * rails_migration[gitlab-rails] action run, L' f: s% W8 b  P7 p! U. H
    * bash[migrate gitlab-rails database] action run
+ D/ I( w: }6 d- g4 e. J      
4 A8 E! ?( o5 G      ================================================================================
' F# }( C4 s, J2 M$ X      Error executing action `run` on resource 'bash[migrate gitlab-rails database]'9 U5 ], s6 Y4 N: u+ v
      ================================================================================: l/ i$ R) Z$ T, w- a$ b7 h  v( d
      
! K# r$ U3 q7 }4 @9 L      Mixlib::ShellOut::ShellCommandFailed1 E! H3 @7 ^% ?/ V. l& G
      ------------------------------------+ Y- F7 S! G9 _/ y
      Command execution failed. STDOUT/STDERR suppressed for sensitive resource
7 w- ~3 _4 {. S0 j9 a9 u: n      * s: j1 V- Q" l$ x* a5 e" ~
      Resource Declaration:
! F2 l: h! x/ I& ]; ?      ---------------------
- }- n" u& a; `! O  w/ S      suppressed sensitive resource output
# M0 n1 c& j" ]% o6 x      
/ K7 o4 D7 O& w+ n. t      Compiled Resource:
8 @) x1 S) \5 M+ V- i  M      ------------------! K# V9 }- r3 x! X5 k9 n6 }) `* ]: T! }
      suppressed sensitive resource output9 k% a7 d7 U6 c0 v
      " \0 f; L' {0 c3 b$ e' S% M
      System Info:
* T/ P* A- C9 r$ G( |+ {      ------------$ O$ m5 b8 A3 x4 {' Q8 G
      chef_version=15.17.4' U3 B1 p" M2 E$ s
      platform=ubuntu  P' R+ x, d- T# c* i0 K; B
      platform_version=20.04
% f) v4 x( ~3 p% S( o* r      ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
2 |# K* W( ^( H; W* |0 R- |7 B  F- G: w      program_name=/opt/gitlab/embedded/bin/chef-client
1 N( [5 Y  ]  d0 J      executable=/opt/gitlab/embedded/bin/chef-client+ s% u) i" l# t
      
% k! |4 ^5 {( o   
; Z8 K  o0 H, ?) C9 c    ================================================================================8 ?/ G+ g6 U6 L5 A
    Error executing action `run` on resource 'rails_migration[gitlab-rails]'5 q- r- F' W* G) ?1 V0 `6 p
    ================================================================================
4 ^" C% ^, W% J* c! e' K   
2 D" e) ^: m9 m3 O! @    Mixlib::ShellOut::ShellCommandFailed
) \; ], @3 x2 j8 s    ------------------------------------
2 A9 H7 p$ k* w: X. q. c2 V8 t    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& e9 S+ Q0 n: p1 |& R8 F. ~
   
+ _. Z1 g& |3 H: G    Resource Declaration:1 q7 Y- k1 R  r" M- {3 p( \7 X
    ---------------------
' I& V6 U/ L/ o3 _0 x' }( A    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb7 P% t1 t5 d5 j: i1 y4 a% n7 y
    . ]5 v7 ]+ c4 e+ e+ V* _$ B* s
     51: rails_migration "gitlab-rails" do( r: U9 d$ B. H; a& r. j4 R
     52:   rake_task 'gitlab:db:configure'4 z+ M, B, c, O9 Y% ?
     53:   logfile_prefix 'gitlab-rails-db-migrate': a. j& Y% G' q
     54:   helper migration_helper4 J, N0 E% r. \2 X- s
     55:
$ @3 \0 l( \- F! j$ \+ v9 @     56:   environment env_variables
! z$ r! r- U+ G     57:   dependent_services dependent_services1 _1 e; @( ?: ^% s
     58:   notifies :run, "execute[clear the gitlab-rails cache]", :immediately
) Y) g5 [5 e! [3 }. ^( E     59:   notifies :run, "ruby_block[check remote PG version]", :immediately; B5 a2 T7 Z" M# o$ U
     60:
6 @& l# j; k( @, R4 u; t     61:   only_if { migration_helper.attributes_node['auto_migrate'] }
4 a! _7 G- n7 m# v0 o" j     62: end
4 z0 X& F& C- D6 p1 f      `* C4 Q7 A+ P. w' ?. s
    Compiled Resource:
$ t5 E; D! w2 g/ F    ------------------, ]/ x4 r5 J9 i
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'' R& y& v2 Z2 F2 h
    / i; _+ k% g& I4 W  X3 q
    rails_migration("gitlab-rails") do# c$ l8 \6 L: d; F8 O/ s
      action [:run]: b! \. q2 ?) r0 a
      default_guard_interpreter :default* \2 r# q& Y) Q9 Q" d
      declared_type :rails_migration
. ^  F+ _) ^5 H( ?2 v      cookbook_name "gitlab"
2 l4 O5 S8 y9 D" k& i+ c      recipe_name "database_migrations"1 A; g/ k6 j* R8 n% [( m4 g
      rake_task "gitlab:db:configure"* e! p7 M1 i  z* i
      logfile_prefix "gitlab-rails-db-migrate"/ C. g9 D# r3 t5 ?
      helper "*sensitive value suppressed*"
- g8 z  _7 z) X$ V( {      environment "*sensitive value suppressed*"
) R9 ?3 i5 a7 m      dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]
' x# B9 \0 m3 u1 N4 A      only_if { #code block }9 L9 m8 q9 [) H" C- j, P/ g
    end! x2 g& Z# N' _) z  q! q' v7 \- U
    $ B1 |7 b: x* L" ?
    System Info:2 C/ a' A9 o2 b4 ]5 W: K$ u; p! R
    ------------
+ K/ K" v$ A  ~    chef_version=15.17.4
4 f5 J! A3 {! _2 @: T- |0 z    platform=ubuntu* a% n2 v0 N/ e. f6 j. @
    platform_version=20.04
  {9 }0 E- ], }. S    ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
0 m; f2 V- U. v3 s2 f) }0 O6 j0 V+ k    program_name=/opt/gitlab/embedded/bin/chef-client
$ O" Y  R+ p8 t8 O3 D$ @) P; n9 ~+ f" b    executable=/opt/gitlab/embedded/bin/chef-client! `- {# J5 B& y, G5 U+ n. R
   
5 m) d2 o2 J3 m7 h/ fRunning handlers:
2 _% c* K7 m: U5 \  FThere was an error running gitlab-ctl reconfigure:9 Y/ M; {6 R) }$ x, h5 N  S& ]
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 resource5 n7 F1 L# D5 Q, R" r1 ]9 l
Running handlers complete
; ^+ {. ~, F+ f. \Chef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:2 u% B- {: C0 s1 V  F- }- {
1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;
. W& q6 i2 L. j$ @5 p  }$ b2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;
8 e* I3 E' {& Q. C. ~3. 再次运行 gitlab-rake db:migrate,确认不会再报错;
" Z, y& z2 {$ k) K4. 运行 gitlab-ctl reconfigure;4 V. i0 A5 r9 r6 n: a
5. 重启Gitlab:gitlab-ctl restart。4 R% F1 ]- r) j# @
需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。
( b$ E) e/ n; `6 e) Q5 c参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated# |9 D: l0 I  ~: M8 H) H
2. gitlab-ctl reconfigure failing due to migration issue
! E8 }$ K' V7 U# @4 J) b% [AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2)
回复

使用道具 举报

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

本版积分规则

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