-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
280 lines (269 loc) · 8.7 KB
/
Copy pathdocker-compose.yml
File metadata and controls
280 lines (269 loc) · 8.7 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
# Agentex Docker Compose - local development services
version: '3.8'
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:
- ./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:
image: "redis:7.4.0-alpine"
ports:
- "6379:6379"
networks:
- agentex-network # Redis should also be on the same 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
- ./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-otel-collector:
container_name: agentex-otel-collector
image: otel/opentelemetry-collector-contrib:0.101.0
command: ["--config=/etc/otel-collector-config.yaml"]
volumes:
- ./otel/otel-collector-config.yaml:/etc/otel-collector-config.yaml:ro
ports:
- "4317:4317" # OTLP gRPC
- "4318:4318" # OTLP HTTP
- "8889:8889" # Prometheus metrics endpoint
- "13133:13133" # Health check endpoint
networks:
- agentex-network
agentex:
container_name: agentex
build:
context: ..
dockerfile: agentex/Dockerfile
target: dev
args:
SOURCE_DIR: agentex
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
# Disabled by default; enable when testing, e.g. `ENABLE_AGENT_RUN_SCHEDULES=true ./dev.sh`.
- ENABLE_AGENT_RUN_SCHEDULES=${ENABLE_AGENT_RUN_SCHEDULES:-false}
- AGENTEX_SERVER_TASK_QUEUE=agentex-server
- ALLOWED_ORIGINS=http://localhost:3000
- OTEL_EXPORTER_OTLP_ENDPOINT=http://agentex-otel-collector:4317
- OTEL_SERVICE_NAME=agentex-api
- RETENTION_CLEANUP_ENABLED=${RETENTION_CLEANUP_ENABLED:-false}
- RETENTION_CLEANUP_AGENT_ALLOWLIST=${RETENTION_CLEANUP_AGENT_ALLOWLIST:-}
- RETENTION_CLEANUP_IDLE_DAYS=${RETENTION_CLEANUP_IDLE_DAYS:-7}
- RETENTION_CLEANUP_CRON=${RETENTION_CLEANUP_CRON:-0 4 * * *}
- RETENTION_CLEANUP_PAGE_SIZE=${RETENTION_CLEANUP_PAGE_SIZE:-200}
- RETENTION_CLEANUP_MAX_IN_FLIGHT=${RETENTION_CLEANUP_MAX_IN_FLIGHT:-20}
- RETENTION_CLEANUP_DRY_RUN=${RETENTION_CLEANUP_DRY_RUN:-true}
ports:
- "5003:5003"
volumes:
- .:/app:cached
depends_on:
agentex-temporal:
condition: service_healthy
agentex-redis:
condition: service_healthy
agentex-postgres:
condition: service_healthy
agentex-mongodb:
condition: service_healthy
agentex-otel-collector:
condition: service_started
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 &&
python src/temporal/run_retention_cleanup_schedule.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:
container_name: agentex-temporal-worker
build:
context: ..
dockerfile: agentex/Dockerfile
target: dev
args:
SOURCE_DIR: agentex
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
- RETENTION_CLEANUP_ENABLED=${RETENTION_CLEANUP_ENABLED:-false}
- RETENTION_CLEANUP_AGENT_ALLOWLIST=${RETENTION_CLEANUP_AGENT_ALLOWLIST:-}
- RETENTION_CLEANUP_IDLE_DAYS=${RETENTION_CLEANUP_IDLE_DAYS:-7}
- RETENTION_CLEANUP_PAGE_SIZE=${RETENTION_CLEANUP_PAGE_SIZE:-200}
- RETENTION_CLEANUP_MAX_IN_FLIGHT=${RETENTION_CLEANUP_MAX_IN_FLIGHT:-20}
- RETENTION_CLEANUP_DRY_RUN=${RETENTION_CLEANUP_DRY_RUN:-true}
volumes:
- .:/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
volumes:
agentex-temporal-postgres-data:
agentex-postgres-data:
agentex-redis-data:
agentex-mongodb-data:
networks:
agentex-network:
driver: bridge
name: agentex-network