扫一扫,微信登陆

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

搜索
查看: 1672|回复: 0

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

[复制链接]

1万

主题

1万

帖子

5万

积分

论坛元老

Rank: 8Rank: 8

积分
56206
发表于 2022-9-11 20:40:14 | 显示全部楼层 |阅读模式
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。7 E7 N) {+ ?  h  ?. F
登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。) W7 ]3 d+ y: B4 M+ d' j8 s# {
运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。9 u1 }, Y7 W# a" c! N2 d
接着设置语言和本地化设置:) |9 u" S* [/ B) T) e. w
export LC_ALL=en_US.UTF-8
* V1 k  A, u; _export LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。8 i; C1 F& }+ P
但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?5 \( Q0 {/ ~; r
于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:0 e8 o" W! d) _
Recipe: gitlab::database_migrations
6 L9 b8 B9 T! }% e% Q( V' K; D  * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)
' `5 k- A* w5 e1 c. |: C$ i  * rails_migration[gitlab-rails] action run
9 k9 q# ~/ n8 c    * bash[migrate gitlab-rails database] action run9 F5 A: h" ?" n& ?6 {
      . l8 k/ i( r; M8 p' |  p* F
      ================================================================================
: g7 m$ m% t5 x. ^; n+ C      Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
1 O4 U+ R/ ]" s; |3 e) Q6 f      ================================================================================! F5 h  {% z: |! Q1 x9 [
      ! Q; K; n7 |5 S1 R# s
      Mixlib::ShellOut::ShellCommandFailed
; W0 M" @6 O. T* X      ------------------------------------' p" P: E' [$ ^/ z2 Z
      Command execution failed. STDOUT/STDERR suppressed for sensitive resource
% B) p; M. c* p/ C      " i. [' O* z! Y0 Y1 b4 o, }; s
      Resource Declaration:
0 l9 n9 x' ]" j' k) t! \" W      ---------------------
4 c, r% e  u, h1 I( I$ v      suppressed sensitive resource output
# g: c( A' x$ f7 P" Z2 b      " \* {2 t, p+ V9 {+ u# }
      Compiled Resource:
# a% u+ E+ I5 {! F/ b      ------------------
8 R% O0 z, Y8 d  l: c. o" \4 Y7 `      suppressed sensitive resource output: J  U; t, K. x% p0 Y$ t% n
      
# L0 O, P3 ~$ Z; O0 W9 ~& m  ?      System Info:* A# p( f! |2 R# o7 q1 a
      ------------
7 J, l' B7 A, Q! ]; Z; w      chef_version=15.17.4
  B+ e5 k) z% ^7 W      platform=ubuntu; w' m0 y5 z! e8 P" ?( Z' {; o7 |
      platform_version=20.04  s! ]) s; I# m% O
      ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
" h- _3 }3 P2 J! n3 }& j      program_name=/opt/gitlab/embedded/bin/chef-client
8 V% a! H; A" D. ?% X      executable=/opt/gitlab/embedded/bin/chef-client
* P9 `4 \+ |9 @: I      
, {7 K# s; r% j' O- B    % v: u) E8 B1 N
    ================================================================================
' d0 m$ S1 \' C1 b$ ?$ u9 H! g    Error executing action `run` on resource 'rails_migration[gitlab-rails]'! Y( t3 s5 w" k- d2 ?
    ================================================================================! w, \9 j% t" h8 \1 W1 J* v6 S
    . |( m* w/ c2 O' r6 S
    Mixlib::ShellOut::ShellCommandFailed
1 V: |! D' m2 w, b" u+ a: `/ L    ------------------------------------
. D( ^5 P: |" L# G% Q6 }& i    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: ~0 C' `+ m6 K% ^- d$ I
   
$ N: m. m5 a* [    Resource Declaration:
0 z( C8 R2 C# Q# x: L    ---------------------9 G; h8 c* f1 {$ x  t% `
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb
( `5 ~4 l1 Q, u( v% }   
4 h9 h. E  H: L8 g0 {. R0 e. l     51: rails_migration "gitlab-rails" do
( x7 e: X3 E3 u1 H     52:   rake_task 'gitlab:db:configure'
; I2 S- v. }% K' n$ ?     53:   logfile_prefix 'gitlab-rails-db-migrate'
/ O1 H! W4 t9 q/ s  X     54:   helper migration_helper( s+ G, g: Z6 d1 |, m
     55:
9 G! K8 r* w/ \$ S! P2 U5 I     56:   environment env_variables
8 Z$ a; c3 Z- R- l: ?! L1 m* p     57:   dependent_services dependent_services# u5 o* ~& h! ?0 v0 O% G
     58:   notifies :run, "execute[clear the gitlab-rails cache]", :immediately# G3 i, y. Z. `$ @1 r
     59:   notifies :run, "ruby_block[check remote PG version]", :immediately
' t& L9 v% u! g; p% a+ l. H8 k' O) S     60:
& ~  y; T0 y/ f8 q4 ?$ B( h     61:   only_if { migration_helper.attributes_node['auto_migrate'] }6 I7 N7 X( Q: Y. X
     62: end
$ o0 o3 u3 V3 m& g" E# t; i- K    4 T; I. s1 a* H9 J
    Compiled Resource:/ I: c& X, n" Y$ n( k' C
    ------------------( S4 x- X1 \1 K$ O" }0 l3 m. k
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'$ Y3 e" |2 g) o5 K, _* E, [* F
   
5 `; L9 x1 C" O2 z    rails_migration("gitlab-rails") do
  F' ~; c8 Q$ O; \) U* C0 A      action [:run]" T& D9 P( L5 U( {
      default_guard_interpreter :default
4 E2 Y2 k" m& I: S4 _      declared_type :rails_migration. C1 k1 l# A$ P8 `! t- m
      cookbook_name "gitlab"
  p; r) k+ p8 b. z8 ~# r      recipe_name "database_migrations"
5 y: R% k2 d7 e& w- }3 O, B      rake_task "gitlab:db:configure"
: Y0 U" M# H1 ]! B  s      logfile_prefix "gitlab-rails-db-migrate"# ]0 a4 M) e- c% z4 t6 Z" _
      helper "*sensitive value suppressed*"
& C* v0 u. `/ [! Y4 |5 j+ N      environment "*sensitive value suppressed*"8 c3 U7 `" @4 j/ k" v
      dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]7 J5 \. e" L" N2 d8 Q* A2 Z' _0 _5 H
      only_if { #code block }, [- u7 R" `% V
    end
0 |2 V3 P, ]' H4 r$ e      ~% N+ ]; Z6 _8 _3 ]& B
    System Info:
, @* H  n" f* M; d    ------------
, u8 H5 ?' U  c. V    chef_version=15.17.4
+ p, p" l/ F- c+ N    platform=ubuntu
9 Y! D) `1 Y9 L! k    platform_version=20.04# ^- t+ F* W; W# i1 h) y
    ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]; K/ ~* N  r  |7 ?
    program_name=/opt/gitlab/embedded/bin/chef-client; L3 @. D3 o( _, j$ b
    executable=/opt/gitlab/embedded/bin/chef-client( E9 _3 h9 S9 A
    3 r, w7 n, e& D) n0 `# e( G7 ~
Running handlers:
& w" N  J8 ?- [3 b% @There was an error running gitlab-ctl reconfigure:. o0 _' K( e5 E2 E1 i" z
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
9 _9 S7 y3 {; `) _' ORunning handlers complete6 r/ B5 F1 r# D. ^& L* l) s
Chef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:5 ^- U: P% l2 D. t! o" |
1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;
+ @$ C( g% @% P4 }* z: M2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;
( n9 ?! c: P, R3. 再次运行 gitlab-rake db:migrate,确认不会再报错;
1 ^, N9 |2 L' o1 {6 B5 o  Q4. 运行 gitlab-ctl reconfigure;- O- ]  h( O! ^! {/ R; D8 Q" y# H1 k
5. 重启Gitlab:gitlab-ctl restart。
7 f8 C( S% t2 R7 R& l需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。0 W/ H) z( V; X
参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated
1 j. m( r$ v7 Z4 N5 c3 S# y4 U6 _2. gitlab-ctl reconfigure failing due to migration issue
5 j+ T. ]/ @+ e; Q& |AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2)
回复

使用道具 举报

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

本版积分规则

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