扫一扫,微信登陆

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

搜索
查看: 1025|回复: 0

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

[复制链接]

1万

主题

1万

帖子

5万

积分

论坛元老

Rank: 8Rank: 8

积分
56206
发表于 2022-9-11 20:40:14 | 显示全部楼层 |阅读模式
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
: Q' q& V! ?8 o. R登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。
. E  v+ P' Y5 V3 C4 D! v4 ~运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。
. F+ N+ u9 g$ \5 T% V. C6 W接着设置语言和本地化设置:
5 h) y" ~( n4 K- N9 Y( M$ C& uexport LC_ALL=en_US.UTF-86 |5 X+ i4 h) F) x; B
export LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。
- q' c2 D- {7 I# x但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?
6 w1 B! Q8 q; \" v' ?1 a4 K于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:
. R5 v/ K4 H4 mRecipe: gitlab::database_migrations2 E; w, X# T( E; I- h; ]; g3 ~- _$ y; e
  * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)1 R7 p! J6 K  D
  * rails_migration[gitlab-rails] action run
+ u1 X" J/ h  [1 ^, }    * bash[migrate gitlab-rails database] action run6 M: I% {; |" a
      
2 P0 n# q) m: x      ================================================================================+ `+ `. r7 J) ^; R: ?% b7 a' N; k; A- V
      Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
& O! f7 |1 X: B' y8 X* q      ================================================================================4 ~3 w6 y* X& {6 |
      + F, n# p2 i- f& O3 W' S
      Mixlib::ShellOut::ShellCommandFailed
9 f# E3 G1 G7 q9 h* o      ------------------------------------
' |$ k; Z( ~" C$ w( W& w! G      Command execution failed. STDOUT/STDERR suppressed for sensitive resource. f& Q# X- c2 B; s3 Y
      
7 N# l9 ~* s1 H: e9 _1 J  [6 N      Resource Declaration:, ]7 F3 f/ S& v
      ---------------------
) B+ U" W: R; ]      suppressed sensitive resource output4 _. F7 h/ q9 b" _
      
2 t- |8 `7 H) T  S, z; @9 G      Compiled Resource:. _: v* c& v& E! x7 t) c
      ------------------" c1 W5 j. Z, z8 X" D
      suppressed sensitive resource output
) @  l8 D$ g3 g      
, u1 W! i  t2 y      System Info:: f( \3 I$ n3 Z, A9 H1 W; }" U
      ------------& A& H' k/ h! H* N- g  h
      chef_version=15.17.4* R# j3 x2 J' E- _6 t  i) t" Z4 y/ X
      platform=ubuntu* ]/ M/ @1 s1 S# J$ P
      platform_version=20.04
9 ?8 f4 F3 h6 R  j1 n5 u( H      ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
! t. [3 G9 B; Y& m& z! d& Z! C& D      program_name=/opt/gitlab/embedded/bin/chef-client8 z7 M, t! c3 W7 d% i0 F0 f" U
      executable=/opt/gitlab/embedded/bin/chef-client
& G3 b" E5 {( y( {5 f6 m- O- T0 \      
% C6 ?8 C0 i0 W5 i) {3 a0 W   
$ I8 C% A0 y* j9 a    ================================================================================+ e$ o( o( [4 s  k* p
    Error executing action `run` on resource 'rails_migration[gitlab-rails]'
7 @# `4 F: e3 o1 _    ================================================================================3 X4 G2 s  `8 E9 i3 `' o4 h
   
1 n% i+ X# Q' ^. R& a    Mixlib::ShellOut::ShellCommandFailed" Y# Y# K9 L' {
    ------------------------------------
0 H4 p  P- w4 @! F    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$ _3 T; M/ i# J
   
4 f6 k( q% T- M    Resource Declaration:6 m, |. v; `+ s+ c
    ---------------------/ Q' b9 p+ |2 \, |8 s, c
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb
, ~8 e( c3 l  J! w4 U2 P   
  Q- _1 D) `; D% B; d     51: rails_migration "gitlab-rails" do
8 |) p$ i* _) X4 S% V     52:   rake_task 'gitlab:db:configure'
& m; G9 E& [8 I0 P% ~     53:   logfile_prefix 'gitlab-rails-db-migrate'* j9 w  h. n/ {2 @
     54:   helper migration_helper. }2 s. R: k8 c/ q# p9 @8 r0 Z) O
     55:
' R# _9 v; C+ b2 F) K( }     56:   environment env_variables
7 {& }+ W" P4 M* T& {/ l" V3 M     57:   dependent_services dependent_services+ Q7 s- T, J. e8 I% R2 c
     58:   notifies :run, "execute[clear the gitlab-rails cache]", :immediately
" |5 f3 }& I4 P/ i, j     59:   notifies :run, "ruby_block[check remote PG version]", :immediately
) W8 d2 H5 v3 ^/ [2 B; M1 p, U4 c" P     60: ( b" m) i- l$ p$ T- }# b/ k" q; [
     61:   only_if { migration_helper.attributes_node['auto_migrate'] }1 E6 g$ d$ H* o
     62: end) L6 T4 R% j& Q
    # X. z% f6 [& b' m! [
    Compiled Resource:
' C2 s$ p8 e- ^* J1 y    ------------------
: B/ r% U! G- _' c2 G    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'
. V$ D8 G& w2 P' Q% V  c- W    ( u7 O0 M+ u# u8 U0 }: s+ h9 R9 f
    rails_migration("gitlab-rails") do/ }  I5 D2 h7 r0 ?
      action [:run]
1 N6 C& G# }& H' J1 S      default_guard_interpreter :default
) i0 D3 L. Q1 a2 `% X  L      declared_type :rails_migration
( ?' O8 r- z- I8 m( V' F      cookbook_name "gitlab"
: X, Q: U( a9 H6 o! d+ h- w      recipe_name "database_migrations"8 J& U! G9 D- g- C
      rake_task "gitlab:db:configure"- \3 y( q2 _* m: y* F0 Y& S
      logfile_prefix "gitlab-rails-db-migrate"
2 r6 D! n8 W$ x" ^3 w      helper "*sensitive value suppressed*": r8 j, E" r0 l- O
      environment "*sensitive value suppressed*"
2 k# E  @" r0 U) u$ r% s; _/ }! \      dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]
) M, p3 ]4 L: O3 F5 t      only_if { #code block }! z1 n9 ~3 c# _1 w* g* k7 y
    end
: g0 p* K3 I/ H' a5 [    * \4 N% K/ w: T, b
    System Info:4 I2 J. b7 p* v8 G  G
    ------------
) m8 I; w7 s1 k# q' S5 p: j    chef_version=15.17.4
4 u! M; F7 e( s4 K: h    platform=ubuntu
7 ~& |' Y, r/ c# g- r4 C5 K0 U    platform_version=20.04
1 F( V5 ^0 o- ~+ W1 H    ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]: [; x1 [) X+ d. m6 k0 b! V! g
    program_name=/opt/gitlab/embedded/bin/chef-client
3 p7 n* l, J( s- ~    executable=/opt/gitlab/embedded/bin/chef-client2 Q, d- h* v; i, b
    5 \1 ~7 e0 |, j
Running handlers:0 J  d2 c0 G% n: Y" s5 n. W, i& l
There was an error running gitlab-ctl reconfigure:
  g3 r6 y) X9 Irails_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$ v! W+ }1 k$ l! ~/ ]
Running handlers complete
7 ]& R6 _3 z, yChef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:4 G+ S3 {9 s, b  p
1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;6 @: V! A* J1 b# L0 ]
2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;0 j0 ]4 j0 U. T# y
3. 再次运行 gitlab-rake db:migrate,确认不会再报错;4 R- @1 J2 k6 V$ l  s& f
4. 运行 gitlab-ctl reconfigure;
1 u' `& t% n; a5. 重启Gitlab:gitlab-ctl restart。6 d( X9 Z( Z0 e
需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。  o: L% a8 {$ z0 l3 j( J4 d
参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated
& j, P, P2 Z' n+ x( l9 c  W2. gitlab-ctl reconfigure failing due to migration issue/ a6 w1 g+ w( m- Y- H
AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2)
回复

使用道具 举报

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

本版积分规则

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