扫一扫,微信登陆

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

搜索
查看: 604|回复: 0

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

[复制链接]

1万

主题

1万

帖子

5万

积分

论坛元老

Rank: 8Rank: 8

积分
56206
发表于 2022-9-11 20:40:14 | 显示全部楼层 |阅读模式
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
7 }0 \* r! r, A0 m登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。. `7 f& Y1 a; q+ |1 g
运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。
- N" e; s. C: K% N6 S接着设置语言和本地化设置:( M" [; p9 e' H8 G5 o
export LC_ALL=en_US.UTF-8
3 S# o8 |" V0 J% s: `, O2 z  ~9 ?export LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。% _; M# j9 w3 f/ M4 w
但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?
7 q# j0 p, U- Q1 d+ _于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:
: w/ d8 c6 X$ b  Q8 r3 sRecipe: gitlab::database_migrations* `( [% L3 o: c" {" ]; q: e5 {
  * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)1 Z- x, ^9 ?7 I, a: L
  * rails_migration[gitlab-rails] action run, X$ V. r2 k, b3 ]
    * bash[migrate gitlab-rails database] action run$ K+ }# Q' Z3 R) B# u9 l( y, D" S
      
; A) @$ d6 U% F- `( ]5 Z      ================================================================================  t) @4 p1 c( L
      Error executing action `run` on resource 'bash[migrate gitlab-rails database]': v9 h0 @# Y/ B3 d
      ================================================================================) d, L0 h! b) \1 \% Z# e" T  D
      
! ?) r* r9 C6 r5 h- F/ T  W      Mixlib::ShellOut::ShellCommandFailed& R7 W0 r2 g4 |) R$ v4 j6 s
      ------------------------------------0 ^9 {  ~! o% B2 j# }( S" R- d2 |% q
      Command execution failed. STDOUT/STDERR suppressed for sensitive resource/ y4 ]# O' r  u  ^! b. {% I( i
      : u# L) U7 o4 Y1 u! [; f* V- g
      Resource Declaration:% z2 t& F5 [. H6 p; o; N
      ---------------------$ f6 ~" M2 i5 o6 A2 m9 r
      suppressed sensitive resource output& V- w' g  L' X. b3 H
      9 V5 H  `, w& |
      Compiled Resource:
, _8 L9 L2 D: h  x      ------------------
" B. ]6 U7 Z% _' h2 r      suppressed sensitive resource output
+ F4 M4 E6 }( g1 s      : X& J7 f6 ~% a: f% e# R
      System Info:
+ D* Q; ~+ e' U7 B' F      ------------( w  V* _2 m; u, |
      chef_version=15.17.4
+ D# f6 R* e; T6 J6 v6 P# \      platform=ubuntu
# Y! G% ~$ X; |- O' C      platform_version=20.04
( p: y$ b# w6 S8 Y5 s2 S. \$ [$ W8 f# u      ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]" U2 g4 e  Y' G! P: k9 {  ^
      program_name=/opt/gitlab/embedded/bin/chef-client
5 V! W+ [* ~: J/ z$ v: ?- I      executable=/opt/gitlab/embedded/bin/chef-client
/ W  l% h' n3 K( N5 Z6 T      
& b( i- \5 {5 J+ S   
2 {% n" W8 m- T; z9 ]    ================================================================================; Z8 m9 B2 m4 I. q, \2 Z# L+ C
    Error executing action `run` on resource 'rails_migration[gitlab-rails]'5 x6 U4 b+ v2 T" w6 D
    ================================================================================/ |+ L: k  ~( T+ `) ?
   
; b. u8 d9 w$ U* Y( t$ p    Mixlib::ShellOut::ShellCommandFailed
! \5 N8 _9 O2 X3 L    ------------------------------------& H! Z+ Q7 U4 ]1 `
    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
- s8 W7 P) {0 G8 ^   
; N0 A, y( p1 P6 ]9 ]    Resource Declaration:
+ t& h( t  x) o7 G8 M: H    ---------------------7 U" Z: u; n. Y7 e( ^* E* d
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb  m, J( I8 t4 s; J( y" T
   
% }, u0 ~; L! \2 H5 i7 I8 E     51: rails_migration "gitlab-rails" do8 B' K  O, N  P9 Z
     52:   rake_task 'gitlab:db:configure'
9 }& M* j% C* ^3 I' A& O! @     53:   logfile_prefix 'gitlab-rails-db-migrate'( t2 ]* j5 Z. Q& M" H+ Z
     54:   helper migration_helper
4 {. S! R) M8 r' o, @% U: [+ Q     55: 4 D8 `" }, B- @0 ]
     56:   environment env_variables7 E8 K* h& K1 s
     57:   dependent_services dependent_services4 q" }& ~6 j3 j$ D7 `) c7 A
     58:   notifies :run, "execute[clear the gitlab-rails cache]", :immediately% d4 B7 b0 k% ]- Z
     59:   notifies :run, "ruby_block[check remote PG version]", :immediately
- G  b" j3 c. H     60: ; D/ r3 B( T9 c
     61:   only_if { migration_helper.attributes_node['auto_migrate'] }
3 W0 M% U- I/ {' A6 H3 ?     62: end
# z. L: R& \* _: f8 p' X& ?; S   
. R9 `0 J, S. |; W4 O/ o7 q    Compiled Resource:. U* O$ _, y% v% Y% q9 i* f5 O* V
    ------------------
6 Q, v2 q2 H1 W1 a& G5 }( z! G    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'3 `' i' Z8 W/ I
    % P, p+ s/ L3 G
    rails_migration("gitlab-rails") do- A( r6 S4 L$ y. T: b
      action [:run]  n8 V1 X$ `9 Z) f
      default_guard_interpreter :default
- C/ t& F( C2 A( o- @      declared_type :rails_migration
. s2 E! F: m2 E. t+ n1 ?$ K7 W      cookbook_name "gitlab", k- G3 n* Y* u
      recipe_name "database_migrations". Y" |& ?* X% J1 d6 D. _, N/ b
      rake_task "gitlab:db:configure"
# p: d- m0 I$ h) D* O  M/ W' Q5 w  C      logfile_prefix "gitlab-rails-db-migrate"
8 g5 _+ W% t# H- Q      helper "*sensitive value suppressed*"* U; G1 M  L* x, E" M; b; T: g
      environment "*sensitive value suppressed*"
6 }) I+ |- n( n  U      dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]
5 A: a! b9 X, _3 F      only_if { #code block }$ i. f7 b3 w+ E" Y
    end+ B. g  A) u' L; j0 X
    + B5 a" A" \/ J" i9 b# @
    System Info:
7 ^6 _5 x3 T! g# C7 m: h    ------------, N  h1 [5 B" N" W  _- t
    chef_version=15.17.4
9 N: f4 n' [/ S    platform=ubuntu
2 ~4 Z) ~8 J1 b6 e    platform_version=20.04+ b) C8 R- G- H+ q
    ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
. c) p+ t% ?$ d" B4 a    program_name=/opt/gitlab/embedded/bin/chef-client
# s( x/ ~1 v* W* Q! c$ B    executable=/opt/gitlab/embedded/bin/chef-client
6 Z: U/ R: `, w; R' L   
; I! T8 E9 A2 j$ f, C5 |$ {Running handlers:( i: ^: k  m2 |, E8 S' n, N
There was an error running gitlab-ctl reconfigure:
- V8 e: ?# M$ k) t; H1 Grails_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' n8 Q5 H6 h+ N5 T
Running handlers complete0 L6 i8 H0 K8 i+ V" _
Chef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:
$ y# Z1 \1 r# W: e& c7 t% ?3 K$ w6 H1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;
* R* k4 o0 y  y6 o2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;
5 u& x7 I+ Q/ O; t% Z3. 再次运行 gitlab-rake db:migrate,确认不会再报错;2 t9 v! w+ y  v/ Y! i3 a; J
4. 运行 gitlab-ctl reconfigure;" ^% E# w) i7 v! J/ \! z0 e
5. 重启Gitlab:gitlab-ctl restart。
9 `* E  {7 z3 l0 }/ }4 j需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。: e6 D; _  [+ t5 j) Q4 y1 @! O  H
参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated
" n: K9 {9 C$ q( ~2 }+ Q2. gitlab-ctl reconfigure failing due to migration issue
: S" g  o- l, c- J" n7 k/ qAD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2)
回复

使用道具 举报

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

本版积分规则

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