扫一扫,微信登陆

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

搜索
查看: 498|回复: 0

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

[复制链接]

1万

主题

1万

帖子

5万

积分

论坛元老

Rank: 8Rank: 8

积分
56206
发表于 2022-9-11 20:40:14 | 显示全部楼层 |阅读模式
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。% J7 J9 `: B4 W0 o% d5 P
登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。: v2 @: @" F% k; C9 e
运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。
  W. Z6 r7 z/ D2 h接着设置语言和本地化设置:7 Z+ N) k% m" p# ^/ B( f" I
export LC_ALL=en_US.UTF-8% i# H. z# w# U  Z& N6 K. z
export LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。8 u# c8 A1 F# I# s: D
但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?- I0 K3 p3 g2 r$ T2 i; J2 J: u# B
于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:3 [) F% G+ }+ _! s( C6 [! Z
Recipe: gitlab::database_migrations
7 d$ [# D$ L0 k" h0 O  * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)
& N; V, L4 n  I1 {' W! j  * rails_migration[gitlab-rails] action run" X' l: ^# K" h* T+ ^& P: O
    * bash[migrate gitlab-rails database] action run
9 a. a% ?7 w6 d$ t4 `2 c7 v4 z      
/ a' K4 V1 Y5 q% v  v  z; `' o+ H& \      ================================================================================: d, ^: l+ U" T4 l4 z: D4 U6 Z8 @9 c
      Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
, w+ f. i- ?) v9 _! ?+ e      ================================================================================
3 v% q9 e( }$ J  r6 f      " E/ ~; L5 k0 V
      Mixlib::ShellOut::ShellCommandFailed, ~+ C+ b% @" D9 O# y: W9 ?! j9 @
      ------------------------------------0 m+ Q3 c: G( e: e0 y9 B
      Command execution failed. STDOUT/STDERR suppressed for sensitive resource# D; a5 K2 K' ?' S& ~, o8 @
      
& ?. c3 D: b9 @9 G* `. l      Resource Declaration:' R/ N. K* m3 [, F$ g
      ---------------------& ~5 |) h' G. D; h/ K3 d
      suppressed sensitive resource output
" f& w9 L6 s2 k      $ ^" {, ~" z  k6 _
      Compiled Resource:
/ A1 p' ~7 [3 x! j+ _7 J& l; J      ------------------5 v/ `; m- N$ p# l3 u; V
      suppressed sensitive resource output/ U$ P+ @- ]7 {7 n
      
. Q8 m7 P; O# B, h      System Info:
& X( [) v4 k# ~/ D. J      ------------  i% Y2 E8 }; X; H
      chef_version=15.17.4) D! y# ^6 l" R# V
      platform=ubuntu$ ^. M- S1 x+ M/ _( y5 q+ z
      platform_version=20.04  t. B: p: T% l* v) U* T
      ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]" `% i# j6 z* b8 M$ |! }3 v
      program_name=/opt/gitlab/embedded/bin/chef-client
+ D! ^4 I4 e1 o" k0 v  Y      executable=/opt/gitlab/embedded/bin/chef-client" Q0 i5 R0 q6 X* v
      
8 x% t# y  b# _$ H9 e   
0 e2 x3 y& s7 f3 Z    ================================================================================6 j* z: B$ G3 w/ R# N
    Error executing action `run` on resource 'rails_migration[gitlab-rails]'
# v+ ?+ B: B  l7 V8 e# `  g    ================================================================================( P& l; M9 q% Y! E
   
/ m' ^: k- T- C& R& k# B    Mixlib::ShellOut::ShellCommandFailed& n3 C0 p  @) p7 Z2 [& n# N' x- C
    ------------------------------------
7 x% g1 T, X$ E  U    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% \" z' y7 E( Q    / Y7 E* \  X, p: r
    Resource Declaration:
/ r+ A4 J$ i' w4 [6 V6 B' o    ---------------------9 s5 n! e) i/ e) r3 k9 G) n. U
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb; @$ }" @  U2 c) V) \/ J
   
; T: o+ i: F, w. t     51: rails_migration "gitlab-rails" do
' ]1 E- e+ {8 Y2 x+ `) ~     52:   rake_task 'gitlab:db:configure'
2 ^3 d: J" h/ j; V3 w7 S     53:   logfile_prefix 'gitlab-rails-db-migrate'5 D# d3 h0 s, U7 w9 _
     54:   helper migration_helper' v: u$ }1 l# s+ S( m# v
     55: % G7 c* `# K5 E5 P9 ]+ `; N( B
     56:   environment env_variables
6 I: Q' ?- t* a3 t! M     57:   dependent_services dependent_services
$ s& @, s5 @( q+ d" r     58:   notifies :run, "execute[clear the gitlab-rails cache]", :immediately
' }  ^/ |, `7 s5 a" s. u     59:   notifies :run, "ruby_block[check remote PG version]", :immediately
1 \  r4 a% b6 B- r2 q# G# Q, p     60: 8 V9 P* c) M3 `6 ]
     61:   only_if { migration_helper.attributes_node['auto_migrate'] }
) B1 t5 E- D/ d2 F     62: end
, w& V3 ?1 m3 K; q% Z   
6 `3 C) I/ g. O! i- @/ ]: d* X; O4 v    Compiled Resource:7 d- W" e6 L: v) r
    ------------------
( }, y; L0 |( p6 d$ a$ E  Y3 S    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'+ g/ h( C9 x* p' }7 z- C- a, ~
   
: b5 d) o, q: ~! a% P+ ~    rails_migration("gitlab-rails") do+ t  q5 U+ y* b7 L
      action [:run]
6 B* M! B) G  ~) v; Q( y" ^      default_guard_interpreter :default
! `" j5 i! S" j  B8 o6 q# d+ g      declared_type :rails_migration- ?, d+ g) n" B% b9 V3 x: V* y
      cookbook_name "gitlab"
3 h: ]2 L3 R+ O- S7 u      recipe_name "database_migrations"( \0 X( Q/ t$ w; k0 o- l* L, x
      rake_task "gitlab:db:configure") R. K8 O: i$ R+ |. i' _6 u( W
      logfile_prefix "gitlab-rails-db-migrate"2 B9 g. p  A9 j) H2 P4 D
      helper "*sensitive value suppressed*"" ^6 x2 s0 v: w
      environment "*sensitive value suppressed*"
% i, x+ A' r- Y      dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]& j4 f0 q( p5 Y+ d) b+ d$ }9 [
      only_if { #code block }0 q2 C$ j3 b" W9 K4 F- F
    end
7 [' s! K* _# `* }8 ~   
8 e, L8 w# f2 X) h; n, b. s& b( W    System Info:
  h7 b% S/ ~. }9 `    ------------# p' v; c, d) y) b( u, O
    chef_version=15.17.4- V% w: ]) a( Q
    platform=ubuntu4 r: b+ a4 u) I4 h7 ]! T
    platform_version=20.043 W8 X2 p) `8 h5 P6 Q2 s6 A; m
    ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]3 O( P7 |1 i3 A$ K1 {& C
    program_name=/opt/gitlab/embedded/bin/chef-client
4 L' ?* e  }% U. h6 [  }$ U    executable=/opt/gitlab/embedded/bin/chef-client8 R2 V3 ]$ b6 \! w9 g
   
% z  h0 z/ @% N8 w& T0 CRunning handlers:1 k+ x4 B  w5 K
There was an error running gitlab-ctl reconfigure:1 @& s( i$ f4 d7 K# O- U
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 resource6 H/ G+ A" A' O# ]
Running handlers complete2 O$ i/ n. E1 Q% l; |# V/ K, k
Chef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:  w( C( |$ \  y" ?  N2 R
1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;
* d7 Y9 r9 f0 @3 a2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;( z9 G4 A& f5 L3 Y" S
3. 再次运行 gitlab-rake db:migrate,确认不会再报错;$ }$ N  c/ z- t# r7 W
4. 运行 gitlab-ctl reconfigure;5 g' J  u5 D6 ^; h: @9 [
5. 重启Gitlab:gitlab-ctl restart。" o" Y* W- e" o% ?& b6 g; O  H
需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。
, d; V9 _6 d$ W) F) r  E: {, c& f参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated' y( {! d2 i8 \& @2 R" N
2. gitlab-ctl reconfigure failing due to migration issue
5 H8 Z/ ]/ }7 v9 V9 }4 Q) g$ n& `AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2)
回复

使用道具 举报

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

本版积分规则

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