services:
  openvpn:
    image: dperson/openvpn-client
    cap_add:
      - NET_ADMIN
      - SYS_MODULE

    devices:
      - /dev/net/tun

    environment:
      - TZ=Europe/Paris

    volumes:
      - /home/docker/DenGate/config:/vpn
      - /lib/modules:/lib/modules:ro

    command: -f /vpn/config.ovpn
    restart: unless-stopped

    sysctls:
      - net.ipv6.conf.all.disable_ipv6=1

    ports:
      - 8085:8090
      - 8787:8080
      - 52000-52100:52000-52100/udp
      - 9696:9696
      - 7878:7878
      - 8989:8989
      - 5055:5055
      - 9117:9117
      - 8191:8191
      - 8265:8265
      - 8266:8266

    networks:
      vpn-network:
      tan-network:
        ipv4_address: 10.10.0.120

    labels:
      - traefik.enable=true

      # qbittorrent
      - traefik.http.routers.qbittorrent.rule=Host(`torrent.luckyden.org`)
      - traefik.http.routers.qbittorrent.entrypoints=websecure
      - traefik.http.routers.qbittorrent.tls.certresolver=cloudflare
      - traefik.http.routers.qbittorrent.service=qbittorrent
      - traefik.http.services.qbittorrent.loadbalancer.server.port=8090

      # neko
      - traefik.http.routers.neko.rule=Host(`neko.luckyden.org`)
      - traefik.http.routers.neko.entrypoints=websecure
      - traefik.http.routers.neko.tls.certresolver=cloudflare
      - traefik.http.routers.neko.service=neko
      - traefik.http.services.neko.loadbalancer.server.port=8080

      # prowlarr
      - traefik.http.routers.prowlarr.rule=Host(`prowlarr.luckyden.org`)
      - traefik.http.routers.prowlarr.entrypoints=websecure
      - traefik.http.routers.prowlarr.tls.certresolver=cloudflare
      - traefik.http.routers.prowlarr.service=prowlarr
      - traefik.http.services.prowlarr.loadbalancer.server.port=9696

      # radarr
      - traefik.http.routers.radarr.rule=Host(`radarr.luckyden.org`)
      - traefik.http.routers.radarr.entrypoints=websecure
      - traefik.http.routers.radarr.tls.certresolver=cloudflare
      - traefik.http.routers.radarr.service=radarr
      - traefik.http.services.radarr.loadbalancer.server.port=7878

      # sonarr
      - traefik.http.routers.sonarr.rule=Host(`sonarr.luckyden.org`)
      - traefik.http.routers.sonarr.entrypoints=websecure
      - traefik.http.routers.sonarr.tls.certresolver=cloudflare
      - traefik.http.routers.sonarr.service=sonarr
      - traefik.http.services.sonarr.loadbalancer.server.port=8989

      # seerr
      - traefik.http.routers.seerr.rule=Host(`jellyseerr.luckyden.org`)
      - traefik.http.routers.seerr.entrypoints=websecure
      - traefik.http.routers.seerr.tls.certresolver=cloudflare
      - traefik.http.routers.seerr.service=seerr
      - traefik.http.services.seerr.loadbalancer.server.port=5055

      # tdarr
      - traefik.http.routers.tdarr.rule=Host(`tdarr.luckyden.org`)
      - traefik.http.routers.tdarr.entrypoints=websecure
      - traefik.http.routers.tdarr.tls.certresolver=cloudflare
      - traefik.http.routers.tdarr.service=tdarr
      - traefik.http.services.tdarr.loadbalancer.server.port=8265

    healthcheck:
      test: ["CMD", "ping", "-c", "1", "1.1.1.1"]
      interval: 1m
      timeout: 10s
      retries: 3


  qbittorrent:
    image: lscr.io/linuxserver/qbittorrent:latest
    restart: unless-stopped
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Paris
      - WEBUI_PORT=8090
      - DOCKER_MODS=ghcr.io/gabe565/linuxserver-mod-vuetorrent
    volumes:
      - /home/docker/BitDen/config:/config
      - /mnt/bindmounts/multimedia/Downloads:/downloads
    depends_on:
      openvpn:
        condition: service_healthy
    network_mode: service:openvpn


  neko:
    image: ghcr.io/m1k1o/neko/firefox:latest
    restart: unless-stopped
    shm_size: 2gb
    volumes:
      - /home/docker/BrowDen/firefox:/home/neko/.mozilla/firefox
    environment:
      - NEKO_WEBRTC_EPR=52000-52100
      - NEKO_WEBRTC_ICELITE=1
      - NEKO_WEBRTC_NAT1TO1=192.168.0.9
      - NEKO_MEMBER_MULTIUSER_USER_PASSWORD=${NEKO_USER_PASS}
      - NEKO_MEMBER_MULTIUSER_ADMIN_PASSWORD=${NEKO_ADMIN_PASS}
    depends_on:
      openvpn:
        condition: service_healthy
    network_mode: service:openvpn


  prowlarr:
    image: lscr.io/linuxserver/prowlarr:latest
    restart: unless-stopped
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Paris
    volumes:
      - /home/docker/ProwDen/config:/config
    depends_on:
      openvpn:
        condition: service_healthy
    network_mode: service:openvpn


  jackett:
    image: lscr.io/linuxserver/jackett:latest
    restart: unless-stopped
    environment:
      - FLARESOLVERR_URL=http://127.0.0.1:8191
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Paris
      - AUTO_UPDATE=true
    volumes:
      - /home/docker/ProwDen/jackett/config:/config
      - /home/docker/ProwDen/jackett/downloads:/downloads
    depends_on:
      openvpn:
        condition: service_healthy
    network_mode: service:openvpn


  flaresolverr:
    image: ghcr.io/flaresolverr/flaresolverr:latest
    restart: unless-stopped
    environment:
      - TZ=Europe/Paris
      - LOG_LEVEL=info
    depends_on:
      openvpn:
        condition: service_healthy
    network_mode: service:openvpn


  radarr:
    image: lscr.io/linuxserver/radarr:latest
    restart: unless-stopped
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Paris
    volumes:
      - /home/docker/RadDen/config:/config
      - /mnt/bindmounts/multimedia/Médias:/movies
      - /mnt/bindmounts/multimedia/Downloads:/downloads
    depends_on:
      openvpn:
        condition: service_healthy
    network_mode: service:openvpn


  sonarr:
    image: lscr.io/linuxserver/sonarr:latest
    restart: unless-stopped
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Paris
    volumes:
      - /home/docker/SonDen/config:/config
      - /mnt/bindmounts/multimedia/Médias:/tv
      - /mnt/bindmounts/multimedia/Downloads:/downloads
    depends_on:
      openvpn:
        condition: service_healthy
    network_mode: service:openvpn


  seerr:
    image: ghcr.io/seerr-team/seerr:latest
    restart: unless-stopped
    init: true
    environment:
      - LOG_LEVEL=debug
      - TZ=Europe/Paris
    volumes:
      - /home/docker/DenRequest/config:/app/config
    depends_on:
      openvpn:
        condition: service_healthy
    network_mode: service:openvpn


  tdarr:
    image: ghcr.io/haveagitgat/tdarr:latest
    restart: unless-stopped
    environment:
      - TZ=Europe/Paris
      - PUID=1000
      - PGID=1000
      - UMASK_SET=002
      - serverIP=0.0.0.0
      - serverPort=8266
      - webUIPort=8265
      - auth=true
      - authSecretKey=${RENDEN_SECRET_KEY}
      - apiKey=${RENDEN_API_KEY}
      - internalNode=true
      - inContainer=true
      - ffmpegVersion=6
      - nodeName=RenDen_node
      - NVIDIA_DRIVER_CAPABILITIES=all
      - NVIDIA_VISIBLE_DEVICES=all
    volumes:
      - /home/docker/RenDen/server:/app/server
      - /home/docker/RenDen/configs:/app/configs
      - /home/docker/RenDen/logs:/app/logs
      - /mnt/bindmounts/multimedia/Médias/Séries:/media/séries
      - /mnt/bindmounts/multimedia/Médias/Films:/media/films
      - /mnt/bindmounts/multimedia/Médias/Animes:/media/animes
      - /mnt/bindmounts/multimedia/Médias/Animations:/media/animations
      - /mnt/bindmounts/multimedia/Médias/Animes Jeunesse:/media/animes jeunesse
      - /tmp/tdarr/transcodes:/temp
    devices:
      - /dev/dri:/dev/dri
    depends_on:
      openvpn:
        condition: service_healthy
    network_mode: service:openvpn


networks:
  vpn-network:
    name: vpn-network
  tan-network:
    external: true
