forked from TonikX/analytics_backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose-prod-ssl-ya-cloud-v1.yml
76 lines (71 loc) · 1.85 KB
/
docker-compose-prod-ssl-ya-cloud-v1.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
version: '3.3'
services:
# db:
# container_name: analytics_db_prod
# image: postgres
# ports:
# - "6435:5432"
# environment:
# - POSTGRES_USER=${POSTGRES_USER}
# - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
# - POSTGRES_DB=${POSTGRES_DB}
# networks:
# nginx_net:
# volumes:
# - ./dbs/postgres-data-prod:/var/lib/postgresql
cache:
image: memcached
privileged: true
ports:
- "11211:11211"
entrypoint:
- memcached
- -m 64
backend:
container_name: analytics_backend_prod
build:
context: ./application
dockerfile: Dockerfile-prod
command: bash -c "sleep 3 && gunicorn analytics_project.wsgi -b 0.0.0.0:8001 --workers 8 --timeout 7200";
networks:
nginx_net:
volumes:
- ./application:/application
expose:
- 8000
restart: always
links:
# - db
- cache
nginx:
image: nginx:latest
container_name: nginx
ports:
- "80:80"
- "443:443"
networks:
nginx_net:
volumes:
- ./application/media:/backend/src/media
- ./application/static-backend:/backend/src/static-backend
- ./frontend/build:/frontend/src
- ./nginx/ssl:/etc/nginx/conf.d
- ./nginx/ssl/data/certbot/conf:/etc/letsencrypt
- ./nginx/ssl/data/certbot/www:/var/www/certbot
command: '/bin/sh -c ''while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g "daemon off;"'''
depends_on:
- backend
certbot:
image: certbot/certbot
container_name: certbot
restart: unless-stopped #+++
networks:
nginx_net:
volumes:
- ./nginx/ssl/data/certbot/conf:/etc/letsencrypt
- ./nginx/ssl/data/certbot/www:/var/www/certbot
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
volumes:
postgres_data:
networks:
nginx_net: