-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
120 lines (105 loc) · 7.7 KB
/
Copy pathdocker-compose.yml
File metadata and controls
120 lines (105 loc) · 7.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
# ═══════════════════════════════════════════════════════════════════════════════
# ALGO TRADING BOT - DOCKER COMPOSE CONFIGURATION
# ═══════════════════════════════════════════════════════════════════════════════
#
# This configuration enables:
# - Hot reloading: Code changes on Windows reflect instantly in container
# - Environment isolation: .env file for secrets (API keys, etc.)
# - Data persistence: Volumes for ArcticDB data, logs, and reports
#
# Usage:
# docker-compose up --build # Build and run
# docker-compose up -d # Run in background
# docker-compose logs -f # Follow logs
# docker-compose down # Stop and remove
#
# ═══════════════════════════════════════════════════════════════════════════════
services:
# ─────────────────────────────────────────────────────────────────────────────
# TRADING BOT SERVICE
# ─────────────────────────────────────────────────────────────────────────────
trading_bot:
build:
context: .
dockerfile: Dockerfile
container_name: algo_trading_bot
# ─────────────────────────────────────────────────────────────────────────
# VOLUMES (Hot Reloading & Persistence)
# ─────────────────────────────────────────────────────────────────────────
# Map only source code directories for hot reload, not the entire project.
# This preserves the installed dependencies inside the container.
volumes:
# Source code (hot reload) - READ-WRITE
- ./src:/app/src:ro
- ./scripts:/app/scripts:ro
- ./config:/app/config
# Named volumes for data persistence (survives container restarts)
- trading_data:/app/data
- trading_logs:/app/logs
- trading_reports:/app/reports
# ─────────────────────────────────────────────────────────────────────────
# ENVIRONMENT
# ─────────────────────────────────────────────────────────────────────────
env_file:
- .env
environment:
# Python configuration
- PYTHONUNBUFFERED=1
- PYTHONDONTWRITEBYTECODE=1
# Trading configuration (can be overridden in .env)
- TRADING_MODE=${TRADING_MODE:-paper}
- LOG_LEVEL=${LOG_LEVEL:-INFO}
- HEALTH_KEEPALIVE=${HEALTH_KEEPALIVE:-true}
# Timezone (important for market hours)
- TZ=UTC
# ─────────────────────────────────────────────────────────────────────────
# COMMAND
# ─────────────────────────────────────────────────────────────────────────
command: python scripts/nautilus_runner.py
# ─────────────────────────────────────────────────────────────────────────
# HEALTHCHECK
# ─────────────────────────────────────────────────────────────────────────
healthcheck:
test: ["CMD-SHELL", "python -c \"import urllib.request; urllib.request.urlopen('http://localhost:8080/health').read()\""]
interval: 30s
timeout: 5s
retries: 3
start_period: 20s
# ─────────────────────────────────────────────────────────────────────────
# NETWORKING
# ─────────────────────────────────────────────────────────────────────────
# Expose ports if needed (e.g., for monitoring dashboard)
ports:
- "8080:8080"
# ─────────────────────────────────────────────────────────────────────────
# RESOURCE LIMITS (Recommended for production)
# ─────────────────────────────────────────────────────────────────────────
deploy:
resources:
limits:
memory: 3G
reservations:
memory: 1G
# ─────────────────────────────────────────────────────────────────────────
# RESTART POLICY
# ─────────────────────────────────────────────────────────────────────────
restart: unless-stopped
# ─────────────────────────────────────────────────────────────────────────
# LOGGING
# ─────────────────────────────────────────────────────────────────────────
logging:
driver: "json-file"
options:
max-size: "50m"
max-file: "5"
# ═══════════════════════════════════════════════════════════════════════════════
# NAMED VOLUMES
# ═══════════════════════════════════════════════════════════════════════════════
# These persist data even when containers are removed
volumes:
trading_data:
name: algo_trading_data
trading_logs:
name: algo_trading_logs
trading_reports:
name: algo_trading_reports