扫一扫,微信登陆

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

搜索
查看: 436|回复: 0

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

[复制链接]

1万

主题

1万

帖子

5万

积分

论坛元老

Rank: 8Rank: 8

积分
56206
发表于 2022-9-11 20:40:14 | 显示全部楼层 |阅读模式
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
: j# y1 z/ s5 i. Y7 |, l7 ?8 B登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。
# _0 [6 n) O% G! y7 b8 N运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。  Z6 t5 y8 l' R
接着设置语言和本地化设置:
( ]7 `; R! r7 p; a* {export LC_ALL=en_US.UTF-8
+ k. k1 R0 m! Y/ f. e% n9 K3 Qexport LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。
! c  }, u5 F; o! p但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?
" |& s$ o# H0 }于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:2 [2 K& N: h1 }; i: Z
Recipe: gitlab::database_migrations- X: Z. v' r6 c& _( X
  * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)* b# n; P, u/ W9 Y; ?1 P
  * rails_migration[gitlab-rails] action run
8 B8 J# [7 b9 I: @" \    * bash[migrate gitlab-rails database] action run7 ~$ N$ b+ D# R) V( K0 S: ~
      
2 b$ O, G2 n# l6 B1 J0 X/ B: b( I      ================================================================================
7 g& K4 S" Z7 O4 V8 `- T      Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
! G8 r  e3 l' M: Z( r      ================================================================================
  @* ]5 f, c, f- N" N  |      6 z( D  ^! i9 Y% E& \8 U" O
      Mixlib::ShellOut::ShellCommandFailed  W; L5 g: b8 z5 ]: e. x
      ------------------------------------
2 B8 {; \7 n6 W      Command execution failed. STDOUT/STDERR suppressed for sensitive resource
# J. ?0 u- e+ F- ?      # C  R/ e2 \0 I$ ?" o: ]7 w
      Resource Declaration:, P, h7 [3 [9 Y; |1 I
      ---------------------2 ^% s- t' U; A6 u9 g/ K8 S% u9 f
      suppressed sensitive resource output; p, N8 Q4 B) [! J8 c3 w
      
. |7 q9 x: u* T2 y      Compiled Resource:
) }3 V) B5 ~- P6 U  e; U      ------------------
8 ]- Y2 g! h! V6 f      suppressed sensitive resource output
, j# H4 k8 Y5 @! r  s8 t      3 W: x8 G' d* T$ l3 A$ p9 y
      System Info:
0 S$ M. ^2 z( _. R      ------------) f! b1 p. C8 W; C
      chef_version=15.17.4; g9 M' m  |1 u7 g! x' x+ n
      platform=ubuntu
% G  X/ N0 v' {) A8 P2 o9 T& Z      platform_version=20.04$ K! J5 S0 N1 T5 H* }, n/ d
      ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
; X* C6 N' s  F      program_name=/opt/gitlab/embedded/bin/chef-client/ e; l6 X6 }$ J$ b
      executable=/opt/gitlab/embedded/bin/chef-client2 t: g2 F# {$ @0 O' O
      / C( h$ ~) P" V6 F3 v; u0 V5 z
    , k' k& a4 F8 ^- G; U# m7 Q
    ================================================================================6 {, I; I0 w' F$ Z! T* I: C! Q$ ~
    Error executing action `run` on resource 'rails_migration[gitlab-rails]'
. A, e: m! Q( J. s+ Y    ================================================================================
. o% ~1 j& M8 v4 j7 I    9 I/ \2 Q+ p# ]$ _9 ~
    Mixlib::ShellOut::ShellCommandFailed
* }  P1 \% J, a$ V2 `1 Y% ^    ------------------------------------+ x. d! Q4 ~& Y
    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) N. J! X& O) w6 B7 T* y/ V
   
1 K# S) m. w8 g* e# [( A. X    Resource Declaration:
' G; t0 Y0 x: s3 f0 g% ~. ]    ---------------------
7 I6 I& b' k; l& z    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb
+ d  S( Q9 B, h3 Q   
4 i, D- u/ ?: O( C     51: rails_migration "gitlab-rails" do* X5 }9 I: e. u
     52:   rake_task 'gitlab:db:configure'
3 y) g& K3 w* v, F; m) @! Q' B     53:   logfile_prefix 'gitlab-rails-db-migrate'
' i/ @" {. K! H# g& A3 ?     54:   helper migration_helper( R2 A- `5 \$ Q& y! e1 W+ b5 l' S9 ^
     55:
) d) e# f( O. o( v- O     56:   environment env_variables# g' p( @+ J; b. ]  H* I% w
     57:   dependent_services dependent_services
( S/ k4 d5 u' G6 @     58:   notifies :run, "execute[clear the gitlab-rails cache]", :immediately  Z% E" H6 y! V+ t
     59:   notifies :run, "ruby_block[check remote PG version]", :immediately
, r! d3 Z, n, g0 G, x     60: & [* ?& E; R: `7 |* Q3 a
     61:   only_if { migration_helper.attributes_node['auto_migrate'] }
4 _& @; B/ k5 R. D+ _     62: end
1 ^% C6 ?2 d1 C1 X% s$ M   
- u0 b, j% q* M8 y    Compiled Resource:9 u) ~0 S; z7 d1 F
    ------------------0 _) M+ ?$ z+ X  z: I2 {
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'
& e$ @6 V* a$ p0 O% Q    ! z; [; |& [4 f" f# ~6 f: c: V6 |
    rails_migration("gitlab-rails") do
# \( p9 |' Z7 `# I6 N$ @0 W      action [:run]  ?- C6 K* t/ t3 o5 U
      default_guard_interpreter :default
4 z4 q4 f# Y( \( \      declared_type :rails_migration: W7 g3 ]1 m" I# e) G
      cookbook_name "gitlab"
8 e; {$ }- J, e* n      recipe_name "database_migrations"
; @  K  i/ q# Q# f. g- g" K      rake_task "gitlab:db:configure"
# n) h+ w7 d3 @. K' |      logfile_prefix "gitlab-rails-db-migrate"
( i, s6 k% n/ V, U7 o6 c; K) q      helper "*sensitive value suppressed*"
& C; }8 @3 O- d2 u& [- ^8 @2 F      environment "*sensitive value suppressed*"/ H9 E) b- \. H: c5 p  O3 \
      dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]+ \2 h0 ]; F1 b+ [
      only_if { #code block }
/ e3 k' X' Y6 P6 w+ m/ p    end
1 p# Z; R8 K' {! ^$ J& ~0 L' u. A   
# I/ z) \. h3 ]& |- F    System Info:" s5 v" \3 c- B! c8 B3 e. ^, ]
    ------------
( i8 M4 h* H, Y* v) R1 ^    chef_version=15.17.4
9 h# T1 i7 e+ W& G0 _1 n& b+ ~6 [    platform=ubuntu
3 r+ v7 h2 C5 N: v5 \/ l    platform_version=20.04
# D" c, A) z1 U- w    ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
2 |! O( ^- o9 F! {- J' ?    program_name=/opt/gitlab/embedded/bin/chef-client
: @0 F  _3 k  P  {; Z5 a% N    executable=/opt/gitlab/embedded/bin/chef-client
, }$ Y0 ?" k7 E" ?! ~! P    4 D0 W" T( r8 e0 ?
Running handlers:
. s" n+ f: y, ZThere was an error running gitlab-ctl reconfigure:: X" m; d# m9 q* H) N4 p9 d2 l* }1 A
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
. V2 o& ^$ F* Y0 p' oRunning handlers complete: B9 U" w0 Y7 x! x2 j
Chef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:! d+ c5 ~& I, o6 H1 e' [
1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;8 n( T8 u2 a- L8 ]; L6 k
2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;
1 a0 Z0 h3 R5 P9 L" l3. 再次运行 gitlab-rake db:migrate,确认不会再报错;1 Q( G  ]& R, R1 u* X
4. 运行 gitlab-ctl reconfigure;
: z+ \+ v# _! v. D5 L# p' T# }. \' h5. 重启Gitlab:gitlab-ctl restart。0 u% T' ?2 m5 p! S) o+ l
需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。( o- [( c3 `2 s: t  o
参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated
0 p7 O: x0 Y: `3 q. _1 ~: z8 z2. gitlab-ctl reconfigure failing due to migration issue. L. x% z' J& M/ O
AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2)
回复

使用道具 举报

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

本版积分规则

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