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

扫一扫,微信登陆

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

搜索
查看: 1469|回复: 0

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

[复制链接]

1万

主题

1万

帖子

5万

积分

论坛元老

Rank: 8Rank: 8

积分
56206
发表于 2022-9-11 20:40:14 | 显示全部楼层 |阅读模式
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
" f6 u- _( J( j) m登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。
8 Z1 _; \/ f9 ~) u; a4 ]9 n运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。
' x, W  L1 m! V& f6 i+ w: m: v7 J接着设置语言和本地化设置:5 l5 w$ _7 m* O0 m: p& S$ j+ l
export LC_ALL=en_US.UTF-8$ W6 {' v0 o/ d$ ^1 K8 q- c2 J
export LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。  i; h, m  o0 U- q
但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?
, V, O. A3 c; ?0 D  n于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:
- p7 |! ?7 z. \2 {* CRecipe: gitlab::database_migrations' u9 {. F8 l. ~
  * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)( p1 x5 w+ b# ]" e6 l) C# e' |# o
  * rails_migration[gitlab-rails] action run
" x& Q; L% ~1 I- ?0 [    * bash[migrate gitlab-rails database] action run1 j2 E# F% o3 ~$ S
      
( j1 D! m. m! J7 E      ================================================================================
& G( J; w5 d9 E) e      Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
! e. B+ s, v, I( X: ^      ================================================================================6 `) I2 u0 Z/ T/ N8 v
      
4 T+ Q* X" i! t, @7 u      Mixlib::ShellOut::ShellCommandFailed  F1 J7 s5 W- E, l# Q- o8 l
      ------------------------------------/ s3 `. n! a! g8 S6 n% q
      Command execution failed. STDOUT/STDERR suppressed for sensitive resource* P* y1 V" B9 D: g1 I- y* z
      6 e- Q. U9 j1 p+ z- m- X' E4 F5 R
      Resource Declaration:. q+ `2 |' z( f! A
      ---------------------
- B! I! z) r& Z' t: z0 @      suppressed sensitive resource output$ C9 d: `/ @! [- D3 g
      ! B+ v  m( J- Z% q1 h$ Q
      Compiled Resource:  R* i2 p6 z' s$ v7 o/ h
      ------------------( s) n9 z* s5 J3 x( h. r
      suppressed sensitive resource output
+ p* {& @( [! k      
. l$ B' j4 y0 [' Q% u" e8 X  u0 Z      System Info:8 U( }: W( a9 y. @
      ------------4 w# ]- u3 v$ [% V4 J4 A  r
      chef_version=15.17.4- j' U, x, n/ W$ m% T. ?- z" J
      platform=ubuntu
2 n) Q- ^1 X9 N% b' F( }: E, \+ ~* {      platform_version=20.04- W' H4 v5 x. F5 |
      ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
7 K4 R% v. [# J0 L      program_name=/opt/gitlab/embedded/bin/chef-client
4 z& R& {9 H9 @; `! ?, c& ?      executable=/opt/gitlab/embedded/bin/chef-client
" F' A9 N1 w4 ^( H      
7 m$ i* W5 ]- t6 {/ j2 @  ?& u    ( k0 v( B- P. {
    ================================================================================
/ h- z8 V4 a+ ~4 r3 h- d- V    Error executing action `run` on resource 'rails_migration[gitlab-rails]'! W/ v7 d% [% r# r% a/ F1 ?
    ================================================================================
' f6 x  a' b5 H# J, \7 x' K   
5 ]' y- `% j! t    Mixlib::ShellOut::ShellCommandFailed
$ l  r- Z8 l3 S# C* v# P+ u    ------------------------------------, N1 w; ?: I' f9 c
    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 f1 ]9 `! F& n
    7 k+ W' A4 Z0 W5 L6 W% h/ H
    Resource Declaration:
, O# q+ X! h* `, J! r    ---------------------
' }4 a. n8 W8 F9 ]& b( }    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb
& ~; y3 k% D0 A  }! U, C7 z   
6 b2 X2 j5 d* z- J: Z! u- S$ g+ O1 P* L     51: rails_migration "gitlab-rails" do
9 z! o  _' q  a     52:   rake_task 'gitlab:db:configure'$ Y2 J4 o( I7 H8 U7 k  t4 v
     53:   logfile_prefix 'gitlab-rails-db-migrate'3 u4 D2 {/ ^1 K' w% G
     54:   helper migration_helper
4 j5 u+ ~( X3 M: p8 v1 D1 t* d     55:
+ P2 J1 g- a6 i& g     56:   environment env_variables
" t6 G: i3 p( \. ^     57:   dependent_services dependent_services
, |4 z+ Z0 W; \! s( z  t- W2 Q     58:   notifies :run, "execute[clear the gitlab-rails cache]", :immediately" D; [( m) C( Z1 H/ h1 K
     59:   notifies :run, "ruby_block[check remote PG version]", :immediately
, d/ n: I' A' G4 n. A     60:
# ?: U2 J. j$ T8 |4 I& O8 E1 x% ?     61:   only_if { migration_helper.attributes_node['auto_migrate'] }% a! W5 A2 v) J- @
     62: end0 n" D: q" M/ f8 }& e3 ^( |4 p& K( Q
   
' \7 I; W+ r" [3 {/ k    Compiled Resource:* W; Q0 m( L' O8 K$ F
    ------------------" a8 W9 U" Q4 I1 o3 ?" F! @9 l% e% n
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'0 W) e$ r, j2 m$ @; [! Y
    # j& R7 G4 V6 Q  W
    rails_migration("gitlab-rails") do6 E9 Z) ~# S0 @" \8 [: c# Y+ H
      action [:run]$ U: B( @0 C$ i2 n* ~4 i
      default_guard_interpreter :default: }4 B; W. y: P7 d
      declared_type :rails_migration8 E1 Q, E" K) O5 x6 G
      cookbook_name "gitlab"
; _! V* H$ Y" E9 j# C1 Q      recipe_name "database_migrations"+ A6 B; D2 G: y0 ^: B; R+ |$ V
      rake_task "gitlab:db:configure"
* Q0 T# z+ {, x$ X7 V. J8 n- C      logfile_prefix "gitlab-rails-db-migrate"" c6 w3 s# i" g+ u+ u) x5 Q
      helper "*sensitive value suppressed*"
( ^9 t/ }, ^8 G- a+ m2 X      environment "*sensitive value suppressed*"  @0 y% d/ c; K2 [8 K( y( w  q. k
      dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]: \" c7 ~9 X$ F+ l) `, h( F
      only_if { #code block }# s, t; Y  D5 x# A
    end2 h" N, @7 ]) \
   
" y! K; R' ^. @% ~- n) O1 o    System Info:% f7 J7 F! r  W; D# z# m
    ------------
# ^! e4 ]% w  l& z    chef_version=15.17.48 M; Z6 ]1 `# f, I- M+ y: l* Q
    platform=ubuntu" Q9 j6 ]" V) r( j& ?( j+ f& P
    platform_version=20.04' |$ b) N, ^* K% f% t: k+ b
    ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
3 t5 E' \9 ^$ a! t# z8 J    program_name=/opt/gitlab/embedded/bin/chef-client& |* d& ^8 B( h4 k0 H& F9 r
    executable=/opt/gitlab/embedded/bin/chef-client, X' q- n) l3 F& H# C- H( F
    , `* M1 i1 f. ]4 y/ [
Running handlers:" P( R6 J# Q# I3 K, @% H% X1 d
There was an error running gitlab-ctl reconfigure:/ {1 t. z  T4 x3 d4 `
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
1 {. y# k; R4 `* O5 m8 g, tRunning handlers complete
( o# l! P% B4 h, V, j" `Chef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:
" O- ]3 x9 B1 t2 A0 d$ M( W4 L1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;
2 |' P* v- ?) @2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;
( M9 [5 M. t3 b, l6 T% L3. 再次运行 gitlab-rake db:migrate,确认不会再报错;
" m# h6 h' h$ q" P2 I4 U1 P2 a6 O4. 运行 gitlab-ctl reconfigure;) J' H" E1 Z8 Y! o  g
5. 重启Gitlab:gitlab-ctl restart。
7 l" D+ m( q/ S, i! ~4 @. g5 f需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。
5 h. N2 r! i* O/ a8 V. \参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated
6 Z: m8 p2 s$ [3 K, ]2. gitlab-ctl reconfigure failing due to migration issue& D# v! D) Z, }' D2 V: d+ ^
AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2)
回复

使用道具 举报

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

本版积分规则

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