This is an automated email from the ASF dual-hosted git repository. danwatford pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/ofbiz-tools.git
The following commit(s) were added to refs/heads/master by this push: new 28b7d5f Implemented: Use container deployment for demo-next site (OFBIZ-12798) 28b7d5f is described below commit 28b7d5fdc626801a5a4498008cb981db9c429d08 Author: Daniel Watford <d...@foomoo.co.uk> AuthorDate: Wed Apr 12 07:47:52 2023 +0100 Implemented: Use container deployment for demo-next site (OFBIZ-12798) --- demo-backup/all-manual.sh | 5 ++-- demo-backup/ofbizdocker/README.md | 6 +++-- .../after-config-applied.d/apply-fop-config.sh | 9 +++++++ .../after-config-applied.d/apply-solr-config.sh | 7 +++++ .../after-config-applied.d/fop-xconf-update.xslt | 10 +++++++ .../home/ofbizdocker/demo-next/docker-compose.yml | 31 ++++++++++++++++++++++ .../home/ofbizdocker/demo-next/ofbiz-postgres.env | 13 +++++++++ .../demo-next/postgres-initdb.d/10-init-user-db.sh | 16 +++++++++++ .../home/ofbizdocker/demo-next/postgres.env | 2 ++ .../home/ofbizdocker/pull-and-restart.sh | 2 +- 10 files changed, 96 insertions(+), 5 deletions(-) diff --git a/demo-backup/all-manual.sh b/demo-backup/all-manual.sh index 4c185a4..08d1e23 100755 --- a/demo-backup/all-manual.sh +++ b/demo-backup/all-manual.sh @@ -1,7 +1,8 @@ #!/bin/sh -# Trunk deployments by the ofbizDemo user have been disabled in favour of container deployments +# Trunk and next deployments by the ofbizDemo user have been disabled in favour of container deployments # by the ofbizdocker user. See /home/ofbizdocker/README.md # ./trunk.sh -./next-manual.sh +#./next-manual.sh + ./stable-manual.sh diff --git a/demo-backup/ofbizdocker/README.md b/demo-backup/ofbizdocker/README.md index 1b669b5..3c042e2 100644 --- a/demo-backup/ofbizdocker/README.md +++ b/demo-backup/ofbizdocker/README.md @@ -1,7 +1,7 @@ # Docker deployments of OFBiz -As part of OFBIZ-12757 and OFBIZ-12786, docker deployments are being carried on VM ofbiz-vm1.apache.org for the -demo-trunk site. +As part of OFBIZ-12757, OFBIZ-12786 and OFBIZ-12798, docker deployments are being carried on VM ofbiz-vm1.apache.org for the +demo-trunk and demo-next sites. Work under OFBIZ-12757 also created 3 experimental sites: * exp1.ofbiz.apache.org @@ -33,6 +33,8 @@ The `pull-and-restart.sh` script does the following: The `demo-trunk` application listens on AJP port 8009. +The `demo-next` application listens on AJP port 28009. + If in use, the `exp1` application listens on AJP port 38009, the `exp2` application listens on AJP port 48009, and the `exp3` application listens on AJP port 58009. The Apache server on ofbiz-vm1.apache.org has been configured to reverse-proxy to these applications for hostnames exp1.ofbiz.apache.org, exp2.ofbiz.apache.org and exp3.ofbiz.apache.org respectively. diff --git a/demo-backup/ofbizdocker/home/ofbizdocker/demo-next/after-config-applied.d/apply-fop-config.sh b/demo-backup/ofbizdocker/home/ofbizdocker/demo-next/after-config-applied.d/apply-fop-config.sh new file mode 100644 index 0000000..644baf4 --- /dev/null +++ b/demo-backup/ofbizdocker/home/ofbizdocker/demo-next/after-config-applied.d/apply-fop-config.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +set -x + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" +FOP_XML_FILE="/ofbiz/framework/webapp/config/fop.xconf" +TMPFILE=$(mktemp) + +xsltproc --output "$TMPFILE" "$SCRIPT_DIR/fop-xconf-update.xslt" "$FOP_XML_FILE" +mv "$TMPFILE" "$FOP_XML_FILE" diff --git a/demo-backup/ofbizdocker/home/ofbizdocker/demo-next/after-config-applied.d/apply-solr-config.sh b/demo-backup/ofbizdocker/home/ofbizdocker/demo-next/after-config-applied.d/apply-solr-config.sh new file mode 100644 index 0000000..0b10bc5 --- /dev/null +++ b/demo-backup/ofbizdocker/home/ofbizdocker/demo-next/after-config-applied.d/apply-solr-config.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +set -x + +if [ -d /ofbiz/plugins/solr ]; then + sed "s/^solr.webapp.domainName=.*/solr.webapp.domainName=${OFBIZ_HOST}/" \ + /ofbiz/plugins/solr/config/solrconfig.properties > /ofbiz/config/solrconfig.properties +fi diff --git a/demo-backup/ofbizdocker/home/ofbizdocker/demo-next/after-config-applied.d/fop-xconf-update.xslt b/demo-backup/ofbizdocker/home/ofbizdocker/demo-next/after-config-applied.d/fop-xconf-update.xslt new file mode 100644 index 0000000..a5467ef --- /dev/null +++ b/demo-backup/ofbizdocker/home/ofbizdocker/demo-next/after-config-applied.d/fop-xconf-update.xslt @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:template match="/fop"> + <xsl:element name="fop"> + <xsl:copy-of select="@*"/> + <base>https://demo-next.ofbiz.apache.org</base> + <xsl:copy-of select="node()[not(self::base)]"/> + </xsl:element> + </xsl:template> +</xsl:stylesheet> diff --git a/demo-backup/ofbizdocker/home/ofbizdocker/demo-next/docker-compose.yml b/demo-backup/ofbizdocker/home/ofbizdocker/demo-next/docker-compose.yml new file mode 100644 index 0000000..7b37667 --- /dev/null +++ b/demo-backup/ofbizdocker/home/ofbizdocker/demo-next/docker-compose.yml @@ -0,0 +1,31 @@ +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:release22.01-plugins-snapshot + mem_limit: 2400M + memswap_limit: 2400M + cpu_shares: 200 + ports: + - 127.0.0.1:28009:8009 + volumes: + - ./after-config-applied.d:/docker-entrypoint-hooks/after-config-applied.d + env_file: + - ofbiz-postgres.env + environment: + OFBIZ_HOST: demo-next.ofbiz.apache.org + OFBIZ_ENABLE_AJP_PORT: 1 + OFBIZ_DATA_LOAD: demo + OFBIZ_CONTENT_URL_PREFIX: https://demo-next.ofbiz.apache.org diff --git a/demo-backup/ofbizdocker/home/ofbizdocker/demo-next/ofbiz-postgres.env b/demo-backup/ofbizdocker/home/ofbizdocker/demo-next/ofbiz-postgres.env new file mode 100644 index 0000000..9d713da --- /dev/null +++ b/demo-backup/ofbizdocker/home/ofbizdocker/demo-next/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="CHANGEME" + +OFBIZ_POSTGRES_OLAP_DB=ofbizolapdb +OFBIZ_POSTGRES_OLAP_USER=ofbizolap +OFBIZ_POSTGRES_OLAP_PASSWORD="CHANGEME" + +OFBIZ_POSTGRES_TENANT_DB=ofbiztenantdb +OFBIZ_POSTGRES_TENANT_USER=ofbiztenant +OFBIZ_POSTGRES_TENANT_PASSWORD="CHANGEME" diff --git a/demo-backup/ofbizdocker/home/ofbizdocker/demo-next/postgres-initdb.d/10-init-user-db.sh b/demo-backup/ofbizdocker/home/ofbizdocker/demo-next/postgres-initdb.d/10-init-user-db.sh new file mode 100644 index 0000000..3a91a85 --- /dev/null +++ b/demo-backup/ofbizdocker/home/ofbizdocker/demo-next/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/demo-next/postgres.env b/demo-backup/ofbizdocker/home/ofbizdocker/demo-next/postgres.env new file mode 100644 index 0000000..d86bdb9 --- /dev/null +++ b/demo-backup/ofbizdocker/home/ofbizdocker/demo-next/postgres.env @@ -0,0 +1,2 @@ +# Mandatory environment variable to set the password of the postgres superuser. +POSTGRES_PASSWORD="CHANGEME" diff --git a/demo-backup/ofbizdocker/home/ofbizdocker/pull-and-restart.sh b/demo-backup/ofbizdocker/home/ofbizdocker/pull-and-restart.sh index 12d485d..588b3f8 100755 --- a/demo-backup/ofbizdocker/home/ofbizdocker/pull-and-restart.sh +++ b/demo-backup/ofbizdocker/home/ofbizdocker/pull-and-restart.sh @@ -6,7 +6,7 @@ set -e cd /home/ofbizdocker -for appDir in demo-trunk exp1 exp2 exp3; do +for appDir in demo-trunk demo-next exp1 exp2 exp3; do echo "Restarting $appDir docker-compose application with latest container images." pushd "$appDir" docker compose pull