扫一扫,微信登陆

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

搜索
查看: 966|回复: 0

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

[复制链接]

1万

主题

1万

帖子

5万

积分

论坛元老

Rank: 8Rank: 8

积分
56206
发表于 2022-9-11 20:40:14 | 显示全部楼层 |阅读模式
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
7 X" N) p) y8 X" Z  T登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。
# }- T- }' E" N1 W运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。
% g- u+ v" z' s8 T: J接着设置语言和本地化设置:
0 G( W+ c4 c$ w, K! c: Dexport LC_ALL=en_US.UTF-8
* |; M$ Z" d. N8 E# t' Aexport LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。- q; [* ]( d  _5 _5 Z; Y( l$ C
但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?
: J+ X! a1 R8 j9 y# w于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:
! D6 [0 _4 w2 L" xRecipe: gitlab::database_migrations
3 g5 a% }3 D8 T* P% N  * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)0 l3 A; f- M8 f/ I0 c6 U
  * rails_migration[gitlab-rails] action run# R) x% u* x1 H) N6 P, I6 P
    * bash[migrate gitlab-rails database] action run
" S: n) h9 ?( U9 y6 o0 {      
/ Y6 F7 g" \! B3 I. Y      ================================================================================
, X  z  `5 S0 j( g! F, x      Error executing action `run` on resource 'bash[migrate gitlab-rails database]'# K: G# h8 Y# A& k- E; e
      ================================================================================
$ `/ f' G4 g2 A      
2 w8 e1 h/ _# i: x4 h- v      Mixlib::ShellOut::ShellCommandFailed& G  Z3 _. |5 P8 S  s
      ------------------------------------8 t/ w$ g7 m+ k# D3 l6 Q
      Command execution failed. STDOUT/STDERR suppressed for sensitive resource
; w2 u) |# |9 G/ g7 z      
& c6 D4 Z4 O3 ~$ v" B; N& i      Resource Declaration:
. f1 R6 g' ~( u" B2 [" L2 o      ---------------------8 c8 \8 p: D! W- l$ a0 f
      suppressed sensitive resource output
- I8 Y0 T, z, d      1 |# ~; A+ a+ j" ]# D
      Compiled Resource:
6 i7 {( {9 S3 f5 ]3 W      ------------------
' ^2 N) u. J; L      suppressed sensitive resource output
5 v( x! G. L; Z4 N  |      
* X& A. M+ ^. W! m5 @# z      System Info:
$ B3 w5 s/ ~( i: O7 c      ------------
6 c- l; S3 D& g# P      chef_version=15.17.4& j& f9 `4 k4 T- z* |4 I
      platform=ubuntu1 R% N( j/ B; B
      platform_version=20.04
$ V5 K2 \4 h1 H2 k9 L$ Q1 M5 J      ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
5 [. _1 ]% F  w9 h" v1 ?" D, k      program_name=/opt/gitlab/embedded/bin/chef-client
1 D6 P- W9 @0 S: ?6 |      executable=/opt/gitlab/embedded/bin/chef-client
" a1 W* X# B& b/ U1 O0 k& e      , R' e7 }7 m6 ]% w& P+ z  u
    3 r7 c% S- |7 F& i7 w
    ================================================================================$ M& o1 C- Y5 e+ j3 m" Z
    Error executing action `run` on resource 'rails_migration[gitlab-rails]'/ U3 T+ H3 a' u9 n
    ================================================================================
8 e4 `1 b4 Y1 `) `0 |  g+ Y- X    8 t1 X' j# i7 N& b: S: \: L; r
    Mixlib::ShellOut::ShellCommandFailed
* [% I) k6 S) O2 Z; R6 K* o    ------------------------------------- ^0 K4 b& M" D5 P5 h
    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
4 G+ l3 g$ c+ K    : B: |/ F7 D  A* i! p1 E
    Resource Declaration:
* [/ i; D2 \5 \# U/ ^4 X6 q/ I6 k    ---------------------
3 O( c0 i+ I6 N" S' _1 Z+ k: X9 i    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb- H# Y8 K  g+ J; l  D0 d1 T; y
    8 Q5 g) g5 U! J( g* O* U5 S
     51: rails_migration "gitlab-rails" do! [( j( ], ?  J
     52:   rake_task 'gitlab:db:configure'' H: c2 z4 X1 V
     53:   logfile_prefix 'gitlab-rails-db-migrate'- }2 N" N" m* e$ ?) P, ~, z
     54:   helper migration_helper
, ~" b: c" x1 v) k* X; Q, C. w     55:
! P+ Y; N, B# Y" P5 H! \% o, f9 f     56:   environment env_variables6 J* f  h- F; S" L; R, g
     57:   dependent_services dependent_services
. ?/ j0 D/ D. w3 ?     58:   notifies :run, "execute[clear the gitlab-rails cache]", :immediately1 h4 t* m- f0 Z# z/ p) u. z$ c
     59:   notifies :run, "ruby_block[check remote PG version]", :immediately
" A- V! S. A2 ~6 `8 {, a# H, A     60: - M8 J5 h2 R7 N; w
     61:   only_if { migration_helper.attributes_node['auto_migrate'] }
, G9 o  A0 ?( D5 Y- T* E) U7 B* m* K     62: end; z3 }7 o0 A  _$ a
   
8 X! v$ q8 g, k/ q; u( g    Compiled Resource:- l& Z& {7 ]& a+ ~0 ~9 e2 A$ Q( {4 z$ R
    ------------------2 u; L$ `: p3 R& D( y9 U
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'
, E( J8 N% c0 G( }" Y0 F   
9 a7 B" W# P  s$ R    rails_migration("gitlab-rails") do' `6 o4 W+ w5 c9 b
      action [:run]
% \% O2 V/ i. `      default_guard_interpreter :default
  t& k# H! z7 p. G  |3 x6 `9 P$ f! H      declared_type :rails_migration- V7 v$ ?1 C' Q" z
      cookbook_name "gitlab") L' a6 N, r/ ^  \0 j7 F& ~, z  ?5 N
      recipe_name "database_migrations"
5 J# d! |( Y9 R( L5 X      rake_task "gitlab:db:configure"$ s' K" }1 U# W" `, M( @
      logfile_prefix "gitlab-rails-db-migrate"9 M% q1 t* l- }$ B% k7 z
      helper "*sensitive value suppressed*"
3 Q- e" n1 U2 Y5 V4 I2 G/ H5 `      environment "*sensitive value suppressed*"- _* V, `9 P) u  s
      dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]
7 r3 K1 s4 T/ D( B      only_if { #code block }
, f. |: F: J2 @/ k/ Z    end- W& q' y6 E; s8 L; i( ^
   
- v; M; g, `/ K6 c! T% {: X    System Info:
7 s* I) v5 D, M, A$ n6 ?    ------------
+ C) f5 N0 p3 Q2 A# A    chef_version=15.17.4
/ o8 Q% d8 q3 |( g) ?  Q& E    platform=ubuntu
6 K' _" I: c! G' C8 O# V8 r    platform_version=20.04
& @3 z: O+ m) g+ q4 I: C    ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
7 m2 v$ }+ \4 h- Y8 I; G  M0 v1 A. N    program_name=/opt/gitlab/embedded/bin/chef-client& @# b. {( w3 k9 u; q  K5 t
    executable=/opt/gitlab/embedded/bin/chef-client
7 a% O4 v( j7 Y' I    - c9 h! T& r1 [2 u1 [
Running handlers:0 W7 w7 ]0 P/ s
There was an error running gitlab-ctl reconfigure:
- Y1 B( f, H' H2 p  P9 V& V9 |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- X5 s7 F3 M, d* Z8 k, l; B
Running handlers complete
9 }) c$ C0 _4 @) c; J7 \4 FChef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:
( a$ S3 S1 e3 B; x6 T! }. Q1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;7 n7 @) _" E" c+ Q/ ^
2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;
8 D' W; i" O, H- f3. 再次运行 gitlab-rake db:migrate,确认不会再报错;( y7 o2 n8 \( s! b  {4 @
4. 运行 gitlab-ctl reconfigure;
/ w4 x( j& D  W5 ?1 u! l  E5. 重启Gitlab:gitlab-ctl restart。9 d) h$ K# L4 `+ l8 g
需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。$ d+ n" i; H- d; j, V
参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated
; }) S5 g3 q1 Z1 Y+ s# G2. gitlab-ctl reconfigure failing due to migration issue1 D3 h  ]" {4 |4 k* M8 L
AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2)
回复

使用道具 举报

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

本版积分规则

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