Sign inSign up

chucky2401/deluge-openvpn

By chucky2401

•Updated 9 months ago

Use Deluge with an OpenVPN connection

Image
Networking
1

1.9K

chucky2401/deluge-openvpn repository overview

⁠Docker OpenVPN/Deluge

Find me at:

Deluge is a lightweight, Free Software, cross-platform BitTorrent client.

placeholder

⁠Supported Architectures

Simply pulling chucky2401/deluge:tagversion should retrieve the correct image for your arch.

Actually, only the following arch are available:

  • linux/amd64
  • linux/arm64

⁠Usage

To help you get started creating a container from this image, you will find docker compose example below.

With the below configuration, you must have prepare the following:

  • openvpn directory with the vpn.ovpn file

  • vpn_credentials file to authenticate to the VPN. You must respect this format:

    username
    password
    

This example is the most simple.

services:
  syncrelay:
    image: chucky2401/deluge:latest
    container_name: deluge
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/net/tun
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Paris
      - LOCAL_NETWORK=192.168.1.0/24
      - DELUGE_LOGLEVEL=warning
      - VPN_FILE=/.openvpn/vpn.ovpn
    volumes:
      - ./openvpn/:/.openvpn
      - ./config/:/deluge-conf
      - ./downloads:/downloads
    ports:
      - 8112:8112
      - 6881:6881
      - 6881:6881/udp
      - 58846:58846
    dns:
      - 8.8.8.8
      - 8.4.4.8
    dns_search: '.'
    restart: unless-stopped
    secrets:
      - VPN_CREDENTIALS

secrets:
  # The VPN_CREDENTIALS must have
  # username on first line and
  # password on second line
  VPN_CREDENTIALS:
    file: vpn_credentials

You can replace the vpn_credentials secrets with the following environment variables:

  • VPN_USER
  • VPN_PASSWORD

But I don't recommend them, as the variables will be in clear text in the container.

⁠Parameters

Here the list of all parameters.

For the VPN_CREDENTIALS no need to set an environment variable, but the secret must be write exactly as above

ParameterDefaultRemarkFunction
PUID=10001000Optionalfor UserID - see below for explanation
PGID=10001000Optionalfor GroupID - see below for explanation
TZ=Europe/ParisN/AOptionalspecify a timezone to use, see this list⁠.
LOCAL_NETWORK=192.168.1.0/24EmptyMandatoryDefine your local network ip range with CIDR to be able to access the container
DELUGE_LOGLEVEL=warningerrorOptionalSet the Deluge log level. (Valid values: none; info; warning; error; debug)
VPN_FILE=/.openvpn/vpn.ovpnN/AMandatoryInternal container path to the OpenVPN .ovpn file. You can use a Docker secret
DELUGE_DAEMON_USERNAME=delugeOptionalUsername to access the Deluge daemon
DELUGE_DAEMON_PASSWORD=randomOptional - Use docker logs to find it or open ./config/auth. You can also use a Docker secretPassword of the associated username to access the Deluge daemon
DELUGE_DAEMON_USER_LEVEL=10OptionalLevel access of the associated username. (Valid values: 0 (None); 1 (Read only); 5 (Normal); 10 (Administrator))
DELUGE_DAEMON_PORT=58846OptionalSet the listening port for Deluge daemon
VPN_USER=N/ANot recommendedSet the VPN username
VPN_PASSWORD=N/ANot recommendedSet the VPN password
⁠Deluge password with secret

You can use a Docker secret to set Deluge daemon access password like VPN_CREDENTIALS

  [...]
    environment:
      - DELUGE_DAEMON_PASSWORD=/run/secrets/DELUGE_DAEMON_PASSWORD
    secrets:
      - DELUGE_DAEMON_PASSWORD
  [...]

secrets:
  DELUGE_DAEMON_PASSWORD:
    file: deluge_daemon_password
⁠OpenVPN file with secret

You can use a Docker secret to set OpenVPN file configuration like VPN_CREDENTIALS

  [...]
    environment:
      - VPN_FILE=/run/secrets/VPN_FILE
    secrets:
      - VPN_FILE
  [...]

secrets:
  VPN_FILE:
    file: vpn.ovpn

⁠Complete example with only secrets

services:
  deluge:
    container_name: deluge
    image: chucky2401/deluge:latest
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/net/tun
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Paris
      - LOCAL_NETWORK=192.168.1.0/24
      - DELUGE_LOGLEVEL=warning
      - DELUGE_DAEMON_USERNAME=user
      - DELUGE_DAEMON_PASSWORD=/run/secrets/DELUGE_DAEMON_PASSWORD
      - DELUGE_DAEMON_USER_LEVEL=10
      - VPN_FILE=/run/secrets/VPN_FILE
    volumes:
      - ./config/:/deluge-conf
      - ./downloads:/downloads
    ports:
      - 8112:8112
      - 6881:6881
      - 6881:6881/udp
      - 58846:58846
    networks:
      - deluge
    dns:
      - 8.8.8.8
      - 8.4.4.8
    dns_search: '.'
    restart: unless-stopped
    secrets:
      - VPN_CREDENTIALS
      - VPN_FILE
      - DELUGE_DAEMON_PASSWORD
    labels:
      - wud.watch=false
    deploy:
      resources:
        limits:
          memory: 1G

networks:
  deluge:
    driver: bridge
    enable_ipv6: false

secrets:
  VPN_CREDENTIALS:
    file: vpn_credentials
  VPN_FILE:
    file: vpn.ovpn
  DELUGE_DAEMON_PASSWORD:
    file: deluge_daemon_password

⁠User / Group Identifiers

When using volumes (-v flags), permissions issues can arise between the host OS and the container, I avoid this issue by allowing you to specify the user PUID and group PGID.

Ensure any volume directories on the host are owned by the same user you specify and any permissions issues will vanish like magic.

In this instance PUID=1000 and PGID=1000, to find yours use id your_user as below:

id your_user

Example output:

uid=1000(your_user) gid=1000(your_user) groups=1000(your_user)

⁠Roadmap

For the moment I have only one think to do: use two containers.

  1. VPN
  2. Deluge

The Deluge container will use the VPN container to access internet.

This because Docker is design to do one thing per container, and not two like this image.

⁠F.A.Q

⁠Why add an environment variable to set daemon port?

I know, with Docker is very easy to set another port on the host side.

But, before creating this complete image, I was using a different port for security purpose, in case if the container is breached. I think so someone else wants to do the same as me, so I keep this feature.

Tag summary

Content type

Image

Digest

sha256:c78e49bfc…

Size

42.7 MB

Last updated

9 months ago

docker pull chucky2401/deluge-openvpn:1-beta.3