# ============================================================ # Pipeline Edge 배포 Compose # # 목적: 스피폭스 등 고객사 엣지 서버에 Pipeline을 올려 # 기존 Python data-collector + Kafka + forwarder를 완전 대체 # # 실행: # cd /home/wace/pipeline-edge # docker compose -f docker-compose.edge.yml up -d # # 전제: # - .env 파일에 DATABASE_URL, PASSWORD_ENCRYPTION_KEY, JWT_SECRET 설정 # - Harbor 레지스트리 로그인 완료 (docker login harbor.wace.me) # - 엣지에서 PLC(예: 192.168.101.50:2004) 도달 가능 # - 엣지에서 IDC EMQX (211.115.91.170:31883) 도달 가능 # ============================================================ services: pipeline-backend: image: ${PIPELINE_IMAGE:-harbor.wace.me/vexplor_fleet/pipeline-backend:latest} container_name: pipeline-backend restart: always ports: - "8080:8080" # REST API + Admin UI - "1883:1883" # 내장 MQTT (로컬 용, 선택) - "8083:8083" # MQTT WebSocket (선택) environment: # ─── 핵심 ───────────────────────────────────────── - NODE_ENV=production - PORT=8080 # ─── DB 연결 (IDC 원격 또는 로컬 Postgres) ────────── - DATABASE_URL=${DATABASE_URL} # ─── 보안 ───────────────────────────────────────── - JWT_SECRET=${JWT_SECRET} - PASSWORD_ENCRYPTION_KEY=${PASSWORD_ENCRYPTION_KEY} - ENCRYPTION_KEY=${ENCRYPTION_KEY} # ─── 장비 수집기 자동 시작 ──────────────────────── # 엣지에선 반드시 true — 부팅 시 DB의 모든 활성 연결 폴링 시작 - ENABLE_AUTO_COLLECTOR=true # ─── 회사/엣지 식별 ────────────────────────────── - COMPANY_CODE=${COMPANY_CODE:-spifox} - EDGE_ID=${EDGE_ID} volumes: # 영속 데이터 (업로드, 로그 등) - pipeline-data:/app/storage - pipeline-uploads:/app/uploads networks: - pipeline-network labels: - "com.centurylinklabs.watchtower.enable=true" healthcheck: test: ["CMD-SHELL", "curl -sf http://localhost:8080/health || exit 1"] interval: 30s timeout: 10s retries: 3 # ─── 프론트엔드 (선택) ────────────────────────────── # 엣지에서 직접 UI 접근하고 싶으면 켜기. 보통은 중앙 Pipeline UI 사용. pipeline-front: image: ${PIPELINE_FRONT_IMAGE:-harbor.wace.me/vexplor_fleet/pipeline-front:latest} container_name: pipeline-front restart: always ports: - "9771:3000" environment: - NEXT_PUBLIC_API_URL=http://localhost:8080/api - SERVER_API_URL=http://pipeline-backend:8080 - NODE_OPTIONS=--max-old-space-size=2048 networks: - pipeline-network labels: - "com.centurylinklabs.watchtower.enable=true" profiles: ["with-ui"] # docker compose --profile with-ui up 로 선택 기동 # ─── Watchtower (자동 업데이트) ────────────────────── # 기존 스피폭스 엣지와 동일한 패턴: Harbor 폴링 + 라벨 기반 watchtower: image: nickfedor/watchtower:latest container_name: watchtower restart: always environment: - WATCHTOWER_POLL_INTERVAL=300 - WATCHTOWER_CLEANUP=true - WATCHTOWER_LABEL_ENABLE=true volumes: - /var/run/docker.sock:/var/run/docker.sock - ~/.docker/config.json:/config.json:ro command: --interval 300 labels: - "com.centurylinklabs.watchtower.enable=false" profiles: ["watchtower"] networks: pipeline-network: driver: bridge name: pipeline-network volumes: pipeline-data: name: pipeline-data pipeline-uploads: name: pipeline-uploads