Red Hat Training

A Red Hat training course is available for Red Hat Decision Manager

Red Hat OpenShift Container Platform への Red Hat Decision Manager のデプロイメント

Red Hat Decision Manager 7.0

Red Hat Customer Content Services

概要

本書は、OpenShift 環境への Red Hat Decision Manager 7.0 デプロイメントについて説明します。

前書き

システム管理者は、OpenShift 環境に Red Hat Decision Manager をデプロイして管理できます。OpenShift プラットフォームは、コンテナーのデプロイメントおよび管理を自動化します。Decision Manager で提供されたテンプレートを使用して OpenShift にデプロイし、必要に応じてスケーリングを行います。

前提条件

デプロイした OpenShift 環境が必要です。詳細は、使用する OpenShift 製品のドキュメンテーションを参照してください。

第1章 概要

OpenShift 環境をお持ちの場合は、通常のオンプレミスデプロイメントの代わりに、OpenShift 環境に Red Hat Decision Manager をデプロイできます。

この場合、Decision Server は、OpenShift の Pod としてデプロイされます。Pod のスケールアップとスケールダウンを行い、必要な数だけコンテナーを提供できます。標準の OpenShift 方法を使用して Pod を管理し、負荷を分散し、新しいバージョンをデプロイできます。

OpenShift インフラストラクチャーに、Decision Server とともに Decision Central をデプロイすることもできます。これにより、Decision Central を使用して Decision Server を管理し、新しいルールをデプロイできるようになります。

また、Decision Central を使用せずに Decision Server をデプロイできます。このように Decision Server を管理するオプションは複数あります。

  • source to image (S2I) テンプレートを使用し、Git リポジトリーにデシジョンサービスのソースを指定します。OpenShift が自動的にソースをビルドし、デシジョンサービスを Decision Server イメージにインストールし、サービスを開始します。Decision Server を管理する必要はありません。新しいバージョンのデシジョンサービスを使用する場合は、新しいイメージをビルドできます。このオプションは、コンテナーインフラストラクチャーに一般的な統合アプローチで推奨されます。
  • Maven リポジトリーからサービスを自動的にロードするように Decision Server を設定します。
  • Decision Central、コントローラー、または REST API のインスタンスを使用して Decision Server を管理します。
重要

OpenShift で実行する Decision Server へのコールはすべてステートレスである必要があります。サーバーはステートフルなコールにも対応しますが、サーバーが複数のコンテナーにスケールされるか、OpenShift によって自動的に再起動する可能性があるため、コール間でステートが保存されない場合があります。

第2章 OpenShift 環境に Red Hat Decision Manager をデプロイする準備

OpenShift 環境に Red Hat Decision Manager をデプロイする前に、準備タスクをいくつか完了する必要があります。追加イメージ (たとえば、デシジョンサービスの新しいバージョン、または別のデシジョンサービス) をデプロイする場合は、このタスクを繰り返す必要はありません。

前提条件

  1. OpenShift 環境で 4 ギガバイト以上のメモリーが利用可能であることを確認します。
  2. デプロイメント用の OpenShift プロジェクトを作成します。
  3. OpenShift web コンソールと oc コマンドを使用してプロジェクトにログインします。

2.1. イメージストリームが利用可能であることを確認

You must ensure that the image streams that are required for the deployment are available in your OpenShift environment. Some versions of the OpenShift environment include the necessary image streams. You must check if they are available. If they are not available, you must install the rhdm70-image-streams.yaml file.

手順

  1. 以下のコマンドを実行します。

    $ oc get imagestreamtag -n openshift | grep rhdm70-decisioncentral-openshift
    $ oc get imagestreamtag -n openshift | grep rhdm70-kieserver-openshift

    両コマンドの出力が空でない場合は、必要なイメージストリームが利用できるため、これ以外の操作は必要ありません。

  2. If the output of one or both of the commands is empty, download the rhdm-7.0.1-openshift-templates.zip product deliverable file from the Software Downloads page for Red Hat Decision Manager 7.0. Extract the rhdm70-image-streams.yaml file from it. Complete one of the following actions:

    • 以下のコマンドを実行します。

      $ oc create -f rhdm70-image-streams.yaml
    • Using the OpenShift Web UI, select Add to Project → Import YAML / JSON, then choose the file or paste its contents.

2.2. Decision Server にシークレットの作成

OpenShift は、シークレット と呼ばれるオブジェクトを使用してパスワードやキーストアなどの機密情報を保持します。詳細は、OpenShift ドキュメントの「Secrets」の章を参照してください。

Decision Server に SSL 証明書を作成し、それをシークレットとして OpenShift 環境に提供します。

注記

HTTPS に対応しない S2I (source to image) を使用して Decision Server をデプロイする場合は、シークレットオブジェクトを作成する必要がありません。

手順

  1. Decision Server の SSL 暗号化の秘密鍵および公開鍵を使用して SSL キーストアを生成します。プロダクション環境で、期待する Decision Server の URL に一致する有効な署名付き証明書を生成します。キーストアを keystore.jks ファイルに保存します。証明書の名前と、キーストアファイルのパスワードを記録します。

    自己署名型または購入する SSL 証明書を使用してキーストアを作成する方法は「Generate a SSL Encryption Key and Certificate」を参照してください。

  2. oc コマンドを使用して、新しいキーストアファイルからシークレット kieserver-app-secret を生成します。

    $ oc create secret generic kieserver-app-secret --from-file=keystore.jks
  3. サービスアカウント kieserver-service-account を作成します。

    $ oc create serviceaccount kieserver-service-account
  4. シークレットをサービスアカウントに追加します。

    $ oc secret add sa/kieserver-service-account secret/kieserver-app-secret

2.3. Decision Central へのシークレットの作成

OpenShift 環境に Decision Central をデプロイする場合は、Decision Central に SSL 証明書を作成し、OpenShift 環境にシークレットとして提供します。Decision Central と Decision Server には、同じ証明書とキーストアを使用しないでください。

手順

  1. Decision Central の SSL 暗号化の秘密鍵および公開鍵を使用して、SSL キーストアを生成します。プロダクション環境で、期待する Decision Central の URL に一致する有効な署名付き証明書を生成します。キーストアを keystore.jks ファイルに保存します。証明書の名前と、キーストアファイルのパスワードを登録します。

    自己署名型または購入する SSL 証明書を使用してキーストアを作成する方法は「Generate a SSL Encryption Key and Certificate」を参照してください。

  2. oc コマンドを使用して、新しいキーストアファイルからシークレット decisioncentral-app-secret を生成します。

    $ oc create secret generic decisioncentral-app-secret --from-file=keystore.jks
  3. サービスアカウント decisioncentral-service-account を作成します。

    $ oc create serviceaccount decisioncentral-service-account
  4. シークレットをサービスアカウントに追加します。

    $ oc secret add sa/decisioncentral-service-account secret/decisioncentral-app-secret

第3章 OpenShift 環境への Red Hat Decision Manager のデプロイメント

OpenShift 環境に Red Hat Decision Manager をデプロイするには、Red Hat Decision Manager で用意した OpenShift テンプレートを使用します。

前提条件

2章OpenShift 環境に Red Hat Decision Manager をデプロイする準備」に記載されている準備タスクを完了する必要があります。

注記

OpenShift web UI を使用する代わりに、oc コマンドラインツールを使用してテンプレートをデプロイし、パラメーターを設定できます。詳細は、使用する OpenShift バージョンのドキュメンテーションを参照してください。

3.1. Decision Central および Decision Server のデプロイメント

OpenShift インフラストラクチャーに、Decision Server とともに Decision Central をデプロイすることもできます。これにより、Decision Central を使用して Decision Server を管理し、新しいルールを開発できるようになります。

手順

  1. In the OpenShift Web UI, select Add to Project → Browse Catalog, search for decision, and then select the Red Hat Decision Manager 7.0 applications (Persistent with https) template.

    • If this template is not available, download the rhdm-7.0.1-openshift-templates.zip product deliverable file from the Software Downloads page for Red Hat Decision Manager 7.0. Extract the rhdm70-full.yaml file. Select Add to Project → Import YAML / JSON and then select or paste the rhdm70-full.yaml file. In the Add Template window, ensure Process the template is selected and click Continue.
  2. 以下の必須パラメーターを設定します。

    • Application Name: The name of the OpenShift application. It is used in the default URLs for Decision Central and Decision Server.
    • Decision Central Server Certificate Name: The name of the certificate in the keystore that you created in 「Decision Central へのシークレットの作成」.
    • Decision Central Server Keystore Password: The password for the keystore that you created in 「Decision Central へのシークレットの作成」.
    • KIE Server Certificate Name: The name of the certificate in the keystore that you created in 「Decision Server にシークレットの作成」.
    • KIE Server Keystore Password: The password for the keystore that you created in 「Decision Server にシークレットの作成」.
    • KIE Server ID: The name of the server template on the Decision Central that the Decision Server is to join. Set this parameter to any value. If you do not set it and then the Decision Server pod is restarted or scaled, each new instance of the server might join a new template.
    • ImageStream Namespace: The namespace where the image streams are available. If the image streams were already available in your OpenShift environment (see 「イメージストリームが利用可能であることを確認」), the namespace is openshift. If you have installed the image streams file, the namespace is the name of the OpenShift project.

      You can also set other parameters as necessary. In particular, you can change the username and password for the Maven repository that is built into Decision Central. Use the Maven repository username and Maven repository password fields.

      ATTENTION: Do not change the Maven repository URL field. If you change it, the Decision Server will work with a different Maven repository, but the Decision Central will still use its own built-in repository. Therefore, the Decision Central will not deploy services to the Decision Server.

  3. Create をクリックします。

3.2. S2I (Source to Image) を使用した Decision Server のデプロイメント

S2I (Source to Image) を使用して、OpenShift インフラストラクチャーに Decision Server をデプロイできます。この場合は、Git リポジトリーにデシジョンサービスを提供します。OpenShift は自動的にソースをビルドし、デシジョンサービスを Decision Server イメージにインストールし、サービスを開始します。イメージをこれ以上管理する必要はありません。新しいバージョンのデシジョンサービスを使用する場合は、新しいイメージをビルドします。このオプションは、コンテナーインフラストラクチャーにおける一般的なバージョン管理アプローチ (DevOps) でしばしば推奨されます。

HTTPS に対応の有無にかかわらず、S2I を使用して Decision Server をデプロイできます。

作業を開始する前の注意事項

デシジョンサービスの完全ソースコードが、OpenShift サーバーがアクセスできる Git リポジトリーで利用可能であることを確認します。ソースコードは Maven プロセスを使用してビルドされるため、pom.xml ファイルが含まれる必要があります。

手順

  1. In the OpenShift Web UI, select Add to Project → Browse Catalog, search for decision, and then select the Red Hat Decision Manager Execution Server 7.0 S2I Ephemeral (no https) or Red Hat Decision Manager Execution Server 7.0 S2I (Ephemeral with https) template.

    • If this template is not available, download the rhdm-7.0.1-openshift-templates.zip product deliverable file from the Software Downloads page for Red Hat Decision Manager 7.0. Extract the rhdm70-kieserver-basic-s2i.yaml or rhdm70-kieserver-https-s2i.yaml file. Select Add to Project → Import YAML / JSON and then select or paste the file. In the Add Template window, ensure Process the template is selected and click Continue.
  2. 以下の必須パラメーターを設定します。

    • Application Name: The name of the OpenShift application. It is used in the default URLs for Decision Central and Decision Server.
    • KIE Server Certificate Name: The name of the certificate in the keystore that you created in 「Decision Server にシークレットの作成」. Not available if you are configuring a server without HTTPS support.
    • KIE Server Keystore Password: The password for the keystore that you created in 「Decision Server にシークレットの作成」. Not available if you are configuring a server without HTTPS support.
    • KIE Server Container Deployment: The identifying information of the decision service (KJAR file) that is built from your source. The format is: <containerId>=<groupId>:<artifactId>:<version>. You can provide two or more KJAR files using the | separator, for example: containerId=groupId:artifactId:version|c2=g2:a2:v2. The Maven build process must produce all these files from the source in the Git repository.
    • Git Repository URL: The URL for the Git repository that contains the source for your decision service.
    • Git Reference: The branch in the Git repository
    • Context Directory: The path to the source within the project downloaded from the Git repository
    • Artefact Directory: The path within the project that contains the required binary files (KJAR files and any other necessary files) after a successful Maven build. Normally this directory is the target directory of the build. However, you can provide prebuilt binaries in this directory in the Git repository
    • ImageStream Namespace: The namespace where the image streams are available. If the image streams were already available in your OpenShift environment (see 「イメージストリームが利用可能であることを確認」), the namespace is openshift. If you have installed the image streams file, the namespace is the name of the OpenShift project.

      また、必要に応じて、その他のパラメーターを設定できます。特に、デシジョンサービスの Maven ビルドが Maven レポジトリーからパッケージをプルする場合は、ミラーリポジトリーの URL を設定でき、必要に応じて、ミラーリポジトリーにアクセスするためのユーザー名およびパスワードを設定できます。この場合、ビルドプロセスは、元のリポジトリーを設定する代わりに、ミラーリポジトリーからパッケージをプルします。

      • Maven mirror URL
      • Maven repository username
      • Maven repository password
  3. Create をクリックします。

3.3. S2I (Source to Image) を使用しない Decision Server のデプロイメント

Decision Central および S2I を使用せずに Decision Server を OpenShift インフラストラクチャーにデプロイできます。この場合、Decision Server は Maven リポジトリーからデシジョンサービスを選択できます。サービスを自動的にロードするように Decision Server を設定できますが、Decision Central、コントローラー、または API を使用して Decision Server を管理することもできます。

作業を開始する前の注意事項

デシジョンサービスに Maven リポジトリーが利用できることを確認します。

Decision Central または管理コンソールを使用する場合は、それがインストールされており、KIE サーバーを制御するように設定が記録されていることを確認します。

手順

  1. In the OpenShift Web UI, select Add to Project → Browse Catalog, search for decision, and then select the Red Hat Decision Manager Execution Server 7.0 (Ephemeral with https) template.

    • If this template is not available, download the rhdm-7.0.1-openshift-templates.zip product deliverable file from the Software Downloads page for Red Hat Decision Manager 7.0. Extract the rhdm70-kieserver.yaml. Select Add to Project → Import YAML / JSON and then select or paste the rhdm70-kieserver.yaml file. In the Add Template window, ensure Process the template is selected and click Continue.
  2. 以下の必須パラメーターを設定します。

    • Application Name: The name of the OpenShift application. It is used in the default URLs for Decision Central and Decision Server.
    • KIE Server Certificate Name: The name of the certificate in the keystore that you created in 「Decision Server にシークレットの作成」.
    • KIE Server Keystore Password: The password for the keystore that you created in 「Decision Server にシークレットの作成」.
    • ImageStream Namespace: The name of the OpenShift project.

      必要に応じて、以下のような、その他のパラメーターも設定できます。

      • デシジョンサービスを取得するために Maven リポジトリーを設定する場合は、以下のパラメーターにそのリポジトリーを設定します。

        • Maven repository URL
        • Maven repository username
        • Maven repository password
      • デシジョンサービスを自動的にロードするように Decision Server を設定するには、以下のパラメーターを設定します。

        • KIE Server Container Deployment: The identifying information of the decision service (KJAR file). The format is: <containerId>=<groupId>:<artifactId>:<version>. You can provide two or more KJAR files using the | separator, for example: containerId=groupId:artifactId:version|c2=g2:a2:v2. The Decision Server pulls the files from the Maven repository.
      • 同じ OpenShift インフラストラクチャーにデプロイした Decision Central を使用して Decision Server を管理するには、以下のパラメーターを設定します。

        • KIE server controller service: The OpenShift service name for the Decision Central
        • KIE server controller user: Decision Central にログオンするユーザー名
        • KIE server controller password: The password for logging onto the Decision Central
        • KIE Server ID: The name of the server template on the Decision Central that this server is to join.
      • Decision Central またはコントローラーを使用して Decision Server を管理する場合は、Decision Central の web ユーザーインターフェイスにアクセスするのに使用する URL、またはコントローラーの設定に従って、プロトコル、ホスト、ポートパラメーターを設定します。

        • KIE server controller protocol (http または https)
        • KIE server controller host
        • KIE server controller port
        • KIE server controller user: Decision Central またはコントローラーにログオンするユーザー名
        • KIE server controller password: The password for logging onto the Decision Central or controller
        • KIE Server ID: The name of the server template on the Decision Central or controller that this server is to join.
  3. Create をクリックします。

第4章 OpenShift で Red Hat Decision Manager の管理

必要に応じて、OpenShift で Decision Server をスケールします。

OpenShift で Decision Central のスケールを行わないでください。Decision Central と Decision Server をデプロイし、Decision Server をスケールすると、Decision Central は、Decision Server のコピーをすべて管理します。

4.1. デシジョンサービスのアップデート

新しいバージョンのデシジョンサービスをアップデートする場合は、既存の Pod を使用して新しいバージョンをデプロイするか、新しい Pod を作成します。

既存の Pod でデシジョンサービスを変更するには、Decision Central、コントローラー、または API を使用して Decision Server を管理する必要があります。この場合、変更は、コンテナーを使用しないオンプレミスデプロイメントと同じように処理されます。

一般的なコンテナーアプリケーションライフサイクルを使用する場合は、新しい Pod をビルドしてデシジョンサービスをアップデートします。通常は、このソリューションには S2I (Source to Image) デプロイメントがもっとも便利です。

重要

S2I でデプロイしたサーバーは、Decision Central、コントローラー、または API を使用したデシジョンサービスの変更をサポートしません。デシジョンサービスを変更するには、新しい S2I イメージをビルドします。

同じ URL エイリアスにサービスをアップデートするには、「再作成ストラテジー」を使用します。Decision Server は「ローリングストラテジー」をサポートしません。

付録A バージョン情報

Documentation last updated on: Monday, October 1, 2018.

法律上の通知

Copyright © 2019 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat Software Collections is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.