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

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


The following commit(s) were added to refs/heads/trunk by this push:
     new 14d0ded04f Fixed: Container initialisation now run hook scripts 
(OFBIZ-12784)
14d0ded04f is described below

commit 14d0ded04fd169f56a009905def88ab413ed7137
Author: Daniel Watford <dan...@watfordconsulting.com>
AuthorDate: Sun Mar 26 21:44:54 2023 +0100

    Fixed: Container initialisation now run hook scripts (OFBIZ-12784)
---
 docker/docker-entrypoint.sh                                    | 10 +++++-----
 .../postgres-demo/after-config-applied.d/applySolrConfig.sh    |  7 +++++++
 docker/examples/postgres-demo/docker-compose.yml               |  4 ++++
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh
index 4310c7aa04..33dc7b5306 100755
--- a/docker/docker-entrypoint.sh
+++ b/docker/docker-entrypoint.sh
@@ -54,7 +54,7 @@
 # OFBIZ_CONTENT_URL_PREFIX
 # Used to set the content.url.prefix.secure and content.url.prefix.standard 
properties in
 # framework/webapp/config/url.properties.
-# Default: <empty>>
+# Default: <empty>
 #
 # OFBIZ_ENABLE_AJP_PORT
 # Enable the AJP (Apache JServe Protocol) port to allow communication with 
OFBiz via a reverse proxy.
@@ -192,7 +192,7 @@ run_init_hooks() {
 # If required, load data into OFBiz.
 load_data() {
   if [ ! -f "$CONTAINER_DATA_LOADED" ]; then
-    run_init_hooks /docker-entrypoint-hooks/before-data-load.d/*
+    run_init_hooks before-data-load 
/docker-entrypoint-hooks/before-data-load.d/*
 
     case "$OFBIZ_DATA_LOAD" in
     none) ;;
@@ -215,7 +215,7 @@ load_data() {
 
     touch "$CONTAINER_DATA_LOADED"
 
-    run_init_hooks /docker-entrypoint-hooks/after-data-load.d/*
+    run_init_hooks after-data-load /docker-entrypoint-hooks/after-data-load.d/*
   fi
 }
 
@@ -294,7 +294,7 @@ disable_components() {
 # in the classpath and override the build-time copies of the properties in 
ofbiz.jar.
 apply_configuration() {
   if [ ! -f "$CONTAINER_CONFIG_APPLIED" ]; then
-    run_init_hooks /docker-entrypoint-hooks/before-config-applied.d/*
+    run_init_hooks before-config-applied 
/docker-entrypoint-hooks/before-config-applied.d/*
 
     if [ -n "$OFBIZ_ENABLE_AJP_PORT" ]; then
       # Configure tomcat to listen for AJP connections on all interfaces 
within the container.
@@ -320,7 +320,7 @@ apply_configuration() {
     fi
 
     touch "$CONTAINER_CONFIG_APPLIED"
-    run_init_hooks /docker-entrypoint-hooks/after-config-applied.d/*
+    run_init_hooks after-config-applied 
/docker-entrypoint-hooks/after-config-applied.d/*
   fi
 }
 
diff --git 
a/docker/examples/postgres-demo/after-config-applied.d/applySolrConfig.sh 
b/docker/examples/postgres-demo/after-config-applied.d/applySolrConfig.sh
new file mode 100644
index 0000000000..7ee4ad2857
--- /dev/null
+++ b/docker/examples/postgres-demo/after-config-applied.d/applySolrConfig.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/docker/examples/postgres-demo/docker-compose.yml 
b/docker/examples/postgres-demo/docker-compose.yml
index 34a5283d02..65d8b94ce2 100644
--- a/docker/examples/postgres-demo/docker-compose.yml
+++ b/docker/examples/postgres-demo/docker-compose.yml
@@ -20,7 +20,11 @@ services:
     cpu_shares: 200
     ports:
       - 8443:8443
+    volumes:
+      - 
./after-config-applied.d:/docker-entrypoint-hooks/after-config-applied.d
     env_file:
       - ofbiz-postgres.env
     environment:
       OFBIZ_DATA_LOAD: demo
+      OFBIZ_HOST: example.internal
+      OFBIZ_CONTENT_URL_PREFIX: https://example.internal:8443

Reply via email to