-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathproduction.yml
117 lines (104 loc) · 2.64 KB
/
production.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
# TODO: have one file for prod and one for dev
version: '3.4'
services:
nginx:
image: nginx:stable-alpine
networks:
- frontend
- backend
links:
- api
- frontend
ports:
- "80:80" # HTTP
- "443:443" # HTTPS
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- /docker-volumes/etc/letsencrypt/live/haskellbazaar.com/fullchain.pem:/etc/letsencrypt/live/haskellbazaar.com/fullchain.pem
- /docker-volumes/etc/letsencrypt/live/haskellbazaar.com/privkey.pem:/etc/letsencrypt/live/haskellbazaar.com/privkey.pem
# for certbot challenges
- /docker-volumes/data/letsencrypt:/data/letsencrypt
restart: always
# TODO: add a cerbot as a cron job in docker compose file
# TODO: use named volume instead of host volumes to store certificate pem files
frontend:
image: nginx:stable-alpine
volumes:
- ./frontend/nginx/default.conf:/etc/nginx/conf.d/default.conf
networks:
- backend
# TODO: add a healthcheck
restart: always
api:
image: chouffe/haskell-bazaar
networks:
- backend
links:
- postgres
depends_on:
- postgres
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8001/health"]
start_period: 45s
command: "./haskell-bazaar-exe"
environment:
- ENVIRONMENT=Prod
secrets:
- mailchimp-api-key
- mailchimp-base-url
- mailchimp-list-id
- psql-user
- psql-password
- psql-db
postgres:
image: postgres:11.1
container_name: haskell-bazaar-postgres
networks:
- backend
healthcheck:
test: ["CMD", "pg_isready", "-U", "haskellbazaar"]
volumes:
- psql-data:/var/lib/postgresql/data
# Run init.sql and seed.sql on creation
- ./db/scripts/init.sql:/docker-entrypoint-initdb.d/1-init.sql
- ./db/scripts/seed.sql:/docker-entrypoint-initdb.d/2-seed.sql
postgres-backup:
image: chouffe/haskell-bazaar-postgres-backup
build:
context: ./db/backup
dockerfile: Dockerfile
links:
- postgres
depends_on:
- postgres
container_name: haskell-bazaar-postgres-backup
networks:
- backend
volumes:
- psql-data:/var/lib/postgresql/data
- psql-backups:/backups
secrets:
- psql-user
- psql-password
- psql-db
volumes:
psql-data:
psql-backups:
secrets:
# Postgresql
psql-user:
external: true
psql-password:
external: true
psql-db:
external: true
# Mailchimp
mailchimp-api-key:
external: true
mailchimp-base-url:
external: true
mailchimp-list-id:
external: true
networks:
frontend:
backend: