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

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

5万

积分

0

好友

1万

主题
发表于 2022-9-11 20:40:14 | 查看: 2107| 回复: 0
上周更新系统,看到Gitlab-CE有新版本,直接就更新了。今天写好代码要推送的时候,发现服务端竟然挂了,提示502错误。
1 F9 \4 I1 {( v& N1 q* R登陆到服务器,运行 gitlab-ctl status 查看状态,组件都正常运行。唯一的意外是:ssh登录服务器时,会出现”LANG cannot change locale (en_US.utf8)” 的提示。暂时想不到其他原因,就先解决这个问题。
  a8 e' x3 F; V4 H* o运行 locale -a 命令,发现系统中确实没有 en_US.utf8 的本地化设置文件。于是编辑 /etc/locale.gen 文件,取消 “en_US.UTF-8 UTF-8” 这一行的注释,运行 locale-gen ,生成 en_US.utf8 相关文件。$ G! U$ Q7 V, q
接着设置语言和本地化设置:) O6 X1 u3 Z2 Z/ X2 d! ?# I2 @
export LC_ALL=en_US.UTF-8
5 K" q4 Q9 g: ?. @. n) p8 G$ pexport LANG=en_US.UTF-8断开ssh重新登陆,bash的警告提示消失了。运行 gitlab-ctl restart 重启Gitlab,代码能正常推送,网站能打开,似乎问题都解决了。
9 h- L6 L' O9 ?; P3 U, d7 l! }) p" X但是好事多磨,过了没多久,发现网页都是500错误。虽然能通过git正常推送和拉去代码,但是网页用不了也挺烦人的。想到上个月为了节省服务器资源,把Premethus、Grafana等用不到的组件都关了,会不会是这个原因导致的?
+ {4 x/ U4 y4 L& y5 g! V于是编辑 /etc/gitlab/gitlab.rb 文件,把组件又启用。运行 gitlab-ctl reconfigure 重新配置,意外发现了,脚本无法运行成功,出现了如下提示:
9 G8 Q. d% d! p! F7 a) [0 lRecipe: gitlab::database_migrations- M7 S" l  d" W# Q1 l% \
  * ruby_block[check remote PG version] action nothing (skipped due to action :nothing)
9 `* M3 A9 A; c+ G* T6 v  * rails_migration[gitlab-rails] action run
( a+ U7 ]. [: {    * bash[migrate gitlab-rails database] action run
/ u! t8 Y0 a2 |% T: \      + G, F: }6 J, ]5 r$ j7 t
      ================================================================================" o) K$ }; y! d+ |. @( q% _) Q: j. ^
      Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
' M' f. T4 x7 @, D      ================================================================================+ o2 B4 v% O3 E
      
( J8 X8 V  i' E% p9 u; _      Mixlib::ShellOut::ShellCommandFailed
& R* @9 c, P. j* P      ------------------------------------. A5 l5 V- S. _- }0 g
      Command execution failed. STDOUT/STDERR suppressed for sensitive resource
% S( A8 Q, ~( n: _) q: F4 q      & j% \, X( M4 n& _
      Resource Declaration:
- e9 |. T; L6 p      ---------------------5 V: a% j- L2 K* b5 C4 [" E
      suppressed sensitive resource output3 g9 e) @, S% E5 Y8 v/ j: i) z+ D
      
" Q' z/ C: n/ ^      Compiled Resource:' r* ~* ?* `" x4 ~1 P0 B
      ------------------
6 K# W& c! g' X! g( p! x      suppressed sensitive resource output$ I7 a2 q' \4 G) Z" b1 U& p
      
, P* X8 @% I5 b6 X      System Info:
3 l7 a' U- n5 ]      ------------
6 v7 ]+ p: G# S: E4 V; K& Q+ ^      chef_version=15.17.4* I: r, ^6 G+ T
      platform=ubuntu& i4 d$ F: F* [8 ]8 M$ S
      platform_version=20.04, P! p  V% W' D: m7 {6 X$ x3 Z& V
      ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]) G6 r& N$ z0 ^6 c# l, `
      program_name=/opt/gitlab/embedded/bin/chef-client' J# g+ d  |; R1 N5 d- C( _
      executable=/opt/gitlab/embedded/bin/chef-client( }# Q8 S8 x$ J' N7 k. d) L
      5 R4 H$ B, ?9 y* H% z$ S
   
) ?: V* |7 G( n5 I8 k, s    ================================================================================8 H1 b+ P* I) U  h3 \
    Error executing action `run` on resource 'rails_migration[gitlab-rails]'5 X/ P. {: @: T2 z3 n3 p+ S
    ================================================================================
2 Z# M+ b. b: V   
* z: Q2 ^1 x1 {: T) K/ o    Mixlib::ShellOut::ShellCommandFailed
; G; L3 F& [8 i8 T7 W! l) Z    ------------------------------------
3 X3 d; O/ D& 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 resource1 o" A9 f/ Z! z7 M
    ; A! U( g, n. s1 R9 G6 J+ b
    Resource Declaration:
! h3 d" Y, V, ]! d5 x9 H    ---------------------
6 k& J$ y5 Q- [$ f% z* Z. s, H    # In /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb) c1 B9 r$ L" I: V7 `
    9 [) u: _8 V$ x; H6 k# y8 Q% K6 M
     51: rails_migration "gitlab-rails" do& E& G1 S& P1 U; W  x
     52:   rake_task 'gitlab:db:configure'
, a" }8 M' o8 L: R     53:   logfile_prefix 'gitlab-rails-db-migrate'
  s9 A& B) i( h     54:   helper migration_helper& @2 `; X; o# n  z. {6 V2 v* z) [& ~
     55:
- A! S: x; D' X" g     56:   environment env_variables2 ?  B2 p8 O( n5 M0 Y( ~
     57:   dependent_services dependent_services
8 i* e5 O# ~+ @+ g5 U% g" b6 X6 V- R     58:   notifies :run, "execute[clear the gitlab-rails cache]", :immediately" V: x0 O. L$ |2 ~
     59:   notifies :run, "ruby_block[check remote PG version]", :immediately$ B$ D9 R( `2 ]# T# t( X. j( I
     60: ; Q6 a2 T  n% S8 p  u" i1 d
     61:   only_if { migration_helper.attributes_node['auto_migrate'] }
2 p% M( P. ?: x- ]& \     62: end. g5 y- x* Q1 F/ o; j
   
) e1 v# o% a) z; t. M    Compiled Resource:
! G1 y/ ^) O. h. H8 D    ------------------
* X* ~  m4 j( l8 v  d    # Declared in /opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/recipes/database_migrations.rb:51:in `from_file'. A3 o0 W  M8 x) ]1 e+ G6 |
   
. W  y! k) |& s& g    rails_migration("gitlab-rails") do
7 H4 r# z0 ]; b% J      action [:run]
' O& z* i+ L( u; M! C% {      default_guard_interpreter :default3 j9 n; E. R1 N. K. P
      declared_type :rails_migration* E4 C0 U( E1 N4 Q! G# y, l* D8 d
      cookbook_name "gitlab"3 T9 \1 P5 s& T1 @' [2 X3 q; s3 x' |, x$ Y
      recipe_name "database_migrations"
9 [/ K9 e! x* ^0 B' D# b, R      rake_task "gitlab:db:configure"
: O: _  y2 v/ O$ A/ Q. C      logfile_prefix "gitlab-rails-db-migrate"
2 ^' `+ w& v: l, F7 j! s      helper "*sensitive value suppressed*"
8 u7 s  A- r) V' x) \0 s; m: x( v      environment "*sensitive value suppressed*"
" _  v) a( h$ q& o      dependent_services ["runit_service[puma]", "sidekiq_service[sidekiq]"]
; O$ a; i6 \. V' Q, H1 W6 K      only_if { #code block }
% @! P) `$ l4 y/ l% }    end+ i4 q" b! d$ i- [* P
   
6 \; X! K7 V4 Y& _' w0 l5 p    System Info:
+ l6 L/ r& ?- h5 n1 r4 C$ W* v* s    ------------5 j) @1 d4 b( w: i1 u# q
    chef_version=15.17.4
  Z  ^* _- O; }9 X7 r; Z    platform=ubuntu0 D, H1 M* B7 c# l: O; m# U- H
    platform_version=20.04
, s# O9 j+ \9 c8 s    ruby=ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]: V! l7 C8 V7 J
    program_name=/opt/gitlab/embedded/bin/chef-client2 |1 t( T! O5 p, ~/ Q+ U4 l
    executable=/opt/gitlab/embedded/bin/chef-client. f$ f. X0 A0 c6 ]9 ^4 _1 [
   
0 |  V$ ~% |  {1 ^7 m4 dRunning handlers:
$ ~. h4 G$ L1 R" O6 }: wThere was an error running gitlab-ctl reconfigure:
- ]' c9 V* T! x8 Orails_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# h, _5 r. Y" f; p  K( F, h
Running handlers complete
2 c" }: M1 Y4 pChef Infra Client failed. 0 resources updated in 21 seconds网上一查,发现和上次碰到的 Gitlab更新设置总是500错误 问题一样,又是Gitlab官方的锅。但是这次解决问题比之前更麻烦,步骤为:6 R" O( e) b; ]8 y' @+ ?7 K2 p
1. 运行 gitlab-rake db:migrate,出现错误没关系,中间会输出一行用于终止后台任务的命令;
4 l, w/ _8 O- e, k2. 复制这条命令或者上一步控制台输出的指令: gitlab-rake gitlab:background_migrations:finalize[ProjectNamespaces::BackfillProjectNamespaces,projects,id,'[null\,"up"]']。运行这条指令可能会失败,如果失败,请重新运行上面的指令,成功说明问题解决了;
* H4 Y& ?, h8 F: y" k, {3. 再次运行 gitlab-rake db:migrate,确认不会再报错;- a' B8 W5 B& L$ d7 {+ S
4. 运行 gitlab-ctl reconfigure;
& y  p7 F' r& f) p2 P) N5. 重启Gitlab:gitlab-ctl restart。
5 k. n1 k* p/ @1 S; D  u, w5 n5 T需要注意的是,这个bug是在Gitlab-CE 14.10.0中引入,在14.10.1版本被修复。如果运行过reconfigure但没解决错误,是无法直接升级到14.10.1版本的。" d/ T9 J% E' \! C# W7 r
参考1. Gitlab-ctl reconfigure doesn’t work after gitlab omnibus updated
0 n2 x/ T9 K  g0 R" S: c: T2. gitlab-ctl reconfigure failing due to migration issue- q, J5 D8 t& F) h- N
AD:【加速器推荐】 搬瓦工官方代理服务Just My Socks,高速CN2 GIA线路流畅访问外网,被墙自动更换IP打赏赞(2)

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

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

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

GMT+8, 2026-10-17 08:11 , Processed in 0.931596 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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