扫一扫,微信登陆

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

搜索
查看: 1202|回复: 0

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

[复制链接]

1万

主题

1万

帖子

5万

积分

论坛元老

Rank: 8Rank: 8

积分
56206
发表于 2022-9-11 20:40:14 | 显示全部楼层 |阅读模式
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。* @2 A# n# G, x% N: \% W
登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。
4 g& m% G) }; i- ^9 f* P: l; C运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。. h, C6 I& T* t. T
接着设置语言和本地化设置:# S2 |; q+ S. s+ F5 f0 r
export LC_ALL=en_US.UTF-87 C" D. J* |4 K1 S! ^7 m0 w5 P
export LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。+ x" x+ S! ]4 f5 O* p3 y
但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?0 w. c' h  \4 R4 k& Y
于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:
* C5 k% P7 L$ _: j) Q+ GRecipe: gitlab::database_migrations3 K* x8 r4 u6 c% D8 k! y* {
  * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)8 C% A6 G# v2 r2 w  o/ Q2 `" x
  * rails_migration[gitlab-rails] action run
1 g2 `0 y& P8 K4 V3 d2 n    * bash[migrate gitlab-rails database] action run
8 c( [2 N8 h1 Y( \      
/ _$ k$ J2 ~! r! c+ X1 l+ _8 J      ================================================================================7 w3 {: ^5 Z6 W4 H+ l
      Error executing action `run` on resource 'bash[migrate gitlab-rails database]'5 T& U" i8 o. k; x6 x+ |( r, u
      ================================================================================
' a/ ]5 ?3 O8 X" ~: |9 [1 N( ?      
# b: m. I3 c) L6 |; f% d6 q      Mixlib::ShellOut::ShellCommandFailed% o/ `: a% M* a5 [8 J- k; T
      ------------------------------------
4 s! z  M4 o' c6 u# o      Command execution failed. STDOUT/STDERR suppressed for sensitive resource
% }) Y6 A* P( z1 \3 Q& L      
) b& x( G% v7 |# W4 i      Resource Declaration:$ U/ {' ~6 Q( [
      ---------------------
/ k* |2 d% E0 p" g% i1 H2 H' T9 U      suppressed sensitive resource output
7 ~" ~, }. {9 }" O( B8 r      - ~7 C" I7 D1 t, o4 V
      Compiled Resource:) n# o! Q: {8 q, ^+ Y, r% `
      ------------------! [% Q" e5 \4 t2 r! U- ]
      suppressed sensitive resource output" g0 f$ b+ E+ b& `
      0 D6 i) N7 ?3 p: N3 `) c5 j$ Q6 R; t  b+ o
      System Info:
( M( r. z& b8 n9 |! ]      ------------
+ [4 I$ N4 q) D( [      chef_version=15.17.4  K* K; M. h/ l& @4 F! a
      platform=ubuntu
! i5 J$ \- c0 @8 ~4 w      platform_version=20.046 z3 D7 O/ z" {; {* w; s% F
      ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]& b8 Z' f  e/ D6 ~+ J
      program_name=/opt/gitlab/embedded/bin/chef-client
0 k' B' A" C- z; E- m" r8 V' p      executable=/opt/gitlab/embedded/bin/chef-client3 R7 {9 z% I2 A1 S1 D
      : H& L" v$ X$ j
    ! R% F0 [- ^+ U  a2 N6 I+ c
    ================================================================================
5 q7 i- l( q. d    Error executing action `run` on resource 'rails_migration[gitlab-rails]'/ c* i# |7 g$ y: `, {
    ================================================================================
: p  s# {& t3 ~8 a: r  I8 k    & i. N% [- y5 b$ i9 `* m$ T4 o: k
    Mixlib::ShellOut::ShellCommandFailed
: B9 q; `9 p" Q4 _" S9 [    ------------------------------------
$ `5 {; J; P. h    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, T4 E, y3 ]$ T* K1 p
    + y9 W% k- H, N& r- @8 F7 G
    Resource Declaration:
7 y  c+ v& m9 Q* E' H    ---------------------
7 z7 _) [" [9 U+ B7 X1 i& n8 o; A    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb/ K* T5 l% F) b" U( w6 a* y
   
6 \( H2 j+ C; a# t  W     51: rails_migration "gitlab-rails" do2 c7 b% M; Q9 v
     52:   rake_task 'gitlab:db:configure'
3 s9 W3 K) l7 U3 |: P     53:   logfile_prefix 'gitlab-rails-db-migrate'2 B- ~, |- o$ T: H
     54:   helper migration_helper
( p) f& I, [1 o' D     55:
! T, F; O6 e) U& [" Z9 v6 s     56:   environment env_variables! y) L( H* w" c5 h) \' G
     57:   dependent_services dependent_services
" J4 z7 C! t9 j5 L     58:   notifies :run, "execute[clear the gitlab-rails cache]", :immediately
1 {' z2 a! m6 j" l# D* y     59:   notifies :run, "ruby_block[check remote PG version]", :immediately
3 ^3 a4 k9 L- N5 U7 Z& f& b" |     60:
' H1 X3 K+ K0 n     61:   only_if { migration_helper.attributes_node['auto_migrate'] }
+ _9 \  o+ Y5 A     62: end5 {! ]4 E; i) a
    7 c2 Q% Q) N; m2 T
    Compiled Resource:
9 j/ a$ V1 ^- h8 Y+ u2 B4 Z    ------------------
  j9 |* F9 Y6 h5 G  H: k3 r    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'
/ l8 L" `" {4 s7 o5 ?5 j    " x: A$ z- N- D& y$ H, a1 D
    rails_migration("gitlab-rails") do
' p% f9 V: J3 s1 c4 A' ], |      action [:run]5 t( s6 o0 h4 P7 i
      default_guard_interpreter :default" M! d2 K+ f# [) d# D# w
      declared_type :rails_migration( a, l8 c1 E7 c! m
      cookbook_name "gitlab"- ~' n! B7 B, g1 l! v7 c
      recipe_name "database_migrations"
: G) r+ E' W  [) F/ g$ R* ^3 Y      rake_task "gitlab:db:configure"
) B! J% i+ u; C' H" d. ~+ E8 h      logfile_prefix "gitlab-rails-db-migrate"6 u; {* s$ k" _
      helper "*sensitive value suppressed*"
/ v; p8 m; d1 B- V" C, s6 o/ z      environment "*sensitive value suppressed*") ?: \) S- p4 R/ a/ _$ L, E( E
      dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]
6 g8 U& N# g, U8 C3 r; L5 z- h      only_if { #code block }
1 _8 L8 l5 H' \$ t) [4 a& f" x    end* `1 Z& U4 C' }& G4 c% H
    1 }0 d7 t+ D7 _' S0 A1 O4 O% ~* c5 N
    System Info:& j% A2 I' M+ d% z  A
    ------------
! c# t7 j( h1 O1 x    chef_version=15.17.4
$ y: ]4 u% W% f+ f5 `  P    platform=ubuntu8 x$ k! f' H3 V
    platform_version=20.040 y9 _% l& S, K5 o2 c
    ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]/ k9 [5 J# ]6 T. M( Q$ b
    program_name=/opt/gitlab/embedded/bin/chef-client$ R. t+ u  X- {
    executable=/opt/gitlab/embedded/bin/chef-client- y. k3 ?& T" N$ C9 d. B
    9 }* i1 w. M9 j2 V
Running handlers:5 u9 ?3 q0 W4 T1 k# u, E
There was an error running gitlab-ctl reconfigure:
9 |4 m6 T5 j1 `+ Y. z8 k/ F5 @rails_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
7 |4 j* C" q3 ]1 b/ R% E9 [9 QRunning handlers complete
( D7 ^0 c, y8 UChef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:
7 w* B$ n( b# o8 w1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;; p  r, `$ \' r) V- Z( D
2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;, x# I  E! \9 J4 Q
3. 再次运行 gitlab-rake db:migrate,确认不会再报错;
# a: ^1 ]+ o; \- ^6 |5 R4. 运行 gitlab-ctl reconfigure;& C3 X$ E# T! T0 Y. t( u
5. 重启Gitlab:gitlab-ctl restart。
  \; a/ U  v+ U! h' W$ h4 ]2 [9 {需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。. f; e0 v& E  C: s( b, c
参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated* Q2 @: t! o! W4 X) ^" e
2. gitlab-ctl reconfigure failing due to migration issue1 m. z1 V* K+ \( r) G$ w
AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2)
回复

使用道具 举报

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

本版积分规则

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