-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
149 lines (140 loc) · 3.97 KB
/
Copy pathdocker-compose.yml
File metadata and controls
149 lines (140 loc) · 3.97 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# ==============================================================================
# AutoCUB — Docker Compose (Arquitetura Mimetizada do autoSINAPI_API)
# Integração ecossistema Mundo AEC (SINAPI + CUB + futuro INCC)
# ==============================================================================
services:
db:
image: postgres:15-alpine
container_name: cub_db
hostname: db
env_file: .env
environment:
- POSTGRES_MULTIPLE_DATABASES=cub,kong
- POSTGRES_USER=${POSTGRES_USER:-autocub_user}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-autocub_pass}
- KONG_PG_USER=${KONG_PG_USER:-kong}
- KONG_PG_PASSWORD=${KONG_PG_PASSWORD:-kong_pass}
volumes:
- cub_postgres_data:/var/lib/postgresql/data
- ./docker/db/multiple-databases.sh:/docker-entrypoint-initdb.d/multiple-databases.sh
ports:
- "127.0.0.1:5433:5432" # Porta 5433 no host para não conflitar com sinapi_db (5432)
restart: unless-stopped
networks:
- aec-net
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-autocub_user} -d cub && pg_isready -U ${KONG_PG_USER:-kong} -d kong"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
container_name: cub_redis
restart: unless-stopped
ports:
- "127.0.0.1:6380:6379" # Porta 6380 no host para evitar conflitos
networks:
- aec-net
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
api:
container_name: cub_api
build:
context: .
dockerfile: docker/Dockerfile
env_file: .env
environment:
- POSTGRES_HOST=db
- POSTGRES_PORT=5432
- REDIS_HOST=redis
- REDIS_PORT=6379
volumes:
- ./autocub_downloads:/app/autocub_downloads
- ./autocub:/app/autocub
ports:
- "8002:8002"
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
networks:
- aec-net
celery_worker:
container_name: cub_celery_worker
build:
context: .
dockerfile: docker/Dockerfile
command: celery -A autocub.tasks.celery_app worker --loglevel=info --concurrency=2
env_file: .env
environment:
- POSTGRES_HOST=db
- POSTGRES_PORT=5432
- REDIS_HOST=redis
- REDIS_PORT=6379
volumes:
- ./autocub_downloads:/app/autocub_downloads
- ./autocub:/app/autocub
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
networks:
- aec-net
# Gateway Kong (Opcional para ambiente com API Key e Rate Limiting)
kong-migrations:
image: kong:3.4
container_name: cub_kong_migrations
command: kong migrations bootstrap
environment:
- KONG_DATABASE=postgres
- KONG_PG_HOST=db
- KONG_PG_USER=${KONG_PG_USER:-kong}
- KONG_PG_PASSWORD=${KONG_PG_PASSWORD:-kong_pass}
- KONG_PG_DATABASE=kong
depends_on:
db:
condition: service_healthy
networks:
- aec-net
restart: on-failure:5
kong:
image: kong:3.4
container_name: cub_kong
env_file: .env
environment:
- KONG_DATABASE=postgres
- KONG_PG_HOST=db
- KONG_PG_USER=${KONG_PG_USER:-kong}
- KONG_PG_PASSWORD=${KONG_PG_PASSWORD:-kong_pass}
- KONG_PG_DATABASE=kong
- KONG_PROXY_ACCESS_LOG=/dev/stdout
- KONG_ADMIN_ACCESS_LOG=/dev/stdout
- KONG_PROXY_ERROR_LOG=/dev/stderr
- KONG_ADMIN_ERROR_LOG=/dev/stderr
- KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl
depends_on:
kong-migrations:
condition: service_completed_successfully
db:
condition: service_healthy
ports:
- "8000:8000"
- "8443:8443"
- "127.0.0.1:8001:8001"
- "127.0.0.1:8444:8444"
restart: unless-stopped
networks:
- aec-net
volumes:
cub_postgres_data:
networks:
aec-net:
name: aec-net
driver: bridge