-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yaml
More file actions
159 lines (151 loc) · 4.21 KB
/
docker-compose.prod.yaml
File metadata and controls
159 lines (151 loc) · 4.21 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
version: "3.9"
# =============================================================================
# Production Docker Compose Configuration
# =============================================================================
# Usage: docker compose -f docker-compose.prod.yaml up -d
# =============================================================================
services:
# =============================================================================
# Backend - LangGraph Agent Server (Production)
# =============================================================================
agent:
build:
context: ./apps/agent
dockerfile: Dockerfile
target: production
container_name: horizon-agent-prod
ports:
- "2024:2024"
- "8000:8000"
environment:
- ENVIRONMENT=production
- HOST=0.0.0.0
- PORT=2024
- CORS_ORIGINS=${CORS_ORIGINS:-http://localhost:3000}
- PYTHONDONTWRITEBYTECODE=1
- PYTHONUNBUFFERED=1
env_file:
- ./apps/agent/.env
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8000/health" ]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
restart: always
networks:
- horizon-network
deploy:
resources:
limits:
cpus: '2'
memory: 2G
reservations:
cpus: '0.5'
memory: 512M
# =============================================================================
# Frontend - Next.js Web Application (Production)
# =============================================================================
web:
build:
context: ./apps/web
dockerfile: Dockerfile
target: production
container_name: horizon-web-prod
ports:
- "3000:3000"
environment:
- NODE_ENV=production
- NEXT_PUBLIC_LANGGRAPH_API_URL=${LANGGRAPH_API_URL:-http://localhost:2024}
depends_on:
agent:
condition: service_healthy
restart: always
networks:
- horizon-network
deploy:
resources:
limits:
cpus: '1'
memory: 1G
reservations:
cpus: '0.25'
memory: 256M
# =============================================================================
# Sandbox - Isolated Code Execution (Production)
# =============================================================================
sandbox:
build:
context: ./apps/sandbox
dockerfile: Dockerfile
container_name: horizon-sandbox-prod
volumes:
- sandbox-workspaces:/workspaces
environment:
- SANDBOX_TIMEOUT=30
- SANDBOX_MAX_MEMORY=256m
- SANDBOX_MAX_CPU=0.5
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
read_only: true
tmpfs:
- /tmp:size=50M,mode=1777
networks:
- sandbox-network
restart: always
deploy:
resources:
limits:
cpus: '1'
memory: 512M
# =============================================================================
# Redis - Session and Cache Storage (Production)
# =============================================================================
redis:
image: redis:7-alpine
container_name: horizon-redis-prod
volumes:
- redis-data:/data
command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
interval: 10s
timeout: 5s
retries: 5
restart: always
networks:
- horizon-network
deploy:
resources:
limits:
cpus: '0.5'
memory: 256M
# =============================================================================
# Nginx - Reverse Proxy (Production)
# =============================================================================
nginx:
image: nginx:alpine
container_name: horizon-nginx
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./certs:/etc/nginx/certs:ro
depends_on:
- web
- agent
restart: always
networks:
- horizon-network
networks:
horizon-network:
driver: bridge
sandbox-network:
driver: bridge
internal: true
volumes:
sandbox-workspaces:
redis-data: