From 37ca8e594e0e27f987a31ee1128ae06e9363733d Mon Sep 17 00:00:00 2001 From: gahusb Date: Tue, 19 May 2026 08:31:37 +0900 Subject: [PATCH] feat(video-lab): docker-compose entry + nginx routing (SP-8) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit video-lab service: port 18801, REDIS_URL/INTERNAL_API_KEY env, depends_on redis, /app/data volume mount. nginx: /api/video/ proxy + /media/video/ direct serve alias. frontend depends_on + volume mount 추가. Plan-B-Video Phase 1. Co-Authored-By: Claude Opus 4.7 (1M context) --- docker-compose.yml | 25 +++++++++++++++++++++++++ nginx/default.conf | 26 ++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index ceed14d..07207a1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -90,6 +90,29 @@ services: timeout: 5s retries: 3 + video-lab: + build: + context: ./video-lab + container_name: video-lab + restart: unless-stopped + ports: + - "18801:8000" + environment: + - TZ=${TZ:-Asia/Seoul} + - REDIS_URL=${REDIS_URL:-redis://redis:6379} + - INTERNAL_API_KEY=${INTERNAL_API_KEY:-} + - VIDEO_DATA_DIR=/app/data + - CORS_ALLOW_ORIGINS=${CORS_ALLOW_ORIGINS:-http://localhost:3007,http://localhost:8080} + volumes: + - ${RUNTIME_PATH}/data/video:/app/data + depends_on: + - redis + healthcheck: + test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"] + interval: 60s + timeout: 5s + retries: 3 + insta-lab: build: context: ./insta-lab @@ -265,6 +288,7 @@ services: - personal - packs-lab - travel-proxy + - video-lab ports: - "8080:80" volumes: @@ -274,6 +298,7 @@ services: - ${RUNTIME_PATH}/travel-thumbs:/data/thumbs:ro - ${RUNTIME_PATH}/data/music:/data/music:ro - ${RUNTIME_PATH}/data/videos:/data/videos:ro + - ${RUNTIME_PATH}/data/video:/data/video:ro - ${RUNTIME_PATH}/data/insta/insta_cards:/data/insta_cards:ro extra_hosts: - "host.docker.internal:host-gateway" diff --git a/nginx/default.conf b/nginx/default.conf index a521381..5e5f137 100644 --- a/nginx/default.conf +++ b/nginx/default.conf @@ -36,6 +36,17 @@ server { autoindex off; } + # video media — Nginx 직접 mp4 서빙 + location ^~ /media/video/ { + alias /data/video/; + + expires 1d; + add_header Cache-Control "public, max-age=86400" always; + add_header Accept-Ranges bytes always; + + autoindex off; + } + # music videos — Nginx가 직접 비디오 파일 서빙 location ^~ /media/insta/ { alias /data/insta_cards/; @@ -68,6 +79,21 @@ server { proxy_pass http://$music_backend$request_uri; } + # video-lab — 영상 생성 gateway + location /api/video/ { + resolver 127.0.0.11 valid=10s; + set $video_backend video-lab:8000; + + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_pass http://$video_backend$request_uri; + + proxy_read_timeout 120s; + proxy_connect_timeout 10s; + } + # realestate API location /api/realestate/ { proxy_http_version 1.1;