Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
131 lines (125 loc) · 3.42 KB
/
Copy pathdocker-compose.yml
File metadata and controls
131 lines (125 loc) · 3.42 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
services:
db:
image: postgres:15-alpine
container_name: autoincc_postgres
restart: unless-stopped
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgrespassword
POSTGRES_DB: autoincc
PGDATA: /var/lib/postgresql/data/pgdata
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
- ./app/db/init_db.sql:/docker-entrypoint-initdb.d/init_db.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d autoincc"]
interval: 5s
timeout: 5s
retries: 5
networks:
- autoincc_network
redis:
image: redis:7-alpine
container_name: autoincc_redis
restart: unless-stopped
ports:
- "6379:6379"
volumes:
- redisdata:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 5
networks:
- autoincc_network
init:
build:
context: .
dockerfile: Dockerfile
container_name: autoincc_init
restart: "no"
command: ["python", "-m", "app.db.init_service"]
environment:
- APP_ENV=production
- DATABASE_URL=postgresql://postgres:postgrespassword@db:5432/autoincc
- REDIS_URL=redis://redis:6379/0
- LOG_LEVEL=INFO
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
networks:
- autoincc_network
api:
build:
context: .
dockerfile: Dockerfile
container_name: autoincc_api
restart: unless-stopped
ports:
- "8000:8000"
environment:
- APP_ENV=production
- DEBUG=False
- HOST=0.0.0.0
- PORT=8000
- DATABASE_URL=postgresql://postgres:postgrespassword@db:5432/autoincc
- REDIS_URL=redis://redis:6379/0
- CACHE_ENABLED=True
- CACHE_TTL_SECONDS=3600
# STORY-MCP-009: sem default. Defina API_KEY no .env (ver .env.example);
# ausente => o trigger de ETL fica desabilitado (503), nunca chave de dev.
- API_KEY=${API_KEY:?defina API_KEY no .env para habilitar o trigger de ETL}
- BCB_API_URL=https://api.bcb.gov.br/dados/serie/bcdata.sgs
- ETL_REQUEST_DELAY_BASE=1.5
- ETL_REQUEST_DELAY_JITTER=1.5
- ETL_POLITE_PACING_ENABLED=True
- LOG_LEVEL=INFO
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
init:
condition: service_completed_successfully
networks:
- autoincc_network
celery_worker:
build:
context: .
dockerfile: Dockerfile
container_name: autoincc_celery_worker
restart: unless-stopped
command: ["celery", "-A", "app.tasks.celery_app", "worker", "-l", "info", "--concurrency=2"]
environment:
- APP_ENV=production
- DATABASE_URL=postgresql://postgres:postgrespassword@db:5432/autoincc
- REDIS_URL=redis://redis:6379/0
- CACHE_ENABLED=True
- CACHE_TTL_SECONDS=3600
- BCB_API_URL=https://api.bcb.gov.br/dados/serie/bcdata.sgs
- ETL_REQUEST_DELAY_BASE=1.5
- ETL_REQUEST_DELAY_JITTER=1.5
- ETL_POLITE_PACING_ENABLED=True
- LOG_LEVEL=INFO
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
init:
condition: service_completed_successfully
networks:
- autoincc_network
volumes:
pgdata:
driver: local
redisdata:
driver: local
networks:
autoincc_network:
driver: bridge