LoginSignup
2
0

More than 3 years have passed since last update.

GitLab(on docker) restore 後の 再起動で ActiveRecord::IrreversibleOrderError

Posted at

概要

PC交換に伴い gitlab/gitlab-ce:13.0.1-ce.0 向けのバックアップデータをリストアしたところ、ActiveRecord::IrreversibleOrderError が発生し、GitLab自体起動できなくなった際の備忘メモ。

こちらを参照し

## sudo docker-compose up -d &ブラウザからの起動確認後 & tarボール配置後
sudo docker exec -it gitlab-container gitlab-backup restore

上記restoreコマンド実行完了後、ブラウザからのアクセスすると一見リストアが成功したように思えたが、その後

sudo docker-compose restart

してみると 起動途中で ActiveRecord::IrreversibleOrderError が発生しGitLabが起動できない状態となった。
ちなみに、12.x.x(バージョン不確か) では上記手順で、問題なくリストア&再起動できていた。。記憶がある。。

また、tarボールは定期的に

docker exec -t gitlab-container gitlab-backup create BACKUP=dump

で、data/backups配下から吸い出したもの。

環境

image: gitlab/gitlab-ce:13.0.1-ce.0

NAME="Ubuntu"
VERSION="20.04 LTS (Focal Fossa)"

対処

こちら を参考に for Omnibus のリストア方法を勘案し、以下手順で回避できた。

  1. gitlabの再配置&起動確認
  2. gitlab-ctlで特定サービスを停止(& tarボールのコピー)
  3. リストア
  4. gitlab-ctl reconfigure 他
  5. docker-compose restart

gitlabの再配置&起動確認

image 及び data / config / logs などのローカル情報を削除し、

sudo docker-compose up -d

で素のGitlabが立ち上がりブラウザからのアクセスが行えることを確認する。

. gitlab-ctlで特定サービスを停止(& tarボールのコピー)

先の起動確認後、tarボールを/var/opt/gitlab/data/backups配下にコピーし、特定のサービスを停止する。

$ sudo cp dump_gitlab_backup.tar data/backups/.
$ sudo docker exec -it {コンテナ} /bin/bash  ← 以降コンテナ側で作業
# chown git.git /var/opt/gitlab/backups/dump_gitlab_backup.tar
# gitlab-ctl stop unicorn
# gitlab-ctl stop puma
# gitlab-ctl stop sidekiq
# gitlab-ctl status ← 一応ステータス確認

リストア

特定サービス停止後、コンテナ側で、リストアコマンドを実行する。

# gitlab-backup restore BACKUP=dump

gitlab-ctl reconfigure 他

reconfigure他を実施し、コンテナを抜けて、ブラウザよりリストアが完了していることを確認する。

# gitlab-ctl reconfigure
# gitlab-ctl restart
# gitlab-rake gitlab:check SANITIZE=true
# exit

docker-compose restart

最後に、再起動してもGitLabが正常に立ち上がることを確認する。

sudo docker-compose restart

参考URL

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0