version: '3'
services:
  plex:
    image: plexinc/pms-docker
    network_mode: host
    restart: always
    depends_on:
      streamarrfs:
        condition: service_healthy
        restart: true
    healthcheck:
      test: ["CMD", "ls", "-d", "/streamarrfs/healthcheck"]
      interval: 10s
      timeout: 10s
      start_period: 5s
    volumes:
        - streamarrfs-plex-config:/config
        - streamarrfs-plex-transcode:/transcode
        - /tmp/streamarrfs-tmp/streamarrfs-mnt:/streamarrfs:ro
    logging:
        driver: json-file
        options:
            max-size: 10m

  streamarrfs:
    image: puttyman/streamarrfs:latest
    ports:
      - 3000:3000
    environment:
      - NODE_ENV=production
      # - STREAMARRFS_JACKETT_FEED_URL_ITEM_1=http://HOST:9117/api/v2.0/indexers/yts/results/torznab/api?apikey=key&t=search&cat=&q=
    cap_add:
      - SYS_ADMIN
    devices:
      - /dev/fuse
    security_opt:
      - apparmor=unconfined
    volumes:
      - streamarrfs-db:/server/db
      - streamarrfs-downloads:/streamarrfs-downloads
      - /tmp/streamarrfs-tmp:/tmp:shared
    healthcheck:
      test: ["CMD", "ls", "-d", "/tmp/streamarrfs-mnt/healthcheck"]
      interval: 10s
      timeout: 10s
      retries: 5
      start_period: 5s
    deploy:
      # Note only resouces is allowed by docker compose. Others are ignored
      resources:
        limits:
          memory: 8196M
        reservations:
          memory: 2048M
  
  jackett:
    image: lscr.io/linuxserver/jackett:latest
    container_name: jackett
    volumes:
      - jackett-config:/config
      - jackett-cache:/downloads
    ports:
      - 9117:9117
    restart: always
    healthcheck:
      test: ["CMD", "curl", "http://localhost:9117"]
      interval: 5s
      timeout: 5s
      retries: 5
      start_period: 5s
    deploy:
      resources:
        limits:
          memory: 1024M
        reservations:
          memory: 256M

volumes:
  streamarrfs-plex-config:
  streamarrfs-plex-transcode:
  streamarrfs-downloads:
  streamarrfs-db:
  jackett-config:
  jackett-cache: