10.2. バイナリービルドおよび OpenShift Web コンソールを使用した Red Hat build of Kogito マイクロサービスの OpenShift へのデプロイ
OpenShift のビルドには、かなりの時間がかかる場合があります。OpenShift での Red Hat build of Kogito マイクロサービスのビルドおよびデプロイを短時間で行う別の方法として、バイナリービルドを使用できます。
Operator は以下のカスタムリソースを使用して、開発するマイクロサービス (ドメイン固有のマイクロサービス) をデプロイします。
-
KogitoBuildはアップロードしたアプリケーションを処理し、ランタイムイメージを作成します。 -
KogitoRuntimeはランタイムイメージを起動し、要件に応じて設定します。
前提条件
- RHPAM Kogito Operator がインストールされている。
-
ocOpenShift CLI がインストールされており、関連する OpenShift クラスターにログインしている。ocのインストールおよびログインの手順は、OpenShift documentation を参照。 -
OpenShift Web コンソールにアクセスでき、
KogitoBuildおよびKogitoRuntimeの作成および編集に必要なパーミッションが設定されている。 (Red Hat build of Quarkus のみ) プロジェクトの
pom.xmlファイルにquarkus-smallrye-health拡張機能の依存関係が含まれる。この拡張機能は、OpenShift の Red Hat build of Quarkus プロジェクトに必要な Liveness および Readiness Probe を有効にします。OpenShift 上の Red Hat build of Quarkus アプリケーションの SmallRye Health 依存関係
<dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-smallrye-health</artifactId> </dependency>
<dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-smallrye-health</artifactId> </dependency>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
手順
- アプリケーションをローカルに構築します。
-
Operators
Installed Operators に移動し、RHPAM Kogito Operator を選択します。 - Red Hat build of Kogito ビルド定義を作成するには、Operator ページで Kogito Build タブを選択し、Create KogitoBuild をクリックします。
アプリケーションウィンドウで、Form View または YAML View を使用してビルド定義を設定します。
少なくとも、以下の YAML ファイルのサンプルに示されるようにアプリケーション設定を定義します。
Red Hat build of Kogito ビルドを使用した Red Hat build of Quarkus アプリケーションの YAML 定義の例
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Red Hat build of Kogito ビルドを使用した Spring Boot アプリケーションの YAML 定義の例
Copy to Clipboard Copied! Toggle word wrap Toggle overflow アプリケーションデータを定義したら、Create をクリックして Red Hat build of Kogito ビルドを生成します。
アプリケーションが Red Hat build of KogitoBuilds ページに一覧表示されます。アプリケーション名を選択して、アプリケーション設定および YAML の詳細を表示または変更できます。
以下のコマンドを使用して、ビルドしたバイナリーをアップロードします。
oc start-build example-quarkus --from-dir=target/ -n namespace
$ oc start-build example-quarkus --from-dir=target/ -n namespaceCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
from-dirは、ビルドしたアプリケーションのtargetフォルダーパスと同じです。 -
namespaceは、KogitoBuildの作成先の namespace に置き換えます。
-
- Red Hat build of Kogito マイクロサービス定義を作成するには、Operator ページで Kogito Runtime タブを選択し、Create KogitoRuntime をクリックします。
アプリケーションウィンドウで、Form View または YAML View を使用してマイクロサービス定義を設定します。
少なくとも、以下の YAML ファイルのサンプルに示されるようにアプリケーション設定を定義します。
Red Hat build of Kogito マイクロサービスを使用した Red Hat build of Quarkus アプリケーションの YAML 定義の例
apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this microservice kind: KogitoRuntime # Application type metadata: name: example-quarkus # Application name
apiVersion: rhpam.kiegroup.org/v1 # Red Hat build of Kogito API for this microservice kind: KogitoRuntime # Application type metadata: name: example-quarkus # Application nameCopy to Clipboard Copied! Toggle word wrap Toggle overflow Red Hat build of Kogito マイクロサービスを使用した Spring Boot アプリケーションの YAML 定義の例
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 注記この場合、アプリケーションは、KogitoRuntime を使用してローカルにビルドされ、デプロイされます。アプリケーション名が
KogitoBuildおよびKogitoRuntimeで同じである必要があります。アプリケーションデータを定義したら、Create をクリックして Red Hat build of Kogito マイクロサービスを生成します。
アプリケーションが Red Hat build of Kogito マイクロサービスページに一覧表示されます。アプリケーション名を選択して、アプリケーション設定や YAML ファイルの内容を表示または変更できます。
Web コンソールの左側のメニューで Builds
Builds に移動して、アプリケーションのビルドのステータスを表示します。 特定のビルドを選択して、ビルドの詳細を表示できます。
-
アプリケーションのビルドが完了したら、Workloads
Deployments に移動して、アプリケーションのデプロイメント、Pod のステータスなどの情報を表示します。 Red Hat build of Kogito マイクロサービスをデプロイしたら、Web コンソールの左側のメニューの Networking
Routes に移動し、デプロイされたアプリケーションへのアクセスリンクを表示します。 アプリケーション名を選択して、ルート設定を表示または変更できます。
必要に応じてアプリケーションルートを使用すると、Red Hat build of Kogito マイクロサービスはビジネス自動化ソリューションと統合できます。