2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

GitLab Update(13.8.8⇒16.11.2)

Posted at

このドキュメントの目的

  • GitLabをv13.8.8からv16.11.2までの更新手順を記録し、今後のバージョンアップに役立てる

動作環境

  • Hyper-V上のUbuntu

更新手順

更新は次の手順で進める

  1. アップデートパスを確認
  2. 現環境のバックアップ
  3. debパッケージをダウンロード&インストール

事前準備

  1. GitLabのバージョンを確認する
    sudo gitlab-rake gitlab:env:info
    
  2. GitLabのサイトでアップデートパスを確認する
    https://gitlab-com.gitlab.io/support/toolbox/upgrade-path/

バックアップ

  1. Hyper-Vのバックアップを作成する(バックアップはこれだけで良いかも)
  2. データベースをバックアップする
    sudo gitlab-backup create
    
  3. 設定をバックアップする
    sudo cp -ap /etc/gitlab <任意のディレクトリ>
    
  4. アップデート時の自動バックアップを禁止する
    /etc/gitlab/に skip-auto-backup を作成

更新実行(例:14.0.12)

  1. アップデートパスで確認したバージョンのGitlLabをwgetでダウンロードする
    アーカイブ:https://packages.gitlab.com/gitlab/gitlab-ce
    wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/ubuntu/focal/gitlab-ce_14.0.12-ce.0_amd64.deb/download.deb
    
    認証に失敗する場合、末尾に --no-check-certificate を付ける
  2. GitLabをアップデートする
    sudo dpkg -i gitlab-ce_14.0.12-ce.0_amd64.deb
    
    更新後、gitlabにアクセスしてバージョンが更新されていることを確認
  3. マイグレーション終了を確認
    次のコマンドを実行して、「0」が出力されれば終了。数時間かかることもあるので気長に待つこと。
    sudo gitlab-rails runner -e production 'puts Gitlab::BackgroundMigration.remaining'
    
  4. GitLabにアクセスして動作確認する

備考

  • aptを使っていないので、debコマンドでインストールする

  • 14世代より、HTTPサーバーがpumaだけになったので、unicornを禁止しpumaだけを使うようにした

  1. /etc/gitlab/gitlab.rb を編集
    unicorn['enable'] = false
    puma['enable'] = true
    
  2. 次のコマンドで再設定
    sudo gitlab-ctl reconfigure
    
  3. 次のコマンドでunicornが動いていないことを確認
    ps axwwu | grep unicorn
    
  • 容量が足りないとき
    データベースのバックアップをどんどん作っていくと、容量不足でアップデートに失敗したり、GitLab自体が動作しなくなることもある。そのときは下記フォルダにあるデータベースのバックアップを削除すること。
    /var/opt/gitlab/backups

  • 不要なテーブルを削除
    Ver.14.5よりdiffのテーブル構成が変わったらしい。次のコマンドを実行することでデータベース容量を圧縮することができる模様。
    https://gitlab-docs.creationline.com/ee/update/versions/gitlab_14_changes.html#1450
    https://qiita.com/wadakatu/items/b7b5ef486a67d6ec2455

    gitlab-psql
    VACUUM FULL merge_request_diff_commits
    

参考

[アップグレード手順(Ver.13 ~ Ver.14.6.2まで)]
(https://qiita.com/wadakatu/items/9c9b08874fb1372df382)

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?