Skip to content

Commit f8525cd

Browse files
authored
Merge pull request #12 from IMIO/del-docker-cron-instance
[DEL] docker cron instance [DEVOPS-47]
2 parents 0eca290 + aa45032 commit f8525cd

File tree

5 files changed

+15
-139
lines changed

5 files changed

+15
-139
lines changed

docker-dev.cfg

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[buildout]
22
parts +=
33
instance
4-
instance-cron
54
parts -=
65
instance2
76
instance3
@@ -23,6 +22,12 @@ zope-conf-additional =
2322
bind 0.0.0.0:${port:instance1-monitor}
2423
</product-config>
2524
${zope-conf:additional}
25+
<clock-server>
26+
method /${port:plone-path}/@@cron-tick
27+
period 3600
28+
user admin
29+
password ${port:admin-password}
30+
</clock-server>
2631
${zope-conf:zamqp}
2732
environment-vars -=
2833
OO_PORT ${port:oo-port}
@@ -38,19 +43,6 @@ blob-storage = /data/blobstorage
3843
environment-vars =
3944
ZC_ASYNC_UUID /data/async-uuid.txt
4045

41-
[instance-cron]
42-
<= instance
43-
http-address = 8087
44-
zope-conf-additional =
45-
${zope-conf:additional}
46-
<clock-server>
47-
method /${port:plone-path}/@@cron-tick
48-
period 3600
49-
user admin
50-
password ${port:admin-password}
51-
</clock-server>
52-
${zope-conf:zamqp}
53-
5446
environment-vars += ${bigbang:environment-vars}
5547

5648
[instance-debug]

docker/docker-compose-dev.yml

Lines changed: 6 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ services:
1717
mem_limit: 500M
1818
mem_reservation: 150M
1919
mem_swappiness: 0
20+
2021
zeo:
2122
image: imiobe/iadelib:dev
2223
command: zeoserver
@@ -32,6 +33,7 @@ services:
3233
SERVICE_NAME: "zeo"
3334
healthcheck:
3435
test: "/plone/zeo_healthcheck.sh"
36+
3537
instance:
3638
image: imiobe/iadelib:dev
3739
command: instance
@@ -43,13 +45,13 @@ services:
4345
depends_on:
4446
- zeo
4547
- libreoffice
46-
- worker-cron
4748
environment:
4849
- ZEO_CLIENT_CACHE_SIZE=1000MB
4950
- ZODB_CACHE_SIZE=100000
5051
- CLUSTER=iadelib_pm42
5152
- HOSTNAME=instance1
5253
- PLONE_PATH=demo
54+
- ADMIN_PASSWORD=test
5355
volumes:
5456
- ./data/:/data
5557
- tmp:/tmp
@@ -58,32 +60,7 @@ services:
5860
test: "curl -f localhost:8081/$$PLONE_PATH/@@ok"
5961
labels:
6062
SERVICE_NAME: "instance1"
61-
worker-cron:
62-
image: imiobe/iadelib:dev
63-
command: instance-cron
64-
ports:
65-
- "8087:8087"
66-
networks:
67-
- delib_internal
68-
- delib_external
69-
depends_on:
70-
- zeo
71-
environment:
72-
- ZEO_CLIENT_CACHE_SIZE=1000MB
73-
- ZODB_CACHE_SIZE=100000
74-
- ADMIN_PASSWORD=test
75-
- PUBLIC_URL=http://localhost/PM
76-
- PLONE_PATH=demo
77-
- CLUSTER=iadelib_pm42
78-
- HOSTNAME=worker-cron
79-
volumes:
80-
- ./data/:/data
81-
- tmp:/tmp
82-
- vartmp:/var/tmp
83-
healthcheck:
84-
test: "curl -f localhost:8087/$$PLONE_PATH/@@ok"
85-
labels:
86-
SERVICE_NAME: "worker-cron"
63+
8764
worker-async:
8865
image: imiobe/iadelib:dev
8966
command: instance-async
@@ -92,7 +69,6 @@ services:
9269
depends_on:
9370
- zeo
9471
- libreoffice
95-
- worker-cron
9672
environment:
9773
- ZEO_CLIENT_CACHE_SIZE=1000MB
9874
- ZODB_CACHE_SIZE=100000
@@ -107,39 +83,7 @@ services:
10783
- vartmp:/var/tmp
10884
labels:
10985
SERVICE_NAME: "worker-async"
110-
# worker-amqp:
111-
# image: imiobe/iadelib:dev
112-
# command: instance-amqp
113-
# ports:
114-
# - "20085:8286"
115-
# networks:
116-
# - delib_internal
117-
# - delib_external
118-
# depends_on:
119-
# - zeo
120-
# - worker-cron
121-
# environment:
122-
# - ZEO_CLIENT_CACHE_SIZE=1000MB
123-
# - ZODB_CACHE_SIZE=100000
124-
# - CLUSTER=iadelib_pm42
125-
# - PLONE_PATH=demo
126-
# - MQ_CLIENT_ID
127-
# - MQ_WS_URL
128-
# - MQ_WS_LOGIN
129-
# - MQ_WS_PASSWORD
130-
# - MQ_HOST
131-
# - MQ_PORT
132-
# - MQ_LOGIN
133-
# - MQ_PASSWORD
134-
# - HOSTNAME=worker-amqp
135-
# healthcheck:
136-
# test: "curl -f localhost:8286/$$PLONE_PATH/@@ok"
137-
# volumes:
138-
# - ./data/:/data
139-
# - tmp:/tmp
140-
# - vartmp:/var/tmp
141-
# labels:
142-
# SERVICE_NAME: "worker-cron"
86+
14387
maintenance:
14488
image: imiobe/iadelib:dev
14589
ports:
@@ -166,6 +110,7 @@ services:
166110
- vartmp:/var/tmp
167111
labels:
168112
SERVICE_NAME: "maintenance"
113+
169114
volumes:
170115
tmp:
171116
vartmp:

docker/docker-compose.yml

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ services:
4646
depends_on:
4747
- zeo
4848
- libreoffice
49-
- worker-cron
5049
environment:
5150
- ZEO_CLIENT_CACHE_SIZE=1000MB
5251
- ZODB_CACHE_SIZE=100000
5352
- CLUSTER=iadelib_pm42
5453
- HOSTNAME=instance1
5554
- PLONE_PATH=demo
55+
- ADMIN_PASSWORD=test
5656
volumes:
5757
- ./data:/data
5858
- tmp:/tmp
@@ -62,33 +62,6 @@ services:
6262
labels:
6363
SERVICE_NAME: "instance1"
6464

65-
worker-cron:
66-
image: imiobe/iadelib:latest
67-
command: instance-cron
68-
ports:
69-
- "8087:8087"
70-
networks:
71-
- delib_internal
72-
- delib_external
73-
depends_on:
74-
- zeo
75-
environment:
76-
- ZEO_CLIENT_CACHE_SIZE=1000MB
77-
- ZODB_CACHE_SIZE=100000
78-
- ADMIN_PASSWORD=test
79-
- PUBLIC_URL=http://localhost/PM
80-
- PLONE_PATH=demo
81-
- CLUSTER=iadelib_pm42
82-
- HOSTNAME=worker-cron
83-
volumes:
84-
- ./data:/data
85-
- tmp:/tmp
86-
- vartmp:/var/tmp
87-
healthcheck:
88-
test: "curl -f localhost:8087/$$PLONE_PATH/@@ok"
89-
labels:
90-
SERVICE_NAME: "worker-cron"
91-
9265
worker-async:
9366
image: imiobe/iadelib:latest
9467
command: instance-async
@@ -122,7 +95,6 @@ services:
12295
- delib_external
12396
depends_on:
12497
- zeo
125-
- worker-cron
12698
environment:
12799
- ZEO_CLIENT_CACHE_SIZE=1000MB
128100
- ZODB_CACHE_SIZE=100000
@@ -144,7 +116,7 @@ services:
144116
- tmp:/tmp
145117
- vartmp:/var/tmp
146118
labels:
147-
SERVICE_NAME: "worker-cron"
119+
SERVICE_NAME: "worker-amqp"
148120

149121
maintenance:
150122
image: imiobe/iadelib:latest
@@ -156,7 +128,6 @@ services:
156128
depends_on:
157129
- zeo
158130
- libreoffice
159-
- worker-cron
160131
environment:
161132
- ZEO_CLIENT_CACHE_SIZE=1000MB
162133
- ZODB_CACHE_SIZE=100000

docker/docker-entrypoint.sh

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,6 @@ function setup() {
1010
fi
1111
chmod 777 /data/*
1212
}
13-
function wait_for_cron() {
14-
echo "Waiting for cron"
15-
URL="worker-cron:8087/$PLONE_PATH"
16-
CURL="curl --write-out %{http_code} -so /dev/null $URL/@@ok"
17-
MAX_TRIES=50
18-
INTERVAL=5
19-
set +e
20-
SECONDS=0
21-
response="404"
22-
tries=0
23-
while [[ $response != "200" && $tries -lt $MAX_TRIES ]]
24-
do
25-
sleep $INTERVAL
26-
echo "Waiting for cron"
27-
response=$($CURL)
28-
((tries+=1))
29-
done
30-
set -e
31-
if [[ $tries == "$MAX_TRIES" ]]; then
32-
echo "Failed to reach $URL after $SECONDS s"
33-
exit 1
34-
else
35-
echo "$URL is up. Waited $SECONDS s"
36-
fi
37-
}
3813
function start() {
3914
echo "Starting $1"
4015
cmd="bin/$1"
@@ -61,11 +36,6 @@ function start() {
6136

6237
setup "$1"
6338

64-
PRIORIY="instance-cron instance-debug maintenance script zeoserver"
65-
if [[ "instance" == "$1" || ( ! $PRIORIY == *"$1"* && $# -gt 0 ) ]]; then
66-
wait_for_cron "$1"
67-
fi
68-
6939
case "$1" in
7040
"")
7141
exit 0

docker/docker-initialize.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ def __init__(
2828
self.instance1_conf = '/plone/parts/instance/etc/zope.conf'
2929
self.instance_amqp_conf = '/plone/parts/instance-amqp/etc/zope.conf'
3030
self.instance_async_conf = '/plone/parts/instance-async/etc/zope.conf'
31-
self.instance_cron_conf = '/plone/parts/instance-cron/etc/zope.conf'
3231
self.instance_debug_conf = '/plone/parts/instance-debug/etc/zope.conf'
3332
self.zeoserver_conf = '/plone/parts/zeoserver/etc/zeo.conf'
3433

@@ -84,10 +83,9 @@ def _fix_amqp(self, path):
8483
def fixtures(self):
8584
""" ZEO Client
8685
"""
87-
self._fix_conf(self.instance1_conf, False)
86+
self._fix_conf(self.instance1_conf, True)
8887
self._fix_conf(self.instance_async_conf, False)
8988
self._fix_conf(self.instance_amqp_conf, False)
90-
self._fix_conf(self.instance_cron_conf, True)
9189
# instance debug doesn't exist in dev env
9290
if os.path.exists(self.instance_debug_conf):
9391
self._fix_conf(self.instance_debug_conf, False)

0 commit comments

Comments
 (0)