-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompose.yaml
114 lines (106 loc) · 2.88 KB
/
compose.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
x-common:
&common
logging:
driver: local
restart: unless-stopped
services:
web:
<<: *common
build:
context: .
dockerfile: docker/app/Dockerfile
target: web
environment:
- ADMIN_USERNAME=$ADMIN_USERNAME
- ADMIN_PASSWORD=$ADMIN_PASSWORD
- APP_ENV=$APP_ENV
- PORTAINER_PORT=8443
- PROXY_X_FOR_PROTO=$PROXY_X_FOR_PROTO
- REDIS_HOST=redis
- SECRET_KEY=$SECRET_KEY
- SENTRY_DSN=$SENTRY_DSN
- SERVICE_NAME=web
- WARNING_FILTERS=$WARNING_FILTERS
volumes:
- app_data:/app/data
depends_on:
- redis
healthcheck:
test: curl -f -sS -m 5 http://localhost:8000/ >/dev/null || exit 1
deploy:
resources:
limits:
memory: 256m
worker:
<<: *common
build:
context: .
dockerfile: docker/app/Dockerfile
target: worker
environment:
- APP_ENV=$APP_ENV
- NGINX_HOST=nginx # for the health_check job
- REDIS_HOST=redis
- SENTRY_DSN=$SENTRY_DSN
- SERVICE_NAME=worker
volumes:
- app_data:/app/data
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
- redis
healthcheck:
test: (set -e; info=$(rq info -W -u redis://$$REDIS_HOST?socket_timeout=5 | fgrep -iv error | egrep '(idle|busy)' | egrep -o '(\b[[:digit:]]{1,3}\.){3}[[:digit:]]{1,3}\b' | fgrep -v 127.0.0.1); for ip in $(awk '/32 host/ {print f} {f=$2}' </proc/net/fib_trie | sort | uniq); do echo "$$info" | fgrep $$ip >/dev/null && break; done) || exit 1
deploy:
resources:
limits:
memory: 2g
scheduler:
<<: *common
build:
context: .
dockerfile: docker/app/Dockerfile
target: scheduler
environment:
- RQ_REDIS_URL=redis://redis?socket_timeout=5
depends_on:
- redis
healthcheck:
test: python -c 'import os; import sys; import socket; import redis; ip = socket.gethostbyname(socket.gethostname()); cl = redis.Redis.from_url(os.environ["RQ_REDIS_URL"]).client_list(); any(c["addr"].split(":")[0] == ip and c["cmd"] != "client|list" for c in cl) or sys.exit(1)' || exit 1
deploy:
resources:
limits:
memory: 128m
nginx:
<<: *common
build:
context: .
dockerfile: docker/nginx/Dockerfile
volumes:
- ./conf/ssl:/etc/nginx/ssl:ro
- ./static/images:/app/static/images:ro
ports:
- 443:443
depends_on:
- web
healthcheck:
test: curl -f -sS -m 5 http://localhost/static/picstylist.css >/dev/null || exit 1
deploy:
resources:
limits:
memory: 128m
redis:
<<: *common
build:
context: .
dockerfile: docker/redis/Dockerfile
volumes:
- redis_data:/data
healthcheck:
test: timeout 5 redis-cli ping >/dev/null || exit 1
deploy:
resources:
limits:
memory: 128m
volumes:
app_data:
redis_data: