16.3. 集中型 OSTree ミラーの管理
実稼働環境の場合、すべてのコミットを提供する集中型 OSTree ミラーを用意すると、次のようないくつかの利点があります。
- ディスクストレージの重複排除および最小化
- static delta 更新を使用した、クライアントの更新の最適化
- デプロイメント期間中に単一の OSTree ミラーを参照
集中型 OSTree ミラーを管理するには、各コミットを Image Builder から集中型リポジトリーにプルして、そこからコミットをユーザーに提供する必要があります。
osbuild.infra
Ansible コレクションを使用して、OSTree ミラーの管理を自動化することもできます。osbuild.infra Ansible を参照してください。
集中型リポジトリーを作成するために、Web サーバー上で次のコマンドを直接実行できます。
手順
空のブループリントを作成し、"rhel-92" をディストリビューションとして使用するようにカスタマイズします。
name = "minimal-rhel92" description = "minimal blueprint for ostree commit" version = "1.0.0" modules = [] groups = [] distro = "rhel-92"
ブループリントをサーバーにプッシュします。
# composer-cli blueprints push minimal-rhel92.toml
作成したブループリントから RHEL for Edge Commit (
.tar
) イメージをビルドします。# composer-cli compose start-ostree minimal-rhel92 edge-commit
.tar
ファイルを取得し、ディスクに解凍します。# composer-cli compose image _<rhel-92-uuid> $ tar -xf <rhel-92-uuid>.tar -C /usr/share/nginx/html/
ディスク上の
/usr/share/nginx/html/repo
が、すべての ref とコミットの一元的な OSTree リポジトリーになります。別の空のブループリントを作成し、"rhel-87" をディストリビューションとして使用するようにカスタマイズします。
name = "minimal-rhel87" description = "minimal blueprint for ostree commit" version = "1.0.0" modules = [] groups = [] distro = "rhel-87"
ブループリントをプッシュし、別の RHEL for Edge Commit (
.tar
) イメージを作成します。# composer-cli blueprints push minimal-rhel87.toml # composer-cli compose start-ostree minimal-rhel87 edge-commit
.tar
ファイルを取得し、ディスクに解凍します。# composer-cli compose image <rhel-87-uuid> $ tar -xf <rhel-87-uuid>.tar
コミットをローカルリポジトリーにプルします。
ostree pull-local
を使用すると、あるローカルリポジトリーから別のローカルリポジトリーにコミットデータをコピーできます。# ostree --repo=/usr/share/nginx/html/repo pull-local repo
オプション: OSTree リポジトリーのステータスを検査します。出力例を以下に示します。
$ ostree --repo=/usr/share/nginx/html/repo refs rhel/8/x86_64/edge rhel/9/x86_64/edge $ ostree --repo=/usr/share/nginx/html/repo show rhel/8/x86_64/edge commit f7d4d95465fbd875f6358141f39d0c573df6a321627bafde68c73850667e5443 ContentChecksum: 41bf2f8b442a770e9bf03e096a46a286f5836e0a0702b7c3516ef4e0acec2dea Date: 2023-09-15 16:17:04 +0000 Version: 8.7 (no subject) $ ostree --repo=/usr/share/nginx/html/repo show rhel/9/x86_64/edge commit 89290dbfd6f749700c77cbc434c121432defb0c1c367532368eee170d9e53ea9 ContentChecksum: 70235bfb9cae82c53f856183750e809becf0b9b076122b19c40fec92fc6d74c1 Date: 2023-09-15 15:30:24 +0000 Version: 9.2 (no subject)
RHEL 9.2 ブループリントを更新して新しいパッケージを追加し、新しいコミットをビルドします。以下に例を示します。
name = "minimal-rhel92" description = "minimal blueprint for ostree commit" version = "1.1.0" modules = [] groups = [] distro = "rhel-92" [[packages]] name = "strace" version = "*"
更新されたブループリントをプッシュし、新しい RHEL for Edge Commit (
.tar
) イメージを作成します。compose が既存の OSTree リポジトリーを参照するようにします。# composer-cli blueprints push minimal-rhel92.toml # composer-cli compose start-ostree minimal-rhel92 edge-commit --url http://localhost/repo --ref rhel/9/x86_64/edge
.tar
ファイルを取得し、ディスクに解凍します。# rm -rf repo # composer-cli compose image <rhel-92-uuid> # tar -xf <rhel-92-uuid>.tar
コミットをリポジトリーにプルします。
# ostree --repo=/usr/share/nginx/html/repo pull-local repo
オプション: OSTree リポジトリーのステータスを再度検査します。
$ ostree --repo=/usr/share/nginx/html/repo refs rhel/8/x86_64/edge rhel/9/x86_64/edge $ ostree --repo=/usr/share/nginx/html/repo show rhel/8/x86_64/edge commit f7d4d95465fbd875f6358141f39d0c573df6a321627bafde68c73850667e5443 ContentChecksum: 41bf2f8b442a770e9bf03e096a46a286f5836e0a0702b7c3516ef4e0acec2dea Date: 2023-09-15 16:17:04 +0000 Version: 8.7 (no subject) $ ostree --repo=/usr/share/nginx/html/repo show rhel/9/x86_64/edge commit a35c3b1a9e731622f32396bb1aa84c73b16bd9b9b423e09d72efaca11b0411c9 Parent: 89290dbfd6f749700c77cbc434c121432defb0c1c367532368eee170d9e53ea9 ContentChecksum: 2335930df6551bf7808e49f8b35c45e3aa2a11a6c84d988623fd3f36df42a1f1 Date: 2023-09-15 18:21:31 +0000 Version: 9.2 (no subject) $ ostree --repo=/usr/share/nginx/html/repo log rhel/9/x86_64/edge commit a35c3b1a9e731622f32396bb1aa84c73b16bd9b9b423e09d72efaca11b0411c9 Parent: 89290dbfd6f749700c77cbc434c121432defb0c1c367532368eee170d9e53ea9 ContentChecksum: 2335930df6551bf7808e49f8b35c45e3aa2a11a6c84d988623fd3f36df42a1f1 Date: 2023-09-15 18:21:31 +0000 Version: 9.2 (no subject) commit 89290dbfd6f749700c77cbc434c121432defb0c1c367532368eee170d9e53ea9 ContentChecksum: 70235bfb9cae82c53f856183750e809becf0b9b076122b19c40fec92fc6d74c1 Date: 2023-09-15 15:30:24 +0000 Version: 9.2 (no subject) $ rpm-ostree db diff --repo=/usr/share/nginx/html/repo 89290dbfd6f749700c77cbc434c121432defb0c1c367532368eee170d9e53ea9 a35c3b1a9e731622f32396bb1aa84c73b16bd9b9b423e09d72efaca11b0411c9 ostree diff commit from: 89290dbfd6f749700c77cbc434c121432defb0c1c367532368eee170d9e53ea9 ostree diff commit to: a35c3b1a9e731622f32396bb1aa84c73b16bd9b9b423e09d72efaca11b0411c9 Added: elfutils-default-yama-scope-0.188-3.el9.noarch elfutils-libs-0.188-3.el9.x86_64 strace-5.18-2.el9.x86_64