扫一扫,微信登陆

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

搜索
查看: 1507|回复: 0

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

[复制链接]

1万

主题

1万

帖子

5万

积分

论坛元老

Rank: 8Rank: 8

积分
56206
发表于 2022-9-11 20:40:14 | 显示全部楼层 |阅读模式
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
: |+ W7 n; u2 r, t2 P登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。
: M* Y$ R( D, J2 n运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。
" w$ P9 z, C5 E& R" X接着设置语言和本地化设置:
2 D9 ~/ C: q4 rexport LC_ALL=en_US.UTF-83 b; R/ V( R- P4 {# J- ]  I3 E4 V/ M
export LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。
( C, ]& V8 ^& t6 k: U但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?7 \% {7 {  l- `' k7 N% N2 F
于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:' a& q7 K" |$ @6 D6 P
Recipe: gitlab::database_migrations6 y( c" M1 V, G( }. B1 j- D
  * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)9 _( V& h% f; ^
  * rails_migration[gitlab-rails] action run
# g" P+ y( S4 s2 P) U7 |& F# U+ d    * bash[migrate gitlab-rails database] action run
+ {/ a( _" k1 ~( [2 f4 q      
- ~! W" c$ n0 a* t+ H- R9 ~8 Y      ================================================================================% f- V& z; s! Q/ v, \8 f" A# U
      Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
5 e; \# R! ~* }% G( j7 O9 O; N2 y2 a) z      ================================================================================+ J) f4 Z) U2 H1 W
      
* O- c* Y8 h! F- ]  m. y5 X      Mixlib::ShellOut::ShellCommandFailed8 K' ^- T) U, \. d! e! \
      ------------------------------------4 Q1 [2 d. u2 v2 s
      Command execution failed. STDOUT/STDERR suppressed for sensitive resource
0 h3 c2 N+ J& |9 M0 M' `# f      
( C# z: H. H$ U2 q& U7 d      Resource Declaration:% G1 R( A' z2 s
      ---------------------9 I  C: l0 u5 b
      suppressed sensitive resource output
$ b; o% v+ j7 @0 |6 O9 y% }0 p* G      4 Z5 i1 d0 q- O3 x! P" H" J
      Compiled Resource:
/ M# T5 s+ G' \% R: P9 u8 C      ------------------
. q- ~2 n1 b9 {' S" v      suppressed sensitive resource output
3 U) b* a2 _- U* h3 ]      
: w7 k/ a7 a5 {$ d' I      System Info:7 ?, @0 L. r4 X6 e; u
      ------------0 y4 b3 t% a  l/ [, W
      chef_version=15.17.4) z0 t4 Q. P6 N: e8 W% P9 o$ [
      platform=ubuntu
9 c. Z# r- e# G, t4 H      platform_version=20.04
5 m1 x! V/ X: w3 X7 ]- [      ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
; O& m$ D: I* f) s! I      program_name=/opt/gitlab/embedded/bin/chef-client
- ]9 i2 T/ d- {: ]! n5 @      executable=/opt/gitlab/embedded/bin/chef-client" g9 A% V7 K4 |2 e) v/ H6 y
      
: j: D( m) @" f& t' _   
* c6 @. E# z. k" V    ================================================================================4 @) G# A, H3 F7 w6 c
    Error executing action `run` on resource 'rails_migration[gitlab-rails]'
! Z0 |/ O0 R) ^7 Z2 a6 r& R    ================================================================================
+ ?/ }' v" V% ?; p    8 _& D, ^- J- A$ \; L
    Mixlib::ShellOut::ShellCommandFailed
! ~7 S2 C# ?: |3 q& J    ------------------------------------
. `5 m8 R" j# b# p2 G    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. J7 h# s$ g; x/ F. ^8 s" w0 `$ M
    ! g3 C: o  }6 q5 Y  n
    Resource Declaration:: Y1 e. r! @+ P% U- n& i
    ---------------------% U# P% \) L7 T5 x, Y3 O
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb7 k0 E! Z" z, |3 @* ~
   
6 L8 \1 t  |: T7 E4 B     51: rails_migration "gitlab-rails" do; p& X$ @7 C4 }# P4 a' D8 i1 ~
     52:   rake_task 'gitlab:db:configure'# ?2 o( r& y% x* F
     53:   logfile_prefix 'gitlab-rails-db-migrate'
0 r- ~1 j8 L4 w" j( @( f     54:   helper migration_helper: v: {& N# H8 S9 S/ k: E
     55: , y0 l9 o. q/ _/ d" n
     56:   environment env_variables
# l0 b; u' c4 r     57:   dependent_services dependent_services. t1 w+ }) H5 R3 t
     58:   notifies :run, "execute[clear the gitlab-rails cache]", :immediately" z/ Y# k6 O8 d5 l* S5 U+ t. h& E) h
     59:   notifies :run, "ruby_block[check remote PG version]", :immediately
) k* ]* ]; x9 ~3 u     60:
; u2 W& w. B; {0 t5 g; a7 a# Z     61:   only_if { migration_helper.attributes_node['auto_migrate'] }
, p4 V9 |# D9 u0 c     62: end* l  q5 d0 _9 M( b% Y5 h% W
   
! Q- |. C; ?3 S3 x    Compiled Resource:1 F7 {1 x( ?- P' \  Z5 U% }
    ------------------
5 @5 `. K2 `8 H. M1 ?    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'
  X3 _; x5 r1 ^3 C   
8 U3 G& l$ m- l8 s# C    rails_migration("gitlab-rails") do
  r$ R% E' Z/ `5 H0 Z      action [:run]
2 o" Q  Z. U5 s      default_guard_interpreter :default! S/ w/ C. t- R0 b3 z1 y/ ]8 I! U
      declared_type :rails_migration
3 O3 j0 M# _/ B; T8 @8 i      cookbook_name "gitlab"
  m6 a! O7 d0 V, I# v      recipe_name "database_migrations"$ m% M) O- d0 F( \  y
      rake_task "gitlab:db:configure"; Q4 C- @# d% r- N3 K/ h: v6 V" y
      logfile_prefix "gitlab-rails-db-migrate"
- S# A1 B: ]" _      helper "*sensitive value suppressed*"; R+ ?! O, w; f) J
      environment "*sensitive value suppressed*"! Z9 w5 G" G2 _/ Z+ b
      dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]2 a7 M0 K" S0 {* P2 B+ J
      only_if { #code block }
  m: U8 {) V8 v4 @; X    end) p1 w. t* b& F7 F  h  X
    , [$ Q5 @1 e. ^: [7 `
    System Info:/ X; a$ @5 Z" f" e& g2 y. g
    ------------. O/ D# j6 P8 Z) Y; [0 N
    chef_version=15.17.4& i8 n1 s1 [% w! V4 ^2 ~7 k/ G
    platform=ubuntu
) @3 g1 k! S7 w    platform_version=20.04: R, C$ x5 R9 F: n. A2 L
    ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
  z& ~0 H0 |% P; E' d. {4 |2 S* A    program_name=/opt/gitlab/embedded/bin/chef-client- q% \$ @# z0 i/ w0 C% f. x
    executable=/opt/gitlab/embedded/bin/chef-client/ C3 S  }: v6 [7 Q
    8 c' B1 ^. L; g- x8 j. h' C
Running handlers:5 t& R4 x& N  W$ p: Y
There was an error running gitlab-ctl reconfigure:
. i+ \( u5 W( W' P& J$ \) Erails_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# p4 k4 u0 @; V8 `5 Z
Running handlers complete* h' ]7 L' {- u- C9 D8 W4 s- s
Chef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:
& U: G) @) n4 ~3 E0 |1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;
4 l6 o. D) j  L# ^( o: L9 w2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;5 [  f7 `% r7 }9 j0 U5 O2 w. D
3. 再次运行 gitlab-rake db:migrate,确认不会再报错;& [# r8 r# v' D9 O1 T
4. 运行 gitlab-ctl reconfigure;( Y2 v: A/ I1 r+ H2 c% V
5. 重启Gitlab:gitlab-ctl restart。8 u! y+ D& a/ C$ ^0 i( a- e
需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。; M* g5 q$ E( n1 g; G$ z% ]
参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated
6 \  r1 p8 I& y  y2. gitlab-ctl reconfigure failing due to migration issue/ ~) n3 @1 l7 c: C
AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2)
回复

使用道具 举报

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

本版积分规则

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