【Gitlab】gitlabを 12.5.4 > 19.2.1 へアップデートする! centos > ubuntuも

Technology

現状

NAME="CentOS Linux"
VERSION="7 (Core)"

System information
System:
Proxy:          no
Current User:   git
Using RVM:      no
Ruby Version:   2.6.3p62
Gem Version:    2.7.9
Bundler Version:1.17.3
Rake Version:   12.3.3
Redis Version:  3.2.12
Git Version:    2.22.2
Sidekiq Version:5.2.7
Go Version:     unknown

GitLab information
Version:        12.5.4-ee
Revision:       2a57951c0ee
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     PostgreSQL
DB Version:     10.9
URL:            http://gitlab.grtlab.com
HTTP Clone URL: http://gitlab.grtlab.com/some-group/some-project.git
SSH Clone URL:  git@gitlab.grtlab.com:some-group/some-project.git
Elasticsearch:  no
Geo:            no
Using LDAP:     no
Using Omniauth: yes
Omniauth Providers:

GitLab Shell
Version:        10.2.0
Repository storage paths:
- default:      /var/opt/gitlab/git-data/repositories
GitLab Shell path:              /opt/gitlab/embedded/service/gitlab-shell
Git:            /opt/gitlab/embedded/bin/git

相当古いですね
# バックアップの実行
sudo gitlab-rake gitlab:backup:create

Creating backup archive: 1786444658_2026_08_11_12.5.4-ee_gitlab_backup.tar ... done
Uploading backup archive to remote storage  ... skipped
Deleting tmp directories ... done
done
Deleting old backups ... skipping
Warning: Your gitlab.rb and gitlab-secrets.json files contain sensitive data
and are not included in this backup. You will need these files to restore a backup.
Please back them up manually.
Backup task is done.

ローカルに、gitlab.rbとsecrets.jsonもダウンロード!

cent os 7 リポジトリ設定

# 公式ミラーからVaultへの自動書き換え
sudo sed -i -e 's/mirrorlist=#mirrorlist/mirrorlist=/#mirrorlist/g' /etc/yum.repos.d/CentOS-*.repo
sudo sed -i -e 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*.repo

# yumキャッシュの更新確認
sudo yum clean all
sudo yum makecache

swapを8GBに変更しておく

sudo swapoff /swapfile && \
sudo dd if=/dev/zero of=/swapfile bs=1024 count=8388608 && \
sudo chmod 600 /swapfile && \
sudo mkswap /swapfile && \
sudo swapon /swapfile

8388608+0 records in
8388608+0 records out
8589934592 bytes (8.6 GB) copied, 79.5421 s, 108 MB/s
Setting up swapspace version 1, size = 8388604 KiB
no label, UUID=9e87a71d-6337-4b98-9ac8-491bbdcc7fce
# free -h
              total        used        free      shared  buff/cache   available
Mem:           1.8G        135M         83M         17M        1.6G        1.5G
Swap:          8.0G          0B        8.0G

バックグラウンド処理の競合を防ぐため一回設定反映

# sudo gitlab-ctl reconfigure
Running handlers:
Running handlers complete
Chef Client finished, 7/701 resources updated in 12 seconds
gitlab Reconfigured!
# gitlab-ctl stop
ok: down: crond: 497s, normally up
ok: down: gitaly: 497s, normally up
ok: down: gitlab-exporter: 496s, normally up
ok: down: gitlab-workhorse: 496s, normally up
ok: down: grafana: 495s, normally up
ok: down: logrotate: 495s, normally up
ok: down: node-exporter: 495s, normally up
ok: down: postgres-exporter: 494s, normally up
ok: down: postgresql: 494s, normally up
ok: down: prometheus: 493s, normally up
ok: down: redis: 493s, normally up
ok: down: redis-exporter: 492s, normally up
ok: down: sidekiq: 491s, normally up
ok: down: unicorn: 488s, normally up
# 1. 念のためGitLabサービスを止めてメモリを解放する
sudo gitlab-ctl stop

# 2. パッケージのアップデートを実行
# (自動的に必要なDB更新などが走り、サービスが再起動されます)
sudo yum install -y gitlab-ee-12.10.14-ee.0.el7

# 3. バックグラウンド処理(DBマイグレーション)の完了確認
# "0" になるまで待ちます
sudo gitlab-rails runner -e production "puts Gitlab::BackgroundMigration.remaining"
12.5.4 からの必要経由バージョン例:
12.5.4 ➔ 12.10.14 ➔ 13.0.14
13.0.14 (★現在ここです)
13.1.11
13.8.8
13.12.15 (ここで13系完了)
14.0.12
14.3.6
14.9.5
14.10.5 (ここで14系完了)
15.0.5
15.4.6
15.11.13 (ここで15系完了)
16.0.8
16.3.7
16.7.7
16.11.10 (16系のゴール)

バックアップエラーに。なったので ( stopした状態なので動かなかた。

# 1. 自動バックアップをスキップするためのフラグファイルを作成
sudo touch /etc/gitlab/skip-auto-backup

# 2. 再度アップデートコマンドを実行
sudo yum install -y gitlab-ee-12.10.14-ee.0.el7

手動反映。。。

# 1. 停止している Redis を起動する
sudo gitlab-ctl start redis

# 2. Redis と PostgreSQL が run(起動中)になっているか確認
sudo gitlab-ctl status redis
sudo gitlab-ctl status postgresql

# 4. 手動で DB マイグレーションを実行
sudo gitlab-rake db:migrate
# sudo gitlab-ctl reconfigure
Running handlers:
Running handlers complete
Chef Client finished, 16/721 resources updated in 01 minutes 22 seconds
gitlab Reconfigured!

okっぽいstartさせてみる

# sudo gitlab-ctl start
ok: run: crond: (pid 7692) 648s
ok: run: gitaly: (pid 7699) 647s
ok: run: gitlab-exporter: (pid 9422) 49s
ok: run: gitlab-workhorse: (pid 9413) 50s
ok: run: grafana: (pid 9441) 47s
ok: run: logrotate: (pid 7729) 646s
ok: run: node-exporter: (pid 7747) 645s
ok: run: postgres-exporter: (pid 9434) 48s
ok: run: postgresql: (pid 7680) 649s
ok: run: prometheus: (pid 7760) 644s
ok: run: redis: (pid 8752) 243s
ok: run: redis-exporter: (pid 7768) 644s
ok: run: sidekiq: (pid 9404) 51s
ok: run: unicorn: (pid 9513) 1s

外部からも確認できた。

# Puma(Web サーバー)のログを確認(Ctrl + C で抜けられます)
$ sudo gitlab-ctl tail unicorn ( 新しいものはpuma
==> /var/log/gitlab/unicorn/unicorn_stderr.log <==
I, [2026-08-11T11:23:04.707Z #9532]  INFO -- : listening on addr=127.0.0.1:8080 fd=20
I, [2026-08-11T11:23:04.708Z #9532]  INFO -- : unlinking existing socket=/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket
I, [2026-08-11T11:23:04.714Z #9532]  INFO -- : listening on addr=/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket fd=21
I, [2026-08-11T11:23:05.146Z #9532]  INFO -- : master process ready 

ここで 12.10.14はOK

sudo gitlab-ctl stop unicorn && \
sudo gitlab-ctl stop puma && \
sudo gitlab-ctl stop sidekiq
ok: down: unicorn: 1s, normally up
ok: down: sidekiq: 0s, normally up
これでメモリが1GBほど空いた。

バックアップせず実行

sudo touch /etc/gitlab/skip-auto-backup && \
sudo yum install -y gitlab-ee-13.0.14-ee.0.el7

エラーになったので postgresqlを11にアップグレード

# 1. 念のため自動アップグレード無効化フラグを削除(もし残っていれば)
sudo rm -f /etc/gitlab/disable-postgresql-upgrade

# 2. GitLab サービス(特に PostgreSQL)が起動しているか確認
sudo gitlab-ctl start postgresql
sudo gitlab-ctl start redis

# 3. PostgreSQL の手動アップグレードを実行
sudo gitlab-ctl pg-upgrade
Toggling services: OK
==== Upgrade has completed ====
Please verify everything is working and run the following if so
sudo rm -rf /var/opt/gitlab/postgresql/data.10
sudo rm -f /var/opt/gitlab/postgresql-version.old
# 1. 重いWeb/Workerプロセスだけ停止(DBとRedisは動いたまま)
sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop puma
sudo gitlab-ctl stop sidekiq

# 2. フラグ作成と 13.0.14 インストール
sudo touch /etc/gitlab/skip-auto-backup
sudo yum install -y gitlab-ee-13.0.14-ee.0.el7
gitlab Reconfigured!
Restarting previously running GitLab services
ok: run: crond: (pid 12388) 1s
ok: run: gitaly: (pid 11287) 391s
ok: run: gitlab-exporter: (pid 12372) 1s
ok: run: gitlab-workhorse: (pid 12358) 2s
ok: run: grafana: (pid 12399) 0s
ok: run: logrotate: (pid 12412) 1s
ok: run: node-exporter: (pid 12425) 0s
ok: run: postgres-exporter: (pid 12434) 1s
ok: run: postgresql: (pid 10843) 411s
ok: run: prometheus: (pid 12443) 0s
ok: run: redis: (pid 12178) 97s
ok: run: redis-exporter: (pid 12452) 0s
tput: unknown terminal "xterm-ghostty"

     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/


Upgrade complete! If your GitLab server is misbehaving try running
  sudo gitlab-ctl restart
before anything else.
The automatic database backup was skipped as requested.
You may enable it again anytime by running the following command:
  sudo rm /etc/gitlab/skip-auto-backup

  Verifying  : gitlab-ee-13.0.14-ee.0.el7.x86_64                                                                                                                                                                 1/2
  Verifying  : gitlab-ee-12.10.14-ee.0.el7.x86_64                                                                                                                                                                2/2

Updated:
  gitlab-ee.x86_64 0:13.0.14-ee.0.el7

無事 13に!メモリ使用も減ってやや快適なような?

処理完了を確認、これが0になってから次の更新。

sudo gitlab-rails runner "puts Gitlab::BackgroundMigration.remaining"

バージョン更新順の確認
https://gitlab-com.gitlab.io/support/toolbox/upgrade-path/?current=13.0.14&target=15.11.13&distro=alma

完了チェックと次バージョン更新用sh 待つのが面倒なので^^;

#!/bin/sh

# ==============================================================================
# GitLab アップグレードパス(公式推奨ルートの抜粋)
# ------------------------------------------------------------------------------
# アップグレード時はバージョンを飛ばさず、以下の「アップグレードパス」を順に通過する必要があります。
# (例: 13.1.11 -> 13.8.8 -> 13.12.15 -> 14.0.12 -> 14.9.5 -> 14.10.5 -> 15.0.5 ...)
#
# 【主要なアップグレードパス一覧(13.x 〜 16.x系)】
#   ・13.1.11
#   ・13.8.8      <- ★ 次はここ
#   ・13.12.15
#   ・14.0.12
#   ・14.9.5
#   ・14.10.5
#   ・15.0.5
#   ・15.4.6
#   ・15.11.13
#   ・16.3.7
#   ・16.7.7
#   ・16.11.10
#   (※お使いの環境のタイプに応じて EE / CE を切り替えてご利用ください)
# ==============================================================================

# ------------------------------------------------------------------------------
# 設定:次にアップグレードするバージョンを指定してください
# ------------------------------------------------------------------------------
NEXT_VERSION="13.8.8"
TYPE="ee"   # Community Edition の場合は "ce" に変更してください

# パッケージ名の自動構築
PACKAGE_NAME="gitlab-${TYPE}-${NEXT_VERSION}-${TYPE}.0.el7"

# ------------------------------------------------------------------------------
# 事前準備:不要なサービスを停止してメモリを最大限解放する
# ------------------------------------------------------------------------------
echo "==> 次のバージョン [ ${NEXT_VERSION} (${PACKAGE_NAME}) ] への更新準備を開始します。"
echo "==> メモリ確保のため Puma と Sidekiq を一時停止します..."

sudo gitlab-ctl stop puma
sudo gitlab-ctl stop sidekiq

echo "==> メモリ解放完了。バックグラウンドマイグレーションの確認を開始します..."

# ------------------------------------------------------------------------------
# メイン処理(バックグラウンドマイグレーション監視 & インストール)
# ------------------------------------------------------------------------------
while true; do
  RESULT=$(sudo gitlab-rails runner 'puts Gitlab::BackgroundMigration.remaining' 2>/dev/null | tr -d '\r\n')
  
  if [ "$RESULT" = "0" ] || [ -z "$RESULT" ]; then
    echo "【完了】バックグラウンドマイグレーション残りが「$RESULT」になりました。"
    echo "【実行】${PACKAGE_NAME} のインストールを開始します..."
    sudo yum install -y "$PACKAGE_NAME"
    break
  fi

  case "$RESULT" in
    *[!0-9]*)
      echo "【エラー検出】想定外の出力が発生したため安全のため停止しました: '$RESULT'"
      break
      ;;
    *)
      echo "[$(date '+%H:%M:%S')] まだマイグレーションが残っています (残り: $RESULT 件)。"
      
      # マイグレーションが残っている場合、Sidekiq が止まっていれば自動で起動して処理を進行させる
      if ! sudo gitlab-ctl status sidekiq | grep -q "^run:"; then
        echo "[$(date '+%H:%M:%S')] マイグレーション進行のため Sidekiq を自動起動します..."
        sudo gitlab-ctl start sidekiq
      fi

      echo "15秒後に再確認します..."
      sleep 15
      ;;
  esac
done

13.12.15で警告が出たので。unicornの設定を消して、pumaに

# vi /etc/gitlab/gitlab.rb

# Pumaをシングルモードにして大幅にメモリ節約
puma['worker_processes'] = 0
puma['per_worker_max_memory_mb'] = 1024

# (※先ほど話題に出たUnicornの設定が残っていればコメントアウト)
# unicorn['worker_timeout'] = 60
# unicorn['worker_processes'] = 2
sudo gitlab-ctl reconfigure

okなら次に。

remainingで3と残っていたら。。。再起動しても消えないので

sudo gitlab-rails runner "Gitlab::Database::BackgroundMigrationJob.pending.find_each { |j| j.execute }"

フロント実行らしい、これで またsh実行

14系へのアップデート レガシーストレージ廃止対応

# sudo gitlab-rake gitlab:storage:legacy_projects
* Found 4 projects using Legacy Storage
# sudo gitlab-rake gitlab:storage:migrate_to_hashed
Enqueuing migration of 4 projects in batches of 200. Done!

enqueueだけでまだ完了していないのでフォアグラウンドに回す

対象プロジェクトを確認、いらないものなら sudo touch /etc/gitlab/skip-unmigrated-data-check で無視してもOK

# sudo gitlab-rails runner "Project.with_unmigrated_storage.find_each { |p| puts \"ID: #{p.id} | Name: #{p.full_path}\" }"
ID: 2 | Name: junichi/twitter-simple-list-view
ID: 3 | Name: junichi/musico
ID: 4 | Name: junichi/docs
ID: 5 | Name: junichi/system-centos-7

いらないけど、とりあえず、もう一度更新

sudo gitlab-rails runner "Project.with_unmigrated_storage.find_each { |p| Projects::HashedStorage::MigrateRepositoryService.new(project: p, old_disk_path: p.disk_path).execute }"

更新できないので諦めて、skip指示を出して

# sudo touch /etc/gitlab/skip-unmigrated-data-check

14.3 でmigrationエラー

Running handlers:
There was an error running gitlab-ctl reconfigure:

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: Expected process to exit with [0], but received '1'
---- Begin output of "bash"  "/tmp/chef-script20260811-7035-5hnmp3" ----
STDOUT: rake aborted!
StandardError: An error has occurred, all later migrations canceled:

Expected batched background migration for the given configuration to be marked as 'finished', but it is 'active':       {:job_class_name=>"CopyColumnUsingBackgroundMigrationJob", :table_name=>"events", :column_name=>"id", :job_arguments=>[["id"], ["id_convert_to_bigint"]]}

Finalize it manualy by running

        sudo gitlab-rake gitlab:background_migrations:finalize[CopyColumnUsingBackgroundMigrationJob,events,id,'[["id"]\, ["id_convert_to_bigint"]]']

For more information, check the documentation

        https://docs.gitlab.com/ee/user/admin_area/monitoring/background_migrations.html#database-migrations-failing-because-of-batched-background-migration-not-finished
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:1109:in `ensure_batched_background_migration_is_finished'
/opt/gitlab/embedded/service/gitlab-rails/db/post_migrate/20210622045705_finalize_events_bigint_conversion.rb:11:in `up'
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migrations/lock_retry_mixin.rb:31:in `ddl_transaction'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:61:in `block (3 levels) in <top (required)>'
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'

Caused by:
Expected batched background migration for the given configuration to be marked as 'finished', but it is 'active':       {:job_class_name=>"CopyColumnUsingBackgroundMigrationJob", :table_name=>"events", :column_name=>"id", :job_arguments=>[["id"], ["id_convert_to_bigint"]]}

Finalize it manualy by running

        sudo gitlab-rake gitlab:background_migrations:finalize[CopyColumnUsingBackgroundMigrationJob,events,id,'[["id"]\, ["id_convert_to_bigint"]]']

For more information, check the documentation

        https://docs.gitlab.com/ee/user/admin_area/monitoring/background_migrations.html#database-migrations-failing-because-of-batched-background-migration-not-finished
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:1109:in `ensure_batched_background_migration_is_finished'
/opt/gitlab/embedded/service/gitlab-rails/db/post_migrate/20210622045705_finalize_events_bigint_conversion.rb:11:in `up'
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migrations/lock_retry_mixin.rb:31:in `ddl_transaction'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:61:in `block (3 levels) in <top (required)>'
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
== 20210622045705 FinalizeEventsBigintConversion: migrating ===================
STDERR:
---- End output of "bash"  "/tmp/chef-script20260811-7035-5hnmp3" ----
Ran "bash"  "/tmp/chef-script20260811-7035-5hnmp3" returned 1
# sudo gitlab-rake gitlab:background_migrations:finalize[CopyColumnUsingBackgroundMigrationJob,events,id,'[["id"]\, ["id_convert_to_bigint"]]']
done

エラーでまくりましたが、ひとつずつこつこつ進めて。。。

Running handlers:
Running handlers complete
Chef Infra Client finished, 12/742 resources updated in 03 minutes 13 seconds
gitlab Reconfigured!

なんとかreconfigure OK !

14.3 nginxのソケット変更

ls /var/opt/gitlab/gitlab-workhorse/sockets/socket

sockets が追加されていたので nginxのgitlab.confを更新

14 – 15系でのチェック変更。。。queue

while true; do
  # 1. 旧形式の残り件数を取得
  OLD_RESULT=$(sudo gitlab-rails runner -e production 'puts Gitlab::BackgroundMigration.remaining' 2>/dev/null | tr -d '\r\n')

  # 2. 新形式 (BatchedMigration) のqueued件数を取得
  NEW_RESULT=$(sudo gitlab-rails runner -e production 'puts Gitlab::Database::BackgroundMigration::BatchedMigration.queued.count' 2>/dev/null)
  NEW_RESULT=$(echo "$NEW_RESULT" | tr -d '\r\n')

  # 数値以外の異常出力チェック
  case "$OLD_RESULT$NEW_RESULT" in
    *[!0-9]*)
      echo "【エラー検出】想定外の出力が発生したため安全のため停止しました:"
      echo "  旧形式出力: '$OLD_RESULT'"
      echo "  新形式出力: '$NEW_RESULT'"
      break
      ;;
  esac

  # 両方が 0(または空)であれば完了とみなす
  if { [ "$OLD_RESULT" = "0" ] || [ -z "$OLD_RESULT" ]; } && { [ "$NEW_RESULT" = "0" ] || [ -z "$NEW_RESULT" ]; }; then
    echo "【完了】バックグラウンドマイグレーションが全て完了しました(旧: ${OLD_RESULT:-0}件 / 新: ${NEW_RESULT:-0}件)。"
    echo "【実行】${PACKAGE_NAME} のインストールを開始します..."
    sudo yum install -y "$PACKAGE_NAME"
    break
  fi

  echo "[$(date '+%H:%M:%S')] まだマイグレーションが残っています (旧: ${OLD_RESULT:-N/A} 件 / 新: ${NEW_RESULT:-N/A} 件)。15秒後に再確認します..."
  sleep 15
done

両方 0 かチェックの必要が

ようやく 14.9.5 > 14.10.5 に。とりあえず15のラストまで行きたいところです。

16.3.7 バックアップを生成 すっと更新できました。

# GitLab のバックアップを実行
sudo gitlab-backup create

 Warning: Your gitlab.rb and gitlab-secrets.json files contain sensitive data
and are not included in this backup. You will need these files to restore a backup.
Please back them up manually.
2026-08-12 04:29:52 UTC -- Backup 1786508884_2026_08_12_16.3.7-ee is done.
2026-08-12 04:29:52 UTC -- Deleting backup and restore PID file ... done

backup.tarと設定ファイルを保存。とりあえずダウンロードしました。

 gitlab-secrets.json  gitlab.rb

これを ubuntuに入れておきます

ubuntu 22.04 に gitlab 16.3.7をインストール

sudo apt update
sudo apt install -y curl openssh-server ca-certificates tzdata perl

# EE 用のリポジトリスクリプトを実行
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash

Reading package lists... Done
Repository configured successfully.
Ready to install packages.

URLはバックアップから戻して修正必要、今回は一時利用なので、本番の時にnginxから修正

sudo EXTERNAL_URL="http://gitlabtmp.example.com" apt install -y gitlab-ee=16.3.7-ee.0
# sudo gitlab-ctl status
run: crond: (pid 25314) 409s; run: log: (pid 25324) 408s
run: gitaly: (pid 25671) 300s; run: log: (pid 25068) 516s
run: gitlab-kas: (pid 25680) 296s; run: log: (pid 25268) 497s
run: gitlab-workhorse: (pid 25687) 296s; run: log: (pid 25396) 388s
run: logrotate: (pid 24986) 530s; run: log: (pid 24998) 527s
run: nginx: (pid 25543) 346s; run: log: (pid 25435) 383s
run: postgresql: (pid 25116) 506s; run: log: (pid 25127) 505s
run: puma: (pid 25328) 403s; run: log: (pid 25339) 400s
run: redis: (pid 25022) 523s; run: log: (pid 25031) 522s
run: registry: (pid 25700) 295s; run: log: (pid 25551) 346s
run: sidekiq: (pid 25345) 397s; run: log: (pid 25363) 393s

エラーが出ているけど大丈夫そうです。

バックアップからの復帰

/etc/gitlab/gitlab-secrets.json は上書き必須。

gitlab.rbは低負荷設定のみ書くだけ。

# Webサーバーとバックグラウンド処理のワーカー数を最小に制限
puma['worker_processes'] = 2
sidekiq['concurrency'] = 5

# Prometheus(監視)をオフにして500MBほど浮かせる
prometheus_monitoring['enable'] = false

くらい

sudo gitlab-ctl reconfigure
# 1. Puma と Sidekiq を停止(DBとRedisは動かしたままにする)
sudo gitlab-ctl stop puma
sudo gitlab-ctl stop sidekiq

# 2. 念のためステータス確認(postgresql と redis だけが run になっていればOK)
sudo gitlab-ctl status

# 3. リストア実行(ファイル名は環境に合わせて指定)
sudo gitlab-backup restore BACKUP=1700000000_2026_08_12_17.0.0-ee

backups に 1700000000_2026_08_12_17.0.0-ee_gitlab_backup.tar
-eeまで記入必要

# sudo gitlab-backup restore BACKUP=1786508884_2026_08_12_16.3.7-ee
2026-08-12 05:48:28 UTC -- Unpacking backup ...
2026-08-12 05:48:48 UTC -- Unpacking backup ... done
2026-08-12 05:48:48 UTC -- Restoring database ...
2026-08-12 05:48:48 UTC -- Be sure to stop Puma, Sidekiq, and any other process that
connects to the database before proceeding. For Omnibus
installs, see the following link for more information:
301 Moved Permanently
Before restoring the database, we will remove all existing tables to avoid future upgrade problems. Be aware that if you have custom tables in the GitLab database these tables and all data will be removed. Do you want to continue (yes/no)? yes

puma sidekiqなどは停めてから。と。

This task will now rebuild the authorized_keys file.
You will lose any data stored in the authorized_keys file.
Do you want to continue (yes/no)? yes
2026-08-12 05:52:18 UTC -- Warning: Your gitlab.rb and gitlab-secrets.json files contain sensitive data
and are not included in this backup. You will need to restore these files manually.
2026-08-12 05:52:18 UTC -- Restore task is done.
2026-08-12 05:52:18 UTC -- Deleting backup and restore PID file ... done

okっぽいです。

# sudo gitlab-ctl restart
ok: run: gitaly: (pid 40809) 0s
ok: run: gitlab-kas: (pid 40829) 0s
ok: run: gitlab-workhorse: (pid 40840) 0s
ok: run: logrotate: (pid 40852) 1s
ok: run: nginx: (pid 40858) 0s
ok: run: postgresql: (pid 40868) 0s
ok: run: puma: (pid 40877) 1s
ok: run: redis: (pid 40882) 0s
ok: run: sidekiq: (pid 40889) 1s
:/var/opt/gitlab/backups# free -h
               total        used        free      shared  buff/cache   available
Mem:           3.8Gi       528Mi       1.4Gi        61Mi       1.9Gi       3.0Gi
Swap:          8.0Gi        24Mi       8.0Gi

restartしてみた。てすとで設定した

ubuntu 22.04でgitlab 更新 16.3.7 -> 19.2.1

Upgrade Path
GitLab - Upgrade Path Wizard

16.3.7になったのですが、これは 16.3.9からで大丈夫そうです(おそらく ↑のcurrentに16.3.7が選べないので 16.3.9からの更新を想定

apt-get install gitlab-ee=16.7.10-ee.0
apt-get install gitlab-ee=16.11.10-ee.0
apt-get install gitlab-ee=17.1.8-ee.0
apt-get install gitlab-ee=17.3.7-ee.0
apt-get install gitlab-ee=17.5.5-ee.0
apt-get install gitlab-ee=17.8.7-ee.0
apt-get install gitlab-ee=17.11.7-ee.0
apt-get install gitlab-ee=18.2.8-ee.0
apt-get install gitlab-ee=18.5.7-ee.0
apt-get install gitlab-ee=18.8.11-ee.0
apt-get install gitlab-ee=18.11.9-ee.0
apt-get install gitlab-ee=19.2.1-ee.0

16.7.10更新で早速エラー

詳細なログをありがとうございます!ログ全体を確認したところ、根本的な原因は「アップデートによって新しくなった Redis などのコンポーネントがメモリ上に古いまま残っており、その影響で Gitaly の再起動(sv restart)がタイムアウト(1351秒経過)してエラーになった」という現象です。
ログ内にある以下のメッセージが大きなヒントになっています。
Warnings: The version of the running redis service is different than what is installed.Please restart redis to start the new version.全サービスを一括でリフレッシュしてプロセスを掃除すれば、問題なく通過できます!

復旧手順(以下のコマンドを順番に実行してください)

Step 1. 固まっている Gitaly などのプロセスを強制終了する

応答しなくなっている古いプロセスを確実に停止させます。
Bash

# Gitaly 関連プロセスを強制終了
sudo pkill -9 -f gitaly

Step 2. Redis をはじめとする全サービスをリスタートする

警告が出ている Redis を含め、一度 GitLab 全体を一度停止・起動して新しいバージョンのバイナリをロードさせます。
Bash

# 全サービスを停止
sudo gitlab-ctl stop

# 完全に止まったことを確認してから起動
sudo gitlab-ctl start

Step 3. 途中で止まった dpkg の構成設定を再実行する

パッケージのアップデート処理(gitlab-ee のインストール)を最後まで完走させます。
Bash

# 未完了のパッケージ処理を再開
sudo dpkg --configure -a

# 設定の再反映
sudo gitlab-ctl reconfigure

Step 4. 正常性の確認

Bash

sudo gitlab-ctl status

すべてのコンポーネント(特に gitalyredis)が run: (pid ...) と表示され、稼働秒数が安定していれば修復完了です!
修復できたら、次のバージョンへ進む前に念のためバックグラウンドマイグレーションの完了確認を行ってください。
Bash

sudo gitlab-rails runner -e production 'puts GitLab::BackgroundMigration.remaining'

(結果が 0 になれば、次の 16.11.10 等へのアップグレードへ進んで大丈夫です)

16.11.10でrestart画面

Daemons using outdated libraries ├─────┐
│ Which services should be restarted?         │
│    [*] gitlab-runsvdir.service              │
│          <Ok>              <Cancel>

こんな画面が出ました enterでrestartされました

Restarting previously running GitLab services
ok: run: gitaly: (pid 82382) 35s
ok: run: gitlab-kas: (pid 82884) 0s
ok: run: gitlab-workhorse: (pid 82894) 1s
ok: run: logrotate: (pid 82905) 0s
ok: run: nginx: (pid 82911) 1s
ok: run: postgresql: (pid 81836) 204s
ok: run: redis: (pid 54620) 1039s
ok: run: sidekiq: (pid 82921) 0s

     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/


Upgrade complete! If your GitLab server is misbehaving try running
  sudo gitlab-ctl restart
before anything else.
If you need to roll back to the previous version you can use the database
backup made during the upgrade (scroll up for the filename).

Scanning processes...
Scanning candidates...
Scanning linux images...

Running kernel seems to be up-to-date.

Restarting services...
 systemctl restart gitlab-runsvdir.service

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.

config差分チェック 16->17などコンフィグ変更でエラーになった。。。

sudo gitlab-ctl diff-config

先にチェックして修正しておくと吉
max_concurrency > concurrencyみたいなのが。reconfigureでエラーになる前に更新実行前に修正できるので。

とりあえず 19.2.1までアップグレードできました。

今後の方針

個人利用なら、普通にgithubで何の問題もない

チーム利用なら 4GBくらいのVPSで最小、8GBで他の必要があれば?それでもgithubのほうが良いですよね。

ローカルでdockerで動かしながら、githubでよいプロジェクトは移行していこうと思います。

約6時間で 約30円( webarena indigo 4GB ) で16.x-19.21まで更新しました。
ちょっとエラーも出たので修正しつつ。

次は docker + gitlab 19.2.1 でローカルでちょっと動かします。 wordpressもdockerで。

バックアップ時はgitlab-secrets.json必須です。

2026-08-12 10:16:44 UTC -- Warning: Your gitlab.rb and gitlab-secrets.json files contain sensitive data
and are not included in this backup. You will need these files to restore a backup.
Please back them up manually.

お気軽にコメントください!

スパム対応のためコメント認証に数日かかることがありますが、お気軽にコメントいただけると嬉しいです^^

コメント

タイトルとURLをコピーしました