Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
130 lines (126 loc) · 4.76 KB
/
Copy pathdocker-compose.yml
File metadata and controls
130 lines (126 loc) · 4.76 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
# Docker Compose for ManimCat
# Production-ready with Redis for task queue and state management
services:
redis:
image: redis:7-alpine
container_name: manim-redis
ports:
- "${REDIS_PORT:-6379}:6379"
volumes:
- redis-data:/data
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 10
start_period: 5s
command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru
networks:
- manimcat-network
manimcat:
build:
context: .
dockerfile: Dockerfile
args:
- NODE_ENV=production
image: manimcat:latest
# Compose provides the shared Redis service. Bypass the image's Hugging Face
# single-container launcher, which owns an embedded localhost Redis instance.
command: ["node", "dist/server.js"]
# No fixed container_name: keeping it would prevent `docker compose up --scale manimcat=N`.
#
# Host port binding. One replica keeps stable access:
# MANIMCAT_PUBLISHED_PORT=3000
# Multi-replica smoke run on one host lets Docker assign host ports:
# MANIMCAT_PUBLISHED_PORT=0 docker compose up --scale manimcat=2
# docker compose port manimcat 3000 # prints the assigned host port
# Production traffic across replicas still requires a reverse proxy, load balancer or
# orchestrator ingress: this project ships cross-replica event fan-out, not an HTTP LB.
ports:
- "${MANIMCAT_PUBLISHED_PORT:-3000}:3000"
environment:
- NODE_ENV=production
- PORT=3000
- LOG_LEVEL=${LOG_LEVEL:-info}
- PROD_SUMMARY_LOG_ONLY=${PROD_SUMMARY_LOG_ONLY:-true}
- HTTP_PROXY=${HTTP_PROXY:-}
- HTTPS_PROXY=${HTTPS_PROXY:-}
- NO_PROXY=${NO_PROXY:-}
- http_proxy=${http_proxy:-}
- https_proxy=${https_proxy:-}
- no_proxy=${no_proxy:-}
- REDIS_HOST=redis
- REDIS_PORT=6379
- REDIS_DB=${REDIS_DB:-0}
# Cross-replica Studio event delivery (Redis Pub/Sub); memory only for single-instance setups
- STUDIO_EVENT_TRANSPORT=${STUDIO_EVENT_TRANSPORT:-redis}
# Optional: keep deployments that share one Redis on separate channels
- STUDIO_EVENT_REDIS_CHANNEL=${STUDIO_EVENT_REDIS_CHANNEL:-}
# Cross-replica Run coordination: one session lease per Studio session, plus durable
# cancellation markers. Renewal must stay below half the lease TTL (validated at boot).
- STUDIO_RUN_COORDINATION=${STUDIO_RUN_COORDINATION:-redis}
- STUDIO_RUN_LEASE_TTL_MS=${STUDIO_RUN_LEASE_TTL_MS:-60000}
- STUDIO_RUN_LEASE_RENEW_MS=${STUDIO_RUN_LEASE_RENEW_MS:-15000}
- STUDIO_RUN_CANCEL_TTL_MS=${STUDIO_RUN_CANCEL_TTL_MS:-3600000}
# Optional: keep deployments that share one Redis on separate prefixes/channels
- STUDIO_RUN_REDIS_PREFIX=${STUDIO_RUN_REDIS_PREFIX:-}
- STUDIO_RUN_CONTROL_CHANNEL=${STUDIO_RUN_CONTROL_CHANNEL:-}
# Shared Studio persistence is required when requests can reach multiple replicas.
- ENABLE_STUDIO_DB=${ENABLE_STUDIO_DB:-false}
- SUPABASE_URL=${SUPABASE_URL:-}
- SUPABASE_KEY=${SUPABASE_KEY:-}
# Upstream routing (required for server-side generation unless frontend passes customApiConfig)
- MANIMCAT_ROUTE_KEYS=${MANIMCAT_ROUTE_KEYS:-}
- MANIMCAT_ROUTE_API_URLS=${MANIMCAT_ROUTE_API_URLS:-}
- MANIMCAT_ROUTE_API_KEYS=${MANIMCAT_ROUTE_API_KEYS:-}
- MANIMCAT_ROUTE_MODELS=${MANIMCAT_ROUTE_MODELS:-}
- DISPLAY=:99
volumes:
# Persist studio workspace sessions, generated code, and studio outputs
- studio-workspace-data:/app/.studio-workspace
# Persist generated images and uploaded reference images
- image-storage:/app/public/images
# Persist generated videos
- video-storage:/app/public/videos
# Persist Manim media cache and intermediate render artifacts
- manim-media:/app/media
# Temp directory for rendering
- manim-tmp:/app/tmp
depends_on:
redis:
condition: service_healthy
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "node -e \"require('http').get('http://localhost:3000/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))\""]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- manimcat-network
# Resource limits (adjust based on your needs)
deploy:
resources:
limits:
cpus: '2'
memory: 4G
reservations:
cpus: '1'
memory: 2G
networks:
manimcat-network:
driver: bridge
volumes:
studio-workspace-data:
driver: local
image-storage:
driver: local
manim-tmp:
driver: local
manim-media:
driver: local
redis-data:
driver: local
video-storage:
driver: local