Create docker-compose.yml
Browse files- docker-compose.yml +65 -0
docker-compose.yml
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# docker-compose.yml
|
| 2 |
+
|
| 3 |
+
version: '3.8'
|
| 4 |
+
|
| 5 |
+
services:
|
| 6 |
+
postgres:
|
| 7 |
+
image: postgres:15 # Consider timescale/pgvector image if needed: ankane/pgvector
|
| 8 |
+
container_name: agent_postgres
|
| 9 |
+
environment:
|
| 10 |
+
POSTGRES_USER: user
|
| 11 |
+
POSTGRES_PASSWORD: password
|
| 12 |
+
POSTGRES_DB: agentdb
|
| 13 |
+
volumes:
|
| 14 |
+
- postgres_data:/var/lib/postgresql/data
|
| 15 |
+
ports:
|
| 16 |
+
- "5432:5432" # Expose only if needed externally
|
| 17 |
+
restart: unless-stopped
|
| 18 |
+
# For pgvector extension (if using ankane/pgvector image or standard postgres + setup):
|
| 19 |
+
# command: postgres -c shared_preload_libraries='pg_stat_statements,pgvector' # Example
|
| 20 |
+
|
| 21 |
+
redis:
|
| 22 |
+
image: redis:7
|
| 23 |
+
container_name: agent_redis
|
| 24 |
+
ports:
|
| 25 |
+
- "6379:6379" # Expose only if needed externally
|
| 26 |
+
restart: unless-stopped
|
| 27 |
+
|
| 28 |
+
agent-worker:
|
| 29 |
+
build: . # Assumes Dockerfile is in the current directory
|
| 30 |
+
container_name: agent_worker
|
| 31 |
+
depends_on:
|
| 32 |
+
- postgres
|
| 33 |
+
- redis
|
| 34 |
+
environment:
|
| 35 |
+
# Override or add environment variables here
|
| 36 |
+
NUM_WORKERS: 4 # Example: Run 4 workers in this container (or scale replicas)
|
| 37 |
+
PYTHONUNBUFFERED: 1 # Ensure logs appear immediately
|
| 38 |
+
# Pass GPU capabilities if learning worker runs here (see Docker Compose GPU support docs)
|
| 39 |
+
# volumes:
|
| 40 |
+
# Mount code if needed for development: .:/app
|
| 41 |
+
command: ["python", "your_main_script.py"] # Command to start workers
|
| 42 |
+
restart: unless-stopped
|
| 43 |
+
|
| 44 |
+
# Optional: Separate Learning Worker Service (if GPU resources are specific)
|
| 45 |
+
# learning-worker:
|
| 46 |
+
# build: . # Or a specific Dockerfile for learning
|
| 47 |
+
# container_name: learning_worker
|
| 48 |
+
# depends_on:
|
| 49 |
+
# - postgres
|
| 50 |
+
# environment:
|
| 51 |
+
# # ... similar env vars ...
|
| 52 |
+
# LEARNING_INTERVAL_HOURS: 6
|
| 53 |
+
# DEVICE: cuda
|
| 54 |
+
# deploy: # Requires Docker Swarm or Kubernetes for GPU allocation
|
| 55 |
+
# resources:
|
| 56 |
+
# reservations:
|
| 57 |
+
# devices:
|
| 58 |
+
# - driver: nvidia
|
| 59 |
+
# count: 1 # Request 1 GPU
|
| 60 |
+
# capabilities: [gpu]
|
| 61 |
+
# command: ["python", "your_learning_script.py"] # Command to start scheduler/learning
|
| 62 |
+
# restart: unless-stopped
|
| 63 |
+
|
| 64 |
+
volumes:
|
| 65 |
+
postgres_data:
|