Hitachi

Hitachi Microservices Platform - Paxos Commit Transaction Orchestrator ユーザーズガイド


3.4.4 TP1-Bridgeコンテナイメージの作成(通常版かつTP1-Bridge限定)

TP1-Bridgeコンテナイメージの作成方法について説明します。

このコンテナイメージは通常版の場合で、TP1-Bridgeを使用するときに作成します。

〈この項の構成〉

(1) Containerfileのテンプレートの修正

uCosminexus Application Runtime with Java for Spring Bootの修正パッチがあるかどうかを確認して、使用するHitachi Microservices Platform - Bridge Option for OpenTP1が提供するTP1-Bridge用Containerfileのテンプレートを選択してください。選択したテンプレートに、次の修正をしてください。

uCosminexus Application Runtime with Java for Spring Bootの修正パッチがある場合のContainerfileのテンプレートの例を、次に示します。

FROM registry.access.redhat.com/ubi9/ubi-minimal:9.5-1742914212 AS builder
RUN microdnf install \
        -y \
        --setopt=install_weak_deps=0 \
        --nodocs \
        alsa-lib \
        cups-libs \
        findutils \
        lksctp-tools \
        nss \
        ncurses \
        tar \
        cpio \
        gzip
WORKDIR /tmp
RUN mkdir ./X64LIN
COPY ucars/X64LIN ./X64LIN
RUN chmod +x ./X64LIN/setup
RUN ./X64LIN/setup -f -c HL0S ./
RUN mkdir patch
WORKDIR patch
COPY ucars/PACK_TAR.Z .
RUN tar xzvf PACK_TAR.Z && ./UPDATE -f; export RET=$?; if [ ${RET} -ne 0 -a ${RET} -ne 1 ]; then exit ${RET}; fi
 
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.5-1742914212 AS ucars
COPY --from=builder /opt /opt
COPY --from=builder /etc/.java /etc/.java
RUN microdnf install \
        -y \
        --setopt=install_weak_deps=0 \
        --nodocs \
        dnf \
    && dnf install \
        -y \
        --setopt=install_weak_deps=0 \
        --nodocs \
        --allowerasing \
        curl-minimal \
        jq \
        glibc \
        <uCosminexus Application Runtime with Java for Spring Bootの前提RPMパッケージ>     …4
        :
    && dnf clean all \
    && rm -rf /var/cache/dnf/*
ENV PATH=/opt/Cosminexus/jdk17/bin:$PATH
 
RUN chgrp -R 1001 /opt/hitachi/ucars     …3
 
COPY ./DigiCertGlobalRootG2.crt /opt/Cosminexus/jdk17/lib/security/     …1
RUN keytool -import -alias AzureCACert -trustcacerts \
    -file /opt/Cosminexus/jdk17/lib/security/DigiCertGlobalRootG2.crt \
    -keystore /opt/Cosminexus/jdk17/lib/security/cacerts \
    -storepass changeit \
    -noprompt
COPY ./gtsrootr1.pem /opt/Cosminexus/jdk17/lib/security/     …2
COPY ./gtsrootr2.pem /opt/Cosminexus/jdk17/lib/security/
COPY ./gtsrootr3.pem /opt/Cosminexus/jdk17/lib/security/
COPY ./gtsrootr4.pem /opt/Cosminexus/jdk17/lib/security/
RUN keytool -import -alias gtsrootr1 -trustcacerts \
    -file /opt/Cosminexus/jdk17/lib/security/gtsrootr1.pem \
    -keystore /opt/Cosminexus/jdk17/lib/security/cacerts \
    -storepass changeit \
    -noprompt
RUN keytool -import -alias gtsrootr2 -trustcacerts \
    -file /opt/Cosminexus/jdk17/lib/security/gtsrootr2.pem \
    -keystore /opt/Cosminexus/jdk17/lib/security/cacerts \
    -storepass changeit \
    -noprompt
RUN keytool -import -alias gtsrootr3 -trustcacerts \
    -file /opt/Cosminexus/jdk17/lib/security/gtsrootr3.pem \
    -keystore /opt/Cosminexus/jdk17/lib/security/cacerts \
    -storepass changeit \
    -noprompt
RUN keytool -import -alias gtsrootr4 -trustcacerts \
    -file /opt/Cosminexus/jdk17/lib/security/gtsrootr4.pem \
    -keystore /opt/Cosminexus/jdk17/lib/security/cacerts \
    -storepass changeit \
    -noprompt
 
USER 1001:0
 
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.5-1742914212 AS ucars_eads
RUN microdnf install \
        -y \
        --setopt=install_weak_deps=0 \
        --nodocs \
        dnf \
    && dnf install \
        -y \
        --setopt=install_weak_deps=0 \
        --nodocs \
        --allowerasing \
        curl-minimal \
        jq \
        glibc \
    && dnf clean all \
    && rm -rf /var/cache/dnf/*
 
RUN microdnf install \
        -y \
        --setopt=install_weak_deps=0 \
        --nodocs \
        ncurses \
        tar \
        cpio \
        gzip
WORKDIR /tmp
RUN mkdir ./X64LIN
COPY /X64LIN ./X64LIN
RUN chmod +x ./X64LIN/setup
RUN ./X64LIN/setup -f -c HC13 ./
RUN mkdir patch
WORKDIR patch
COPY PACK_TAR.Z .
RUN tar xzvf PACK_TAR.Z && ./UPDATE -f; export RET=$?; if [ ${RET} -ne 0 -a ${RET} -ne 1 ]; then exit ${RET}; fi
 
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.5-1742914212
RUN mkdir -p /deployments/eads-lib \
    && mkdir -p /deployments/eads-log \
    && chown 1001:0 /deployments/eads-log \
    && chmod 770 /deployments/eads-log \
    && mkdir -p /deployments/tp1-log \
    && chown 1001:0 /deployments/tp1-log \
    && chmod 770 /deployments/tp1-log
ENV LOADER_PATH=/deployments/eads-lib
ENV PATH=/opt/Cosminexus/jdk17/bin:$PATH
COPY --from=ucars /opt /opt
COPY --from=ucars /etc/.java /etc/.java
RUN microdnf install \
        -y \
        --setopt=install_weak_deps=0 \
        --nodocs \
        dnf \
    && dnf install \
        -y \
        --setopt=install_weak_deps=0 \
        --nodocs \
        --allowerasing \
        curl-minimal \
        jq \
        glibc \
    && dnf clean all \
    && rm -rf /var/cache/dnf/*
WORKDIR /deployments
COPY --from=ucars_eads --chown=1001:0 --chmod=0440 /opt/hitachi/xeads/javaclient/lib/ /deployments/eads-lib
COPY --chown=1001:0 --chmod=0550 ./health_check.sh /deployments/
COPY --chown=1001:0 --chmod=0550 ./wait_transactions.sh /deployments/
COPY --chown=1001:0 --chmod=0440 ./tp1-bridge-V.R.S.jar /deployments/
CMD /opt/hitachi/ucars/bin/starter.sh java ${HMPPCTO_JAVA_OPTIONS} -jar /deployments/tp1-bridge-V.R.S.jar
注※

V.R.Sは使用するHMP-PCTOのバージョンに合わせて読み替えてください。

(2) Containerfileと資材の配置

次の表に示すとおり、Containerfileと資材をコンテナイメージビルド環境に配置してください。

表3‒9 Containerfileと資材の配置構成

ファイル/ディレクトリ構成

作成・提供元

備考

<コンテナイメージビルド作業ディレクトリ>/

ユーザ

Containerfile

ユーザ

uCosminexus Application Runtime with Java for Spring Bootの修正パッチがない場合

HMP-PCTOの提供ファイル「templates/container-files/<RHELバージョン>/tp1-bridge/normal/Containerfile」を使用してください。

uCosminexus Application Runtime with Java for Spring Bootの修正パッチがある場合

HMP-PCTOの提供ファイル「templates/<RHELバージョン>/container-files/tp1-bridge/patch/Containerfile」を使用してください。

tp1-bridgeV.R.S.jar

(HMP-PCTOのTP1-BridgeアプリケーションのJARファイル)

ユーザ

3.3.4 JARファイルのビルド(通常版かつTP1-Bridge限定)」で作成したもの

health_check.sh

(HMP-PCTOのトランザクションヘルスチェックスクリプト)

日立

wait_transactions.sh

(HMP-PCTOの未決着トランザクション待機スクリプト)

日立

X64LIN

(Hitachi Elastic Application Data Store Client for Javaのインストーラ)

日立

HMP-PCTOに同梱されているHitachi Elastic Application Data Store Client for JavaのインストーラのX64LINディレクトリをコピーしてください。

PACK_TAR.Z

(Hitachi Elastic Application Data Store Client for Javaの修正パッチ)

日立

HMP-PCTOにHitachi Elastic Application Data Store Client for Javaの修正パッチが同梱されている場合だけ格納してください。

ucars

ユーザ

X64LIN

(uCosminexus Application Runtime with Java for Spring Bootのインストーラ)

日立

uCosminexus Application Runtime with Java for Spring BootのインストールCD-ROMに格納されているX64LINディレクトリをコピーしてください。

PACK_TAR.Z

(uCosminexus Application Runtime with Java for Spring Bootの修正パッチ)

日立

uCosminexus Application Runtime with Java for Spring Bootの修正パッチがある場合だけ格納してください。

DigiCertGlobalRootG2.crt

(DigiCertGlobalRootG2 CA証明書)

ユーザ

分散トレース収集サービスにAzure Monitor Application Insightsを使用する場合だけ格納してください。

GTS Root R1.pem

GTS Root R2.pem

GTS Root R3.pem

GTS Root R4.pem

(GTS Root R1、GTS Root R2、GTS Root R3、GTS Root R4証明書)

ユーザ

分散トレース収集サービスにGoogle Cloud PlatformのCloud Traceを使用する場合だけ格納してください。

(凡例)−:該当しません。

(3) コンテナイメージのビルド

Containerfileを使用して、コンテナイメージをビルドします。

TP1-Bridgeコンテナイメージのビルドのコマンドを次に示します。

cd <コンテナイメージビルド作業ディレクトリ>/
docker△build△-f△./Containerfile△-t△<コンテナレジストリ>/[<namespace>/]<TP1-Bridgeコンテナイメージのユーザ任意のイメージ名>:<ユーザ任意のタグ名>△.

(凡例)△:半角スペース1文字

<実行例>

cd build/
docker build -f ./Containerfile -t myregistry.example.com/myproject/tp1-bridge:latest .

この例では、TP1-Bridgeコンテナイメージのイメージ名・タグ名を「tp1-bridge:latest」としています。

(4) コンテナイメージの登録

ビルドしたTP1-Bridgeコンテナイメージを、Kubernetesクラスタで使用するコンテナレジストリにdocker pushコマンドなどで登録してください。

インターネット接続のない閉塞環境の場合は、ローカルのリポジトリ・レジストリなどを使用したり、コンテナイメージビルド環境でエクスポートしたコンテナイメージをKubernetesクラスタの各ワーカーノードにインポートしたりするなどの方法で対応してください。