-
Notifications
You must be signed in to change notification settings - Fork 928
/
docker-compose.yml
114 lines (111 loc) · 2.52 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
version: '3.8'
services:
redis:
image: redis:latest
container_name: redis_container
environment:
- REDIS_PASSWORD=${REDIS_PASSWORD}
- REDIS_PORT=${REDIS_PORT}
command:
- /bin/sh
- -c
- redis-server --requirepass "$${REDIS_PASSWORD:?REDIS_PASSWORD variable is not set}"
ports:
- "$REDIS_PORT:$REDIS_PORT"
env_file:
- .env
networks:
- app-network
healthcheck:
test: ["CMD-SHELL", "redis-cli", "--raw", "incr", "ping"]
interval: 1s
timeout: 3s
retries: 10
deploy:
resources:
limits:
cpus: "0.2"
memory: "50MB"
postgres:
container_name: postgres_container
image: postgres:latest
environment:
- POSTGRES_USER=${DB_USER:-master}
- POSTGRES_PASSWORD=${DB_PASSWORD:-password}
- PGDATA=/data/postgres
- POSTGRES_DB=${DB_NAME-rb}
volumes:
- postgres:/data/postgres
- ./.docker/postgres:/docker-entrypoint-initdb.d
command: postgres -c checkpoint_timeout=600 -c max_wal_size=4096 -c synchronous_commit=0 -c full_page_writes=0
env_file:
- .env
ports:
- "$DB_PORT:$DB_PORT"
networks:
- app-network
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 10s
timeout: 5s
retries: 10
deploy:
resources:
limits:
cpus: "0.25"
memory: "100MB"
server01: &server
container_name: server01_container
image: josimarz/rinhadebackend2024q1:latest
hostname: server01
ports:
- "8080:8080"
environment:
- DB_HOST=${DB_HOST}
- DB_PORT=${DB_PORT}
- DB_USER=${DB_USER}
- DB_PASSWORD=${DB_PASSWORD}
- DB_NAME=${DB_NAME}
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_healthy
networks:
- app-network
env_file:
- .env
deploy:
resources:
limits:
cpus: "0.9"
memory: "180MB"
server02:
<<: *server
container_name: server02_container
hostname: server02
ports:
- "8081:8080"
nginx:
image: nginx:latest
container_name: nginx_container
volumes:
- ./.docker/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- server01
- server02
ports:
- "9999:9999"
networks:
- app-network
deploy:
resources:
limits:
cpus: "0.15"
memory: "40MB"
networks:
app-network:
driver: bridge
volumes:
postgres: