概要
JS7 jobscheduler x PostgreSQL で手っ取り早く触りたい人向け
docker-composeでの実行方法
DBの違い以外は、基本的にはこちらと同じ内容です。
JS7® JobScheduler docker-compose で起動(MySQL版)
準備
必要なファイル、ディレクトリを準備します。
docker-compose.yml
docker-compose.yml
version: '3'
services:
db:
image: postgres:15-alpine
volumes:
- db_data:/var/lib/postgresql/data
ports:
- "5432:5432"
networks:
- js7network
environment:
POSTGRES_INITDB_ARGS: "--encoding=UTF-8 --locale=ja_JP.UTF-8"
POSTGRES_USER: js7user
POSTGRES_PASSWORD: js7password
POSTGRES_DB: js7db
restart: "no"
js7-joc-primary:
depends_on:
- db
image: sosberlin/js7:joc-${JS7VERSION}
hostname: js7-joc-primary
ports:
- "4446:4446"
volumes:
- js7-joc-primary-config:/var/sos-berlin.com/js7/joc/resources/joc
- js7-joc-primary-logs:/var/log/sos-berlin.com/js7/joc
networks:
- js7network
environment:
RUN_JS_JAVA_OPTIONS: -Xmx256m
RUN_JS_USER_ID: "${JS7USERID}:${JS7GROUPID}"
restart: "no"
js7-controller-primary:
image: sosberlin/js7:controller-${JS7VERSION}
hostname: js7-controller-primary
volumes:
- js7-controller-primary:/var/sos-berlin.com/js7/controller
networks:
- js7network
environment:
RUN_JS_JAVA_OPTIONS: -Xmx256m
RUN_JS_USER_ID: "${JS7USERID}:${JS7GROUPID}"
restart: "no"
js7-agent-primary:
image: sosberlin/js7:agent-${JS7VERSION}
hostname: js7-agent-primary
volumes:
- js7-agent-primary:/var/sos-berlin.com/js7/agent/
networks:
- js7network
environment:
RUN_JS_JAVA_OPTIONS: -Xmx256m
RUN_JS_USER_ID: "${JS7USERID}:${JS7GROUPID}"
restart: "no"
volumes:
db_data:
driver: local
driver_opts:
type: none
device: ${PWD}/db_data
o: bind
js7-joc-primary-config:
driver: local
driver_opts:
type: none
device: ${PWD}/js7-joc-primary-config
o: bind
js7-joc-primary-logs:
driver: local
driver_opts:
type: none
device: ${PWD}/js7-joc-primary-logs
o: bind
js7-controller-primary:
driver: local
driver_opts:
type: none
device: ${PWD}/js7-controller-primary
o: bind
js7-agent-primary:
driver: local
driver_opts:
type: none
device: ${PWD}/js7-agent-primary
o: bind
networks:
js7network:
hibernate.cfg.xml
hibernate.cfg.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<property name="hibernate.connection.password">js7password</property>
<property name="hibernate.connection.url">jdbc:postgresql://db:5432/js7db</property>
<property name="hibernate.connection.username">js7user</property>
<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="hibernate.show_sql">false</property>
<property name="hibernate.connection.autocommit">false</property>
<property name="hibernate.format_sql">true</property>
<property name="hibernate.temp.use_jdbc_metadata_defaults">false</property>
<property name="hibernate.connection.provider_class">org.hibernate.hikaricp.internal.HikariCPConnectionProvider</property>
<property name="hibernate.hikari.maximumPoolSize">10</property>
</session-factory>
</hibernate-configuration>
.env
(環境変数用) ※バージョンは任意
echo -e "JS7USERID=$(id -u)\nJS7GROUPID=$(id -g)\nJS7VERSION=2-5-2" > .env
# 確認
cat .env
JS7USERID=1000
JS7GROUPID=1000
JS7VERSION=2-5-2
ディレクトリ作成
mkdir db_data
mkdir js7-agent-primary
mkdir js7-controller-primary
mkdir js7-joc-primary-config
mkdir js7-joc-primary-logs
ここまでで、下記のような構成になります。
.
├── .env
├── db_data
├── docker-compose.yml
├── hibernate.cfg.xml
├── js7-agent-primary
├── js7-controller-primary
├── js7-joc-primary-config
└── js7-joc-primary-logs
コンテナ起動
まずコンテナを起動
$ docker compose up -d
# 確認
$ docker compose ps
NAME COMMAND SERVICE STATUS PORTS
js7-db-1 "docker-entrypoint.s…" db running 33060/tcp
js7-js7-agent-primary-1 "sh /usr/local/bin/e…" js7-agent-primary running
js7-js7-controller-primary-1 "sh /usr/local/bin/e…" js7-controller-primary running
js7-js7-joc-primary-1 "sh /usr/local/bin/e…" js7-joc-primary running
hibernate.cfg.xml
をVolumeマウント先に上書きコピー (インストール時に使用します)
cp -f hibernate.cfg.xml js7-joc-primary-config/
js7-joc-primary にて 上記ファイルを指定してインストール
docker compose exec js7-joc-primary /bin/sh -c /opt/sos-berlin.com/js7/joc/install/joc_install_tables.sh
# ログ確認 ※ver 2.5.2 では出力されない
tail js7-joc-primary-logs/install-result.log
# js7-joc-primary のみ再起動
docker compose restart js7-joc-primary
動作チェック
あとは、ブラウザで js7-joc-primary にて指定したポート番号にアクセスしてください。
http://localhost:4446/
※初期ユーザーは Account: root / password: root です
以降はこちらと全く同じ内容となりますので、こちらをご覧ください。
JS7® JobScheduler docker-compose で起動(MySQL版)