-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose-swarm.yaml
142 lines (133 loc) · 3.24 KB
/
docker-compose-swarm.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
version: "3.7"
services:
nginx:
build:
context: ./nginx
network: host
image: ${REGISTRY_HOST}/shane/smwc-web-nginx:${VERSION}
deploy:
mode: global
resources:
limits:
cpus: "2.0"
memory: 50M
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik-public"
- "traefik.constraint-label=traefik-public"
- "traefik.http.routers.STACK_NAME-http.rule=Host(${TRAEFIK_HOST})"
- "traefik.http.routers.STACK_NAME-http.entrypoints=http"
- "traefik.http.routers.STACK_NAME-http.middlewares=https-redirect"
- "traefik.http.routers.STACK_NAME-https.rule=Host(${TRAEFIK_HOST})"
- "traefik.http.routers.STACK_NAME-https.entrypoints=https"
- "traefik.http.routers.STACK_NAME-https.tls=true"
- "traefik.http.services.STACK_NAME.loadbalancer.server.port=80"
- "traefik.http.services.STACK_NAME.loadbalancer.server.scheme=http"
volumes:
- /data/docker/STACK_NAME:/data
secrets:
- source: cssnr_basic_http_auth
target: /etc/nginx/auth.users
depends_on:
- app
networks:
- traefik-public
- net-internal
app:
build:
context: ./app
network: host
image: ${REGISTRY_HOST}/shane/smwc-web-app:${VERSION}
env_file: ${ENV_FILE}
command: "gunicorn smwc_web.wsgi:application -w 2 -b 0.0.0.0:9000"
healthcheck:
test: ["CMD", "curl", "-sf", "http://localhost:9000/app-health-check/"]
interval: 1m
timeout: 10s
retries: 3
start_period: 30s
deploy:
mode: global
resources:
limits:
cpus: "2.0"
memory: 400M
volumes:
- /data/docker/STACK_NAME:/data
depends_on:
- redis
networks:
- net-internal
worker:
image: ${REGISTRY_HOST}/shane/smwc-web-app:${VERSION}
env_file: ${ENV_FILE}
command: "celery -A smwc_web worker -l INFO -c 2"
deploy:
replicas: 1
resources:
limits:
cpus: "2.0"
memory: 250M
volumes:
- /data/docker/STACK_NAME:/data
depends_on:
- app
- redis
networks:
- net-internal
beat:
image: ${REGISTRY_HOST}/shane/smwc-web-app:${VERSION}
env_file: ${ENV_FILE}
command: "celery -A smwc_web beat -l INFO -S django"
deploy:
replicas: 1
resources:
limits:
cpus: "2.0"
memory: 150M
depends_on:
- app
- redis
networks:
- net-internal
# flower:
# image: mher/flower:1.2
# env_file: ${ENV_FILE}
# deploy:
# replicas: 1
# resources:
# limits:
# cpus: '2.0'
# memory: 100M
# volumes:
# - flower_data:/data
# depends_on:
# - app
# - redis
# networks:
# - net-internal
redis:
image: redis:6-alpine
command: "redis-server --appendonly yes"
deploy:
replicas: 1
resources:
limits:
cpus: "2.0"
memory: 50M
volumes:
- redis_data:/data
networks:
- net-internal
secrets:
cssnr_basic_http_auth:
external: true
volumes:
# data_dir:
# flower_data:
redis_data:
networks:
traefik-public:
external: true
net-internal:
driver: overlay