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

找回密码
立即注册
搜索
热搜: 活动 交友 discuz
发新帖

5万

积分

0

好友

1万

主题
发表于 2022-9-11 20:40:14 | 查看: 1967| 回复: 0
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
$ s" n2 G4 z& I. x' N, B  |登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。
- x2 H% i* Y6 n运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。
. Q7 n/ Y8 K6 C1 k接着设置语言和本地化设置:( k; P' w" D- `7 |& k; n. A
export LC_ALL=en_US.UTF-8! }5 O5 V* F4 \9 }7 t
export LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。
* C( c. B8 u0 T- u. K. O; y4 |3 @' T但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?$ X/ s" E* z: p; a! z
于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:8 C  v5 i) |& A9 s
Recipe: gitlab::database_migrations
/ g! R/ `% L" B5 r! }, u' V( A: ]  * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)5 X- i* I) K! ?0 e$ [0 W
  * rails_migration[gitlab-rails] action run+ J  i3 g( W; h. s$ `1 H) c3 U
    * bash[migrate gitlab-rails database] action run  I" T& Y6 A% l
      
# O; k6 G8 U) I6 Q- O      ================================================================================0 z9 \' Q' Q, ^; d2 o
      Error executing action `run` on resource 'bash[migrate gitlab-rails database]'* P, g1 Q1 g- T; ^2 I. r" H
      ================================================================================
. a- N# y  X- p3 R      
$ y; ]% J& U$ {: C0 F; V      Mixlib::ShellOut::ShellCommandFailed3 c% s1 S5 r, u
      ------------------------------------$ Y- D: ~: J/ v# p9 w
      Command execution failed. STDOUT/STDERR suppressed for sensitive resource
9 _8 K) z) L( y+ C, K: {+ B0 ~      
/ C2 `6 Y) Z% J/ D* x, A      Resource Declaration:5 c2 z- S: }! B8 M  g! |+ K1 o6 Y
      ---------------------
3 _" a9 _& {2 w6 i3 A      suppressed sensitive resource output. Y& e* p# s4 Q, g9 U
      7 _( S% z9 T# R
      Compiled Resource:* R2 z) T* R  S( G- k
      ------------------
$ F4 j$ i  T: G6 N" m      suppressed sensitive resource output
. X* d8 m" @' Y, U, Z2 E) h      
8 ]( |0 \) h, J2 Y+ ?      System Info:. P' k2 Q- ]. _7 b; S% U# j
      ------------
6 |# M9 C2 A" B! b/ a1 e* R      chef_version=15.17.4
, R. }2 t' G4 ^) ^      platform=ubuntu
* l% y1 Y1 n# r( {3 |      platform_version=20.04) t$ w8 `1 g1 U9 }* X
      ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
3 I0 F. l- n2 Y4 Q# k      program_name=/opt/gitlab/embedded/bin/chef-client
3 e# ~0 H% r8 ^$ s3 h      executable=/opt/gitlab/embedded/bin/chef-client
3 p! h9 s8 {9 O) i+ m5 a' j      
/ ]! i* N% c3 p, ]8 N% O# g% B/ D1 ^    5 H9 A. A: D5 y: \# V
    ================================================================================* N+ n" J. X: [3 H4 q
    Error executing action `run` on resource 'rails_migration[gitlab-rails]'
: N4 q0 I' l* t4 _, G  E" \    ================================================================================
! k2 V  ^; B% b9 M, L3 |+ D    & k" {1 l2 y, q9 r: G* ~# l0 B/ I5 x2 S
    Mixlib::ShellOut::ShellCommandFailed
( a- u* Y- w3 n  p- I* x! C    ------------------------------------
0 r! I; }, ~# M    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
9 _! D) S0 F$ }6 R6 b( ^1 X   
& @% i4 Q* l  P  e    Resource Declaration:
, h- K7 @2 P/ R8 L  _/ _4 `( u    ---------------------
0 q; b& ~9 Q7 g& [3 ~    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb
5 f+ w  J+ F5 C' L0 E) l    4 k4 s# y& m$ |" ]: Z
     51: rails_migration "gitlab-rails" do5 x' ]' U4 X3 r
     52:   rake_task 'gitlab:db:configure'( H; g5 C5 D& G9 B" w
     53:   logfile_prefix 'gitlab-rails-db-migrate'
3 I; i5 X7 S( }8 `& T0 K" c, [0 ~     54:   helper migration_helper. k6 [7 w* G9 l- y; N4 c/ u& K
     55:
& Y: O7 B) W( x7 e8 u6 ^5 y     56:   environment env_variables
  K4 H" G7 @( a' [  w0 ~: ^5 Z. R     57:   dependent_services dependent_services
0 [! U! P  }  S( g& W# j     58:   notifies :run, "execute[clear the gitlab-rails cache]", :immediately
& H7 T7 L! ?( Q* _: r! J8 m     59:   notifies :run, "ruby_block[check remote PG version]", :immediately
% ~& Q9 m( _1 z4 V     60: ; J! }7 }& z3 C3 P8 y% H* N
     61:   only_if { migration_helper.attributes_node['auto_migrate'] }5 J$ P3 ~" R1 ~! |1 p% t
     62: end
) t" `" P( q" x4 M' s$ Z    3 b1 l) b1 V- g. [4 b
    Compiled Resource:
6 |  l8 G. ]) N+ W0 ~    ------------------* N' W( H$ M3 Q8 T+ J/ l
    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'
* B& W6 P% l" c/ E+ m+ y& D    / h; j  ?- k% P. B
    rails_migration("gitlab-rails") do
5 U3 }3 \7 [+ X      action [:run]
) I" p$ _) `2 G+ g" ?      default_guard_interpreter :default
" k. c$ q- {1 t( i% f9 ?- M" d# S+ @      declared_type :rails_migration7 a( ^! C$ C. C# M
      cookbook_name "gitlab"" |( B7 ^! i" l1 o
      recipe_name "database_migrations"3 O: T8 _6 k! ?, J- {8 D- m/ L+ c  o
      rake_task "gitlab:db:configure"
# L5 v9 v) C% k      logfile_prefix "gitlab-rails-db-migrate"8 l7 X3 k8 {6 E: C9 m" f$ G  q
      helper "*sensitive value suppressed*"
; O  A. Q- g$ T+ c9 U; s      environment "*sensitive value suppressed*"
$ \7 f8 g, x5 F      dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]1 k) M: T6 @0 D+ `
      only_if { #code block }/ _+ M2 F9 v$ n+ ]# j4 s5 w
    end
; W9 N* M4 ~- Z( D8 M2 q4 ^7 `' |: v    ! ~; k! B! i3 H& c9 E& j. A
    System Info:% r3 {+ T4 a7 U% E# u6 K: |- X
    ------------
( F3 _  K6 C; _# a7 U5 S* f7 s9 T    chef_version=15.17.4
& q8 @/ C0 f* u3 o. o    platform=ubuntu
: x) e# ~1 X# h$ Y, O7 Q7 i    platform_version=20.04
* K  x2 k: M3 ]2 m6 u    ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
6 {' ]: o7 d$ N! t& p- W    program_name=/opt/gitlab/embedded/bin/chef-client
/ q, e0 ?. w& |$ F    executable=/opt/gitlab/embedded/bin/chef-client- P/ R; L% B: K5 w. G7 t$ P* g' s
    % p; _- j. K9 E! ^
Running handlers:
4 j1 z0 Y: R7 Y. c4 R6 H7 WThere was an error running gitlab-ctl reconfigure:
" u# Y( s- S) [0 k0 ^, @! F0 xrails_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 Y; ~6 v$ e* C: n
Running handlers complete
' N" `1 E0 d; C: oChef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:* U! I% Q7 t( j) i* O4 q8 r
1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;
& x+ E  z% n, _& J- e- C2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;5 D3 }$ Z7 o2 ?. e0 c4 B2 z' r1 `
3. 再次运行 gitlab-rake db:migrate,确认不会再报错;
& O% R9 h! {' A) }0 {) d& N. |4. 运行 gitlab-ctl reconfigure;
0 A8 ^- K7 A7 V8 S0 J$ u5. 重启Gitlab:gitlab-ctl restart。9 m; H! v! X& s+ S5 K! I! }- N
需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。3 w- X- \' F0 h
参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated4 X1 s2 S1 [  K6 _' [5 o
2. gitlab-ctl reconfigure failing due to migration issue! ~  P( Y7 `# f2 A! s/ R
AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2)

收藏回复 显示全部楼层 道具 举报

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

QQ|Archiver|手机版|小黑屋|青浦海洋数码电脑城 ( 沪ICP备18024137号 )

GMT+8, 2026-8-16 17:49 , Processed in 0.313881 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表