-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
148 lines (139 loc) · 3.3 KB
/
Copy pathdocker-compose.yml
File metadata and controls
148 lines (139 loc) · 3.3 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
services:
# --- INFRASTRUCTURE ---
postgres:
image: postgres:15
container_name: bot_postgres
restart: always
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-your_secure_password_here}
POSTGRES_DB: ${POSTGRES_DB:-cityscale_db}
ports:
- "5432:5432"
volumes:
- ./data/postgres:/var/lib/postgresql/data
networks:
- bot-network
redis:
image: redis:7-alpine
container_name: bot_redis
restart: always
ports:
- "6379:6379"
volumes:
- ./data/redis:/data
networks:
- bot-network
ollama:
image: ollama/ollama:latest
container_name: bot_ollama
restart: always
ports:
- "11434:11434"
volumes:
- ./data/ollama:/root/.ollama
networks:
- bot-network
# --- PYTHON BOT SERVICES ---
bot-api:
build:
context: .
dockerfile: Dockerfile
container_name: bot_api
restart: always
depends_on:
- postgres
- redis
- ollama
env_file:
- .env
environment:
POSTGRES_HOST: postgres
REDIS_HOST: redis
OLLAMA_BASE_URL: http://ollama:11434
WHATSAPP_API_URL: http://whatsapp-gateway:8080
ports:
- "8000:8000"
networks:
- bot-network
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
interval: 30s
timeout: 10s
retries: 3
bot-worker:
build:
context: .
dockerfile: Dockerfile
container_name: bot_worker
restart: always
depends_on:
- postgres
- redis
- ollama
env_file:
- .env
environment:
POSTGRES_HOST: postgres
REDIS_HOST: redis
OLLAMA_BASE_URL: http://ollama:11434
WHATSAPP_API_URL: http://whatsapp-gateway:8080
command: celery -A celery_app worker --loglevel=info
networks:
- bot-network
deploy:
resources:
limits:
cpus: "0.50"
memory: 512M
bot-beat:
build:
context: .
dockerfile: Dockerfile
container_name: bot_beat
restart: always
depends_on:
- redis
env_file:
- .env
environment:
REDIS_HOST: redis
command: celery -A celery_app beat --loglevel=info
networks:
- bot-network
# --- WHATSAPP GATEWAY (Evolution API) ---
whatsapp-gateway:
build:
context: ./whatsapp_gateway_src
dockerfile: Dockerfile
container_name: whatsapp_gateway
restart: always
depends_on:
- redis
- evolution-postgres
env_file:
- ./whatsapp_gateway_src/.env
ports:
- "8085:8080" # Alterado para 8085 para o manager v2
networks:
- bot-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 3
evolution-postgres:
image: postgres:15
container_name: evolution_postgres
restart: always
environment:
POSTGRES_DB: ${EVO_POSTGRES_DB:-evolution_db}
POSTGRES_USER: ${EVO_POSTGRES_USER:-evolution_user}
POSTGRES_PASSWORD: ${EVO_POSTGRES_PASSWORD:-evolution_pass}
volumes:
- ./whatsapp_gateway_src/data/postgres:/var/lib/postgresql/data
networks:
- bot-network
networks:
bot-network:
driver: bridge