From 76e045aa82b677eeb6b636da041622264070278a Mon Sep 17 00:00:00 2001 From: gahusb Date: Sat, 11 Apr 2026 08:51:46 +0900 Subject: [PATCH] infra(agent-office): Docker Compose service + Nginx WebSocket proxy Co-Authored-By: Claude Opus 4.6 --- docker-compose.yml | 26 ++++++++++++++++++++++++++ nginx/default.conf | 16 ++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 55c47a3..69c821a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -108,6 +108,32 @@ services: timeout: 5s retries: 3 + agent-office: + build: + context: ./agent-office + container_name: agent-office + restart: unless-stopped + ports: + - "18900:8000" + environment: + - TZ=${TZ:-Asia/Seoul} + - CORS_ALLOW_ORIGINS=${CORS_ALLOW_ORIGINS:-http://localhost:3007,http://localhost:8080} + - STOCK_LAB_URL=http://stock-lab:8000 + - MUSIC_LAB_URL=http://music-lab:8000 + - TELEGRAM_BOT_TOKEN=${TELEGRAM_BOT_TOKEN:-} + - TELEGRAM_CHAT_ID=${TELEGRAM_CHAT_ID:-} + - TELEGRAM_WEBHOOK_URL=${TELEGRAM_WEBHOOK_URL:-} + volumes: + - ${RUNTIME_PATH:-.}/data/agent-office:/app/data + depends_on: + - stock-lab + - music-lab + healthcheck: + test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"] + interval: 30s + timeout: 5s + retries: 3 + travel-proxy: build: ./travel-proxy container_name: travel-proxy diff --git a/nginx/default.conf b/nginx/default.conf index 8123e20..cfcb846 100644 --- a/nginx/default.conf +++ b/nginx/default.conf @@ -139,6 +139,22 @@ server { } + # agent-office API + WebSocket + location /api/agent-office/ { + resolver 127.0.0.11 valid=10s; + set $agent_office_backend agent-office: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_set_header X-Forwarded-Proto $scheme; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_read_timeout 86400s; + proxy_pass http://$agent_office_backend$request_uri; + } + # API 프록시 (여기가 포인트: /api/ 중복 제거) location /api/ { proxy_http_version 1.1;