扫一扫,微信登陆

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

搜索
查看: 1544|回复: 0

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

[复制链接]

1万

主题

1万

帖子

5万

积分

论坛元老

Rank: 8Rank: 8

积分
56206
发表于 2022-9-11 20:40:14 | 显示全部楼层 |阅读模式
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。' V6 ~5 J  j& t; s' u) J
登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。4 z' ]" p  j- o" A
运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。
5 k- M: D! d' P; b  J接着设置语言和本地化设置:
1 ?: b% V8 Z: Oexport LC_ALL=en_US.UTF-8
* b, `# L# V9 \' V; F& `# t. Gexport LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。: P1 I( `5 C7 Q" i
但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?! j$ Q7 |. j9 s8 F5 e3 ]2 G& ~
于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:+ J8 C5 W  v& F3 v
Recipe: gitlab::database_migrations
9 q! c" `' {7 h8 D0 x  * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)
: }4 Q4 B" ^7 h" H% ?  l0 h  * rails_migration[gitlab-rails] action run0 Y' I: ^: [$ p# U( f- C5 p
    * bash[migrate gitlab-rails database] action run  T3 n. I3 B. Y. D' v* _
      / c- b! m0 r$ B1 C
      ================================================================================! h5 L5 q" a2 Q" X% p2 O+ t
      Error executing action `run` on resource 'bash[migrate gitlab-rails database]'# C+ `, K+ @9 o
      ================================================================================
; L8 a8 G& K" ~, Z* {2 p# p% m7 S      
/ x! n% B; p! ]% R# e6 q8 @      Mixlib::ShellOut::ShellCommandFailed
! p6 i" D% K; J5 R      ------------------------------------; k! a% V" m8 R3 ]
      Command execution failed. STDOUT/STDERR suppressed for sensitive resource
' x; q  t# t: A4 F# _1 t& P      
' Q8 q- v. J1 b0 M1 U& e! m4 p% `      Resource Declaration:2 q! E7 |) U& z2 Z9 }9 z; ^) w. ]
      ---------------------8 w1 y+ U* E3 Y6 M! k  P
      suppressed sensitive resource output6 W2 R1 N5 b! M4 G
      
' I! V8 P1 D1 ~1 ~      Compiled Resource:* y, A; j& Z- s' F& u
      ------------------
) {: e4 j: \" ]( p* p# i7 @      suppressed sensitive resource output
* z3 W  @  H, U% O- s2 ^      
+ F- p) ]0 a( A6 e" O3 {* }      System Info:0 E& ^4 |! w5 c; R+ Q, l# H
      ------------, ~& Q! y+ C% S  b' }5 A
      chef_version=15.17.4
1 o, B0 `. N3 _" g5 D: P2 s- J, P      platform=ubuntu
" r9 x/ ]3 C/ }7 X! ^+ o      platform_version=20.042 {% z- L: g8 F/ S" \
      ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
2 H' k* o2 A9 v3 X5 x      program_name=/opt/gitlab/embedded/bin/chef-client
% h% I& W. u* j1 n( E3 z  b      executable=/opt/gitlab/embedded/bin/chef-client7 K; B7 C4 ~# h. |
      
9 d. r" k+ I- N7 t    / Y8 z! v( S9 e3 k0 m) m8 m
    ================================================================================$ w; g. P' m* {" y1 i
    Error executing action `run` on resource 'rails_migration[gitlab-rails]'
8 C' h9 J- r# ^9 u9 P$ }    ================================================================================
8 z( W7 `( P' g  d    ( v0 |  i! k. w4 S" V! ~/ w
    Mixlib::ShellOut::ShellCommandFailed
+ a$ b& m  S3 ^2 P( [9 r0 f$ B    ------------------------------------7 ^+ k: g- b' p: i( u; h+ L  @
    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
* h: L  f. S& X$ U   
6 U9 t, D- V( y; u! I; G6 `% l    Resource Declaration:
* l) E8 K( p0 B+ Y2 B  B  L    ---------------------, O  ]# J1 M' d& X5 d- E
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb' q1 s& H. @, Y  Q
   
) @+ u; a; l% F& N; V# B     51: rails_migration "gitlab-rails" do
9 u" b+ K2 e1 J; X     52:   rake_task 'gitlab:db:configure'
+ q2 Z  y$ x7 ~* ]: R     53:   logfile_prefix 'gitlab-rails-db-migrate'
* J& y7 U8 P+ z  c     54:   helper migration_helper
7 m( b/ Z7 R3 Y9 G' j% J0 A     55: ! R3 g4 b% G3 z* j
     56:   environment env_variables
' r' `. B! Z5 U     57:   dependent_services dependent_services
# |, |5 o; r- K9 B' R" x& r  \     58:   notifies :run, "execute[clear the gitlab-rails cache]", :immediately
# j8 E- `. S; @; x9 c! \6 s$ R1 L     59:   notifies :run, "ruby_block[check remote PG version]", :immediately/ e- u( U4 m( y; \% q' G# z
     60:
3 M" S' H" n, ?( u0 U" f6 U     61:   only_if { migration_helper.attributes_node['auto_migrate'] }* |( U% C+ j1 k' w5 u& \6 `! {. C5 q
     62: end  V1 m6 q" d7 c4 T/ n7 c$ \
    2 x/ b% U2 R) y# o9 O+ }' q9 J
    Compiled Resource:
5 ^: d' B& {  J# j/ q3 ~& t    ------------------6 N( a9 X# I' b3 |/ P; }: T
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'' L8 T9 B' Y+ A4 \4 d+ I
    1 [8 k% }  t- U. L' U% q, ^
    rails_migration("gitlab-rails") do8 e6 [2 j6 x: C/ ~" w# Q/ b  P
      action [:run]
% N- [1 d' U' h+ {/ D      default_guard_interpreter :default% x! ^' l  ]" ?: h
      declared_type :rails_migration  f# ^8 l0 h# w( j7 n# x
      cookbook_name "gitlab"! l: o+ s% V3 g, [
      recipe_name "database_migrations"# O$ w0 N* K8 H5 A0 ]  ]
      rake_task "gitlab:db:configure"
; `# O% E& U, m5 m# r      logfile_prefix "gitlab-rails-db-migrate"
3 Y% F/ k. g2 Y! ?  R+ Y      helper "*sensitive value suppressed*"# C  e4 E' R  t) F" F
      environment "*sensitive value suppressed*"
; d# {$ b# u/ W% l- [1 o      dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]& W2 |, Q, l  z! F
      only_if { #code block }
! Q: q6 @" z( M" w    end
: E& e+ C/ b7 r: @! n    & x% |7 ~0 s* |3 _: f& y/ n! u
    System Info:
1 N# E$ C/ d4 B" S1 H4 N    ------------
- @% z/ i5 q# X: |4 a8 V7 q    chef_version=15.17.41 N+ q6 |9 ~% n
    platform=ubuntu- @7 @! \* P! P/ s2 D# y
    platform_version=20.04, U$ a! A+ f4 }/ c7 Y. b/ K2 g
    ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]- j1 B+ w& @- D$ ^+ F
    program_name=/opt/gitlab/embedded/bin/chef-client
/ Z0 h- c' l" J    executable=/opt/gitlab/embedded/bin/chef-client
2 h4 ^/ S. F1 Q, f+ I    " z% Q4 ~7 c2 P: c. w# Q3 c$ k: n
Running handlers:& I9 ]* g7 {+ x# B0 H
There was an error running gitlab-ctl reconfigure:9 V7 t! ^; D2 ]. K" p  j( K
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 resource: s% I1 M1 k  O9 J: D  N8 J
Running handlers complete
# y( X8 Q- l# q) U8 p0 {) Q5 `Chef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:5 L7 j6 B: x6 l. p. j
1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;5 _$ j* E# b0 L* F. m& V2 `
2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;
' ?$ b/ ^; r6 _& n/ K' z, j7 f3. 再次运行 gitlab-rake db:migrate,确认不会再报错;
9 i- E0 @6 Y  O/ c2 p4. 运行 gitlab-ctl reconfigure;
7 z) x& d3 @6 V+ c+ r7 J5. 重启Gitlab:gitlab-ctl restart。, }+ O& U( I3 ]% s1 U) a
需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。
7 [' ~5 |9 S  }- ?$ V3 P' ?$ F* q0 m参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated6 ], A5 G8 M# H% ]
2. gitlab-ctl reconfigure failing due to migration issue
' j8 W& g$ v8 b) g7 KAD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2)
回复

使用道具 举报

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

本版积分规则

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