Skip to content

Commit

Permalink
Merge pull request #12 from IMIO/del-docker-cron-instance
Browse files Browse the repository at this point in the history
[DEL] docker cron instance [DEVOPS-47]
  • Loading branch information
duchenean authored Jan 16, 2024
2 parents 0eca290 + aa45032 commit f8525cd
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 139 deletions.
20 changes: 6 additions & 14 deletions docker-dev.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[buildout]
parts +=
instance
instance-cron
parts -=
instance2
instance3
Expand All @@ -23,6 +22,12 @@ zope-conf-additional =
bind 0.0.0.0:${port:instance1-monitor}
</product-config>
${zope-conf:additional}
<clock-server>
method /${port:plone-path}/@@cron-tick
period 3600
user admin
password ${port:admin-password}
</clock-server>
${zope-conf:zamqp}
environment-vars -=
OO_PORT ${port:oo-port}
Expand All @@ -38,19 +43,6 @@ 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}
<clock-server>
method /${port:plone-path}/@@cron-tick
period 3600
user admin
password ${port:admin-password}
</clock-server>
${zope-conf:zamqp}

environment-vars += ${bigbang:environment-vars}

[instance-debug]
Expand Down
67 changes: 6 additions & 61 deletions docker/docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ services:
mem_limit: 500M
mem_reservation: 150M
mem_swappiness: 0

zeo:
image: imiobe/iadelib:dev
command: zeoserver
Expand All @@ -32,6 +33,7 @@ services:
SERVICE_NAME: "zeo"
healthcheck:
test: "/plone/zeo_healthcheck.sh"

instance:
image: imiobe/iadelib:dev
command: instance
Expand All @@ -43,13 +45,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
Expand All @@ -58,32 +60,7 @@ 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
Expand All @@ -92,7 +69,6 @@ services:
depends_on:
- zeo
- libreoffice
- worker-cron
environment:
- ZEO_CLIENT_CACHE_SIZE=1000MB
- ZODB_CACHE_SIZE=100000
Expand All @@ -107,39 +83,7 @@ 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:
Expand All @@ -166,6 +110,7 @@ services:
- vartmp:/var/tmp
labels:
SERVICE_NAME: "maintenance"

volumes:
tmp:
vartmp:
Expand Down
33 changes: 2 additions & 31 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -62,33 +62,6 @@ 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
Expand Down Expand Up @@ -122,7 +95,6 @@ services:
- delib_external
depends_on:
- zeo
- worker-cron
environment:
- ZEO_CLIENT_CACHE_SIZE=1000MB
- ZODB_CACHE_SIZE=100000
Expand All @@ -144,7 +116,7 @@ services:
- tmp:/tmp
- vartmp:/var/tmp
labels:
SERVICE_NAME: "worker-cron"
SERVICE_NAME: "worker-amqp"

maintenance:
image: imiobe/iadelib:latest
Expand All @@ -156,7 +128,6 @@ services:
depends_on:
- zeo
- libreoffice
- worker-cron
environment:
- ZEO_CLIENT_CACHE_SIZE=1000MB
- ZODB_CACHE_SIZE=100000
Expand Down
30 changes: 0 additions & 30 deletions docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,6 @@ 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"
Expand All @@ -61,11 +36,6 @@ 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
Expand Down
4 changes: 1 addition & 3 deletions docker/docker-initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ 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'

Expand Down Expand Up @@ -84,10 +83,9 @@ def _fix_amqp(self, path):
def fixtures(self):
""" ZEO Client
"""
self._fix_conf(self.instance1_conf, False)
self._fix_conf(self.instance1_conf, True)
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)
Expand Down

0 comments on commit f8525cd

Please sign in to comment.