version: "3"
services:
  gluetun:
    image: qmcgaw/gluetun
    container_name: gluetun
    # Hostname to use for container, required in some instances for the rest of the stack to each other endpoints 
    hostname: gluetun
    # line above must be uncommented to allow external containers to connect.
    # See https://github.com/qdm12/gluetun-wiki/blob/main/setup/connect-a-container-to-gluetun.md#external-container-to-gluetun
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/net/tun:/dev/net/tun
    ports:
      - 6881:6881
      - 6881:6881/udp
      - 8085:8085 # qbittorrent
      - 9117:9117 # Jackett
      - 8989:8989 # Sonarr
      - 9696:9696 # Prowlarr
    volumes:
      - /home/ubuntu/docker/arr-stack/gluetun:/gluetun
    environment:
      # See https://github.com/qdm12/gluetun-wiki/tree/main/setup#setup
      - VPN_SERVICE_PROVIDER=nordvpn
      - VPN_TYPE=wireguard
      # OpenVPN:
      # - OPENVPN_USER=
      # - OPENVPN_PASSWORD=
      # Wireguard:
      - WIREGUARD_PRIVATE_KEY=<YOUR_PRIVATE_KEY> # See https://github.com/qdm12/gluetun-wiki/blob/main/setup/providers/nordvpn.md#obtain-your-wireguard-private-key
      - WIREGUARD_ADDRESSES=10.5.0.2/32
      # Timezone for accurate log times
      - TZ=Europe/London
      # Server list updater
      # See https://github.com/qdm12/gluetun-wiki/blob/main/setup/servers.md#update-the-vpn-servers-list
      - UPDATER_PERIOD=24h

  qbittorrent:
    image: lscr.io/linuxserver/qbittorrent
    container_name: qbittorrent
    network_mode: "service:gluetun"
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/London
      - WEBUI_PORT=8085
    volumes:
      - /home/ubuntu/docker/arr-stack/qbittorrent:/config
      - /home/ubuntu/docker/arr-stack/qbittorrent/downloads:/downloads
    depends_on:
      - gluetun
    restart: always

  jackett:
    image: lscr.io/linuxserver/jackett:latest
    container_name: jackett
    network_mode: "service:gluetun"
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
      - AUTO_UPDATE=true #optional
      - RUN_OPTS= #optional
    volumes:
      - /home/ubuntu/docker/arr-stack/jackett/data:/config
      - /home/ubuntu/docker/arr-stack/jackett/blackhole:/downloads
    restart: unless-stopped

  sonarr:
    image: lscr.io/linuxserver/sonarr:latest
    container_name: sonarr
    network_mode: "service:gluetun"
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
    volumes:
      - /home/ubuntu/docker/arr-stack/sonarr/data:/config
      - /home/ubuntu/docker/arr-stack/sonarr/tvseries:/tv #optional
      - /home/ubuntu/docker/arr-stack/sonarr/downloadclient-downloads:/downloads #optional
    restart: unless-stopped

  prowlarr:
    image: lscr.io/linuxserver/prowlarr:latest
    container_name: prowlarr
    network_mode: "service:gluetun"
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
    volumes:
      - /home/ubuntu/docker/arr-stack/prowlarr/data:/config
    restart: unless-stopped
