扫一扫,微信登陆

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

搜索
查看: 1759|回复: 0

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

[复制链接]

1万

主题

1万

帖子

5万

积分

论坛元老

Rank: 8Rank: 8

积分
56206
发表于 2022-9-11 20:40:14 | 显示全部楼层 |阅读模式
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。2 c; ~0 Q& H6 t0 @3 H
登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。5 H: k1 p4 X, i) k
运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。
- p4 \7 ~2 S3 {# q+ Y接着设置语言和本地化设置:
# b% |' k, h4 ?5 ?0 P3 P) rexport LC_ALL=en_US.UTF-8
8 C3 M. f' x( l% p- O& A. Uexport LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。8 t  \) X. i1 w9 ]( p
但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?( }! O3 p5 H# m! T- p
于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:" N  {* ~' C/ d& S$ u
Recipe: gitlab::database_migrations
6 F* q% G5 C" A( Y" g& ]( X" w  * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)
3 R+ A5 D8 |- h7 ]' k' I- `9 Y! v  * rails_migration[gitlab-rails] action run
. @* N8 e2 q3 x3 y; c; K6 o5 h    * bash[migrate gitlab-rails database] action run3 H( q% r: ~' g1 N# n+ j. x/ d
      6 x( T3 E( c: B( j' T) T
      ================================================================================8 O' X$ ~8 x) O2 T5 k, y
      Error executing action `run` on resource 'bash[migrate gitlab-rails database]'( _/ n: u8 i4 f  N
      ================================================================================, D5 v4 J1 s+ M$ m; z4 N  B3 J
      : j7 E( V" n" |
      Mixlib::ShellOut::ShellCommandFailed
1 q0 @) l: D; W5 |6 F+ `0 C      ------------------------------------5 @  H# J) z; w7 a  E
      Command execution failed. STDOUT/STDERR suppressed for sensitive resource6 J) D5 v# ?* U( M/ A" B
      8 Z& D/ o$ _. M) Y) N  [
      Resource Declaration:% R/ f0 o8 U* d# [; u3 v
      ---------------------" D/ S" H8 F# k7 _& O5 e+ J
      suppressed sensitive resource output
  C# t7 D% R" B* A& R# G3 {3 K      
2 Q6 \6 X( ~. T- v4 c7 l      Compiled Resource:) K% h1 m1 A6 h5 e7 r0 X3 m% V5 j
      ------------------
- G8 a  F# Y& u0 L      suppressed sensitive resource output
: s- ~4 [/ H4 V) i8 ~1 R      
7 O  \! H+ f8 y6 A% a      System Info:/ Q( v4 P4 c, U! |' F1 ^
      ------------
/ e3 j# ~4 j- R% ]3 I. u7 a      chef_version=15.17.47 _0 u1 U! R8 O$ m
      platform=ubuntu: A2 K' a( G; C7 U6 D7 d
      platform_version=20.04
* w$ `0 C+ _0 ^2 i9 v      ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]" L/ O* A  m% c  s; R* T
      program_name=/opt/gitlab/embedded/bin/chef-client
( l6 B5 ^+ W: Q& A7 e: ~      executable=/opt/gitlab/embedded/bin/chef-client
5 |. N2 V3 D3 _5 ?0 h. a$ P      
1 ?* u4 r' E3 G3 e6 A+ `    + i  C) i- M- x9 g
    ================================================================================5 T% n5 O' W$ [" `/ v5 k, q0 [
    Error executing action `run` on resource 'rails_migration[gitlab-rails]'* j# o5 K% A$ _
    ================================================================================6 B5 Q* }4 l+ q* J+ o
   
/ [; l4 E. W% w- H% ]    Mixlib::ShellOut::ShellCommandFailed
) S8 |+ g: H! x/ F" X' r* j1 P    ------------------------------------
+ F9 t$ x# w" l- |8 t! Y% T: T    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  R: Q8 r. O4 q2 E
    ' h( E4 ~! K) O" d
    Resource Declaration:
4 `2 i0 O) ~( ^" I4 a; t" i    ---------------------
$ i$ ~: [2 ^$ W) n1 h0 b    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb. q% L$ H/ n/ d; U$ ]' U8 B
   
1 H& M" ~* ]& `: h3 S     51: rails_migration "gitlab-rails" do# K* M+ A' A& c! J2 T, u4 D
     52:   rake_task 'gitlab:db:configure', ^1 ?8 p) u2 \$ g* Y1 N
     53:   logfile_prefix 'gitlab-rails-db-migrate'
& X8 J6 Y% W1 X4 O& f& T5 O     54:   helper migration_helper
, X- g6 R+ j4 }9 A" l) ?" E6 v     55: 3 |7 W9 Y( `( R( ~% {7 O" q$ \6 \
     56:   environment env_variables
6 o+ F4 U, g, G6 B     57:   dependent_services dependent_services) [7 u5 U1 I6 x! Z0 f+ ?
     58:   notifies :run, "execute[clear the gitlab-rails cache]", :immediately$ H/ s9 d3 a( ~6 D0 U5 M
     59:   notifies :run, "ruby_block[check remote PG version]", :immediately
' q& L$ |& f* a7 v1 m* O     60:
8 {4 j. @6 M& ~/ E9 m" m: H* I: G     61:   only_if { migration_helper.attributes_node['auto_migrate'] }& d8 g; n" m7 C& B
     62: end
. ?, d: Q8 g. O; n4 B% i8 _    ; ~* C9 C! `* D* h& g0 Z  ^! P
    Compiled Resource:, P) d( i/ X# j) h, }- L' P& H
    ------------------
' S$ V% b& V2 E! e    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'
4 U! o# |3 K* O   
  a9 ]8 c; F4 c' I+ r3 _    rails_migration("gitlab-rails") do. r# A4 c$ a9 f$ a' y# j8 v
      action [:run]
8 w* e6 w* R# ~! s      default_guard_interpreter :default
- ?  I) z# R% F; G      declared_type :rails_migration3 f" B, k2 Y! z4 d
      cookbook_name "gitlab"- b- b& K& q% U0 e5 m+ l6 p  C
      recipe_name "database_migrations"
) ^% v9 s; o9 V! p2 V  {      rake_task "gitlab:db:configure"' k% p$ Q2 L" g: M
      logfile_prefix "gitlab-rails-db-migrate"
: y) ~% S7 a, i3 b  [      helper "*sensitive value suppressed*"& a4 v$ r, w+ \1 ^7 c( L8 n5 i
      environment "*sensitive value suppressed*", ]% D# q0 E6 ^% S: J. g
      dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]9 T- a* v) O) g3 w8 [6 @
      only_if { #code block }+ m3 ~* P5 w. Y
    end
( c# }! u) |  N/ L    7 O5 g9 i/ ]0 W) `( G. ~
    System Info:
% [6 V; A9 j  ^: c6 P    ------------$ X6 D) q' n- k" v( w' l4 @
    chef_version=15.17.4
8 r9 D/ n. \4 N' @9 l    platform=ubuntu* _$ c. ]; w8 ^
    platform_version=20.04
& J) Y9 N8 c2 `' ^    ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]2 [9 Y$ R5 |2 S, u: p
    program_name=/opt/gitlab/embedded/bin/chef-client
6 Z5 a  u2 g9 G3 @8 ^    executable=/opt/gitlab/embedded/bin/chef-client
! j. k' }: c* j# |   
$ r1 H. A0 C. F# [! hRunning handlers:
4 n& U9 W1 s4 ~There was an error running gitlab-ctl reconfigure:
: K' y7 \+ f/ _! U) ]% orails_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
% q" O1 f# d( h( f, _Running handlers complete# s2 E; R5 m6 }! ]
Chef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:
! D3 Y% n' d$ F& M0 M1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;
* C& t' ?/ }% r0 L2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;2 M1 `/ {( B6 _( R9 D; R
3. 再次运行 gitlab-rake db:migrate,确认不会再报错;
/ }/ m" m; k. ]1 Z) h6 H4 }8 M8 Y! [4. 运行 gitlab-ctl reconfigure;. j; u. L5 o9 k0 q, S
5. 重启Gitlab:gitlab-ctl restart。
! @9 \3 i# d. R' M4 d" ~7 \需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。
; _# d" t8 s% C2 t参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated# U  Y, o! s0 f9 o( D4 E3 x4 b
2. gitlab-ctl reconfigure failing due to migration issue
3 q; }% ^1 \# B2 ?, ^( @, OAD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2)
回复

使用道具 举报

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

本版积分规则

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