-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yaml
79 lines (76 loc) · 1.75 KB
/
docker-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
# Version of docker-compose
version: '3'
services:
db:
# We use the predefined Postgres image
image: postgres:9.6
environment:
# Set user/password for Postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
# Set a path where Postgres should store the data
PGDATA: /var/lib/postgresql/data/pgdata
SERVICE_PORTS: 5432
restart: always
ports:
- "5432"
volumes:
- pgdata:/var/lib/postgresql/data
networks:
- web
# Our Phoenix container
phoenix:
image: phoenix:v1
# The build parameters for this container.
build:
# Here we define that it should build from the current directory
context: .
environment:
# Variables to connect to our Postgres server
PGUSER: postgres
PGPASSWORD: postgres
PGDATABASE: football_results_dev
PGPORT: 5432
# Hostname of our Postgres container
PGHOST: db
SERVICE_PORTS: 4000
# VIRTUAL_HOST: "/api/*"
ports:
- "4000"
networks:
- web
depends_on:
# The db container needs to be started before we start this container
- db
deploy:
replicas: 3
restart_policy:
condition: on-failure
max_attempts: 3
window: 120s
# HAProxy setup
proxy:
image: dockercloud/haproxy
depends_on:
- web
- db
- phoenix
environment:
- BALANCE=leastconn
- ADDITIONAL_SERVICES=project_dir:phoenix,project_dir:db
volumes:
- /var/run/docker.sock:/var/run/docker.sock
ports:
- "80:80"
networks:
- web
deploy:
placement:
constraints: [node.role == manager]
# Define the volumes
volumes:
pgdata:
# Define the networks
networks:
web:
driver: overlay