Sign inSign up

flussonic/watcher

By flussonic

Updated about 3 hours ago

Image
0

50K+

flussonic/watcher repository overview

To run docker, you will need to prepare several variables:
  • LICENSE_KEY
  • DOMAIN
  • CLUSTER_KEY
  • CENTRAL_API_KEY
  • LOGIN
  • PASSWORD
$ vi docker-compose.yml
Docker-compose file
version: "3.7"

volumes:
  dvr_storage:
    driver: local
  postgres_data:
    driver: local
  redis_data:
    driver: local

networks:
  default:
    name: watcher-network

services:
  traefik:
    image: traefik:v2.11
    container_name: traefik
    restart: always
    command:
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.websecure.address=:443"
      - "--log.level=INFO"
      - "--accesslog=true"

      - "--accesslog.fields.defaultmode=keep"
      - "--accesslog.bufferingsize=100"

      - "--entrypoints.web.transport.respondingTimeouts.readTimeout=60s"
      - "--entrypoints.websecure.transport.respondingTimeouts.readTimeout=60s"

    ports:
      - "80:80"
      - "443:443"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
    networks:
      - default

  db:
    image: flussonic/postgres:16
    restart: always
    environment:
      POSTGRES_USER: watcher
      POSTGRES_PASSWORD: watcher
      POSTGRES_DB: watcher
    expose:
      - 5432
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: "pg_isready -q -d $${POSTGRES_DB} -U $${POSTGRES_USER}"
      interval: 10s
      timeout: 20s
      retries: 3
      start_period: 5s
    networks:
      - default

  redis:
    image: flussonic/redis:7
    restart: always
    expose:
      - 6379
    volumes:
      - redis_data:/data
    networks:
      - default

  flussonic:
    image: flussonic/flussonic:latest
    container_name: flussonic
    restart: always
    environment:
        LICENSE_KEY: ${LICENSE_KEY}
        STREAMER_EDIT_AUTH: secret:pass
        STREAMER_CLUSTER_KEY: ${CLUSTER_KEY}
        STREAMER_HTTP: 80
    ports:
      - "1935:1935"
      - "554:554"
    expose:
      - 80
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
      - dvr_storage:/storage
    labels:
      - "traefik.enable=true"

      - "traefik.http.routers.flussonic-streampoint.rule=PathPrefix(`/streampoint`)"
      - "traefik.http.routers.flussonic-streampoint.entrypoints=web"
      - "traefik.http.routers.flussonic-streampoint.priority=10"
      - "traefik.http.routers.flussonic-streampoint.service=flussonic"
      - "traefik.http.routers.flussonic-streampoint.middlewares=ws-headers"

      - "traefik.http.routers.flussonic-streampoint-secure.rule=PathPrefix(`/streampoint`)"
      - "traefik.http.routers.flussonic-streampoint-secure.entrypoints=websecure"
      - "traefik.http.routers.flussonic-streampoint-secure.tls=true"
      - "traefik.http.routers.flussonic-streampoint-secure.priority=10"
      - "traefik.http.routers.flussonic-streampoint-secure.service=flussonic"
      - "traefik.http.routers.flussonic-streampoint-secure.middlewares=ws-headers"

      - "traefik.http.routers.flussonic-streamer.rule=PathPrefix(`/streamer`)"
      - "traefik.http.routers.flussonic-streamer.entrypoints=web"
      - "traefik.http.routers.flussonic-streamer.priority=10"
      - "traefik.http.routers.flussonic-streamer.service=flussonic"

      - "traefik.http.routers.flussonic-streamer-secure.rule=PathPrefix(`/streamer`)"
      - "traefik.http.routers.flussonic-streamer-secure.entrypoints=websecure"
      - "traefik.http.routers.flussonic-streamer-secure.tls=true"
      - "traefik.http.routers.flussonic-streamer-secure.priority=10"
      - "traefik.http.routers.flussonic-streamer-secure.service=flussonic"

      - "traefik.http.routers.flussonic-default.rule=PathPrefix(`/`)"
      - "traefik.http.routers.flussonic-default.entrypoints=web"
      - "traefik.http.routers.flussonic-default.priority=1"
      - "traefik.http.routers.flussonic-default.service=flussonic"

      - "traefik.http.routers.flussonic-default-secure.rule=PathPrefix(`/`)"
      - "traefik.http.routers.flussonic-default-secure.entrypoints=websecure"
      - "traefik.http.routers.flussonic-default-secure.tls=true"
      - "traefik.http.routers.flussonic-default-secure.priority=1"
      - "traefik.http.routers.flussonic-default-secure.service=flussonic"

      - "traefik.http.services.flussonic.loadbalancer.server.port=80"
      - "traefik.http.services.flussonic.loadbalancer.passhostheader=true"
    networks:
      - default

  central-migrate:
    image: flussonic/central:latest
    depends_on:
      db:
        condition: service_healthy
    environment:
      LICENSE_KEY: ${LICENSE_KEY}
      CENTRAL_DATABASE_URL: postgres://watcher:watcher@db.:5432/watcher?sslmode=disable&search_path=central
    command: ['bin/central', '--migrate']
    networks:
      - default

  central:
    image: flussonic/central:latest
    restart: always
    extra_hosts:
      - "${DOMAIN}:host-gateway"
    depends_on:
      db:
        condition: service_healthy
      central-migrate:
        condition: service_completed_successfully
    environment:
      CENTRAL_LICENSE_KEY: ${LICENSE_KEY}
      CENTRAL_DATABASE_URL: postgres://watcher:watcher@db.:5432/watcher?sslmode=disable&search_path=central
      CENTRAL_HTTP_PORT: 80
      CENTRAL_API_KEY: ${CENTRAL_API_KEY}
      CENTRAL_API_URL: http://${DOMAIN}
      CENTRAL_UPSTREAM_URL: http://watcher
      CENTRAL_REDIS_URL: redis://redis:6379/2
      IS_DOCKER: true
    expose:
      - 80
    labels:
      - "traefik.enable=true"

      - "traefik.http.middlewares.ws-headers.headers.customrequestheaders.Connection=Upgrade"

      - "traefik.http.routers.central.rule=PathPrefix(`/central`)"
      - "traefik.http.routers.central.entrypoints=web"
      - "traefik.http.routers.central.priority=10"
      - "traefik.http.routers.central.service=central"

      - "traefik.http.routers.central-secure.rule=PathPrefix(`/central`)"
      - "traefik.http.routers.central-secure.entrypoints=websecure"
      - "traefik.http.routers.central-secure.tls=true"
      - "traefik.http.routers.central-secure.priority=10"
      - "traefik.http.routers.central-secure.service=central"

      - "traefik.http.routers.central-endpoint.rule=PathPrefix(`/endpoint`)"
      - "traefik.http.routers.central-endpoint.entrypoints=web"
      - "traefik.http.routers.central-endpoint.priority=10"
      - "traefik.http.routers.central-endpoint.service=central"
      - "traefik.http.routers.central-endpoint.middlewares=ws-headers"

      - "traefik.http.routers.central-endpoint-secure.rule=PathPrefix(`/endpoint`)"
      - "traefik.http.routers.central-endpoint-secure.entrypoints=websecure"
      - "traefik.http.routers.central-endpoint-secure.tls=true"
      - "traefik.http.routers.central-endpoint-secure.priority=10"
      - "traefik.http.routers.central-endpoint-secure.service=central"
      - "traefik.http.routers.central-endpoint-secure.middlewares=ws-headers"

      - "traefik.http.services.central.loadbalancer.server.port=80"
      - "traefik.http.services.central.loadbalancer.passhostheader=true"
    networks:
      - default

  watcher-migrate:
    image: flussonic/watcher:latest
    depends_on:
      db:
        condition: service_healthy
    environment:
      LICENSE_KEY: ${LICENSE_KEY}
      DATABASE_URL: postgresql://watcher:watcher@db/watcher
      DB: postgresql://watcher:watcher@db/watcher
      REDIS: redis://redis:6379
      CENTRAL_URL: http://${CENTRAL_API_KEY}@central/streamer/api/v3
      FLUSSONIC_MASTER: http://${CLUSTER_KEY}@${DOMAIN}
      API_URL: http://${DOMAIN}
      WATCHER_ADMIN_LOGIN: ${LOGIN}
      WATCHER_ADMIN_PASSWORD: ${PASSWORD}
    entrypoint: [""]
    command: >
      bash -c "/opt/flussonic/contrib/watcher db upgrade &&
      /opt/flussonic/contrib/watcher create_local_streamer &&
      /opt/flussonic/contrib/watcher firstrun &&
      /opt/flussonic/bin/watcher-sync.sh"
    networks:
      - default

  watcher-vms:
    image: flussonic/watcher:latest
    container_name: watcher
    restart: always
    depends_on:
      db:
        condition: service_healthy
      watcher-migrate:
        condition: service_completed_successfully
      redis:
        condition: service_started
      central:
        condition: service_started
    environment:
      LICENSE_KEY: ${LICENSE_KEY}
      DATABASE_URL: postgresql://watcher:watcher@db/watcher
      DB: postgresql://watcher:watcher@db/watcher
      REDIS: redis://redis:6379
      CENTRAL_URL: http://${CENTRAL_API_KEY}@central/streamer/api/v3
      FLUSSONIC_MASTER: http://${CLUSTER_KEY}@${DOMAIN}
      API_URL: http://${DOMAIN}
      LISTEN_HOST: 0.0.0.0
      PORT: 80
      PYTHON_CONFIGURE_OPTS: "--enable-optimizations=no"
      CFLAGS: "-O0"
    entrypoint: [""]
    command: ['/opt/flussonic/bin/watcher.sh', 'run']
    expose:
      - 80
    labels:
      - "traefik.enable=true"

      - "traefik.http.middlewares.to-vsaas.redirectregex.regex=^(https?://[^/]+).*$$"
      - "traefik.http.middlewares.to-vsaas.redirectregex.replacement=$${1}/vsaas/v2"
      - "traefik.http.middlewares.to-vsaas.redirectregex.permanent=true"

      - "traefik.http.routers.block-root.rule=Path(`/`)"
      - "traefik.http.routers.block-root.entrypoints=web"
      - "traefik.http.routers.block-root.priority=20"
      - "traefik.http.routers.block-root.middlewares=to-vsaas"
      - "traefik.http.routers.block-root.service=watcher"

      - "traefik.http.routers.block-root-secure.rule=Path(`/`)"
      - "traefik.http.routers.block-root-secure.entrypoints=websecure"
      - "traefik.http.routers.block-root-secure.tls=true"
      - "traefik.http.routers.block-root-secure.priority=20"
      - "traefik.http.routers.block-root-secure.middlewares=to-vsaas"
      - "traefik.http.routers.block-root-secure.service=watcher"

      - "traefik.http.routers.block-admin.rule=PathPrefix(`/admin`)"
      - "traefik.http.routers.block-admin.entrypoints=web"
      - "traefik.http.routers.block-admin.priority=20"
      - "traefik.http.routers.block-admin.middlewares=to-vsaas"
      - "traefik.http.routers.block-admin.service=watcher"

      - "traefik.http.routers.block-admin-secure.rule=PathPrefix(`/admin`)"
      - "traefik.http.routers.block-admin-secure.entrypoints=websecure"
      - "traefik.http.routers.block-admin-secure.tls=true"
      - "traefik.http.routers.block-admin-secure.priority=20"
      - "traefik.http.routers.block-admin-secure.middlewares=to-vsaas"
      - "traefik.http.routers.block-admin-secure.service=watcher"

      - "traefik.http.routers.watcher.rule=PathPrefix(`/watcher`) || PathPrefix(`/vsaas`) || PathPrefix(`/api/wb`) || PathPrefix(`/wb`)"
      - "traefik.http.routers.watcher.entrypoints=web"
      - "traefik.http.routers.watcher.priority=10"
      - "traefik.http.routers.watcher.service=watcher"
      - "traefik.http.services.watcher.loadbalancer.server.port=80"
      - "traefik.http.services.watcher.loadbalancer.passhostheader=true"
      - "traefik.http.routers.watcher-secure.rule=PathPrefix(`/watcher`) || PathPrefix(`/vsaas`) || PathPrefix(`/api/wb`) || PathPrefix(`/wb`)"
      - "traefik.http.routers.watcher-secure.entrypoints=websecure"
      - "traefik.http.routers.watcher-secure.tls=true"
      - "traefik.http.routers.watcher-secure.priority=10"
      - "traefik.http.routers.watcher-secure.service=watcher"
    networks:
      - default

  watcher-episodes:
    image: flussonic/watcher:latest
    restart: always
    depends_on:
      db:
        condition: service_healthy
      watcher-migrate:
        condition: service_completed_successfully
      redis:
        condition: service_started
      central:
        condition: service_started
    environment:
      LICENSE_KEY: ${LICENSE_KEY}
      DATABASE_URL: postgresql://watcher:watcher@db/watcher
      DB: postgresql://watcher:watcher@db/watcher
      REDIS: redis://redis:6379
      CENTRAL_URL: http://${CENTRAL_API_KEY}@central/streamer/api/v3
      FLUSSONIC_MASTER: http://${CLUSTER_KEY}@flussonic
    entrypoint: [""]
    command: ['/opt/flussonic/bin/watcher.sh', 'episodes']
    networks:
      - default

  watcher-scheduler:
    image: flussonic/watcher:latest
    restart: always
    depends_on:
      db:
        condition: service_healthy
      watcher-migrate:
        condition: service_completed_successfully
      redis:
        condition: service_started
      central:
        condition: service_started
    environment:
      LICENSE_KEY: ${LICENSE_KEY}
      DATABASE_URL: postgresql://watcher:watcher@db/watcher
      DB: postgresql://watcher:watcher@db/watcher
      REDIS: redis://redis:6379
      CENTRAL_URL: http://${CENTRAL_API_KEY}@central/streamer/api/v3
    entrypoint: [""]
    command: ['/opt/flussonic/bin/watcher.sh', 'scheduler']
    networks:
      - default

  watcher-worker-default:
    image: flussonic/watcher:latest
    restart: always
    depends_on:
      db:
        condition: service_healthy
      watcher-migrate:
        condition: service_completed_successfully
      redis:
        condition: service_started
      central:
        condition: service_started
    environment:
      LICENSE_KEY: ${LICENSE_KEY}
      DATABASE_URL: postgresql://watcher:watcher@db/watcher
      DB: postgresql://watcher:watcher@db/watcher
      REDIS: redis://redis:6379
      CENTRAL_URL: http://${CENTRAL_API_KEY}@central/streamer/api/v3
    entrypoint: [""]
    command: ['/opt/flussonic/bin/watcher.sh', 'worker']
    networks:
      - default

  watcher-worker-high:
    image: flussonic/watcher:latest
    restart: always
    depends_on:
      db:
        condition: service_healthy
      watcher-migrate:
        condition: service_completed_successfully
      redis:
        condition: service_started
      central:
        condition: service_started
    environment:
      LICENSE_KEY: ${LICENSE_KEY}
      DATABASE_URL: postgresql://watcher:watcher@db/watcher
      DB: postgresql://watcher:watcher@db/watcher
      REDIS: redis://redis:6379
      CENTRAL_URL: http://${CENTRAL_API_KEY}@central/streamer/api/v3
    entrypoint: [""]
    command: ['/opt/flussonic/bin/watcher.sh', 'worker', 'high']
    networks:
      - default

  watcher-go:
    image: flussonic/watcher:latest
    restart: always
    extra_hosts:
      - "${DOMAIN}:host-gateway"
    depends_on:
      db:
        condition: service_healthy
      watcher-migrate:
        condition: service_completed_successfully
      redis:
        condition: service_started
      central:
        condition: service_started
    environment:
      LICENSE_KEY: ${LICENSE_KEY}
      DATABASE_URL: postgresql://watcher:watcher@db/watcher
      DB: postgresql://watcher:watcher@db/watcher
      REDIS: redis://redis:6379
      CENTRAL_URL: http://${CENTRAL_API_KEY}@central/streamer/api/v3
      API_URL: http://${DOMAIN}
    entrypoint: [""]
    command: ['/opt/flussonic/bin/watcher-go.sh']
    networks:
      - default

Run docker-compose example

DOMAIN= CLUSTER_KEY= CENTRAL_API_KEY= LICENSE_KEY= LOGIN= PASSWORD= docker compose -f docker-compose.yml up -d

Update images and reload containers

docker compose -f docker-compose.yml pull
DOMAIN= CLUSTER_KEY= CENTRAL_API_KEY= LICENSE_KEY= LOGIN= PASSWORD= docker compose -f docker-compose.yml up -d

Tag summary

Content type

Image

Digest

sha256:7c55e4405

Size

108.2 MB

Last updated

about 3 hours ago

docker pull flussonic/watcher