-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
299 lines (281 loc) · 8.57 KB
/
docker-compose.yaml
File metadata and controls
299 lines (281 loc) · 8.57 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
version: '3.8'
# Docker Compose file to run AgentEx backend + UI
# Usage: docker-compose up --build
#
# This includes:
# - AgentEx backend API and all infrastructure (Temporal, Redis, MongoDB, PostgreSQL)
# - AgentEx UI (Next.js frontend)
#
# Services will be available at:
# - AgentEx API: http://localhost:5003
# - AgentEx UI: http://localhost:3000
# - Temporal UI: http://localhost:8080
services:
# =============================================================================
# Infrastructure Services
# =============================================================================
agentex-temporal-postgresql:
container_name: agentex-temporal-postgresql
environment:
- POSTGRES_PASSWORD=temporal
- POSTGRES_USER=temporal
- LOG_LEVEL=error
image: postgres:12
networks:
- agentex-network
ports:
- 5433:5432
volumes:
- agentex-temporal-postgres-data:/var/lib/postgresql/data:cached
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U temporal" ]
interval: 5s
timeout: 5s
retries: 5
start_period: 5s
agentex-temporal:
container_name: agentex-temporal
depends_on:
agentex-temporal-postgresql:
condition: service_healthy
environment:
- DB=postgres12
- DB_PORT=5432
- POSTGRES_USER=temporal
- POSTGRES_PWD=temporal
- POSTGRES_SEEDS=agentex-temporal-postgresql
- DYNAMIC_CONFIG_FILE_PATH=config/dynamicconfig/development-sql.yaml
- LOG_LEVEL=error
image: temporalio/auto-setup:1.25.0
networks:
- agentex-network
ports:
- 7233:7233
volumes:
- ./agentex/temporal/dynamicconfig:/etc/temporal/config/dynamicconfig:cached
healthcheck:
test: [ "CMD-SHELL", "nc -z localhost 7233 || exit 0" ]
interval: 5s
timeout: 5s
retries: 5
start_period: 10s
agentex-temporal-admin-tools:
container_name: agentex-temporal-admin-tools
depends_on:
agentex-temporal:
condition: service_healthy
environment:
- TEMPORAL_ADDRESS=agentex-temporal:7233
- TEMPORAL_CLI_ADDRESS=agentex-temporal:7233
- LOG_LEVEL=error
image: temporalio/admin-tools:1.25.0-tctl-1.18.1-cli-1.1.0
networks:
- agentex-network
stdin_open: true
tty: true
agentex-temporal-ui:
container_name: agentex-temporal-ui
depends_on:
agentex-temporal:
condition: service_healthy
environment:
- TEMPORAL_ADDRESS=agentex-temporal:7233
- TEMPORAL_CORS_ORIGINS=http://localhost:3000
- LOG_LEVEL=error
image: temporalio/ui:2.31.0
networks:
- agentex-network
ports:
- 8080:8080
agentex-redis:
container_name: agentex-redis
image: "redis:7.4.0-alpine"
ports:
- "6379:6379"
networks:
- agentex-network
volumes:
- agentex-redis-data:/data:cached
command: [ "redis-server", "--appendonly", "yes" ]
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
interval: 5s
timeout: 5s
retries: 5
start_period: 5s
agentex-postgres:
container_name: agentex-postgres
image: postgres:17
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: agentex
ports:
- "5432:5432"
networks:
- agentex-network
volumes:
- agentex-postgres-data:/var/lib/postgresql/data:cached
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
interval: 5s
timeout: 5s
retries: 5
start_period: 5s
agentex-mongodb:
container_name: agentex-mongodb
image: mongo:6.0
ports:
- "27017:27017"
networks:
- agentex-network
volumes:
- agentex-mongodb-data:/data/db:cached
- ./agentex/scripts/mongodb:/docker-entrypoint-initdb.d/:ro
environment:
- MONGO_INITDB_DATABASE=agentex
command: mongod --bind_ip_all --quiet
healthcheck:
test: mongosh --eval 'db.runCommand("ping").ok' localhost:27017/agentex --quiet
interval: 5s
timeout: 5s
retries: 5
start_period: 5s
# =============================================================================
# AgentEx Backend API
# =============================================================================
agentex:
container_name: agentex
build:
context: .
dockerfile: agentex/Dockerfile
target: dev
environment:
- ENVIRONMENT=development
- UVICORN_PORT=5003
- DATABASE_URL=postgresql://postgres:postgres@agentex-postgres:5432/agentex
- TEMPORAL_ADDRESS=agentex-temporal:7233
- REDIS_URL=redis://agentex-redis:6379
- MONGODB_URI=mongodb://agentex-mongodb:27017
- MONGODB_DATABASE_NAME=agentex
- WATCHFILES_FORCE_POLLING=true
- ENABLE_HEALTH_CHECK_WORKFLOW=true
- AGENTEX_SERVER_TASK_QUEUE=agentex-server
ports:
- "5003:5003"
volumes:
- ./agentex:/app:cached
depends_on:
agentex-temporal:
condition: service_healthy
agentex-redis:
condition: service_healthy
agentex-postgres:
condition: service_healthy
agentex-mongodb:
condition: service_healthy
networks:
- agentex-network
command: |
bash -c "
echo 'All services are available' &&
export TEMPORAL_ADDRESS=agentex-temporal:7233 &&
export TEMPORAL_HOST=agentex-temporal &&
export MONGODB_URI=mongodb://agentex-mongodb:27017 &&
echo 'Creating database if it does not exist...' &&
PGPASSWORD=postgres psql -h agentex-postgres -U postgres -c 'CREATE DATABASE agentex;' || echo 'Database already exists or creation failed' &&
echo 'Running database migrations...' &&
pushd database/migrations &&
alembic upgrade head &&
popd &&
python src/temporal/run_healthcheck_workflow.py &&
echo 'Starting API server...' &&
uvicorn src.api.app:app --host 0.0.0.0 --port 5003 --reload --reload-dir /app/src --reload-include '*.py' --workers 1
"
user: root
healthcheck:
test: [ "CMD-SHELL", "nc -z localhost 5003 || exit 0" ]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
# =============================================================================
# AgentEx Temporal Worker
# =============================================================================
agentex-temporal-worker:
container_name: agentex-temporal-worker
build:
context: .
dockerfile: agentex/Dockerfile
target: dev
environment:
- ENVIRONMENT=development
- DATABASE_URL=postgresql://postgres:postgres@agentex-postgres:5432/agentex
- TEMPORAL_ADDRESS=agentex-temporal:7233
- TEMPORAL_HOST=agentex-temporal
- REDIS_URL=redis://agentex-redis:6379
- MONGODB_URI=mongodb://agentex-mongodb:27017
- MONGODB_DATABASE_NAME=agentex
- AGENTEX_SERVER_TASK_QUEUE=agentex-server
volumes:
- ./agentex:/app:cached
depends_on:
agentex-temporal:
condition: service_healthy
agentex-redis:
condition: service_healthy
agentex-postgres:
condition: service_healthy
agentex-mongodb:
condition: service_healthy
networks:
- agentex-network
command: |
bash -c "
echo 'Starting Temporal Worker...' &&
export TEMPORAL_ADDRESS=agentex-temporal:7233 &&
export TEMPORAL_HOST=agentex-temporal &&
export MONGODB_URI=mongodb://agentex-mongodb:27017 &&
python src/temporal/run_worker.py
"
user: root
restart: unless-stopped
# =============================================================================
# AgentEx UI
# =============================================================================
agentex-ui:
container_name: agentex-ui
build:
context: ./agentex-ui
dockerfile: Dockerfile
environment:
- NODE_ENV=production
- NEXT_TELEMETRY_DISABLED=1
- NEXT_PUBLIC_AGENTEX_API_BASE_URL=http://localhost:5003
- NEXT_PUBLIC_SGP_APP_URL=https://egp.dashboard.scale.com
- PORT=3000
- HOSTNAME=0.0.0.0
- NODE_TLS_REJECT_UNAUTHORIZED=0
ports:
- "3000:3000"
networks:
- agentex-network
depends_on:
agentex:
condition: service_healthy
restart: unless-stopped
healthcheck:
test: [ "CMD-SHELL", "curl -f http://localhost:3000 || exit 1" ]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
volumes:
agentex-temporal-postgres-data:
agentex-postgres-data:
agentex-redis-data:
agentex-mongodb-data:
networks:
agentex-network:
driver: bridge
name: agentex-network