-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
117 lines (110 loc) · 2.34 KB
/
docker-compose.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
networks:
default:
driver: bridge
services:
api1:
build: .
depends_on:
database:
condition: service_healthy
deploy:
resources:
limits:
cpus: "0.2"
memory: "0.5GB"
environment:
CACHE_ADDRESS: cache
CACHE_PORT: 6379
DATABASE_HOST: database
DATABASE_NAME: postgres
DATABASE_PASSWORD: postgres
DATABASE_PORT: 5432
DATABASE_USER: postgres
PORT: 8080
expose:
- "8080"
hostname: api1
# ports:
# - "8001:8080"
api2:
build: .
depends_on:
database:
condition: service_healthy
deploy:
resources:
limits:
cpus: "0.2"
memory: "0.5GB"
environment:
CACHE_ADDRESS: cache
CACHE_PORT: 6379
DATABASE_HOST: database
DATABASE_NAME: postgres
DATABASE_PASSWORD: postgres
DATABASE_PORT: 5432
DATABASE_USER: postgres
PORT: 8080
expose:
- "8080"
hostname: api2
# ports:
# - "8002:8080"
cache:
command: ["redis-server", "/etc/redis/redis.conf"]
deploy:
resources:
limits:
cpus: "0.2"
memory: "0.5GB"
expose:
- "6379"
hostname: cache
image: redis:latest
ports:
- "8004:6379"
volumes:
- ./scripts/redis/:/etc/redis/
database:
command: ["postgres", "-c", "config_file=/etc/postgresql/postgresql.conf"]
deploy:
resources:
limits:
cpus: "0.7"
memory: "1.25GB"
environment:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
expose:
- "5432"
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres"]
interval: 15s
timeout: 25s
hostname: database
image: postgres:latest
ports:
- "8003:5432"
volumes:
- postgres-db:/var/lib/postgresql/data
- ./scripts/postgres/postgresql.sql:/docker-entrypoint-initdb.d/postgresql.sql
- ./scripts/postgres/postgresql.conf:/etc/postgresql/postgresql.conf
nginx:
depends_on:
- api1
- api2
deploy:
resources:
limits:
cpus: "0.2"
memory: "0.25GB"
hostname: api
image: nginx:latest
ports:
- "9999:9999"
volumes:
- ./scripts/nginx/:/etc/nginx/
version: "3.5"
volumes:
postgres-db: