From d2130561957da20463bfcd7da0140ac7736ecf55 Mon Sep 17 00:00:00 2001 From: anuttinck Date: Tue, 19 Dec 2023 09:43:40 +0100 Subject: [PATCH 1/4] [DEL] cron instances in docker manifests --- docker/docker-compose-dev.yml | 56 ++++++++++++++++---------------- docker/docker-compose.yml | 60 +++++++++++++++++------------------ docker/docker-entrypoint.sh | 58 ++++++++++++++++----------------- 3 files changed, 87 insertions(+), 87 deletions(-) diff --git a/docker/docker-compose-dev.yml b/docker/docker-compose-dev.yml index 1966781..111efb8 100644 --- a/docker/docker-compose-dev.yml +++ b/docker/docker-compose-dev.yml @@ -43,7 +43,7 @@ services: depends_on: - zeo - libreoffice - - worker-cron +# - worker-cron environment: - ZEO_CLIENT_CACHE_SIZE=1000MB - ZODB_CACHE_SIZE=100000 @@ -58,32 +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-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 @@ -92,7 +92,7 @@ services: depends_on: - zeo - libreoffice - - worker-cron +# - worker-cron environment: - ZEO_CLIENT_CACHE_SIZE=1000MB - ZODB_CACHE_SIZE=100000 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 9a94c81..dba7945 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -46,7 +46,7 @@ services: depends_on: - zeo - libreoffice - - worker-cron +# - worker-cron environment: - ZEO_CLIENT_CACHE_SIZE=1000MB - ZODB_CACHE_SIZE=100000 @@ -62,32 +62,32 @@ 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-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 @@ -122,7 +122,7 @@ services: - delib_external depends_on: - zeo - - worker-cron +# - worker-cron environment: - ZEO_CLIENT_CACHE_SIZE=1000MB - ZODB_CACHE_SIZE=100000 @@ -144,7 +144,7 @@ services: - tmp:/tmp - vartmp:/var/tmp labels: - SERVICE_NAME: "worker-cron" + SERVICE_NAME: "worker-amqp" maintenance: image: imiobe/iadelib:latest @@ -156,7 +156,7 @@ services: depends_on: - zeo - libreoffice - - worker-cron +# - 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 86a756e..6d18baf 100755 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -10,31 +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 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" @@ -61,10 +61,10 @@ 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 +#PRIORIY="instance-cron instance-debug maintenance script zeoserver" +#if [[ "instance" == "$1" || ( ! $PRIORIY == *"$1"* && $# -gt 0 ) ]]; then +# wait_for_cron "$1" +#fi case "$1" in "") From 685f71a25f952f627c1ca522e6081de32a73220f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Duch=C3=AAne?= Date: Tue, 19 Dec 2023 10:45:48 +0100 Subject: [PATCH 2/4] Remove instance-cron for docker deployments --- docker-dev.cfg | 20 ++++++-------------- docker/docker-entrypoint.sh | 2 +- docker/docker-initialize.py | 4 +--- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/docker-dev.cfg b/docker-dev.cfg index 2e55480..0ff1757 100644 --- a/docker-dev.cfg +++ b/docker-dev.cfg @@ -1,7 +1,6 @@ [buildout] parts += instance - instance-cron parts -= instance2 instance3 @@ -23,6 +22,12 @@ 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} @@ -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} - - 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-entrypoint.sh b/docker/docker-entrypoint.sh index 6d18baf..776c7a1 100755 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -61,7 +61,7 @@ function start() { setup "$1" -#PRIORIY="instance-cron instance-debug maintenance script zeoserver" +#PRIORIY=instance-cron instance-debug maintenance script zeoserver" #if [[ "instance" == "$1" || ( ! $PRIORIY == *"$1"* && $# -gt 0 ) ]]; then # wait_for_cron "$1" #fi diff --git a/docker/docker-initialize.py b/docker/docker-initialize.py index 8158eec..7c8d5fb 100644 --- a/docker/docker-initialize.py +++ b/docker/docker-initialize.py @@ -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' @@ -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) From ac7da4969bfe70b82595e6a4a3c2ae5827502752 Mon Sep 17 00:00:00 2001 From: anuttinck Date: Wed, 20 Dec 2023 11:57:43 +0100 Subject: [PATCH 3/4] [DEL] comments in docker-compose.yml files --- docker/docker-compose-dev.yml | 66 +++-------------------------------- docker/docker-compose.yml | 30 ---------------- docker/docker-entrypoint.sh | 30 ---------------- 3 files changed, 5 insertions(+), 121 deletions(-) diff --git a/docker/docker-compose-dev.yml b/docker/docker-compose-dev.yml index 01df5af..587b69e 100644 --- a/docker/docker-compose-dev.yml +++ b/docker/docker-compose-dev.yml @@ -17,6 +17,7 @@ services: mem_limit: 500M mem_reservation: 150M mem_swappiness: 0 + zeo: image: imiobe/iadelib:dev command: zeoserver @@ -32,6 +33,7 @@ services: SERVICE_NAME: "zeo" healthcheck: test: "/plone/zeo_healthcheck.sh" + instance: image: imiobe/iadelib:dev command: instance @@ -43,7 +45,6 @@ services: depends_on: - zeo - libreoffice -# - worker-cron environment: - ZEO_CLIENT_CACHE_SIZE=1000MB - ZODB_CACHE_SIZE=100000 @@ -58,32 +59,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 @@ -92,7 +68,6 @@ services: depends_on: - zeo - libreoffice -# - worker-cron environment: - ZEO_CLIENT_CACHE_SIZE=1000MB - ZODB_CACHE_SIZE=100000 @@ -107,39 +82,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: @@ -166,6 +109,7 @@ services: - vartmp:/var/tmp labels: SERVICE_NAME: "maintenance" + volumes: tmp: vartmp: diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index abbbea9..4b7f152 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -46,7 +46,6 @@ services: depends_on: - zeo - libreoffice -# - worker-cron environment: - ZEO_CLIENT_CACHE_SIZE=1000MB - ZODB_CACHE_SIZE=100000 @@ -62,33 +61,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 @@ -122,7 +94,6 @@ services: - delib_external depends_on: - zeo -# - worker-cron environment: - ZEO_CLIENT_CACHE_SIZE=1000MB - ZODB_CACHE_SIZE=100000 @@ -156,7 +127,6 @@ 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 776c7a1..5be998f 100755 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -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" @@ -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 From 9692372ddb50e112ab67bdb0ca9f378e5904c42a Mon Sep 17 00:00:00 2001 From: anuttinck Date: Wed, 20 Dec 2023 14:09:43 +0100 Subject: [PATCH 4/4] [ADD] ADMIN_PASSWORD variable in instance docker service --- docker/docker-compose-dev.yml | 1 + docker/docker-compose.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/docker/docker-compose-dev.yml b/docker/docker-compose-dev.yml index 587b69e..6d697f9 100644 --- a/docker/docker-compose-dev.yml +++ b/docker/docker-compose-dev.yml @@ -51,6 +51,7 @@ services: - CLUSTER=iadelib_pm42 - HOSTNAME=instance1 - PLONE_PATH=demo + - ADMIN_PASSWORD=test volumes: - ./data/:/data - tmp:/tmp diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 4b7f152..087643b 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -52,6 +52,7 @@ services: - CLUSTER=iadelib_pm42 - HOSTNAME=instance1 - PLONE_PATH=demo + - ADMIN_PASSWORD=test volumes: - ./data:/data - tmp:/tmp