services:
  rtmp:
    image: alfg/nginx-rtmp
    ports:
      - "1935:1935"
      - "8080:80"
    volumes:
      - ./rtmp/live.conf:/etc/nginx/nginx.conf.template
      - video_files:/opt/data/hls
  api:
    build: stream-handler
    ports:
      - "9090:9090"
    volumes:
      - ./stream-handler:/stream-handler
    environment:
      - REDIS_ADDR=redis:6379
      - REDIS_PASSWORD=
    command: go run /stream-handler/main.go api
  discovery:
    build: stream-handler
    volumes:
      - ./stream-handler:/stream-handler
      - video_files:/hls
    command: go run /stream-handler/main.go discovery
    environment:
      - HLS_PATH=/hls
      - IP=rtmp
      - DISCOVERY_API_URL=http://api:9090
  redis:
    image: redis:7.0.12-alpine
    ports:
      - "6379:6379"
  edge:
    build: edge
    ports:
      - "8081:8081"
    volumes:
      - ./edge/nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf
      - ./edge/router:/router/

volumes:
  video_files:
