はじめに
Red Hat の Document などの情報をWebサイトを、Local の Webサイトとして構築し、検索・参照ができる機能 RHOKP (Red Hat Offline Knowledte Portal) があるそうです。
製品ドキュメントだけでなく、KB(Knowledge Base)や、CVE情報や Errata などもローカルで見られるようになるようです。
- Product documentation
- Knowledgebase
- CVEs (content)
- Errata (content)
- Product Lifecycles
- Security Data API
- Pages from the Customer Portal
- A Search mechanism for the above
ターゲットは、オフラインの環境のユーザー向けだと思いますが、個人的に「Webサイトが重たいな..」という時に便利そうなので試して見ます。
尚、現時点でローカルに構築されるサイトの情報は全て英語のみになるようで、日本語や多言語に翻訳されたものは対象になっていないのでご注意下さい。
公式ドキュメント
使い方のドキュメントは以下にあります。
この手順を、ほぼそのままななぞってみます。
使用条件
以下のような条件があるようです。
- podman が導入されている
- コンテナのダウンロードにインターネット接続が必要
- Red Hat Satellite の Subscription を持っている
- Red Hat Customer Portal の ID を持っている
AWS/Azure/GCP上で提供している従量課金制のRHELには、Red Hat Satellite の Subscription も無料で付属しています。詳しくは、こちらをご参照下さい。
インストールして見る
Access Key を作る必要があります。こちらにアクセスします。
ここでは後で使いやすいように、環境変数にアクセスキーをセットしておきます。
export MY_KEY=<生成したアクセスキー>
Red Hat Customer Portal ID を使ってみます。
podman login registry.redhat.io -u <Customer Portal ID> -p <password>
ドキュメントのコンテナを PULL します。( Red Hat Satellite の Subscription が必要です)
コンテナが大きいので、PULL にはそこそこ時間がかかります。
podman pull registry.redhat.io/offline-knowledge-portal/rhokp-rhel9:latest
コンテナを起動させます。
podman run --rm -p 8080:8080 -p 8443:8443 --env "ACCESS_KEY=$MY_KEY" -d registry.redhat.io/offline-knowledge-portal/rhokp-rhel9:latest
以下の URLにアクセスします。
http://localhost:8080
・アクセスは HTTPS もありますが、その場合は 8443がポートになります(オレオレ証明書のエラーがでます)
・環境にもよると思いますが、アクセスが可能になるまでコンテナ起動後60秒ほどかかるかもしれません
以下のようなトップページが表示されるはずです。
使い心地
実際にアクセスしてみると、オンライのWebサイトと比較しておそろしい程、高速でした...
Knowldedge Base のドキュメントも検索で探す事ができます。
オフライン環境で作業しなければいけない人をターゲットに作製しているのだと思いますが、通常のオンライン環境がある人にも、おすすめしたいです。
付録:起動と停止のシェル化
毎回起動時に最新のイメージを確認してから起動したいので、シェルを作ってみました。
起動: (最新のイメージを確認してから起動)
./okp.sh start
停止
./okp.sh stop
再起動(停止後、最新のイメージを確認してから起動)
./okp.sh restart
以下がシェルの本体です。シェルの先頭部分にある変数はご自身の環境にあわせてセットして下さい。
#!/bin/bash
REGISTRY_USER=<registry.redhat.ioのユーザー>
REGISTRY_PWD=<registry.redhat.ioのパスワード>
MY_KEY=<生成したアクセスキー>
if [ $# -ne 1 ]
then
echo "How to use: "
echo " okp.sh start : Start RHOKP with the latest image"
echo " okp.sh stop : Stop RHOKP"
echo " okp.sh restart : Restart RHOKP with the latest image"
exit
fi
case "$1" in
start)
# Check if the image is latest, if not, pull the latest.
echo "Checking the latest RHOKP image..."
echo "Logging in to registry.redhat.io."
podman login registry.redhat.io -u $REGISTRY_USER -p $REGISTRY_PWD
podman pull registry.redhat.io/offline-knowledge-portal/rhokp-rhel9:latest
# start the document container
echo "Start RHOKP server"
podman run --rm -p 8080:8080 -p 8443:8443 --env "ACCESS_KEY=$MY_KEY" -d registry.redhat.io/offline-knowledge-portal/rhokp-rhel9:latest
podman ps | grep offline-knowledge-portal
;;
stop)
# stop RHOKP
RHOKP_NAME=`podman ps | grep "registry.redhat.io/offline-knowledge-portal/rhokp-rhel9" | awk '{print $NF}'`
echo "Stopping RHOKP... it takes a while..."
podman stop $RHOKP_NAME
;;
restart)
# stop RHOKP
RHOKP_NAME=`podman ps | grep "registry.redhat.io/offline-knowledge-portal/rhokp-rhel9" | awk '{print $NF}'`
echo "Stopping RHOKP... it takes a while..."
podman stop $RHOKP_NAME
# Check if the image is latest, if not, pull the latest.
echo "Checking the latest RHOKP image..."
echo "Logging in to registry.redhat.io."
podman login registry.redhat.io -u $REGISTRY_USER -p $REGISTRY_PWD
podman pull registry.redhat.io/offline-knowledge-portal/rhokp-rhel9:latest
# start the document container
echo "Start RHOKP server"
podman run --rm -p 8080:8080 -p 8443:8443 --env "ACCESS_KEY=$MY_KEY" -d registry.redhat.io/offline-knowledge-portal/rhokp-rhel9:latest
podman ps | grep offline-knowledge-portal
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac: