This is an automated email from the ASF dual-hosted git repository.

danwatford pushed a commit to branch docker-experimental
in repository https://gitbox.apache.org/repos/asf/ofbiz-tools.git


The following commit(s) were added to refs/heads/docker-experimental by this 
push:
     new e70340e  Added: OFBiz docker instance with Postgres (OFBIZ-12757)
e70340e is described below

commit e70340e51ab2cb5d28d699617cc94478bac2128b
Author: Daniel Watford <dan...@watfordconsulting.com>
AuthorDate: Sat Mar 4 15:44:44 2023 +0000

    Added: OFBiz docker instance with Postgres (OFBIZ-12757)
    
    Added https://exp3.ofbiz.apache.org site which consists of a OFBiz
    docker container paired with a PostgreSQL database container.
    
    The OFBiz container is configured to load demo data.
---
 .../home/ofbizdocker/exp3/docker-compose.yml       | 28 ++++++++++++++++++++++
 .../home/ofbizdocker/exp3/ofbiz-postgres.env       | 13 ++++++++++
 .../exp3/postgres-initdb.d/10-init-user-db.sh      | 16 +++++++++++++
 .../ofbizdocker/home/ofbizdocker/exp3/postgres.env |  2 ++
 .../home/ofbizdocker/pull-and-restart.sh           |  8 +++++++
 5 files changed, 67 insertions(+)

diff --git a/demo-backup/ofbizdocker/home/ofbizdocker/exp3/docker-compose.yml 
b/demo-backup/ofbizdocker/home/ofbizdocker/exp3/docker-compose.yml
new file mode 100644
index 0000000..c10ac10
--- /dev/null
+++ b/demo-backup/ofbizdocker/home/ofbizdocker/exp3/docker-compose.yml
@@ -0,0 +1,28 @@
+version: "2.4"
+
+services:
+  db:
+    image: postgres:13
+    mem_limit: 300M
+    memswap_limit: 300M
+    cpu_shares: 200
+    restart: "no"
+    volumes:
+      - ./postgres-initdb.d:/docker-entrypoint-initdb.d
+    env_file:
+      - postgres.env
+      - ofbiz-postgres.env
+
+  ofbiz:
+    image: ghcr.io/apache/ofbiz:experimental-docker-branch-snapshot
+    mem_limit: 1600M
+    memswap_limit: 1600M
+    cpu_shares: 200
+    ports:
+      - 127.0.0.1:58009:8009
+    env_file:
+      - ofbiz-postgres.env
+    environment:
+      OFBIZ_HOST: exp3.ofbiz.apache.org
+      OFBIZ_ENABLE_AJP_PORT: 1
+      OFBIZ_DATA_LOAD: demo
diff --git a/demo-backup/ofbizdocker/home/ofbizdocker/exp3/ofbiz-postgres.env 
b/demo-backup/ofbizdocker/home/ofbizdocker/exp3/ofbiz-postgres.env
new file mode 100644
index 0000000..682126e
--- /dev/null
+++ b/demo-backup/ofbizdocker/home/ofbizdocker/exp3/ofbiz-postgres.env
@@ -0,0 +1,13 @@
+OFBIZ_POSTGRES_HOST=db
+
+OFBIZ_POSTGRES_OFBIZ_DB=ofbizmaindb
+OFBIZ_POSTGRES_OFBIZ_USER=ofbiz
+OFBIZ_POSTGRES_OFBIZ_PASSWORD="Ab6SqDD2YM2lmEsvao-"
+
+OFBIZ_POSTGRES_OLAP_DB=ofbizolapdb
+OFBIZ_POSTGRES_OLAP_USER=ofbizolap
+OFBIZ_POSTGRES_OLAP_PASSWORD="P7TFUtQHSuvha8gSxMME"
+
+OFBIZ_POSTGRES_TENANT_DB=ofbiztenantdb
+OFBIZ_POSTGRES_TENANT_USER=ofbiztenant
+OFBIZ_POSTGRES_TENANT_PASSWORD="4oXET73QGriblUejjbvR"
diff --git 
a/demo-backup/ofbizdocker/home/ofbizdocker/exp3/postgres-initdb.d/10-init-user-db.sh
 
b/demo-backup/ofbizdocker/home/ofbizdocker/exp3/postgres-initdb.d/10-init-user-db.sh
new file mode 100644
index 0000000..3a91a85
--- /dev/null
+++ 
b/demo-backup/ofbizdocker/home/ofbizdocker/exp3/postgres-initdb.d/10-init-user-db.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+set -e
+
+psql -v ON_ERROR_STOP=1 --username "postgres" --dbname "postgres" <<-EOSQL
+    CREATE USER $OFBIZ_POSTGRES_OFBIZ_USER WITH PASSWORD 
'$OFBIZ_POSTGRES_OFBIZ_PASSWORD';
+    CREATE DATABASE $OFBIZ_POSTGRES_OFBIZ_DB;
+    GRANT ALL PRIVILEGES ON DATABASE $OFBIZ_POSTGRES_OFBIZ_DB TO 
$OFBIZ_POSTGRES_OFBIZ_USER;
+
+    CREATE USER $OFBIZ_POSTGRES_OLAP_USER WITH PASSWORD 
'$OFBIZ_POSTGRES_OLAP_PASSWORD';
+    CREATE DATABASE $OFBIZ_POSTGRES_OLAP_DB;
+    GRANT ALL PRIVILEGES ON DATABASE $OFBIZ_POSTGRES_OLAP_DB TO 
$OFBIZ_POSTGRES_OLAP_USER;
+
+    CREATE USER $OFBIZ_POSTGRES_TENANT_USER WITH PASSWORD 
'$OFBIZ_POSTGRES_TENANT_PASSWORD';
+    CREATE DATABASE $OFBIZ_POSTGRES_TENANT_DB;
+    GRANT ALL PRIVILEGES ON DATABASE $OFBIZ_POSTGRES_TENANT_DB TO 
$OFBIZ_POSTGRES_TENANT_USER;
+EOSQL
diff --git a/demo-backup/ofbizdocker/home/ofbizdocker/exp3/postgres.env 
b/demo-backup/ofbizdocker/home/ofbizdocker/exp3/postgres.env
new file mode 100644
index 0000000..c8b98d6
--- /dev/null
+++ b/demo-backup/ofbizdocker/home/ofbizdocker/exp3/postgres.env
@@ -0,0 +1,2 @@
+# Mandatory environment variable to set the password of the postgres superuser.
+POSTGRES_PASSWORD="20wganpfDASBtBXY7GQ6"
\ No newline at end of file
diff --git a/demo-backup/ofbizdocker/home/ofbizdocker/pull-and-restart.sh 
b/demo-backup/ofbizdocker/home/ofbizdocker/pull-and-restart.sh
index 525c029..0d40d3e 100644
--- a/demo-backup/ofbizdocker/home/ofbizdocker/pull-and-restart.sh
+++ b/demo-backup/ofbizdocker/home/ofbizdocker/pull-and-restart.sh
@@ -21,3 +21,11 @@ docker compose pull
 docker compose up --detach
 popd
 echo Exp2 docker-compose application restarted.
+
+echo Restarting exp3 docker-compose application with latest container images.
+pushd exp3
+docker compose down --volumes
+docker compose pull
+docker compose up --detach
+popd
+echo Exp3 docker-compose application restarted.

Reply via email to