# Invidious - YouTube
# Port: 3000
# Privacy-respecting YouTube

version: "3.9"
services:
  invidious-db:
    image: postgres
    container_name: Invidious-DB
    hostname: invidious-db
    security_opt:
      - no-new-privileges:true
    healthcheck:
      test: ["CMD", "pg_isready", "-q", "-d", "invidious", "-U", "kemal"]
      timeout: 45s
      interval: 10s
      retries: 10
    user: 1026:100
    volumes:
      - /volume1/docker/invidiousdb:/var/lib/postgresql/data
    environment:
      POSTGRES_DB: invidious
      POSTGRES_USER: kemal
      POSTGRES_PASSWORD: "REDACTED_PASSWORD"  # pragma: allowlist secret
    restart: unless-stopped

  invidious:
    image: quay.io/invidious/invidious:latest
    container_name: Invidious
    hostname: invidious
    user: 1026:100
    security_opt:
      - no-new-privileges:true
    healthcheck:
      test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/comments/jNQXAC9IVRw || exit 1
      interval: 30s
      timeout: 5s
      retries: 2
    ports:
      - 10.0.0.100:7601:3000
    environment:
      INVIDIOUS_CONFIG: |
        db:
          dbname: invidious
          user: kemal
          password: "REDACTED_PASSWORD"  # pragma: allowlist secret
          host: invidious-db
          port: 5432
        check_tables: true
        captcha_enabled: false
        default_user_preferences:
          locale: us
          region: US
        external_port: 7601
        domain: invidious.vishinator.synology.me
        https_only: true
    restart: unless-stopped
    depends_on:
      invidious-db:
        condition: service_healthy
