---
services:
  jellyfin:
    image: ghcr.io/linuxserver/jellyfin@sha256:d2cb750aa51a2f19c33e43699fe8230fb2a69ccdcf36d70c9f283bf4ac17043e
    container_name: jellyfin
    devices:
      - /dev/dri/renderD129:/dev/dri/renderD129
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
      - DOCKER_MODS=linuxserver/mods:jellyfin-opencl-intel
    volumes:
      - /home/mafyuh/jellyfin/config:/config
      - nas:/Media
      - /home/mafyuh/jellyfin/transcodes:/transcodes
      - /home/mafyuh/jellyfin/cache:/nvmecache
      - /home/mafyuh/jellyfin/metadata:/nvmemetadata
    ports:
      - 8096:8096
    restart: unless-stopped
    security_opt:
      - apparmor:unconfined

  makemkv:
    image: jlesage/makemkv@sha256:ca6d9778b679ea2a51a10592a7756f93acca4f7a7142d787e9959921cd6bc547
    container_name: makemkv
    ports:
      - 5800:5800
    environment:
      - MAKEMKV_KEY=$MAKEMKV_KEY
    volumes:
      - /docker/appdata/makemkv:/config:rw
      - /home/mafyuh/makemkv/storage:/storage:rw
      - nas:/output:rw
    devices:
      - /dev/sr0:/dev/sr0
    privileged: true
    security_opt:
      - apparmor:unconfined

  syncthing:
    image: ghcr.io/linuxserver/syncthing@sha256:1f55fa811ad3903c4b421129966e0eea4b21d53d2471158288dc4a353e273a0a
    container_name: syncthing
    hostname: JF
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
    volumes:
      - /docker/appdata/syncthing/config:/config
      - /docker/appdata/:/docker/appdata/
      - /home/mafyuh/jellyfin/:/home/mafyuh/jellyfin/
    ports:
      - 8384:8384
      - 22000:22000/tcp
      - 22000:22000/udp
      - 21027:21027/udp
    restart: unless-stopped

  jellystat-db:
    image: postgres:15.2
    environment:
      POSTGRES_DB: 'jfstat'
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: $POSTGRES_PASSWORD
    volumes:
      - /docker/appdata/jellystat/postgres-data:/var/lib/postgresql/data

  jellystat:
    image: cyfershepard/jellystat:1.1.2
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: $POSTGRES_PASSWORD
      POSTGRES_IP: jellystat-db
      POSTGRES_PORT: 5432
      JWT_SECRET: $JWT_SECRET
    ports:
      - "3000:3000"
    volumes:
      - /docker/appdata/jellystat/backup-data:/app/backend/backup-data
    depends_on:
      - jellystat-db
    restart: unless-stopped

volumes:
  nas:
    driver: local
    driver_opts:
      type: nfs
      o: addr=nas.lan,vers=4,rw
      device: ":/mnt/thePool/thePoolShare/Media"