Date: 2026-04-15
Project: Reel Quick (FastAPI + Next.js + ARQ + Mongo + Redis + optional GPU workers)
Context
We containerized the stack and tried to run it in production mode with Docker Compose.
Initial startup failed for both frontend build and backend runtime.
Issues Found
- Docker Compose path mismatches:
- Wrong
env_filepaths (docker/env/*.envexpected but files were indocker/). - Wrong nginx config mount path (
./docker/nginx/nginx.confwhile actual file wasdocker/nginx.conf). Build context was incorrect for a compose file located inside
docker/.Frontend TypeScript build failure:
locationfield type mismatch infrontend/app/create_video/page.tsx.Value inferred as
string | undefinedbut state expectsstring | null.Backend container crash on startup:
ModuleNotFoundError: No module named 'db'.backend/main.pyused non-package imports likefrom db import ....
Root Causes
- Relative paths in compose were not aligned with actual file layout.
- Optional API response property (
file_location?) was used directly inside state update. - Backend entrypoint (
uvicorn backend.main:app) requires package-safe imports (backend.*).
Fixes Applied
Docker and Compose
- Updated
docker/docker-compose.yml:-
build.contextchanged from.to... -
env_filepaths corrected tobackend.envandmongo.env. - nginx bind mount fixed to
./nginx.conf.
-
- Updated
docker/backend.env:- Added:
UPLOAD_FILES_LOCATION=/app/video_filesINPUT_FILES_LOCATION=/app/video_files
- Added repo-root
.dockerignore(Docker uses ignore file from build context root). - Synced
docker/dockerignoreentries. - Updated
docker/README-docker-prod.mdrun commands.
Frontend
- Fixed type narrowing in
frontend/app/create_video/page.tsx:- Captured
file_locationintouploadedLocation. - Guarded before
setFiles(...). - Used guaranteed string value in state update.
- Captured
Backend
- Converted backend imports to package imports in
backend/main.py:-
from db import ...->from backend.db import ... - Similar conversion for
logger,models,objects,workers.
-
- Updated
backend/objects/sound_prompt_preset.pyimport tobackend.objects....
Commands Used for Deploy
# Stop all running containers (host-wide)
docker ps -q | xargs -r docker stop
# Start Reel Quick with GPU workers
cd /home/farhan/reel-quick/docker
docker compose --profile gpu up -d --build
# Verify
docker compose ps
docker compose logs -f api --tail=200
Validation Checklist
-
docker compose psshowsapi,frontend,nginx,mongo,redis, workers as running. -
apilogs no longer showModuleNotFoundError: No module named 'db'. - Frontend image builds successfully (
npm run buildpasses in container build stage). - Upload endpoint works (
POST /uploads). - Workers/control panel endpoints return expected data.
Key Takeaways
- Keep compose file paths consistent with its directory and build context.
- Use package-qualified imports for Python app modules in containerized runtimes.
- Narrow optional API fields before state updates in strict TypeScript projects.
- Add
.dockerignoreat the actual build context root to avoid bloated builds.
Top comments (0)