-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathdocker-compose.deploy.yml
148 lines (141 loc) · 3.21 KB
/
docker-compose.deploy.yml
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
143
144
145
146
147
148
version: '3.7'
services:
app: &app
image: pivorak-web-app:0.0.1
build:
context: .
dockerfile: ./Dockerfile.deploy
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "30"
tmpfs:
- /tmp
env_file:
- /data/docker/.docker_compose.env
networks:
- pivorak-network
volumes:
- pivorak-app-data:/app/data
- .docker_compose.env:/app/.env
deploy:
mode: replicated
replicas: 1
update_config:
parallelism: 2
delay: 10s
order: start-first
restart_policy:
condition: on-failure
placement:
constraints:
- node.role == manager
depends_on:
- postgres
- redis
hostname: pivorak_api:3000
postgres:
image: postgres:12-alpine
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "30"
volumes:
- pivorak-postgres:/var/lib/postgresql/data
networks:
- pivorak-network
expose:
- 5432
env_file:
- /data/docker/.docker_compose.env
deploy:
mode: replicated
replicas: 1
update_config:
parallelism: 1
delay: 10s
order: start-first
restart_policy:
condition: on-failure
healthcheck:
test: ["CMD", "pg_isready"]
timeout: 5s
retries: 15
redis:
image: redis:5-alpine
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "30"
volumes:
- pivorak-redis:/data
networks:
- pivorak-network
expose:
- "6379"
env_file:
- /data/docker/.docker_compose.env
deploy:
mode: replicated
replicas: 1
update_config:
parallelism: 1
delay: 10s
order: start-first
restart_policy:
condition: on-failure
healthcheck:
test: ["CMD", "redis-cli", "-h", "localhost", "ping"]
timeout: 1s
retries: 30
nginx:
image: nginx:1.15-alpine
restart: unless-stopped
volumes:
- pivorak-app-data:/app
- pivorak-nginx:/etc/nginx/conf.d
- pivorak-certbot-conf:/etc/letsencrypt
- pivorak-cerbot-www:/var/www/certbot
ports:
- "80:80"
- "443:443"
networks:
- pivorak-network
depends_on:
- app
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
certbot:
image: certbot/certbot
restart: unless-stopped
volumes:
- pivorak-certbot-conf:/etc/letsencrypt
- pivorak-cerbot-www:/var/www/certbot
environment:
EMAIL: [email protected]
DOMAINS: pivorak.com
SERVER_CONTAINER_LABEL: nginx.proxy
WEBROOT_PATH: /tmp/letsencrypt/www
CERTS_PATH: /etc/ssl/certs
CHECK_FREQ: 1
networks:
- pivorak-network
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
networks:
pivorak-network:
name: pivorak-network
volumes:
pivorak-nginx:
external: true
pivorak-cerbot-www:
external: true
pivorak-certbot-conf:
external: true
pivorak-app-data:
external: true
pivorak-redis:
external: true
pivorak-postgres:
external: true