LoginSignup
4
6

More than 5 years have passed since last update.

intra-mart WebPlatform / IM-WorkFlowをDockerで動かす

Posted at

概要

intra-mart WebPlatform 7.2をDockerで立てる。

AccelPlatformだ! IM-BPMだ!という世間の動向は別として、作られたものを細々と保守する必要があったり、動作検証用に使えるかな、というのがスタート地点です。

まずは、土台の部分を作ることとし、intra-mart上にアプリケーションを配備するのは、これをベースとして違うイメージを作成するようにしたいと思います。

前提条件

次にあげる資材は、ネット上に転がっていないので、手元にあるものをお使いください。

  • intra-mart WebPlatformのセットアップ資材(setup.jar)
  • IM-WorkFlowのセットアップ資材(setup.jar)
  • IM-共通マスタのセットアップ資材

次にあげるものは、ダウンロード可能です。ビルド時に取得することもできますが、説明の簡素化のため手元にあると仮定します。分かりやすいようなフォルダ名においておきます。

  • intra-mart WebPlatformのパッチ
  • IM-Workflowのパッチ

今回はスタンドアロンを対象とし、Webサーバ機能は別に用意せずにintra-mart WebPlatformの機能を利用することとします。

フォルダ構成

こんな感じにしました。

.
│  Dockerfile
│   
└─install_resources
    │  mod_webapp.sh  # IE10対応としてweb.xmlの編集が必要なので、そのスクリプト
    │  patch_2235.zip      # IM-Workflow Version 7.2 Patch11
    │  patch_2299.zip         
    │  patch_2317.zip      
    │
    ├─im_workflow
    │      response_file # IM-Worlflowインストール時に使用する設定ファイル
    │      setup.jar          # インストーラ本体
    │
    ├─im_workflow72_patch11
    │      setup.jar          # 7.2.11インストーラ本体
    │ 
    ├─im_wpaf72_patch10  # WebPlatform/AppFramework Version 7.2 Patch10  
    │      setup.jar          # 7.2.10パッチのインストーラ本体
    │
    ├─install 
    │      response_file # intra-mart WebPlatform インストール時に使用する設定ファイル
    │      setup.jar          # # WebPlatform/AppFramework インストーラ本体
    │
    ├─install_im_master    # これはIM共通マスタのセットアップ資源
    │  ├─doc   # 中身は省略
    │  ├─licenses # 中身は省略
    │  └─storage # 中身は省略
    │
    ├─patch
    │      response_file # パッチインストール時に使用する設定ファイル
    │      
    └─patch10_20160715  # WebPlatform/AppFramework Version 7.2 Patch10 の緊急パッチ
            ApplicationRuntime
            ResourceService

ポイント

intra-mart WebPlatformやIM-Workflowのインストールは、CUIで行うことができますが、設定ファイルを用意しておくことで、インストールを自動化することができます。
出典:3.2.5.2 設定ファイルを読み込んでインストール

立てたい環境ごとに応答ファイルを用意しても良いですが、今回はシンプルにやっています。

java –jar ./setup.jar -s 設定ファイル名 

とすることで、セットアップするときに設定ファイルを作成することもできます。

改行コードしかない行も、意味があるので注意が必要です。

WebPlatformで利用する応答ファイル

JAVA_HOMEとかHOST_NAMEは後で置換するために、このような値となっています。

これが install_resources/install/response_fileだとします。

1
2
y
n
y
###JAVA_HOME###
###imart###
1
1
4
4
###HOST_NAME###
###HOST_NAME###



1024
2048
n
y

IM-Workflowで利用する設定ファイル

これが install_resources/im_workflow/response_fileだとします。

y
n
/imart
1
1
4
4



n
y

パッチで利用する設定ファイル

これが install_resources/patch/response_file だとします。

1
2
y
n
y
/imart
1
1
4
4



n
y

Dockerfile例

# iWP7.2はjava6なので、このイメージを選択しました
FROM openjdk:6

ENV imart /imart
ENV INSTALL_FOLDER /tmp/install_resouces
COPY install_resources/ $INSTALL_FOLDER

# set locale
ENV LANG ja_JP.UTF-8
ENV LANGUAGE ja_JP:ja
ENV LC_ALL ja_JP.UTF-8
RUN \
    unlink /etc/localtime && \
    ln -s /usr/share/zoneinfo/Japan /etc/localtime && \
    # インストール時に使用する設定ファイルの中身を置換します。特にJAVA_HOMEは必要ですね。
    sed -i -e "s|###imart###|$imart|g" \
           -e "s|###JAVA_HOME###|$JAVA_HOME|g" \
           -e "s|###HOST_NAME###|localhost|g" \
           $INSTALL_FOLDER/install/response_file && \
    # iWP7.2本体のインストール
    java -jar $INSTALL_FOLDER/install/setup.jar -f response_file && \
    # IM共通マスタのインストール
    cp -r $INSTALL_FOLDER/install_im_master/* $imart/ && \
    # パッチ用の設定ファイルをコピーして、7.2.10をあてる
    cp $INSTALL_FOLDER/patch/response_file $INSTALL_FOLDER/im_wpaf72_patch10/ && \
    java -jar $INSTALL_FOLDER/im_wpaf72_patch10/setup.jar -f response_file && \
    # 7.2.10の緊急パッチをあてる
    cp -rf $INSTALL_FOLDER/patch10_20160715/ApplicationRuntime/* $imart && \
    cp -rf $INSTALL_FOLDER/patch10_20160715/ResourceService/* $imart && \ 
    # IM-Workflow本体のインストール
    java -jar $INSTALL_FOLDER/im_workflow/setup.jar -f response_file && \
    # IM-Workflowパッチをあてる
    cp $INSTALL_FOLDER/im_workflow/response_file $INSTALL_FOLDER/im_workflow72_patch11/ && \
    java -jar $INSTALL_FOLDER/im_workflow72_patch11/setup.jar -f response_file && \ 

    # web.xmlの修正 IE11対応(HTTPのHeaderをIE=9にするアレ)
    $INSTALL_FOLDER/mod_webapp.sh && \
    chmod +x $imart/bin/*.sh && \
    # 不要なファイルを消しておく
    rm -rf /tmp/* 

WORKDIR $imart

CMD ["java", "-cp", "/imart/bin/imart.jar", "-Xms16m", "-Xmx128m", "jp.co.intra_mart.bin.server.ServerController", "-lonely"]

EXPOSE 8080

# ビルド&起動方法例

ビルド

docker build -t iwp:7.2 .

起動

docker run --rm --name hogehoge iwp:7.2

とすると、コンソールにこんな感じで出ることが確認できると思います。

[INFO] j.c.i.f.s.l.LogManager - [J2EE][Log]Successed to create LogManager.
[INFO] j.c.i.f.b.s.ServiceManager - [J2EE][Service]Successed to create container. - jp.co.intra_mart.framework.base.service.container.ServiceContainerImpl
[INFO] j.c.i.f.b.s.ServiceManager - [J2EE][Service]Successed to create ServiceManager.
[INFO] o.a.s.a.ActionServlet - Loading chain catalog from jar:file:/imart/doc/imart/WEB-INF/lib/struts-core-1.3.8.jar!/org/apache/struts/chain/chain-config.xml
[INFO] c.c.s.w.WebApp - WebApp[http://localhost:8080/imart] active
[INFO] c.c.s.h.Host - Host[] active
[INFO] c.c.v.JniServerSocketImpl - Socket JNI library is not available.
Resin will still run but performance will be slower.
To compile the Socket JNI library on Unix, use ./configure; make; make install.
[INFO] c.c.s.p.Port - hmux listening to localhost:6800
[INFO] c.c.s.p.Port - http listening to *:8080
[INFO] c.c.s.c.Server - Server[id=APP:localhost:8080,cluster=app-tier] active
[INFO] c.c.s.r.Resin - Resin started in 19692ms

システムの管理者画面からライセンスを開くと、期待したバージョンで構築されていることが確認できます。

システム管理者のメイン画面.png

参考

mod_webapp.shの中身

web-appの閉じタグの前に、所定の文字列をぶち込んでいるだけ。

#/bin/bash

sed -i 's#\(^</web-app>\)#<filter>             <filter-name>UserAgentDetectedResponseHeaderAddingFilter</filter-name>            <filter-class>jp.co.intra_mart.common.aid.jsdk.javax.servlet.filter.UserAgentDetectedResponseHeaderAddingFilter</filter-class>            <init-param>                <param-name>header-field-name</param-name>                <param-value>X-UA-Compatible</param-value>            </init-param>            <init-param>                <param-name>\.\*\(\((MSIE\) \[1-9\]\[0-9\]\)\|\(\(rv:\)\[1-9\]\[0-9\]\)\)\.\*</param-name>                <param-value>IE=EmulateIE9,requiresActiveX=true</param-value>            </init-param>        </filter>        <filter-mapping>            <filter-name>UserAgentDetectedResponseHeaderAddingFilter</filter-name>            <url-pattern>/\*</url-pattern>            <dispatcher>REQUEST</dispatcher>        </filter-mapping>\1#g' ${imart}/doc/imart/WEB-INF/web.xml

4
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
6