-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
142 lines (136 loc) · 4.34 KB
/
Copy pathdocker-compose.dev.yml
File metadata and controls
142 lines (136 loc) · 4.34 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
# Hermes Development Stack
# Features hot reload for both frontend and backend
#
# Usage: docker compose -f docker-compose.dev.yml up
#
# Services:
# - Frontend: http://localhost:5173 (Vite dev server with hot reload)
# - API: http://localhost:5173/api/v1 (proxied to the API container)
# - Direct API: http://localhost:8000 (exposed for debugging)
# - Redis: localhost:6379 (exposed for debugging)
services:
# Frontend development server (Vite with hot reload)
app:
build:
context: .
dockerfile: packages/hermes-app/Dockerfile.dev
container_name: hermes-app-dev
restart: unless-stopped
ports:
- "${HERMES_DEV_PORT:-5173}:5173"
volumes:
# Mount source code for hot reload
- ./packages/hermes-app/src:/app/packages/hermes-app/src
- ./packages/hermes-app/public:/app/packages/hermes-app/public
- ./packages/hermes-app/index.html:/app/packages/hermes-app/index.html
# Prevent overwriting node_modules from host
- /app/node_modules
- /app/packages/hermes-app/node_modules
networks:
- hermes-network
environment:
# Keep browser traffic on the Vite origin; Vite proxies /api to the API container.
- VITE_API_BASE_URL=/api/v1
- HERMES_DEV_API_TARGET=http://api:8000
depends_on:
api:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://127.0.0.1:5173/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
# Backend API with hot reload
api:
build:
context: ./packages/hermes-api
dockerfile: Dockerfile
container_name: hermes-api-dev
restart: unless-stopped
ports:
# Expose direct API access for debugging; browser traffic normally uses the app proxy.
- "${API_PORT:-8000}:8000"
env_file:
- .env
environment:
- HERMES_SECRET_KEY=${HERMES_SECRET_KEY}
- HERMES_DEBUG=true
- HERMES_REDIS_URL=${HERMES_REDIS_URL:-redis://redis:6379}
- HERMES_ALLOWED_ORIGINS=["http://localhost:5173","http://localhost:3000","http://localhost:8000"]
volumes:
- ./data/downloads:/app/downloads
- ./data/temp:/app/temp
- ./data/data:/app/data
# Mount source code for hot reload
- ./packages/hermes-api/app:/app/app
networks:
- hermes-network
depends_on:
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/api/v1/health/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# Enable auto-reload on code changes
command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload --log-level debug
# Celery worker with hot reload
celery_worker:
build:
context: ./packages/hermes-api
dockerfile: Dockerfile
container_name: hermes-worker-dev
restart: unless-stopped
env_file:
- .env
environment:
- HERMES_SECRET_KEY=${HERMES_SECRET_KEY}
- HERMES_DEBUG=true
- HERMES_REDIS_URL=${HERMES_REDIS_URL:-redis://redis:6379}
volumes:
- ./data/downloads:/app/downloads
- ./data/temp:/app/temp
- ./data/data:/app/data
# Mount source code for hot reload
- ./packages/hermes-api/app:/app/app
networks:
- hermes-network
depends_on:
redis:
condition: service_healthy
api:
condition: service_healthy
command: celery -A app.tasks.celery_app worker --loglevel=debug --concurrency=1 --hostname=hermes-worker@%h --queues=hermes.downloads,hermes.cleanup,hermes.default
healthcheck:
test: ["CMD", "celery", "-A", "app.tasks.celery_app", "inspect", "ping"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
# Redis for caching and task queue
redis:
image: redis:8-alpine
container_name: hermes-redis-dev
restart: unless-stopped
ports:
# Expose for debugging with redis-cli
- "6379:6379"
volumes:
- redis_data_dev:/data
networks:
- hermes-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 3
start_period: 5s
command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
networks:
hermes-network:
driver: bridge
volumes:
redis_data_dev: # Separate Redis data for development