扫一扫,微信登陆

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

搜索
查看: 497|回复: 0

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

[复制链接]

1万

主题

1万

帖子

5万

积分

论坛元老

Rank: 8Rank: 8

积分
56206
发表于 2022-9-11 20:40:14 | 显示全部楼层 |阅读模式
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。& q& x6 \6 D3 R6 ~
登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。
4 |8 `9 N8 [4 N& c! X运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。1 s, U7 V3 v( i! O( G
接着设置语言和本地化设置:) L) c0 ?; d* {4 }0 D, L9 K, p) ?0 p: w
export LC_ALL=en_US.UTF-8. q6 V2 ^  Z0 s: Z) n. b
export LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。/ C4 w/ I! T4 z+ `# G
但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?
% A& C3 t4 L  V% H5 p6 ?/ Q$ L于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:1 |, [1 Z: ]; i- s  y2 r
Recipe: gitlab::database_migrations2 O( |0 q8 O* M& r7 t
  * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)4 E' |% y$ I9 _# f, e+ ]6 y- C
  * rails_migration[gitlab-rails] action run! M6 a, i" I$ P, l) @3 s0 t5 E  h8 r8 z
    * bash[migrate gitlab-rails database] action run: b" e! C- Y" A3 M
      
3 }3 Y+ u: i, t      ================================================================================7 }% u9 E) w2 c8 a: m% ]! F
      Error executing action `run` on resource 'bash[migrate gitlab-rails database]'+ L" f, G) `8 b2 F8 Y/ f" h
      ================================================================================
& M8 |( z" k  E! c1 A! I/ H      1 p( V* Y" ]6 Y; m9 Q
      Mixlib::ShellOut::ShellCommandFailed
" p, O4 u+ x; k5 Y9 N: S# A8 G      ------------------------------------
3 m) |. R6 c% Q      Command execution failed. STDOUT/STDERR suppressed for sensitive resource# H/ m0 l3 y+ M
      $ m7 @! J% D6 t3 l% r
      Resource Declaration:/ T8 j  n* l+ J2 [
      ---------------------
" K. F9 _# G' f4 Z* `: R      suppressed sensitive resource output
% R/ Y, e0 G8 K# w7 h      * l. ^8 W( h& _8 f# Q8 G
      Compiled Resource:
6 z% e- F' |! U/ @3 p8 _/ a      ------------------
" j1 w& N; b) i      suppressed sensitive resource output. @# |, h2 W. P$ ~% m, Q0 e
      
" e& P( \% o" T/ C      System Info:6 x9 X# u, ~6 q# f2 E( o1 y' x
      ------------
2 B& c" u+ |( X4 a& ?: I8 M# D% g      chef_version=15.17.4
0 p9 V/ @# D$ `6 Q      platform=ubuntu
2 L# k/ w6 n4 Q# I7 t0 E0 h      platform_version=20.04
/ ]/ H, {+ O9 A      ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
, S7 Z' d+ i! ]* P$ m      program_name=/opt/gitlab/embedded/bin/chef-client% M) J) k3 f$ S( X( b! G; ?
      executable=/opt/gitlab/embedded/bin/chef-client2 H8 z# L5 d4 o' d
      
5 t  j; H& t/ Q: Y   
2 J1 }; O5 g. `' l    ================================================================================
9 u' e( ]9 b6 Q. M! o+ ]6 X5 ~    Error executing action `run` on resource 'rails_migration[gitlab-rails]'5 u# q6 z+ {: m! U% a
    ================================================================================
' v* p4 b. s" L8 `! t   
0 g( Q( s4 _/ o' F    Mixlib::ShellOut::ShellCommandFailed$ ~. {  v0 K7 C5 W5 ]; b% X7 @4 A
    ------------------------------------
7 g( L8 _8 t7 U9 E& Q    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+ j- e- C' D- b% k$ x$ V1 e# e7 l
   
" I. X/ I8 b( l2 s: ^* x2 |2 t+ Q* M    Resource Declaration:
. O9 Z9 n$ r3 N) Q' D    ---------------------' s9 R9 w. O9 u$ k. a$ I& e
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb
# z5 m) j" V/ O8 Z' S; Y5 G+ Y% k    3 ?+ V' O" P+ q1 K! o* p4 f
     51: rails_migration "gitlab-rails" do2 T1 [. B9 T- ?7 w7 F: p
     52:   rake_task 'gitlab:db:configure'
2 o: w. V& u4 \; Z/ d     53:   logfile_prefix 'gitlab-rails-db-migrate'
& `5 X  H  v2 T) L" d7 g3 B$ c     54:   helper migration_helper, {/ h+ H- B6 k) U
     55: ! I+ z: i2 g2 E- h9 g0 o
     56:   environment env_variables
$ C: ~+ e# s- u* K' h3 N  Y1 b     57:   dependent_services dependent_services, A4 Q0 s' R% ~, B2 A, G
     58:   notifies :run, "execute[clear the gitlab-rails cache]", :immediately3 [: i1 B  n/ Y" U
     59:   notifies :run, "ruby_block[check remote PG version]", :immediately
# C& H9 T8 c9 @     60: " t! n9 [( l" N- H1 Z, S
     61:   only_if { migration_helper.attributes_node['auto_migrate'] }7 G7 Z3 ^9 q) L! ?, J6 g1 x
     62: end
1 g& J+ L& t' h& A   
1 h& U3 ]; P& ]3 r. }/ C    Compiled Resource:
( E' n* h$ f. W( @) ^. z. j    ------------------
+ n) N0 M. \( b; q& ], T    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'8 G6 g7 x2 A! x2 N
    ; i) l' [2 P( S. S& N2 M2 J
    rails_migration("gitlab-rails") do2 u, d: O  Q: h; V) P
      action [:run]
; M8 _$ `4 O7 J; Y& |      default_guard_interpreter :default2 R4 O8 D, d# g/ {, Q! Z* T
      declared_type :rails_migration
9 O. a( _' r& n2 z9 c8 e      cookbook_name "gitlab"  U- `( t, r3 [6 f. H3 [6 I7 Q+ T9 v! p
      recipe_name "database_migrations"
6 d! D/ ~- w0 v      rake_task "gitlab:db:configure"6 B7 |2 d) c# B0 p# L
      logfile_prefix "gitlab-rails-db-migrate"- J) a# K$ D! q! v8 E( @& F: S
      helper "*sensitive value suppressed*"' F5 t' U# b- \1 d
      environment "*sensitive value suppressed*"
$ Z6 h# x& ?% ~* A6 A* d      dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]  ]  o) `/ y" C% n6 o- J( q
      only_if { #code block }
6 z, x% U" w% O" T" ]2 B    end
3 p  y8 R. j5 d7 m% |" t! a   
9 G* Y% E! {. F& i) T4 O* o9 b    System Info:
0 E9 t7 [! a( {0 H9 u7 a* n- a    ------------
3 ^( r1 q/ O4 O( n' b5 _    chef_version=15.17.4  O. O0 o1 e7 d& h
    platform=ubuntu
) d5 q( N6 ?; y! I6 }    platform_version=20.048 @: D6 R% O2 G# D# I1 Q& D: J
    ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
1 N1 U9 g0 \) k. F! x    program_name=/opt/gitlab/embedded/bin/chef-client) N0 V2 n0 j7 |7 ~, h$ U
    executable=/opt/gitlab/embedded/bin/chef-client
) P$ \1 u9 m$ C% ~& X* y3 j6 `0 @    9 W3 j! D% V" _  m( ~# {
Running handlers:
% Z9 t# Q; J, N. pThere was an error running gitlab-ctl reconfigure:
% K3 A9 l. p# G/ i+ X( w7 i) d9 q" ~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: _) i- K. z0 K& j& U0 c
Running handlers complete0 i" i; b7 t# L
Chef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:
* A+ B) D+ U! U4 C/ r1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;7 A/ J6 a4 M8 B
2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;
+ B6 f- d3 B$ a: y/ Z& ?$ c. s3. 再次运行 gitlab-rake db:migrate,确认不会再报错;0 n6 A' ^! _6 \' ]
4. 运行 gitlab-ctl reconfigure;! z' W6 I  W+ o
5. 重启Gitlab:gitlab-ctl restart。
- w* ^" O5 M) X需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。( b! Z' Y$ z# _6 z) D
参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated
  S! Q* ]& m( I+ }2. gitlab-ctl reconfigure failing due to migration issue) T% ~9 S( c7 G) `9 b4 W3 X
AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2)
回复

使用道具 举报

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

本版积分规则

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