version: "2.4"
services:
  pia:
    image: qmcgaw/private-internet-access:latest
    container_name: pia
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/net/tun
    environment:
      - USER=p1787216
      - PASSWORD=4Jpywa5Jmg
      - ENCRYPTION=strong
      - PROTOCOL=udp
      - REGION=AU Melbourne
      - NONROOT=no
      - DOT=on
      - BLOCK_MALICIOUS=on
      - BLOCK_NSA=off
      - UNBLOCK=
      - FIREWALL=on
      - EXTRA_SUBNETS=
      - PROXY=on
      - PROXY_LOG_LEVEL=Critical
      - PROXY_USER=
      - PROXY_PASSWORD=
    restart: always
    # ports:
    #   - 8000:80
    #   - 8001:8001
    #   - 6881:6881
  # socat0:
  #   image: alpine/socat
  #   container_name: aria2-proxy
  #   depends_on:
  #     - pia
  #     - aria2-ui
  #   ports:
  #     - 8000:8000/tcp
  #   command: tcp-listen:8000,fork,reuseaddr tcp-connect:pia:80
  #   restart: unless-stopped
  socat1:
    image: alpine/socat
    container_name: qbittorrent-proxy
    depends_on:
      - pia
      - qbittorrent
    ports:
      - 8001:8001/tcp
    command: tcp-listen:8001,fork,reuseaddr tcp-connect:pia:8001
    restart: unless-stopped
  socat2:
    image: alpine/socat
    container_name: qbittorrent-tcp-proxy
    depends_on:
      - pia
      - qbittorrent
    ports:
      - 6881:6881/tcp
    command: tcp-listen:8001,fork,reuseaddr tcp-connect:pia:6881
    restart: unless-stopped
  # aria2-ui:
  #   container_name: aria2-ui
  #   restart: unless-stopped
  #   image: wahyd4/aria2-ui:latest
  #   depends_on:
  #     - pia
  #   environment:
  #     - UID=1000
  #     - GID=1000
  #     - ENABLE_AUTH=true
  #   network_mode: "service:pia"
  #   volumes:
  #     - /mnt/aria2-config:/app/conf
  #     - /mnt/downloads:/data
  #     - /home/junv/filebrowser.db:/app/filebrowser.db
  #   mem_limit: 1024m
  #   mem_reservation: 128m
  #   cpu_percent: 20
  qbittorrent:
    image: linuxserver/qbittorrent
    container_name: qbittorrent
    depends_on:
      - pia
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Australia/Melbourne
      - WEBUI_PORT=8001
    volumes:
      - /mnt/configs/qbit:/config
      - /mnt/downloads:/downloads
    restart: unless-stopped
    network_mode: "service:pia"
    mem_limit: 1024m
    mem_reservation: 128m
    cpu_percent: 20
  sync:
    image: resilio/sync
    container_name: resilio-sync
    volumes:
      - /mnt/books:/mnt/sync
        # ports:
        # - 55555
    restart: unless-stopped
    network_mode: "service:pia"
    mem_limit: 1024m
    mem_reservation: 500m
    cpu_percent: 20
  socat0-sync:
    image: alpine/socat
    container_name: sync-proxy
    depends_on:
      - pia
      - sync
    ports:
      - 8002:8002/tcp
    command: tcp-listen:8002,fork,reuseaddr tcp-connect:pia:8888
    restart: unless-stopped
