扫一扫,微信登陆

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

搜索
查看: 1545|回复: 0

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

[复制链接]

1万

主题

1万

帖子

5万

积分

论坛元老

Rank: 8Rank: 8

积分
56206
发表于 2022-9-11 20:40:14 | 显示全部楼层 |阅读模式
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
- h* m/ `. r7 o/ `: s# D登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。- C1 h3 Z. U1 J) s0 I
运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。
3 J6 c# x" c5 `* g接着设置语言和本地化设置:
  r. H7 b+ _$ t+ Wexport LC_ALL=en_US.UTF-8( ?6 C1 l+ C2 j$ p
export LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。; J; C- x9 o9 @+ g* P
但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?; \2 Y  w# q$ U( m% z
于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:
' v5 ^% e& P: b, e/ GRecipe: gitlab::database_migrations0 N% s# |  p/ e* w; {- Z
  * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)
+ z' _% B/ g% J, v  * rails_migration[gitlab-rails] action run
1 l# ~' _7 Z4 e# T4 y1 x    * bash[migrate gitlab-rails database] action run" O2 V  {  r/ }% z5 M* F4 W
      $ x' r: X9 o, \
      ================================================================================) p$ Q' m) |/ E+ s) m
      Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
$ w  _5 U7 _# O/ L/ G. h  Y      ================================================================================2 ?0 l7 g7 Y' {( g
      1 U  ?  O" S" m" ]4 C9 k
      Mixlib::ShellOut::ShellCommandFailed3 S. {+ Q7 O/ x3 Q+ p
      ------------------------------------
9 A2 z/ x9 m# T3 y      Command execution failed. STDOUT/STDERR suppressed for sensitive resource8 c5 w. c4 n% q
      - U# a9 b; z/ Q" t, t2 H
      Resource Declaration:
4 \+ g" j% s* B+ u3 ^0 ?  ?, G" e      ---------------------
* w5 K  r9 Z$ g# h. ^& }      suppressed sensitive resource output
; F+ t  J' O* x& w  P      
6 K; f- X" V' c3 D5 M      Compiled Resource:* [* K* S0 b( ]3 F( a) ]
      ------------------- |  {  ^7 t' L6 s- x
      suppressed sensitive resource output9 ]2 a4 ^+ m3 X9 ?% }# d% l% ]' }
      
* U9 f$ O+ m' Q      System Info:
8 V4 K$ b2 g3 f      ------------
/ ~6 o7 N% |$ g5 a! R1 [4 T5 w      chef_version=15.17.4( C6 E3 S3 c: I$ {* m
      platform=ubuntu8 Q  @6 [2 K/ |2 q4 R
      platform_version=20.04
" m. a5 X! z  u' n+ g      ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
- z7 |; f+ z' F) y8 B% Q3 I      program_name=/opt/gitlab/embedded/bin/chef-client" }. g  o& ~" u1 t* u5 u( p
      executable=/opt/gitlab/embedded/bin/chef-client+ c3 ]/ t' z, Y
      
0 s' R# J# l" M# g    5 R3 c; @% x0 \9 X% j, ^/ u
    ================================================================================
* o2 j, q6 X# f( I1 V  a. n    Error executing action `run` on resource 'rails_migration[gitlab-rails]'
* t/ T0 c4 o( S) o* w    ================================================================================1 G- v. L7 h  v7 _6 ^) C6 |
    # l, ~( e* X  `! U: T3 J
    Mixlib::ShellOut::ShellCommandFailed
& ^5 i5 X7 @  B0 s    ------------------------------------5 q( D- t6 B+ k" ~9 G- A+ \2 s7 J, {
    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  c" @( _" _! e4 d4 _
   
, O1 B& V" T0 G; ~! k    Resource Declaration:
# z5 X2 m7 @0 |1 L+ G    ---------------------5 l! g3 n5 M; m. B7 |; ?- `$ A
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb, M  j9 w# L4 H( V1 i) u9 q
    * D3 S1 c  U# Z' w, d1 \3 a5 j
     51: rails_migration "gitlab-rails" do* R" l0 D( Z, ]
     52:   rake_task 'gitlab:db:configure'
& {. k" ^( o3 x7 y4 N     53:   logfile_prefix 'gitlab-rails-db-migrate'
/ t8 ~* ]4 J0 r7 Y     54:   helper migration_helper
9 Y/ c$ m, k  q* O6 u7 }9 h     55: 1 o4 {5 J" ^1 ]5 j
     56:   environment env_variables
' f3 K8 o3 w' m& U     57:   dependent_services dependent_services7 k; @- Y8 {# N& n. U& ?2 P
     58:   notifies :run, "execute[clear the gitlab-rails cache]", :immediately
- B1 p5 r+ c5 ]% E7 k$ Y0 Y! N     59:   notifies :run, "ruby_block[check remote PG version]", :immediately  h6 d; |; z6 z* H, a2 h5 i
     60: ' s1 l  _5 v- r3 @& t# e
     61:   only_if { migration_helper.attributes_node['auto_migrate'] }
, S. y$ Z4 C" C, m! i. K     62: end
. T$ A0 D6 z! Y# S$ v6 _   
7 i& [1 {1 v/ f6 s    Compiled Resource:/ c! t0 y6 v6 [, j
    ------------------3 P: z- R% n' p) L
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'& v2 r1 b8 l7 b' e( N3 F
   
$ l$ V" V$ k  R    rails_migration("gitlab-rails") do
; {2 @+ u2 C0 d  {! E5 R( e      action [:run]
! _1 t# H" p2 o      default_guard_interpreter :default. O, N  ]( ^3 I" g5 ^& ~
      declared_type :rails_migration! d% z2 O6 v& O: U* q8 S
      cookbook_name "gitlab". C7 C% s7 o9 z0 R! N4 P8 q
      recipe_name "database_migrations"
$ L4 L) f* I1 P; G% d      rake_task "gitlab:db:configure"
4 T/ L% ^0 X) [: J+ Z" l      logfile_prefix "gitlab-rails-db-migrate"
6 h% {3 K1 Y1 C# A- r- V      helper "*sensitive value suppressed*"
, E& Z5 m+ ?$ R( A8 Z" n8 Y' i      environment "*sensitive value suppressed*"
" m6 N- K6 m/ w- Z8 ^      dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]
: {! z) W( Y" m      only_if { #code block }
- K( `" i( _& }0 c# q! X    end0 i1 D" f8 @, |
   
3 Y1 n& V2 e0 ~4 s+ Z" P- C    System Info:8 e+ c; |; q8 Q/ J4 L/ A1 T+ Y5 r/ _+ X
    ------------
4 X8 o& G- h* j+ x    chef_version=15.17.4, _$ e8 f  q+ b2 d# U$ [
    platform=ubuntu
  t: V( Q- k. _& v    platform_version=20.04) \0 K6 S9 }0 c' V. V7 U
    ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]) Z2 O- V3 k8 c3 {# p6 c8 j0 Y  U9 ]$ @$ H
    program_name=/opt/gitlab/embedded/bin/chef-client  ?  M! r5 z$ C6 v; d3 f! L
    executable=/opt/gitlab/embedded/bin/chef-client+ F: p7 ~8 P+ w% w: F+ k
   
  x0 L) g* x' QRunning handlers:! K: R0 ~. _5 S& H1 K2 M6 {
There was an error running gitlab-ctl reconfigure:: L; ^. X6 t( D* r. @
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
! ]3 P3 e6 @& m4 kRunning handlers complete7 b: e1 E) p  y
Chef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:
  j8 H" z, Y, o6 `( K9 I' U1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;
) a$ }* T6 m3 ]2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;+ k, [, @1 a3 Y. R( G
3. 再次运行 gitlab-rake db:migrate,确认不会再报错;
* @* l7 L# Q* X& ~+ t4. 运行 gitlab-ctl reconfigure;
1 E4 K7 O4 Q& h) Y6 U+ n5. 重启Gitlab:gitlab-ctl restart。
! a# h# p# ?3 O, S* s# M' g需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。
( ^7 X% Z5 E' ~6 Q( D5 ]) Z参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated+ V5 |; u0 X# d0 X/ ?+ Y
2. gitlab-ctl reconfigure failing due to migration issue7 x9 e% C  j4 A" V$ [: L' k0 w/ G1 H
AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2)
回复

使用道具 举报

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

本版积分规则

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