diff --git a/docker-dev.cfg b/docker-dev.cfg
index 0ff1757..2e55480 100644
--- a/docker-dev.cfg
+++ b/docker-dev.cfg
@@ -1,6 +1,7 @@
[buildout]
parts +=
instance
+ instance-cron
parts -=
instance2
instance3
@@ -22,12 +23,6 @@ zope-conf-additional =
bind 0.0.0.0:${port:instance1-monitor}
${zope-conf:additional}
-
- method /${port:plone-path}/@@cron-tick
- period 3600
- user admin
- password ${port:admin-password}
-
${zope-conf:zamqp}
environment-vars -=
OO_PORT ${port:oo-port}
@@ -43,6 +38,19 @@ blob-storage = /data/blobstorage
environment-vars =
ZC_ASYNC_UUID /data/async-uuid.txt
+[instance-cron]
+<= instance
+http-address = 8087
+zope-conf-additional =
+ ${zope-conf:additional}
+
+ method /${port:plone-path}/@@cron-tick
+ period 3600
+ user admin
+ password ${port:admin-password}
+
+ ${zope-conf:zamqp}
+
environment-vars += ${bigbang:environment-vars}
[instance-debug]
diff --git a/docker/docker-compose-dev.yml b/docker/docker-compose-dev.yml
index 6d697f9..5cfdc50 100644
--- a/docker/docker-compose-dev.yml
+++ b/docker/docker-compose-dev.yml
@@ -17,7 +17,6 @@ services:
mem_limit: 500M
mem_reservation: 150M
mem_swappiness: 0
-
zeo:
image: imiobe/iadelib:dev
command: zeoserver
@@ -33,7 +32,6 @@ services:
SERVICE_NAME: "zeo"
healthcheck:
test: "/plone/zeo_healthcheck.sh"
-
instance:
image: imiobe/iadelib:dev
command: instance
@@ -45,13 +43,13 @@ services:
depends_on:
- zeo
- libreoffice
+ - worker-cron
environment:
- ZEO_CLIENT_CACHE_SIZE=1000MB
- ZODB_CACHE_SIZE=100000
- CLUSTER=iadelib_pm42
- HOSTNAME=instance1
- PLONE_PATH=demo
- - ADMIN_PASSWORD=test
volumes:
- ./data/:/data
- tmp:/tmp
@@ -60,7 +58,32 @@ services:
test: "curl -f localhost:8081/$$PLONE_PATH/@@ok"
labels:
SERVICE_NAME: "instance1"
-
+ worker-cron:
+ image: imiobe/iadelib:dev
+ command: instance-cron
+ ports:
+ - "8087:8087"
+ networks:
+ - delib_internal
+ - delib_external
+ depends_on:
+ - zeo
+ environment:
+ - ZEO_CLIENT_CACHE_SIZE=1000MB
+ - ZODB_CACHE_SIZE=100000
+ - ADMIN_PASSWORD=test
+ - PUBLIC_URL=http://localhost/PM
+ - PLONE_PATH=demo
+ - CLUSTER=iadelib_pm42
+ - HOSTNAME=worker-cron
+ volumes:
+ - ./data/:/data
+ - tmp:/tmp
+ - vartmp:/var/tmp
+ healthcheck:
+ test: "curl -f localhost:8087/$$PLONE_PATH/@@ok"
+ labels:
+ SERVICE_NAME: "worker-cron"
worker-async:
image: imiobe/iadelib:dev
command: instance-async
@@ -69,6 +92,7 @@ services:
depends_on:
- zeo
- libreoffice
+ - worker-cron
environment:
- ZEO_CLIENT_CACHE_SIZE=1000MB
- ZODB_CACHE_SIZE=100000
@@ -83,7 +107,39 @@ services:
- vartmp:/var/tmp
labels:
SERVICE_NAME: "worker-async"
-
+# worker-amqp:
+# image: imiobe/iadelib:dev
+# command: instance-amqp
+# ports:
+# - "20085:8286"
+# networks:
+# - delib_internal
+# - delib_external
+# depends_on:
+# - zeo
+# - worker-cron
+# environment:
+# - ZEO_CLIENT_CACHE_SIZE=1000MB
+# - ZODB_CACHE_SIZE=100000
+# - CLUSTER=iadelib_pm42
+# - PLONE_PATH=demo
+# - MQ_CLIENT_ID
+# - MQ_WS_URL
+# - MQ_WS_LOGIN
+# - MQ_WS_PASSWORD
+# - MQ_HOST
+# - MQ_PORT
+# - MQ_LOGIN
+# - MQ_PASSWORD
+# - HOSTNAME=worker-amqp
+# healthcheck:
+# test: "curl -f localhost:8286/$$PLONE_PATH/@@ok"
+# volumes:
+# - ./data/:/data
+# - tmp:/tmp
+# - vartmp:/var/tmp
+# labels:
+# SERVICE_NAME: "worker-cron"
maintenance:
image: imiobe/iadelib:dev
ports:
@@ -110,7 +166,6 @@ services:
- vartmp:/var/tmp
labels:
SERVICE_NAME: "maintenance"
-
volumes:
tmp:
vartmp:
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
index 087643b..8a7c307 100644
--- a/docker/docker-compose.yml
+++ b/docker/docker-compose.yml
@@ -46,13 +46,13 @@ services:
depends_on:
- zeo
- libreoffice
+ - worker-cron
environment:
- ZEO_CLIENT_CACHE_SIZE=1000MB
- ZODB_CACHE_SIZE=100000
- CLUSTER=iadelib_pm42
- HOSTNAME=instance1
- PLONE_PATH=demo
- - ADMIN_PASSWORD=test
volumes:
- ./data:/data
- tmp:/tmp
@@ -62,6 +62,33 @@ services:
labels:
SERVICE_NAME: "instance1"
+ worker-cron:
+ image: imiobe/iadelib:latest
+ command: instance-cron
+ ports:
+ - "8087:8087"
+ networks:
+ - delib_internal
+ - delib_external
+ depends_on:
+ - zeo
+ environment:
+ - ZEO_CLIENT_CACHE_SIZE=1000MB
+ - ZODB_CACHE_SIZE=100000
+ - ADMIN_PASSWORD=test
+ - PUBLIC_URL=http://localhost/PM
+ - PLONE_PATH=demo
+ - CLUSTER=iadelib_pm42
+ - HOSTNAME=worker-cron
+ volumes:
+ - ./data:/data
+ - tmp:/tmp
+ - vartmp:/var/tmp
+ healthcheck:
+ test: "curl -f localhost:8087/$$PLONE_PATH/@@ok"
+ labels:
+ SERVICE_NAME: "worker-cron"
+
worker-async:
image: imiobe/iadelib:latest
command: instance-async
@@ -95,6 +122,7 @@ services:
- delib_external
depends_on:
- zeo
+ - worker-cron
environment:
- ZEO_CLIENT_CACHE_SIZE=1000MB
- ZODB_CACHE_SIZE=100000
@@ -116,7 +144,7 @@ services:
- tmp:/tmp
- vartmp:/var/tmp
labels:
- SERVICE_NAME: "worker-amqp"
+ SERVICE_NAME: "worker-cron"
maintenance:
image: imiobe/iadelib:latest
@@ -128,6 +156,7 @@ services:
depends_on:
- zeo
- libreoffice
+ - worker-cron
environment:
- ZEO_CLIENT_CACHE_SIZE=1000MB
- ZODB_CACHE_SIZE=100000
diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh
index 5be998f..86a756e 100755
--- a/docker/docker-entrypoint.sh
+++ b/docker/docker-entrypoint.sh
@@ -10,6 +10,31 @@ function setup() {
fi
chmod 777 /data/*
}
+function wait_for_cron() {
+ echo "Waiting for cron"
+ URL="worker-cron:8087/$PLONE_PATH"
+ CURL="curl --write-out %{http_code} -so /dev/null $URL/@@ok"
+ MAX_TRIES=50
+ INTERVAL=5
+ set +e
+ SECONDS=0
+ response="404"
+ tries=0
+ while [[ $response != "200" && $tries -lt $MAX_TRIES ]]
+ do
+ sleep $INTERVAL
+ echo "Waiting for cron"
+ response=$($CURL)
+ ((tries+=1))
+ done
+ set -e
+ if [[ $tries == "$MAX_TRIES" ]]; then
+ echo "Failed to reach $URL after $SECONDS s"
+ exit 1
+ else
+ echo "$URL is up. Waited $SECONDS s"
+ fi
+}
function start() {
echo "Starting $1"
cmd="bin/$1"
@@ -36,6 +61,11 @@ function start() {
setup "$1"
+PRIORIY="instance-cron instance-debug maintenance script zeoserver"
+if [[ "instance" == "$1" || ( ! $PRIORIY == *"$1"* && $# -gt 0 ) ]]; then
+ wait_for_cron "$1"
+fi
+
case "$1" in
"")
exit 0
diff --git a/docker/docker-initialize.py b/docker/docker-initialize.py
index 7c8d5fb..8158eec 100644
--- a/docker/docker-initialize.py
+++ b/docker/docker-initialize.py
@@ -28,6 +28,7 @@ def __init__(
self.instance1_conf = '/plone/parts/instance/etc/zope.conf'
self.instance_amqp_conf = '/plone/parts/instance-amqp/etc/zope.conf'
self.instance_async_conf = '/plone/parts/instance-async/etc/zope.conf'
+ self.instance_cron_conf = '/plone/parts/instance-cron/etc/zope.conf'
self.instance_debug_conf = '/plone/parts/instance-debug/etc/zope.conf'
self.zeoserver_conf = '/plone/parts/zeoserver/etc/zeo.conf'
@@ -83,9 +84,10 @@ def _fix_amqp(self, path):
def fixtures(self):
""" ZEO Client
"""
- self._fix_conf(self.instance1_conf, True)
+ self._fix_conf(self.instance1_conf, False)
self._fix_conf(self.instance_async_conf, False)
self._fix_conf(self.instance_amqp_conf, False)
+ self._fix_conf(self.instance_cron_conf, True)
# instance debug doesn't exist in dev env
if os.path.exists(self.instance_debug_conf):
self._fix_conf(self.instance_debug_conf, False)