Generate videos via FastAPI + Celery on NVIDIA H100.
api/FastAPI service (seeapi/README.md)vid/model pipelines (seevid/README.md)k3s/K3s manifests (seek3s/README.md)scripts/ops scripts (seescripts/README.md)setup/host setup scripts (seesetup/README.md)MONITORING.mdmetrics and Flower
- FastAPI API (submit jobs, query status, list completed videos)
- Celery worker with Redis broker
- PostgreSQL for job metadata and results
- CogVideoX-2B model running on H100 GPU for text-to-video generation
Model: THUDM/CogVideoX-2b
- Access Method: Direct download from HuggingFace Hub (public model)
- Authentication: None required - model is publicly available
For Private/Gated Models (Future): If switching to private or gated models, add HuggingFace authentication:
-
Add to
.env:HF_TOKEN=your_huggingface_token_here
-
Update
api/config.py:HF_TOKEN = os.getenv('HF_TOKEN')
-
Modify model loading:
self.pipe = CogVideoXPipeline.from_pretrained( model_id, torch_dtype=torch.bfloat16, use_auth_token=token #if token provided ).to("cuda")
- Single image
videogen:latestruns API and Worker (separate deployments) - API:
replicas: 3, RollingUpdate (maxSurge=1, maxUnavailable=0), readiness/liveness on/health - Worker:
replicas: 1, Recreate strategy,runtimeClassName: nvidiafor GPU - Shared PVC
videogen-outputmounted at/app/output - Config via ConfigMap; secrets via
videogen-secretsandvideogen-pg-auth - Services: ClusterIP for internal, NodePort 30080 for external API access
- Docker and Docker Compose
- NVIDIA GPU drivers (for actual generation)
- Create environment file
cp .env.example .env
# edit values (passwords, URLs)- Start services (Docker Compose)
docker compose up -d --buildFor Kubernetes (K3s) deployment, see k3s/README.md for full cluster setup and rollout.
- Health:
GET http://localhost:8000/health - Submit:
POST http://localhost:8000/api/v1/generate(JSON: prompt, fps) - Status:
GET http://localhost:8000/api/v1/job/{job_id} - Completed videos:
GET http://localhost:8000/api/v1/videos - Download video:
GET http://localhost:8000/api/v1/download/{job_id} - Flower UI (optional):
http://localhost:5555
Test the complete video generation pipeline:
./demo.shThe demo script walks through the entire workflow: health check, job submission, progress monitoring, and video download.
- View logs:
docker compose logs -f videogen(API) ordocker compose logs -f celery-worker(tasks) - Portainer UI:
http://localhost:9000→ Containers → Logs - Log files:
logs/app.log(structured logging with rotation)
PostgreSQL Tables:
video_generation_jobs- job metadata and status trackingcelery_taskmeta- Celery task results (auto-created)celery_tasksetmeta- Celery task groups (auto-created)
Storage:
- Job queue: Redis broker
- Task results: PostgreSQL backend
- Generated videos:
/app/outputfilesystem
Configure in .env (see .env.example). Typical variables:
POSTGRES_DB,POSTGRES_USER,POSTGRES_PASSWORDDATABASE_URL,REDIS_URL,FLOWER_BASIC_AUTHENVIRONMENT,LOG_LEVEL
- Centralized config in
api/config.pywith environment-specific settings - Configuration validation on startup
- Environment variables with sensible defaults
- No secrets hard-coded in source code
- Clean volume is created for Postgres
- DB init job applies tables, indexes, and functions
- API usage:
api/README.md - Kubernetes:
k3s/README.md - Video pipeline:
vid/README.md - Monitoring:
MONITORING.md