请选择 进入手机版 | 继续访问电脑版

扫一扫,微信登陆

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

搜索
查看: 1739|回复: 0

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

[复制链接]

1万

主题

1万

帖子

5万

积分

论坛元老

Rank: 8Rank: 8

积分
56206
发表于 2022-9-11 20:40:14 | 显示全部楼层 |阅读模式
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
% @: j8 @3 Q0 h) t4 X登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。
3 R9 W! ]( E& x2 |! P0 H运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。
( Q' N, `' b3 D: Q5 R9 Q/ X接着设置语言和本地化设置:
+ a: }8 p, @4 G8 mexport LC_ALL=en_US.UTF-8
; y6 m4 z: t, z4 Q9 ~0 v! I0 f$ aexport LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。
$ O" B0 V) F0 F% f# O+ G8 O但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?
- C! Y; t* Q5 B$ T于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:6 @" y" p7 j+ C1 G& {. N/ s( j
Recipe: gitlab::database_migrations* r  d. E+ `3 T- T0 e
  * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)
4 W5 ]3 s7 h3 V- y& Q0 p  * rails_migration[gitlab-rails] action run
" \$ G0 _  D' o    * bash[migrate gitlab-rails database] action run. j/ R- E# d/ q/ h6 w. L! }3 Z8 N
      . U- K! [! M; E  C- `; c
      ================================================================================( W' h) s3 x7 k+ Q: U
      Error executing action `run` on resource 'bash[migrate gitlab-rails database]'! F5 e0 B4 h2 R2 w+ U/ o
      ================================================================================
8 e( [: E. A4 g7 N4 g! c5 h& ~      
1 h. z- }7 Z' R! ]      Mixlib::ShellOut::ShellCommandFailed4 D- C& W, Y/ b  v4 d/ {% b5 E
      ------------------------------------$ C# B% o( @! K
      Command execution failed. STDOUT/STDERR suppressed for sensitive resource+ u+ v4 M1 o3 z: B
      ( Q  P  q) r0 X1 K7 d% }4 p
      Resource Declaration:
! m  x- u3 |7 M2 ^: h      ---------------------" K) O8 W3 C3 `6 L5 A
      suppressed sensitive resource output& L  l8 r' ?4 t
      
( K. B/ C! }# b) ^1 Q      Compiled Resource:
4 W' B7 p9 |+ x% f  t      ------------------: s# W9 ^  D& [# j$ s
      suppressed sensitive resource output
% p( p8 h! D& @. h3 _/ Z7 K7 W      
3 k  a( r5 g" ^9 M* ~      System Info:
* L9 V: {$ ]6 k6 E+ G9 [      ------------
. o0 M# s% H& m* [  z+ T      chef_version=15.17.4
4 n, b$ k, _# B1 {      platform=ubuntu
4 L/ L$ j- N" J; K      platform_version=20.04
2 ^" V. Q. z' `4 t      ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]1 o1 n" v+ Q- b( o  I$ p5 T
      program_name=/opt/gitlab/embedded/bin/chef-client# I1 U$ x4 q; `# j) a
      executable=/opt/gitlab/embedded/bin/chef-client
% y5 G. d8 I) s9 W, [# V6 @, L      & ^" N- c4 @, B- Y6 |4 N
    " F( D( C( s. d. w
    ================================================================================) k4 C3 G. d( J( _7 B. k! O. O4 }
    Error executing action `run` on resource 'rails_migration[gitlab-rails]': E. \3 h6 w/ u% H; `- l2 b  k
    ================================================================================
; m4 p" M& D& j5 F1 o; F' H    6 I. N  B+ G) D9 _
    Mixlib::ShellOut::ShellCommandFailed& ^2 m0 N# F, U5 H" b
    ------------------------------------2 y. z. k5 @) I# }
    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, z' F3 Z) y6 V1 |/ w/ F
    ( C" @) R9 Q4 J- b
    Resource Declaration:
% G5 }' z) d8 r7 ^; l    ---------------------
) L, q. o8 C3 t& l7 n3 N+ J    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb. s/ r' g  R2 |6 C# w
   
+ T) R/ S5 p# Y     51: rails_migration "gitlab-rails" do
1 V8 S! c7 z) l) P0 @3 `7 K/ L     52:   rake_task 'gitlab:db:configure'
8 ]1 O6 N+ Q1 R% o, a     53:   logfile_prefix 'gitlab-rails-db-migrate'
$ B2 U' ~% U& z) [1 V7 D  p& q8 H     54:   helper migration_helper: Y0 r! T9 O4 [
     55:
4 M. c: T" M2 k3 A     56:   environment env_variables7 @# \: l" {1 B/ v* ^
     57:   dependent_services dependent_services
. k7 a1 b8 a- U" I6 e     58:   notifies :run, "execute[clear the gitlab-rails cache]", :immediately0 S0 T; e0 z8 x% Y% U$ b5 {) D/ @5 C, u
     59:   notifies :run, "ruby_block[check remote PG version]", :immediately0 @1 S- R/ z0 H! a/ q3 G' l- [
     60:
  n' i" f- R1 U: Y# {     61:   only_if { migration_helper.attributes_node['auto_migrate'] }
6 q* |- O  O* \6 e1 ]* z! Q3 {     62: end
; {: ]+ l3 J& G# U    " W. `* N. {' x0 B
    Compiled Resource:+ E+ ?- h- n; h$ H0 f) \* A
    ------------------
9 |0 [$ d5 p9 {/ B- U6 T    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'
  D5 }8 ]0 |( F) A- y4 {$ @    ; }5 d$ l" G% r. U# q. T
    rails_migration("gitlab-rails") do" R  z2 a4 Q3 q# u, ?
      action [:run]% w1 ]5 S$ X) j2 Q$ _+ z
      default_guard_interpreter :default2 G. J% ~, [6 N5 h( H" ^
      declared_type :rails_migration
0 R, A5 p  r' g9 s0 u( Y      cookbook_name "gitlab"7 M! Z' g8 }8 i+ O4 m, j* Z' G1 H
      recipe_name "database_migrations"
3 A/ y! N+ E2 x: L6 c      rake_task "gitlab:db:configure"" L! Y9 m! {' Z
      logfile_prefix "gitlab-rails-db-migrate", z8 E) b8 t$ v! @
      helper "*sensitive value suppressed*"
8 K3 r& f2 n# S# w8 T      environment "*sensitive value suppressed*"1 q6 q' W$ u0 H, i2 J: }. j
      dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]
% L) R5 f; K2 K9 \" X* P      only_if { #code block }8 }' D. C: r( V( y2 L/ {9 P3 P
    end
" B( ~* E7 C1 S4 C1 f) v    # C3 B. E* E. w# s/ C7 _
    System Info:
, F3 p; R6 }- p* R    ------------
. X% O4 e4 n! w5 }: s- E: V    chef_version=15.17.4
+ V! a1 d  J/ e9 j. p. H# C    platform=ubuntu
' _  j3 f, n0 A- }; Z    platform_version=20.046 a" g0 n. z$ U5 p0 @# R. U, [
    ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]* G2 q- F- k9 V. ?
    program_name=/opt/gitlab/embedded/bin/chef-client
/ H! A0 g" l4 T  a$ Z* L* i( S    executable=/opt/gitlab/embedded/bin/chef-client
5 X+ T/ \- T" G9 |$ L    4 [5 G0 I' f9 T, @
Running handlers:# r* d# ~& ^7 m: l3 i
There was an error running gitlab-ctl reconfigure:
4 {, i4 l: `5 n- Z6 h8 ]7 hrails_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 resource3 z: X+ {: w8 Q# O, A; m
Running handlers complete
2 K7 S5 {9 p& i; \3 FChef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:' a$ e0 u) ~& |$ U, p7 Z
1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;
$ r% p  N9 `) C" I" r2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;" J" k" s: }! w5 W, i6 Z
3. 再次运行 gitlab-rake db:migrate,确认不会再报错;
- _+ h; W) F3 i9 U4. 运行 gitlab-ctl reconfigure;: l2 M% c! T. y3 w4 N
5. 重启Gitlab:gitlab-ctl restart。
. r( S6 I7 [6 O- `& }, `需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。
$ z5 J( y* Y' [, a/ V* N. J参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated
% ?& `7 X  o# w3 w7 u3 f, W' l2. gitlab-ctl reconfigure failing due to migration issue
! g9 e: t; i" i( H% L0 TAD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2)
回复

使用道具 举报

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

本版积分规则

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