version: '3.8'

services:
  # Nginx 보안 프록시 (기존 젤리핀 앱용)
  nginx-security:
    image: nginx:alpine
    container_name: home-service-proxy
    restart: unless-stopped
    ports:
      - "8097:80" # 외부 접속용 포트 (8096과 구분)
      - "8443:443" # HTTPS
    volumes:
      - ./nginx-ssl.conf:/etc/nginx/nginx.conf:ro
      - ./security.conf:/etc/nginx/conf.d/security.conf:ro
      - ./fail2ban-log:/var/log/nginx
      - ./ssl-certs:/etc/nginx/ssl:ro # SSL 인증서 (선택)
      - ./archive:/etc/nginx/ssl/archive:ro # 시놀로지 와일드카드 인증서
    networks:
      - home-service-proxy-net

  # Fail2Ban 보안 모니터링
  fail2ban:
    image: crazymax/fail2ban:latest
    container_name: home-service-fail2ban
    restart: unless-stopped
    network_mode: "host"
    cap_add:
      - NET_ADMIN
      - NET_RAW
    volumes:
      - ./fail2ban-data:/data
      - ./fail2ban-log:/var/log/nginx:ro
      - ./fail2ban.conf:/etc/fail2ban/jail.local:ro
    environment:
      - TZ=Asia/Seoul
      - F2B_LOG_LEVEL=INFO

  # OmniFocus 전용 WebDAV 서버
  webdav:
    image: hacdias/webdav:latest # ARM64 지원
    container_name: omnifocus-webdav
    restart: unless-stopped
    ports:
      - "8090:80" # 내부 WebDAV 포트
    environment:
      - WEBDAV_USERNAME=${WEBDAV_USERNAME}
      - WEBDAV_PASSWORD=${WEBDAV_PASSWORD}
      - TZ=Asia/Seoul
    volumes:
      - ./omnifocus-data:/srv
    networks:
      - home-service-proxy-net

networks:
  home-service-proxy-net:
    driver: bridge
