扫一扫,微信登陆

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

搜索
查看: 1612|回复: 0

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

[复制链接]

1万

主题

1万

帖子

5万

积分

论坛元老

Rank: 8Rank: 8

积分
56206
发表于 2022-9-11 20:40:14 | 显示全部楼层 |阅读模式
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。% |# F, g2 x  C- @- ^+ \$ x
登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。8 K; |7 e" b. ^2 m; o: O6 k
运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。! J% A: v. _. H
接着设置语言和本地化设置:
" F! v% V  S9 @& r2 Zexport LC_ALL=en_US.UTF-8" W" ?. W- U' {/ [4 u6 t0 v8 d3 S
export LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。
7 r% |' {- D6 L( V0 n# I但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?
7 d- M& V7 f6 K于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:
% t! a4 A; ~* l+ M) X+ ?! e2 nRecipe: gitlab::database_migrations9 C, X. }* d, Z  N% z& q+ Z
  * ruby_block[check remote PG version] action nothing (skipped due to action :nothing); @# N) t  o+ R, s: x
  * rails_migration[gitlab-rails] action run
( `2 ~1 k+ E( K' q' a3 F    * bash[migrate gitlab-rails database] action run. h5 `" I$ |! D: {/ A( E
      0 [* [! n' F+ i! s+ |& b
      ================================================================================
: J- v6 ~, d' G# M' R2 T# P' k      Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
( E" F2 Z. ?  r1 h! K6 t# P( V& Y2 y      ================================================================================; ^$ F( q, R3 M6 {
      
8 U$ V# K1 t5 Q3 r* G6 {# i4 [      Mixlib::ShellOut::ShellCommandFailed$ S& R( P- N& K6 j
      ------------------------------------
. g! {- w; a2 D3 K) l      Command execution failed. STDOUT/STDERR suppressed for sensitive resource
, R1 F" W# }$ W' t- Z( \1 W& k' E      
* ]. a/ Q/ Y  G0 f      Resource Declaration:
$ `% K  ]- F0 X: [5 |5 J$ Q      ---------------------
0 J$ i  m* Q) j' Q9 E      suppressed sensitive resource output
" s! F/ z8 f* E" w      & ~$ I& |8 ~8 a) c( A5 c: D' B* i
      Compiled Resource:
: H" i- d& t! C9 f( M7 N      ------------------7 x8 G& f- q- E4 \0 j5 q. }
      suppressed sensitive resource output
& U0 b  S1 p7 a8 p, D) \- J      
2 k+ n) b  c* [) n      System Info:4 @" Z! X6 V" P- d
      ------------
/ f4 O) }5 e; W, B0 M# G  I- f% x      chef_version=15.17.4( a5 w$ K; S. K) v4 g0 G
      platform=ubuntu
0 y0 H$ }" d5 }" m3 h* d. d/ z      platform_version=20.04
. O  ?7 w: Y9 a/ C- \( e      ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]) I- u* G9 T4 a$ C' I  o+ [! M% v* z; z
      program_name=/opt/gitlab/embedded/bin/chef-client
' Q6 z0 Q8 t1 |/ x, n' s      executable=/opt/gitlab/embedded/bin/chef-client8 P. n8 Z! D- ^( A
      
9 k9 `1 ^  `) g8 Z   
; }' H- l  l$ d6 d$ F3 O$ J9 r0 m' O    ================================================================================
! W6 X9 H6 I7 o7 y    Error executing action `run` on resource 'rails_migration[gitlab-rails]'
2 z" u; Q9 S4 f. m) h2 n- Q    ================================================================================
- [% ^9 D1 L) x1 V    % y% Q- E; b2 D) D9 n4 `4 j
    Mixlib::ShellOut::ShellCommandFailed1 u& D8 g+ E3 U. Z$ w( l; |; a
    ------------------------------------
& l, w6 O3 a$ L/ Q5 d- i8 u    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 resource0 h- k" u( C: o8 p7 P$ O
   
: E3 R5 r/ g$ H* U    Resource Declaration:) H: g" Z- o% n$ ?7 q2 _3 D
    ---------------------0 s) |; o+ H' R+ K+ d7 {
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb
: N* g8 u) X4 ?4 P3 T9 B$ u3 Q   
  k8 P! f. _6 k$ h8 `! j+ C     51: rails_migration "gitlab-rails" do
1 j7 n4 H( d: N  C     52:   rake_task 'gitlab:db:configure'
9 N- g5 |. F9 {* T     53:   logfile_prefix 'gitlab-rails-db-migrate'
2 ]+ n" c( U# O  L" V0 x' c     54:   helper migration_helper
7 F+ P/ i" k7 l, @7 O4 z+ G     55:
& Z' S! t% b7 [; M: T     56:   environment env_variables
2 n  @3 N, e/ b4 E# i7 X     57:   dependent_services dependent_services
% |" B3 B1 w2 T- c% [+ K. }     58:   notifies :run, "execute[clear the gitlab-rails cache]", :immediately7 J0 J  J8 @7 \! Q$ n  }- X: k
     59:   notifies :run, "ruby_block[check remote PG version]", :immediately' _5 b. s7 w" }0 C0 u5 u( U5 g
     60:
4 S9 j6 L' H$ L( {; v     61:   only_if { migration_helper.attributes_node['auto_migrate'] }
- A8 a  i& |8 I: K: r     62: end
! b& `, m+ n/ \) U( f    ( \; z+ v  ]4 R7 ~
    Compiled Resource:, X. o9 I- N# x) B# m
    ------------------
, t0 \* B/ A& D    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'
; e& H! c& L% P5 W0 J; f   
0 K! O2 i* s3 z( c6 e4 ^4 ]    rails_migration("gitlab-rails") do
- X" j$ C7 I1 f4 G: t6 W+ J/ N      action [:run]
+ `7 E; \! Y3 n4 }/ ?6 j8 \      default_guard_interpreter :default9 R2 @& Z  \0 u. Q
      declared_type :rails_migration
" Q4 |9 G7 `$ w( G2 ^+ l      cookbook_name "gitlab"9 P! h5 @+ y9 w& y$ v. e0 ?* S
      recipe_name "database_migrations"
! `* A1 A8 [) i1 }      rake_task "gitlab:db:configure"
9 |+ o) @/ Y4 m' u- n& C" Y      logfile_prefix "gitlab-rails-db-migrate"
6 p8 o/ o/ \6 x- d  B      helper "*sensitive value suppressed*"
' n# z' r" A% B      environment "*sensitive value suppressed*"
7 u8 f% F- d0 {+ @; ?      dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]
% g) |2 G$ X6 i- p7 V, V      only_if { #code block }
& j! o% P( o8 M    end8 D7 P5 w. ~3 _6 D, Y  i
   
) j5 f* K% t+ w( S    System Info:
0 ^) d5 c% X. P" `6 q" |: o) O    ------------; [, r+ n2 M* A
    chef_version=15.17.46 F) H% _) S' v# A" o  F3 f
    platform=ubuntu
2 K1 b% s4 j$ {% n. W+ z9 |    platform_version=20.04
3 ^$ X7 W& j0 A* e5 J0 @    ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]9 E# j3 D/ M. v( ?  r
    program_name=/opt/gitlab/embedded/bin/chef-client* l' H! {' I% E1 _/ m) O7 |
    executable=/opt/gitlab/embedded/bin/chef-client
& h* S9 J) r6 J/ Q9 U. l3 _    ; ?& K+ c! O. d& |
Running handlers:4 h/ E! o- O8 `9 T0 h
There was an error running gitlab-ctl reconfigure:
' ?" @; r+ M$ O: D1 v* L* trails_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
* R3 C! J% m, ]- p' \Running handlers complete
8 D% U; X$ e+ SChef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:: y' N4 C$ L; D& ~8 {
1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;/ S" I& A) s+ P6 i6 G' K2 @* {
2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;2 `! J; L+ ^. O
3. 再次运行 gitlab-rake db:migrate,确认不会再报错;
, n# S+ W. L+ j  \( v5 ~# U4. 运行 gitlab-ctl reconfigure;5 I: \( }8 s7 u3 c$ E  W# ]! n1 l5 }
5. 重启Gitlab:gitlab-ctl restart。- o3 G1 [' \( z" o, S# M  \
需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。1 `  k/ i2 C3 C+ K% Q2 q% O/ E
参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated
/ F( e9 ?3 E2 h9 ^2. gitlab-ctl reconfigure failing due to migration issue
! A- Z9 I1 F9 J3 }7 a: a5 vAD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2)
回复

使用道具 举报

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

本版积分规则

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