LoginSignup
6
1

More than 5 years have passed since last update.

ommunibus-gitlabのバージョンを6から10まであげた

Last updated at Posted at 2017-10-17

以前、手動インストールしたDBがmysqlなgitlabをOSとDBもろとも移行コンバートバージョンアップしたときよりはだいぶ簡単で使ってる人も小数社内なので気が楽でしたが、
結構段階ふまないといけなかったりエラー出たり変わったところがあったようなので備忘録しておきます。

概要

移行元:
CentOS6
以下が入ってた(rpmは大事に取っておいてあった)
gitlab-6.8.2_omnibus-1.el6.x86_64.rpm

移行先:
CentOS7
最終的には以下にしたい
gitlab-ce-10.0.3-ce.0.el7.x86_64.rpm

参考

基本的にはgitlab本家のommunibus用バージョンアップマニュアルを見て作業。

遭遇したエラー

  • 7.2.0から10.0へ上げたらpostgresqlのスクリプト実行に失敗とのエラー。切り戻し時にredisが起動しなくなるエラーも出現。

redisのエラーの対処方法は以下を実施した(解決した)

gitlab-ctl stop redis
mv /var/opt/gitlab/redis/dump.rdb /tmp/
gitlab-ctl start redis
gitlab-ctl status

7.2から10.0一気は断念していくつか挟んで段階updateすることに。(メジャーバージョンごとに低いのと高いマイナーバージョンを経る)

  • 8.0から9.0へのupdateに失敗

対処方法としては8.17をはさんだだけです。

作業内容

  • CentOS6と7で両方存在するパッケージを特定(7.2.0が最低だったのでそれを選択)して旧環境でそこまでupdate

旧いのはここから探せる↓
https://about.gitlab.com/downloads/archives/

@旧環境

wget https://downloads-packages.s3.amazonaws.com/centos-6.5/gitlab-7.2.0_omnibus-1.el6.x86_64.rpm
gitlab-ctl status
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
gitlab-ctl stop nginx
gitlab-ctl status
gitlab-rake gitlab:backup:create

ls -lh /var/opt/gitlab/backups/

rpm -Uvh gitlab-7.2.0_omnibus-1.el6.x86_64.rpm
rpm -qa|grep gitlab

gitlab-ctl reconfigure
gitlab-ctl restart
gitlab-ctl status

gitlab-rake gitlab:backup:create
ls -rlt /var/opt/gitlab/backups
cd /var/opt/gitlab/backups
scp -Cpr 1508130395_gitlab_backup.tar user@remote_cent7host:/tmp/
  • 新環境にバックアップを転送して旧環境でupdateしたのと同じバージョンをインストール、旧環境のbackupをレストアする

@新環境

cd /usr/local/src
wget https://downloads-packages.s3.amazonaws.com/centos-7.0.1406/gitlab-7.2.0_omnibus.1-1.el7.x86_64.rpm
rpm -ivh gitlab-7.2.0_omnibus.1-1.el7.x86_64.rpm
rpm -qa|grep gitlab
cp -p /etc/gitlab/gitlab.rb{,.org}
vi /etc/gitlab/gitlab.rb
URL変える場合にはexternal_urlとかを変える等
gitlab-ctl reconfigure
gitlab-ctl restart
gitlab-ctl status

・バックアップをレストアし表示確認する

ls /tmp
bkup_prefix=1508130395      #※ここに調べた値を書く※
cp /tmp/${bkup_prefix}_gitlab_backup.tar /var/opt/gitlab/backups/
chown -R git. /var/opt/gitlab/backups
gitlab-rake gitlab:backup:restore BACKUP=${bkup_prefix}
gitlab-ctl reconfigure
gitlab-ctl restart
gitlab-ctl status

以下必要に応じて実施

chmod -R ug+rwX,o-rwx /var/opt/gitlab/git-data/repositories
chmod -R ug-s /var/opt/gitlab/git-data/repositories
find /var/opt/gitlab/git-data/repositories -type d -print0 | sudo xargs -0 chmod g+s
sudo -u git -H /opt/gitlab/embedded/service/gitlab-shell/bin/create-hooks /var/opt/gitlab/git-data/repositories
gitlab-rake gitlab:check
  • 新環境側で必要そうなパッケージをダウンロードしてupdate+bkupを最新にするまで繰り返す
リポジトリを配置
curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

ダウンロードだけする
yum install --downloadonly --downloaddir=/usr/local/src gitlab-ce-7.14.3-ce.1.el7.x86_64
yum install --downloadonly --downloaddir=/usr/local/src gitlab-ce-8.0.0-ce.0.el7.x86_64
yum install --downloadonly --downloaddir=/usr/local/src gitlab-ce-8.17.8-ce.0.el7.x86_64
yum install --downloadonly --downloaddir=/usr/local/src gitlab-ce-9.0.0-ce.0.el7.x86_64
yum install --downloadonly --downloaddir=/usr/local/src gitlab-ce-10.0.3-ce.0.el7.x86_64

rpm -Uvh gitlab-ce-7.14.3-ce.1.el7.x86_64.rpm
成功し画面表示も問題なさそうである。ので、とりあえずbackupとる
gitlab-rake gitlab:backup:create
1508139800_gitlab_backup.tar

rpm -Uvh gitlab-ce-8.0.0-ce.0.el7.x86_64.rpm 
表示確認OK、bkup取得する
gitlab-rake gitlab:backup:create
1508140552_gitlab_backup.tar

rpm -Uvh gitlab-ce-8.17.8-ce.0.el7.x86_64.rpm 
gitlab-rake gitlab:backup:create
1508142213_2017_10_16_gitlab_backup.tar

rpm -Uvh gitlab-ce-9.0.0-ce.0.el7.x86_64.rpm
gitlab-rake gitlab:backup:create
1508143458_2017_10_16_gitlab_backup.tar

9から10へはやってみたら一気にいけました

rpm -Uvh gitlab-ce-10.0.3-ce.0.el7.x86_64.rpm
gitlab-rake gitlab:backup:create

ちなみに手動版と違ってauthorized_keysとかコピーしなくて全然大丈夫でした。だいたい全部chefがやってくれました。

gitlab10に関する参考情報
https://mag.osdn.jp/17/09/26/170000
https://qiita.com/masakura/items/2a238b9bf3b9d17e19cc

失敗したら切り戻したり複数のバージョンそれぞれでバックアップとる等で作業開始から6時間くらいかかりました。
以上。

6
1
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
6
1