扫一扫,微信登陆

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

搜索
查看: 1648|回复: 0

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

[复制链接]

1万

主题

1万

帖子

5万

积分

论坛元老

Rank: 8Rank: 8

积分
56206
发表于 2022-9-11 20:40:14 | 显示全部楼层 |阅读模式
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
$ a7 X  g! K3 m) B. J登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。
  f) A3 M6 O4 u8 j运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。
$ s4 q/ i  D. u3 l$ b, y# x4 X接着设置语言和本地化设置:  W3 k' @$ p0 w/ r
export LC_ALL=en_US.UTF-8% H* {5 A. c6 R0 w8 b
export LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。
7 r6 M* f: A# B但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?0 I6 Z  B9 @7 ~# v( F# h# E4 c
于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:: z/ |% K+ u, \+ _5 ^3 \
Recipe: gitlab::database_migrations
. S9 J5 i9 w; C# Y$ y/ K% p* H  * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)$ P) d) O/ A" q- A/ {
  * rails_migration[gitlab-rails] action run
6 i* \# F: f0 C' M9 C/ g6 ?, v4 f    * bash[migrate gitlab-rails database] action run
" p: i; `4 ]% [9 _      3 w% M7 T& K5 P/ N* `) c
      ================================================================================
. B9 s( m2 J) s/ Z( C, Q      Error executing action `run` on resource 'bash[migrate gitlab-rails database]'- ~8 A. v- j+ ^+ F+ @! T9 s8 y5 Q
      ================================================================================
/ |7 z* j' e0 f" R  |4 k# W) y      
  p' e. X- _) c      Mixlib::ShellOut::ShellCommandFailed: J. [" W7 ]* `+ @- N3 T2 W6 l
      ------------------------------------
& F4 ~+ l' A$ }      Command execution failed. STDOUT/STDERR suppressed for sensitive resource$ X8 B3 x' `: n& i- m
      7 _' K2 p8 @. A# u' a
      Resource Declaration:2 Q$ E5 p. `) d3 a. u/ C3 E7 C
      ---------------------
$ a5 X% h& {2 A) ~      suppressed sensitive resource output
9 J- U2 z) _6 p2 ?      - k1 X$ \, o8 g5 _( L5 h
      Compiled Resource:
5 z: V' Y: O7 {# \: Z! o      ------------------* Q9 F8 h% V+ C; y. T
      suppressed sensitive resource output* g0 }3 Y( A* M% B/ {6 X# q
      
/ b- }) w6 I! @! N0 `& I! Q      System Info:
! Q% u' C& X' d! F      ------------3 X5 A7 h6 N  K+ W
      chef_version=15.17.4
+ l4 }; W2 R; s  Z- J0 X- |) M      platform=ubuntu
! Y0 {- d  K( ^/ E) g3 k      platform_version=20.04
- H0 G# u2 m: z* }      ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
8 [) H% A5 p: c. {$ O6 w3 ]3 F) y      program_name=/opt/gitlab/embedded/bin/chef-client% J4 ?7 [+ }0 B3 A6 x
      executable=/opt/gitlab/embedded/bin/chef-client
. O) W( H! t. Q( }' R  X6 `/ B      
% p8 C8 ?6 W0 y, G   
3 p4 x2 c" f+ W; p    ================================================================================7 e  c0 H( t% h! o& M
    Error executing action `run` on resource 'rails_migration[gitlab-rails]'
8 m7 R2 X5 [. i+ ?3 E3 U$ J    ================================================================================
5 R8 \5 g$ }+ X' |    & q) ~  ?' j/ \/ r7 Y  H: p
    Mixlib::ShellOut::ShellCommandFailed
' u& p& X: S# r* ^0 C0 G5 S$ J$ i    ------------------------------------
3 K* ?7 v) y- e: L7 S    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% D: B+ T7 K0 b" z* ~
    7 T! i1 M( j$ S! n7 D2 X
    Resource Declaration:* r" O- B) V. h
    ---------------------
% G9 m( e7 A8 a! P; ]    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb
9 D6 _, U* ?7 t% O( ]   
- N4 c: \1 q4 J+ c     51: rails_migration "gitlab-rails" do
( w2 g/ T/ r. T% `     52:   rake_task 'gitlab:db:configure'8 O9 S* |) Y8 |- T% l0 i$ x) K
     53:   logfile_prefix 'gitlab-rails-db-migrate'
/ I& h* \6 z4 w- i( H) y( d! \     54:   helper migration_helper4 t  n% n/ s% E. h
     55:
8 A4 x* E  p# ~     56:   environment env_variables
+ v: S* C' X/ _' t# y     57:   dependent_services dependent_services) W7 w; G* e- a6 A. M( W2 A$ b
     58:   notifies :run, "execute[clear the gitlab-rails cache]", :immediately, z+ q+ _0 Q0 X% Q8 |* O
     59:   notifies :run, "ruby_block[check remote PG version]", :immediately
$ V+ w2 W. c) ~3 j# P     60: 8 t; z9 d7 L2 H
     61:   only_if { migration_helper.attributes_node['auto_migrate'] }7 ^9 R* ^$ m  a% J2 e- U' y- j9 j
     62: end
/ X6 G% r- ?7 D0 f" v   
& ]- M7 `7 j# N    Compiled Resource:0 Y; f0 l6 n3 t
    ------------------7 S5 Y9 d) D4 v4 u1 p/ B
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'
9 T) ?; L. f9 t7 H    8 S6 ]! y, K% _% I) T$ a2 U# J
    rails_migration("gitlab-rails") do
4 @4 G  A5 o) K5 K/ v1 g3 G      action [:run]# q( W8 w4 P. B3 Q" [: |. C
      default_guard_interpreter :default
, {& T- i- x& o  H8 @% x9 E3 a      declared_type :rails_migration
4 S- g% U7 b7 D      cookbook_name "gitlab"# s* }1 L+ K6 n  W' O" S9 u% [. C
      recipe_name "database_migrations"
9 _& ]" e( h$ l7 u# j# e. _- A      rake_task "gitlab:db:configure"
, q3 e! t. [: y/ X' h- w, E' C& Z      logfile_prefix "gitlab-rails-db-migrate"; t# r; i/ O3 A2 D9 U  E; p
      helper "*sensitive value suppressed*"
4 O1 }) g2 r( g      environment "*sensitive value suppressed*"8 Z1 N3 n  ]+ q% ]/ T
      dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]
8 m' f- y6 N  p5 Z3 W  h8 t      only_if { #code block }. c) P" G4 v+ d5 ^2 J2 Q3 }
    end
7 d2 ~' f' C- [! s   
- I- g4 R. Q0 P( G    System Info:1 ]4 K, i: O' f
    ------------6 q' ^+ K. I. x, y8 p' ?* U
    chef_version=15.17.41 ~: A; ~) k- C9 Q: ?; g
    platform=ubuntu; s" q7 c( G5 @0 P. l$ ?" q8 P
    platform_version=20.04) m$ N$ U. _# Q3 ^' B
    ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
+ Z5 i$ y/ j. f) H7 R$ G2 e* m    program_name=/opt/gitlab/embedded/bin/chef-client3 N+ u& S+ Q  H2 E& n9 M" v
    executable=/opt/gitlab/embedded/bin/chef-client5 E6 w, ?- S% Q& G0 @9 W* C4 n
    5 ^; T; Q$ U- m; n+ G
Running handlers:% }* R3 z! P$ R
There was an error running gitlab-ctl reconfigure:
& N* D1 F5 k( }# R* r! F/ `+ qrails_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, F4 |3 i% o/ y* K2 U6 ?7 O* J
Running handlers complete/ q: M8 t! Z( B% {! b$ v
Chef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:
/ g2 H. f. @9 q5 b9 r9 `4 y1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;9 \% Z1 I+ K2 v. n( I
2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;8 }  n8 J! ^7 s4 o) p
3. 再次运行 gitlab-rake db:migrate,确认不会再报错;* _0 X7 T4 i& y
4. 运行 gitlab-ctl reconfigure;  I1 Q- n6 r. R4 U
5. 重启Gitlab:gitlab-ctl restart。5 Y: ^" A; d* ]% ]( ]* U7 R  z  A/ e
需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。6 s; B" [# G" K; P% u
参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated1 C! N" \! @8 @5 l  Y( Q( o2 ~# F% J( h
2. gitlab-ctl reconfigure failing due to migration issue
1 e& [7 L1 W1 V( a, r4 }# x. \AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2)
回复

使用道具 举报

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

本版积分规则

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