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

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

5万

积分

0

好友

1万

主题
发表于 2022-9-11 20:40:14 | 查看: 1978| 回复: 0
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
7 ~9 x; d4 w+ {登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。
  L3 p* {$ |: A' q- @) N运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。/ f  e3 v4 ?( ?( c( f( L' k
接着设置语言和本地化设置:
2 j4 V0 I$ @& m" C; mexport LC_ALL=en_US.UTF-8' H4 J4 k5 c1 V4 w5 y  {5 v
export LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。9 i2 }! w) U) I* \
但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?) N9 c( g8 [- U6 y7 a
于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:
* [& C3 v. g* b9 x" z' b& d! K9 ]Recipe: gitlab::database_migrations
+ p3 L1 b1 G' F3 }& z1 T* V  * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)
# g9 k9 x; g* W/ U# W! q6 W4 M  * rails_migration[gitlab-rails] action run! R) n3 O! ~5 f' y' u$ H
    * bash[migrate gitlab-rails database] action run* r* Z+ W% s2 \& V$ T# q+ U
      2 {6 v" P) O* Y
      ================================================================================8 u; w/ u" }6 Q
      Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
' y* o: C" ^% R7 p" E3 d* V) e      ================================================================================* L8 a: ]3 l3 ~3 h" k: J: w
      1 Q; G' r/ P+ t5 |( i) j1 l& g
      Mixlib::ShellOut::ShellCommandFailed" Z% i: Y* B$ j' Q' H6 M
      ------------------------------------. S3 ]% a- g! t* I
      Command execution failed. STDOUT/STDERR suppressed for sensitive resource. T2 k$ o' Y, J& b
      
3 N) L4 f# E3 `8 c2 f; ^- _3 k4 |, Y      Resource Declaration:" @; O4 I4 y. R3 ~  @
      ---------------------1 F; a7 z9 ~! L# |/ ^( O/ S7 {4 D" g
      suppressed sensitive resource output1 Q8 N* j  J" v2 Y
      / }* g5 _3 {7 `% N' d
      Compiled Resource:2 G5 T; k% L8 x; l0 n
      ------------------2 V9 o3 l# L& o, `3 E' Q
      suppressed sensitive resource output% w! n9 u# a2 \; }; K9 C
      9 ~7 ?. D8 s9 u: Q8 t
      System Info:2 N+ S7 K  m7 _. n% ^* q, G
      ------------
3 P9 f& l$ r% }/ x- M2 K      chef_version=15.17.4+ G4 t5 S  D* w' e
      platform=ubuntu
7 m; s' U, V% ^2 J, C8 `$ o7 ^      platform_version=20.04
1 H0 L9 p5 a1 c( ^      ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
+ i4 i4 F) y3 K, [9 c* o0 D2 n      program_name=/opt/gitlab/embedded/bin/chef-client% v$ @9 q% K: ?, m
      executable=/opt/gitlab/embedded/bin/chef-client
7 C+ Q2 \4 `8 z2 V6 ]  c/ h" T. U      
( K1 C! g$ S6 E  E   
3 V) B5 F, P! J& G* t    ================================================================================8 @3 T' C- Y0 V+ u2 m( i
    Error executing action `run` on resource 'rails_migration[gitlab-rails]'; B# ^4 g4 ~9 _2 p: L
    ================================================================================
2 s4 H  K! E, r: }( U5 m3 G    ; U; l/ t" B" q% I& k
    Mixlib::ShellOut::ShellCommandFailed7 }2 C8 C% c6 d2 A
    ------------------------------------( z* F5 s- M% C# L& G  x5 y
    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* m& t# j- M- `5 K
    1 y/ s4 [3 W$ X4 s! U
    Resource Declaration:
! z  I; L/ [' o6 ]    ---------------------& X1 w+ L% v7 J: x
    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb' A) g* H3 y4 F% m9 B* ^: R
   
+ s' l! M& {  v) i" [7 y& T     51: rails_migration "gitlab-rails" do
" u! X! b9 j# P" n  ^# m) D4 a& A     52:   rake_task 'gitlab:db:configure'1 k6 ?& t6 k8 Z# J, k# ^* e) ]
     53:   logfile_prefix 'gitlab-rails-db-migrate'
& B: Z2 C' Y  W" b0 h# _     54:   helper migration_helper
$ l. \6 Q; J( ]0 J+ @, R3 c2 q0 O: J     55: 5 y& N; b. B1 e4 z. h( @
     56:   environment env_variables
; L) S, v! E# U3 l$ k8 m, e& D     57:   dependent_services dependent_services
  I- y8 d/ ?) w! r1 I2 x     58:   notifies :run, "execute[clear the gitlab-rails cache]", :immediately
& Z0 r/ Q) G2 Z$ }! A     59:   notifies :run, "ruby_block[check remote PG version]", :immediately
" L1 t8 Q* g, S9 _) Y3 i     60:
( W& r7 z( q0 I; d     61:   only_if { migration_helper.attributes_node['auto_migrate'] }
8 K5 P' S6 H4 \. P( N" `: h     62: end
4 Y+ ~2 K# ]4 Y. o    / A+ G4 v; H9 a# n. e. r# B
    Compiled Resource:) S8 {6 k, p! l4 c8 I+ e' {& E
    ------------------
8 z& f( z1 ]) B8 v- I3 ]3 ^    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'
' M! t: i" {  n/ Y) {+ G2 c  X! k   
5 o; K2 n8 I! v; z/ W    rails_migration("gitlab-rails") do
  Y% c4 T) E' Z4 F3 W      action [:run]% q6 T% \/ ^! E: t5 K1 x9 I, F  ]9 P
      default_guard_interpreter :default
1 S1 D/ i# p9 K" r. h4 L# Y' m- X      declared_type :rails_migration
& m) I6 }! ?6 P* T5 W0 R# Q      cookbook_name "gitlab"2 `. A& b8 w. t4 R6 B$ K5 P
      recipe_name "database_migrations"
- U# f5 s/ T: D" u      rake_task "gitlab:db:configure"  V7 ?' Q& R, n4 _
      logfile_prefix "gitlab-rails-db-migrate"% b9 x( g& M" g4 k9 ]1 r
      helper "*sensitive value suppressed*"
! B# r+ r, a1 t$ g& P2 z8 x      environment "*sensitive value suppressed*". ~/ g; y% p; i+ w  V
      dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]
/ b& x* \6 X( Q- ?$ a- j6 j      only_if { #code block }" S" a9 q9 ~7 `; R
    end
( c5 @" f( ]" S' f   
( g8 l, T2 K# ?: h5 R    System Info:
+ O7 a' f) _4 W# _- ~" I; Q    ------------
6 S8 O# s( {$ L/ C* W" T/ S1 O' B    chef_version=15.17.4
2 {/ F' X. ^$ o; }9 i6 G/ |    platform=ubuntu9 i/ H+ V& S. L3 h/ x' g6 w8 t) z. ]
    platform_version=20.04
# [/ U- K' }  I1 h/ A6 ]% i    ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
/ y' D! B+ w" ^. N    program_name=/opt/gitlab/embedded/bin/chef-client/ u& m5 I4 L  o/ ^5 ]+ e( b& X
    executable=/opt/gitlab/embedded/bin/chef-client4 A& I. [$ D, ^+ K# l
   
- O  t* r- z# d, H( vRunning handlers:
, D3 U. I" L6 ~9 CThere was an error running gitlab-ctl reconfigure:
: C& |5 }; C& a9 r! @) Y9 prails_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
  b0 @6 ~* _% }9 ?Running handlers complete$ \+ S- v7 s4 _, f8 p. G
Chef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:# I- f7 J: o! ?" o2 w! {
1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;6 u5 |6 ]  j& t) {" ~4 y. z, a  U5 U
2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;- X  k4 K, y! Q" V0 ~2 W
3. 再次运行 gitlab-rake db:migrate,确认不会再报错;
3 w; O) F# m6 w0 [4. 运行 gitlab-ctl reconfigure;. s0 I+ s, Y) x
5. 重启Gitlab:gitlab-ctl restart。
4 j+ ^8 q( `( f: m- |需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。
* g) k) B  J3 s" o: X$ r; D参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated
- o( C" o2 O/ h& z2. gitlab-ctl reconfigure failing due to migration issue% k1 Q6 v1 A" ]# g
AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2)

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

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

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

GMT+8, 2026-8-27 02:58 , Processed in 0.070934 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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