Red Hat OpenShift LocalへのOracle Blockchain Platform Enterprise Editionのデプロイ

テストおよび内部開発の目的で、Oracle Blockchain Platform Enterprise EditionをRed Hat OpenShift Localにインストールできます。本番環境ではサポートされません。

Red Hat OpenShift Localは、設定とテストを簡素化し、コンテナベースのアプリケーションの開発に必要なすべてのツールでクラウド開発環境をローカルにエミュレートするために、ローカル・コンピュータ上で実行するように設計されています。以前はRed Hat CodeReady Containersと呼ばれていました。

Red Hat OpenShift Localの詳細については、Red Hat OpenShift Localを参照してください。

前提条件:
  • CPU数: 12以上
  • メモリー: 30GB以上
  • ディスク・サイズ: 150GB以上
  • RedHat OpenShiftローカル- Embedded OpenShift version 4.15.3、 CRC (Code Ready Container) version 2.34.1
  • オペレーティングシステム: CentOS 8

この項では、前提条件のテスト済バージョンのインストールの例を示します。インストール手順の追加情報および必要な変更については、各製品のドキュメントを参照してください。次のウォークスルーは、オペレーティング・システムとしてCentOS 8を使用してテストされました。Oracle LinuxやRed Hat Enterprise Linuxなど、他のLinuxディストリビューションも使用できます。

ノート:

前提条件ソフトウェアのインストール・タスクの一部としてIstioをインストールする場合は、最新バージョンではなくバージョン1.22.1をインストールします。

Red Hat OpenShift Localのインストール

次のステップを実行して、Red Hat OpenShift Localをダウンロードしてインストールします。詳細は、CodeReady Containersのインストールを参照してください。

  1. 「Red Hat OpenShift Local」に移動し、「Install OpenShift on your laptop」をクリックします。ログイン・ページにリダイレクトされ、Red Hat資格証明を入力したり、まだアカウントがない場合はアカウントを作成できます。
  2. ログイン後、「クラスタ」をクリックし、「ローカル」タブをクリックします。
  3. ローカル・ページで、「Download OpenShift Local」「Download pull secret」の順にクリックします。
  4. 前のステップでダウンロードしたcrcパッケージおよびプル・シークレットをVMにコピーします。たとえば:
    scp -r -i ~/.ssh/id_rsa ~/Downloads/crc-linux-amd64.tar.xz <username>@<ip-address>:/tmp
    scp -r -i ~/.ssh/id_rsa ~/Downloads/pull-secret.txt <username>@<ip-address>:/tmp
    cd
  5. VMで、crcというディレクトリを作成し、crcパッケージとプル・シークレットをそのディレクトリにコピーします。
  6. 次のコマンドを実行して、OpenShiftをインストールします。
    sudo dnf install NetworkManager
    Failed Loading plugin "osmsplugin": No module named 'librepo'で始まるエラーが表示された場合は、次のコマンドを実行してから、インストール・コマンドを再実行してください。
    sudo sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
    sudo sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
    
  7. 次のコマンドを実行して、アーカイブ・ファイルを抽出します。
    cd ~/crc
    tar xvf crc-linux-amd64.tar.xz
  8. 次のコマンドを実行して、バイナリ・ファイルを/binディレクトリに移動し、パスを更新します。
    mkdir -p ~/bin
    cp ~/crc/crc-linux-*-amd64/crc ~/bin
    export PATH=$PATH:$HOME/bin
    echo 'export PATH=$PATH:$HOME/bin' >> ~/.bashrc

ルート・パーティションのディスク領域を増やす

VMルート・パーティション領域が150 GB未満の場合は、次のステップを実行します。

  1. ブート・ディスク、ルート・ファイル・システムまたは論理ボリューム・マネージャ(LVM)に150 GB以上の空き領域があることを確認します。
  2. fdiskを使用して、100GB以上のLinuxファイル・システム・パーティションを作成します(この例では、新しいパーティションは/dev/sda4です)。
    sudo fdisk /dev/sda
  3. 物理ボリュームをボリューム・グループに追加するには、次のコマンドを使用します。
    sudo vgextend centosvolume /dev/sda4
  4. 次のコマンドを使用して、論理ボリュームのサイズを大きくします。
    sudo lvextend -L+99G /dev/mapper/centosvolume-root
  5. ファイルシステムのサイズを増やすには、次のコマンドを使用します。
    sudo xfs_growfs /dev/centosvolume/root
    Oracle Enterprise Linuxでの同等のコマンドは、oci_growfsです。

OpenShiftローカル・パラメータの構成

次のコマンドを実行して、12個のCPUコア、30 GBのメモリーおよび100 GBのディスク領域を使用するようにOpenShift Localを構成します。

crc config set cpus 12 
crc config set memory 30720 
crc config set disk-size 100

OpenShiftクライアントをダウンロードしてインストールします

次のコマンドを実行して、OpenShiftクライアント・ソフトウェアであるocをダウンロードしてインストールします。

wget -O ~/crc/openshift-client-linux.tar.gz https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/4.15.3/openshift-client-linux-4.15.3.tar.gz 
tar xvzf openshift-client-linux.tar.gz
sudo mv oc /usr/local/bin

クラスタを起動します。

次のコマンドを実行して、クラスタの設定、起動およびステータスの確認を行います。Red Hat OpenShift Localをダウンロードしたときにダウンロードしたプル・シークレットを使用します。

crc setup 
crc start -p ~/crc/pull-secret.txt
crc status
インストールが完了すると、次のような情報が表示されます。
INFO Adding crc-admin and crc-developer contexts to kubeconfig... 
Started the OpenShift cluster.

The server is accessible via web console at:
  https://console-openshift-console.apps-crc.testing

Log in as administrator:
  Username: kubeadmin
  Password: password  (note this password)

Log in as user:
  Username: developer
  Password: developer

Use the 'oc' command line interface:
  $ eval $(crc oc-env)
  $ oc login -u developer https://api.crc.testing:6443

Oracle Blockchain Platform Enterprise Editionのインストール

  1. Red Hat OpenShift Localが稼働していることを確認するには、次の手順を実行します。
    1. コンソールにログインします。
      oc login -u kubeadmin -p <password> https://api.crc.testing:6443
    2. Red Hat OpenShift Localがアクセス可能であることを確認します。
      oc get nodes
  2. 次のコマンドを実行して、Istioプロファイルを設定します。次のコマンドを実行する前に、「Istioのインストール」のステップを完了している必要があります。
    istioctl install --set profile=openshift --set values.pilot.env.ENABLE_TLS_ON_SIDECAR_INGRESS=true --set components.cni.enabled=true --set values.cni.repair.deletePods="true"
  3. Oracle Blockchain Platform Enterprise Editionのページで、「Download」をクリックし、ステップに従ってOracle Blockchain Platform Enterprise Editionパッケージ(約6.5 GB)をダウンロードします。
  4. ダウンロードしたアーカイブ・ファイルを抽出します。
    抽出されたフォルダ構造には、OpenShiftなどの様々なプラットフォーム用のrunmeスクリプトが含まれます。
  5. runme-input.yamlファイルを必要な値で更新します。また、runme-input.yamlおよびrunme.shファイルを実行可能にします。runme-input.yamlファイルで指定したユーザー・アカウントからレジストリにログインできることを確認します。次のrunme-input.yamlファイルの例は、参照として使用できます。
    imageRegistryConfiguration:
      registry: <container_registry_name>
      imageTagPrefix: <container-image-repository-prefix>
      username: <container-registry-username>
     
    imageReleaseVersion: <obpee-release-version>
     
    # Set storageClassName to create a dynamic persistent volume. If empty, default storageClass is used.
     
    controlPlaneStorage:
      storageClassName: 
      # Example 500Mi, 5Gi
      size: 1Gi
    parentDomainName: example.com
    #imagePullTimeout: Use this field to customize the wait time (in seconds) for pulling the required container images from the repository. Default is 1800 seconds.
    imagePullTimeout: 1800
    この例の変数には次の値があります。
    • imageRegistryConfiguration.registryは、使用するコンテナ・レジストリ・サーバーです。例: iad.ocir.io
    • imageRegistryConfiguration.imageTagPrefixは、イメージがプッシュまたはプルされるレジストリを含むコンテナ・ベース・リポジトリ・パスです。例: iad.ocir.io/obpee/bcs
    • imageRegistryConfiguration.usernameは、コンテナ・レジストリのログイン・ユーザー名です。
    • imageReleaseVersionは、Oracle Blockchain Platform Enterprise Editionリリース・バージョンです。
    • controlPlaneStorage.storageClassNameは、PVC (PersistentVolumeClaim)に使用するKubernetesストレージ・クラスです。空の場合は、デフォルトのstorageClassが使用されます。
    • controlPlaneStorage.sizeは、Blockchain Platform Manager (コントロール・プレーン)サービスのPVCサイズです。
    • parentDomainNameは、Blockchain Platform Managerサービスに使用するドメイン名です。例: example.com
    • imagePullTimeoutは、Oracle Blockchain Platform Enterprise Editionのインストール時のイメージ・プル待機タイムアウト(秒)です。デフォルトは1800秒です。
  6. 新しいターミナル・ウィンドウを開き、配布パッケージ・ディレクトリに移動します。スクリプト出力のプロンプトに従って、ステップを実行します。
    1. 次のコマンドを実行して、スクリプトを実行します。
      chmod +x runme_openshift.sh
    2. 次のスクリプトを実行して、アーカイブ・ファイル内のコンテナを指定されたリポジトリにプッシュし、製品をインストールします。
      ./runme_openshift.sh --publish-images
      コンテナ・イメージがすでにリポジトリにアップロードされている場合は、次のコマンドを使用してリポジトリからそれらをプルし、インストールできます。
      ./runme_openshift.sh
    • デフォルトのLDAP管理パスワードを入力します(パスワードは表示されません)。これは、組込みLDAP認証サーバーの管理ユーザーのパスワードを設定するために使用されます。
    • デフォルトのコントロール・プレーン管理ユーザー・パスワードを入力します(パスワードは表示されません): Blockchain Platform Manager管理ユーザーのパスワードの設定に使用されます。
    • レジストリ<registry name>パスワードを入力します。これは、イメージをダウンロードするためのコンテナ・イメージ・レジストリ(runme-input.yamlで指定)への接続に使用されます。
    このスクリプトは、次のサービスをobp-cpネームスペースにインストールします。
    • control-plane
    • openldap
    • obp-auth-server
    • obp-operator
    • hlf-operator
  7. crc VMの/etc/hostsファイルに次の行を追加します。
    <CRC_IP_address> controlplane.<parentDomainName> openldap.<parentDomainName> auth.<parentDomainName>
    この例では、<CRC_IP_address>crc ipコマンドの出力です。
  8. Blockchain Platform Managerコンソールへの接続に使用するコンピュータの/etc/hostsファイルに次の行を追加します。
    <public_vm_ip> controlplane.<parentDomainName> openldap.<parentDomainName> auth.<parentDomainName>
    この例では、<public_vm_ip>はVMのパブリックIPアドレスです。
  9. クライアント・コンピュータからBlockchain Platform Managerにアクセスするには、次のステップを実行します。次のステップでは、firewalldを使用してサーバーへのインバウンド・トラフィックを許可し、HAProxyを使用してトラフィックをOpenShiftローカル・インスタンスに転送します。
    1. /etc/NetworkManager/conf.d/crc-nm-dnsmasq.conf構成ファイルに次のエントリがあることを確認します。
      [main]
              dns=dnsmasq
      dnsmasqインスタンス構成ファイル/etc/NetworkManager/dnsmasq.d/crc.confは次のようになります。
      server=/crc.testing/198.x.x.x
      server=/apps-crc.testing/198.x.x.x
      198.x.x.xは、crc ipコマンドの出力です。NetworkManagerdnsmasqインスタンスは、crc.testingおよびapps-crc.testingのリクエストを198.x.x.x DNSサーバーに転送します。
    2. 次のコマンドを入力して、必要な依存関係をインストールします。
      sudo dnf -y install haproxy policycoreutils-python-utils
    3. 次のコマンドを入力して、ファイアウォールを構成します。
      sudo systemctl start firewalld
      sudo firewall-cmd --add-port=80/tcp --permanent
      sudo firewall-cmd --add-port=6443/tcp --permanent
      sudo firewall-cmd --add-port=443/tcp --permanent
      sudo systemctl restart firewalld
      sudo semanage port -a -t http_port_t -p tcp 6443
      sudo semanage port -a -t http_port_t -p tcp 6443
    4. HAProxyを構成する前に、サーバーのIPアドレスとRed Hat OpenShift Local VMのIPアドレスを知っている必要があります。次のコマンドを実行します。
      export SERVER_IP=$(hostname --ip-address)
      export CRC_IP=$(crc ip)
      cd /etc/haproxy;sudo cp haproxy.cfg haproxy.cfg.orig
    5. haproxy.cfgファイルの内容を次のテキストで置き換えます。
      global
      debug
       
      defaults
      log global
      mode http
      timeout connect 0
      timeout client 0
      timeout server 0
       
      frontend apps
      bind SERVER_IP:80
      bind SERVER_IP:443
      option tcplog
      mode tcp
      default_backend apps
       
      backend apps
      mode tcp
      balance roundrobin
      option ssl-hello-chk
      server webserver1 CRC_IP:80 check
      server webserver2 CRC_IP:443 check
       
      frontend api
      bind SERVER_IP:6443
      option tcplog
      mode tcp
      default_backend api
       
      backend api
      mode tcp
      balance roundrobin
      option ssl-hello-chk
      server webserver1 CRC_IP:6443 check
      
    6. 次のコマンドを実行してHAproxy構成のIPアドレスを置き換え、HAproxyを起動します。
      export CRC_IP=$(crc ip)
      export SERVER_IP=$(hostname --ip-address)
      sudo sed -i "s/CRC_IP/$CRC_IP/g" haproxy.cfg
      sudo sed -i "s/SERVER_IP/$SERVER_IP/g" haproxy.cfg
      sudo systemctl start haproxy

Blockchain Platform Managerにアクセスします

インストール後、生成されたBlockchain Platform Managerホスト名のホスト名解決を構成します。
  1. コマンドを実行して、構成済ホスト名のリストを取得します:
    kubectl get virtualservice -n obp-cp -o json | jq -r .items[].spec.hosts[0]
  2. VM上の/etc/hostsファイルに次のエントリを追加して、生成されたこれらのホスト名のホスト名解決を実行中のRed Hat OpenShiftクラスタのIPアドレスに構成します。
    <IP_Address> controlplane.<parentDomainName> openldap.<parentDomainName> auth.<parentDomainName>
    この例では、<IP_address>crc ipコマンドの出力です。
  3. crc VMセキュリティ・リストで、クライアント・ホスト・コンピュータからのポート443、6443および80が許可されていることを確認します。

Blockchain Platform Manager (コントロール・プレーン管理ツール)にログオンしてインスタンスを作成できるようになりました。

インスタンスを作成したら、「プロビジョニング後の前提条件」の説明に従ってDNS転送を構成する必要があります。