-
Notifications
You must be signed in to change notification settings - Fork 923
/
Copy pathdocker-compose.yml
58 lines (54 loc) · 1.31 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
version: '3.5'
services:
api1: &api # API - Instância 01
image: marcusadriano/rinha-de-backend-2024-q1-go:latest
hostname: api1
depends_on:
- db
environment:
- SERVER_PORT=8080
- DATABASE_URL=postgres://postgres:mysecretpassword@db:5432/rinhabackend?pool_max_conns=6&pool_min_conns=6&pool_max_conn_lifetime=330s
deploy:
resources:
limits:
cpus: '0.25'
memory: '75MB'
api2: # API - Instância 02
<<: *api
hostname: api2
nginx: # Load Balancer
image: nginx:1.25.3
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- db
- api1
- api2
expose:
- "9999"
ports:
- "9999:9999"
deploy:
resources:
limits:
cpus: '0.5'
memory: '200MB'
db: # Banco de dados
image: postgres:16.1
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=mysecretpassword
- POSTGRES_DB=rinhabackend
volumes:
- ./sql/init/:/docker-entrypoint-initdb.d/
- ./sql/postgres.conf:/etc/postgresql/postgresql.conf
deploy:
resources:
limits:
cpus: '0.5'
memory: '200MB'
command: postgres -c 'config_file=/etc/postgresql/postgresql.conf'
networks:
default:
driver: bridge
name: rinha-net