-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcron-stack.yaml
60 lines (55 loc) · 1.34 KB
/
cron-stack.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Run containers periodically
# Deploy stack: docker stack deploy -c cron.yaml cron
version: "3.8"
services:
manager:
# Manager container that run the other cron jobs
image: crazymax/swarm-cronjob
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- TZ=Etc/UTC
- LOG_LEVEL=info
- LOG_JSON=false
deploy:
placement:
constraints:
- "node.role==manager"
ddns:
# Dynamic DNS
image: pascaliske/alpine-curl-jq
command:
- ash
- -cx
- curl https://europe-west2-home-automtn.cloudfunctions.net/update-ip?api_key="$$(cat /run/secrets/cron_ddns_api_key)"
secrets:
- cron_ddns_api_key
deploy:
replicas: 0
labels:
- "swarm.cronjob.enable=true"
- "swarm.cronjob.schedule=*/5 * * * *"
- "swarm.cronjob.skip-running=false"
restart_policy:
condition: none
prune:
image: docker
command:
- docker
- system
- prune
- --force
- --all
volumes:
- /var/run/docker.sock:/var/run/docker.sock
deploy:
mode: global
labels:
- "swarm.cronjob.enable=true"
- "swarm.cronjob.schedule=0 0 * * 0"
- "swarm.cronjob.skip-running=false"
restart_policy:
condition: none
secrets:
cron_ddns_api_key:
external: true