-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose-balance.yaml
88 lines (84 loc) · 2.06 KB
/
docker-compose-balance.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
80
81
82
83
84
85
86
87
88
version: '3.5'
services:
api1: &app
container_name: marcosisocram-api1
image: marcosisocram/rinha-2024-q1:latest
hostname: api1
network_mode: "host"
depends_on:
- pgbouncer
environment:
- PORT=8180
- DB_URL=jdbc:postgresql://localhost:5433/postgres
- DB_USER=user
- DB_PASSWORD=rinha-de-bK
deploy:
resources:
limits:
cpus: '0.2375'
memory: "90MB"
api2: # API - Instância 02
<<: *app
container_name: marcosisocram-api2
hostname: api2
environment:
- PORT=8280
- DB_URL=jdbc:postgresql://localhost:5433/postgres
- DB_USER=user
- DB_PASSWORD=rinha-de-bK
db:
container_name: marcosisocram-db
image: postgres:16.1
hostname: db
network_mode: "host"
environment:
- POSTGRES_PASSWORD=rinha-de-bK
- POSTGRES_USER=user
- POSTGRES_DB=postgres
- PGPORT=5434
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
- ./postgresql.conf:/docker-entrypoint-initdb.d/postgresql.conf
healthcheck:
test: [ "CMD-SHELL", "pg_isready" ]
interval: 5s
timeout: 5s
retries: 5
deploy:
resources:
limits:
cpus: '0.525'
memory: '330MB'
pgbouncer:
image: edoburu/pgbouncer
container_name: marcosisocram-pgbouncer
hostname: pgbouncer
network_mode: "host"
environment:
- DATABASE_URL=postgres://user:rinha-de-bK@localhost:5434/postgres
volumes:
- ./pgbouncer.ini:/etc/pgbouncer/pgbouncer.ini:ro
depends_on:
db:
condition: service_healthy
deploy:
resources:
limits:
cpus: '0.1'
memory: '10MB'
balance:
container_name: marcosisocram-balancinha
image: marcosisocram/balancinha:latest
restart: on-failure
depends_on:
- api1
- api2
expose:
- "9999"
network_mode: "host"
command: [ "/app/balance", "9999", "localhost:8180", "localhost:8280" ]
deploy:
resources:
limits:
cpus: "0.4"
memory: "30MB"