Quantcast
Channel: NeGiMeMo.net
Viewing all articles
Browse latest Browse all 76

GitLab CE のアップデートをサボっていたら更新作業が更に面倒なことになってしまった

$
0
0

GitLabは非常に短い更新サイクルで、毎月バージョンアップがあります。

それ自体は公式リポジトリを使っていれば、例えば CentOS とかなら yum コマンドから簡単にアップデートできるのですが、アップデートにも一定のルールがあって、バージョンを一定数以上飛ばしてのアップデートはできません。

その機能のせいでアップデートに手こずってしまったのでそのやり方を忘れないようメモっておこうかと。

アップデートできない?

久しぶりに GitLab を見たら、例によって真っ赤な文字で update asap と出ていたのでいつもどおり

$ sudo yum update gitlab-ce

としたのですが…

$sudo yum update gitlab-ce
パッケージをダウンロードしています:
gitlab-ce-11.0.4-ce.0.el6.x86_64.rpm                                                                                   | 404 MB     00:37
rpm_check_debug を実行しています
トランザクションのテストを実行しています
トランザクションのテストを成功しました
トランザクションを実行しています
gitlab preinstall: It seems you are upgrading from 10.x version series
gitlab preinstall: to 11.x series. It is recommended to upgrade
gitlab preinstall: to the last minor version in a major version series first before
gitlab preinstall: jumping to the next major version.
gitlab preinstall: Please follow the upgrade documentation at https://docs.gitlab.com/ee/policy/maintenance.html#upgrade-recommendations
gitlab preinstall: and upgrade to 10.8 first.
エラー: %pre(gitlab-ce-11.0.4-ce.0.el6.x86_64) scriptlet failed, exit status 1
Error in PREIN scriptlet in rpm package gitlab-ce-11.0.4-ce.0.el6.x86_64
エラー:   install: スクリプト %pre の実行に失敗しました (2)。gitlab-ce-11.0.4-ce.0.el6 をスキップします。
  Verifying               : gitlab-ce-11.0.4-ce.0.el6.x86_64                                                                              1/2
gitlab-ce-10.6.4-ce.0.el6.x86_64 was supposed to be removed but is not!
  Verifying               : gitlab-ce-10.6.4-ce.0.el6.x86_64                                                                              2/2

失敗:
  gitlab-ce.x86_64 0:10.6.4-ce.0.el6                                    gitlab-ce.x86_64 0:11.0.4-ce.0.el6

失敗しました。

どうやら、現在の最新版は 11.0.4 らしいのですが、現在のバージョンから直接アップデートはできず、先に 10.8 にしろとのこと。

yum でバージョンを指定してアップデートする

まずは、yum でインストールできるバージョンを調べます。

調べるには

sudo yum list --showduplicates

とします。

通常の yum list だと、最新版しか出てこないのですが、この –showduplicates オプションを付けると、過去のパッケージも表示してくれるので、古いバージョンを指定してインストールしたい場合なんかに利用するそうです。

今回は gitlab-ce の過去バージョンを知りたいので、更にパッケージ名も付け足して実行します。これやらないとこのサーバー上でインストールできる全部のパッケージが出てくるっぽい。。(まぁ、それをGrepするって手もなくはないのですが)

$ sudo yum list --showduplicates gitlab-ce
(略)
gitlab-ce.x86_64                           10.8.0-ce.0.el6             gitlab_gitlab-ce
gitlab-ce.x86_64                           10.8.1-ce.0.el6             gitlab_gitlab-ce
gitlab-ce.x86_64                           10.8.2-ce.0.el6             gitlab_gitlab-ce
gitlab-ce.x86_64                           10.8.3-ce.0.el6             gitlab_gitlab-ce
gitlab-ce.x86_64                           10.8.4-ce.0.el6             gitlab_gitlab-ce
gitlab-ce.x86_64                           10.8.5-ce.0.el6             gitlab_gitlab-ce
gitlab-ce.x86_64                           10.8.6-ce.0.el6             gitlab_gitlab-ce
gitlab-ce.x86_64                           11.0.0-ce.0.el6             gitlab_gitlab-ce
gitlab-ce.x86_64                           11.0.1-ce.0.el6             gitlab_gitlab-ce
gitlab-ce.x86_64                           11.0.2-ce.0.el6             gitlab_gitlab-ce
gitlab-ce.x86_64                           11.0.3-ce.0.el6             gitlab_gitlab-ce
gitlab-ce.x86_64                           11.0.4-ce.0.el6             gitlab_gitlab-ce
(略)

今回は、10.8系にしろと言われてるので、まずは10.8を指定してアップデートします。

$ sudo yum install gitlab-ce-10.8.6-ce.0.el6
読み込んだプラグイン:fastestmirror, security
インストール処理の設定をしています
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * epel: mirror.dmmlabs.jp
 * extras: ftp.iij.ad.jp
 * remi-safe: ftp.riken.jp
 * updates: ftp.iij.ad.jp
runner_gitlab-runner/signature                                                                                         |  836 B     00:00
runner_gitlab-runner/signature                                                                                         | 1.0 kB     00:00 ...
runner_gitlab-runner-source/signature                                                                                  |  836 B     00:00
runner_gitlab-runner-source/signature                                                                                  |  951 B     00:00 ...
パッケージ gitlab-ce-10.8.2-1 は利用できません。
エラー: 何もしません

およ?

どうやら10.8系にするとはいっても、10.8系の最新(10.8.2-1)にはできないみたいです。

とりあえず 10.8 の最初のバージョンである、10.8.0 から試してみます。

$ sudo yum install gitlab-ce-10.8.0-ce.0.el6
読み込んだプラグイン:fastestmirror, security
インストール処理の設定をしています
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * epel: mirror.dmmlabs.jp
 * extras: ftp.iij.ad.jp
 * remi-safe: ftp.riken.jp
 * updates: ftp.iij.ad.jp
一致したパッケージ gitlab-ce-10.8.0-ce.0.el6.x86_64 はすでにインストールされています。更新を確認しています。
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> Package gitlab-ce.x86_64 0:10.6.4-ce.0.el6 will be 更新
---> Package gitlab-ce.x86_64 0:10.8.0-ce.0.el6 will be an update
--> 依存性解決を終了しました。

依存性を解決しました

==============================================================================================================================================
 パッケージ                     アーキテクチャ              バージョン                            リポジトリー                           容量
==============================================================================================================================================
更新:
 gitlab-ce                      x86_64                      10.8.0-ce.0.el6                       gitlab_gitlab-ce                      358 M

トランザクションの要約
==============================================================================================================================================
アップグレード       1 パッケージ

総ダウンロード容量: 358 M
これでいいですか? [y/N]y
(以下略)

これはインストールできるらしい。続けてみましたがちゃんとインストールできました。

ということでこれで一旦 10.8.0 になったので、改めてアップデートします。

今度はバージョン指定しないでも大丈夫なはずなので、改めて

$ sudo yum update gitlab-ce
読み込んだプラグイン:fastestmirror, security
更新処理の設定をしています
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * epel: mirror.dmmlabs.jp
 * extras: ftp.iij.ad.jp
 * remi-safe: ftp.riken.jp
 * updates: ftp.iij.ad.jp
runner_gitlab-runner/signature                                                                                         |  836 B     00:00
runner_gitlab-runner/signature                                                                                         | 1.0 kB     00:00 ...
runner_gitlab-runner-source/signature                                                                                  |  836 B     00:00
runner_gitlab-runner-source/signature                                                                                  |  951 B     00:00 ...
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> Package gitlab-ce.x86_64 0:10.8.0-ce.0.el6 will be 更新
---> Package gitlab-ce.x86_64 0:11.0.4-ce.0.el6 will be an update
--> 依存性解決を終了しました。

依存性を解決しました

==============================================================================================================================================
 パッケージ                     アーキテクチャ              バージョン                            リポジトリー                           容量
==============================================================================================================================================
更新:
 gitlab-ce                      x86_64                      11.0.4-ce.0.el6                       gitlab_gitlab-ce                      404 M

トランザクションの要約
==============================================================================================================================================
アップグレード       1 パッケージ

総ダウンロード容量: 404 M
これでいいですか? [y/N]y
パッケージをダウンロードしています:
gitlab-ce-11.0.4-ce.0.el6.x86_64.rpm                                                                                   | 404 MB     00:37
rpm_check_debug を実行しています
トランザクションのテストを実行しています
トランザクションのテストを成功しました
トランザクションを実行しています

(中略)

Running handlers:
Running handlers complete
Chef Client finished, 24/556 resources updated in 01 minutes 53 seconds
gitlab Reconfigured!
Checking for an omnibus managed postgresql: OK
Checking for a newer version of PostgreSQL to install
No new version of PostgreSQL installed, nothing to upgrade to
Ensuring PostgreSQL is updated: OK
Restarting previously running GitLab services
ok: run: alertmanager: (pid 27374) 0s
ok: run: gitaly: (pid 27325) 3s
ok: run: gitlab-monitor: (pid 27384) 1s
ok: run: gitlab-workhorse: (pid 27311) 5s
ok: run: logrotate: (pid 27388) 0s
ok: run: nginx: (pid 27394) 0s
ok: run: node-exporter: (pid 27401) 1s
ok: run: postgres-exporter: (pid 27407) 0s
ok: run: postgresql: (pid 8356) 8154630s
ok: run: prometheus: (pid 27341) 5s
ok: run: redis: (pid 8846) 8154605s
ok: run: redis-exporter: (pid 27491) 1s
ok: run: sidekiq: (pid 27497) 0s
ok: run: unicorn: (pid 27500) 1s

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


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).

  Verifying               : gitlab-ce-11.0.4-ce.0.el6.x86_64                                                                              1/2
  Verifying               : gitlab-ce-10.8.0-ce.0.el6.x86_64                                                                              2/2

更新:
  gitlab-ce.x86_64 0:11.0.4-ce.0.el6

完了しました!

と、いうことで、無事最新版にアップデートできました。

 

多分今回はメジャーバージョンアップを伴っていたから特に面倒くさかったんだとおもいますが、そうでなくともこまめにアップデートするようにしておきたいですね。

とりあえずカレンダーにでも入れておくか。

最近プライベートでもTodoist使いだしたからそっちに入れることにしました。それについてはまたそのうち書くかもしれません。


Viewing all articles
Browse latest Browse all 76

Latest Images

Trending Articles



Latest Images