How to install Deluge and Autobrr on a TrueNAS Scale appliance
This post guides you through the installation of Deluge and Autobrr on a TrueNAS Scale storage appliance.
Motivation
Feel free to skip this section and go straight to the installation instructions.
My motivation for running these apps is to add another node to the swarm archiving the sciop.net scientific document collection. Since I have a TrueNAS appliance always connected to the Internet, I figured running a torrent agent on it will offer a low-maintenance way to use the attached storage to support this effort.
SciOP groups torrents into various collections, and each collection is published as an RSS feed. The use of RSS to feed BitTorrent clients is normally a tool for publishing episodic video. Because of that common use case, some RSS torrent clients (like Sonarr) require that the feed have publication dates, to filter and prioritize episodes to download. The SciOP feeds are static catalogs of documents without publication date fields, so such clients won’t work with them. Autobrr does.
The TrueNAS Scale OS offers certain ready-made Docker images in their “app store” that offer configuration interfaces that can be manipulated through their web UI. Both Deluge and Autobrr are available there, so I chose them for the simplest and most maintainable installation.
OK, on with the installation.
Installation
Concepts
The Deluge Docker image installs two executables: a daemon and a web UI. The daemon does the actual work of enqueuing, downloading, and uploading the torrents. The web UI process allows you to view and control the daemon’s actions through a web interface. The Deluge daemon needs to be reachable by the Autobrr daemon.
The Autobrr Docker image similarly installs a daemon and a web UI. The Autobrr daemon polls RSS feeds and filters them for torrents to potentially download. It then opens a socket connection to the Deluge daemon, and instructs the latter to enqueue new torrents.
The Deluge daemon needs space to store the torrents it downloads. While the torrent metadata is stored within its own Docker container, the actual files should be stored outside the container so you can view them. The external location is reflected as a mount point inside the container.
Lastly, BitTorrent relies on the ability of other clients on the Internet opening connections to your agent to request data. You need to forward the appropriate port from your NAT/router to your appliance to achieve this. This requires your router to give your appliance a static IP address, or to route ports to it by MAC address.
Prepare directories
Decide where you want to store downloaded files. I recommend creating a new dataset separate from your other data, so you can manage it easily, including excluding it from cloud backups, or quickly reclaiming space by deleting the dataset in the future.
For this example, I assume the following directory structure:
- /mnt/pool1/torrents/
- in-progress
- completed
torrents
is the dataset name, and in-progress
is a directory you created under it for holding torrents in progress, and completed
is another directory you created into which downloads will be moved once they are downloaded.
Create this dataset through the TrueNAS Datastets interface. I recommend making it SMB-accessible so you can browse it from your computer using network mounts.
Install Deluge
- Go to the Apps section on the TrueNAS web UI.
- Click Discover Apps.
- Search for
Deluge
. - Click the Install button.
Make the following changes in the installation view:
- Remember the
UserID
allocated by default by the setup utility (mine was568
). - Under Network Configuration:
- Enable Host Network.
- Enable Expose Daemon Port. This allows Autobrr to connect to the Deluge daemon later.
- Remember the daemon port number, e.g.
58846
.
- Under Storage Configuration:
- Select Host Path for Deluge Downloads Storage.
- Enable Enable ACL.
- Using the path browser, select the
torrents
path you defined above (e.g./mnt/pool1/torrents
). This path will mounted as/downloads
in the Deluge container. - Click Add next to the ACL Entries label.
- Add the following ACL entry:
- Select the
USER
type. - Enter the UserID allocated above in the ID field (mine was
568
). - Select
FULL_CONTROL
access.
- Select the
- Enable the Force Flag option under
ACL Options
. This force-adds the ACL entries to every file and subfolder under the directory.
- Click Install.
Wait for the installation to complete and the application to start running.
Configure Deluge
- Click the Apps tab in the TrueNAS web UI.
- Click the Deluge app name.
- Click the WebUI button, or navigate to the web UI by appending the Deluge web UI port (by default
:8112
) to your TrueNAS appliance’s IP address in a web browser1.
On the web interface, do the following:
- Enter the default password:
deluge
. - Refuse the offer to change the password.
- Click Connection Manager at the top of the Web UI.
- In the Connection Manager window, select the running daemon instance (there is only one).
- Make sure its status is Online.
- Select the daemon instance, and click Connect.
- Click Preferences on the top of the Web UI.
With a properly-connected daemon, you should see many preferences fields filled out. If the fields appear blank, close the Preferences window and click Preferences again.
In the Preferences window, make the following changes:
- Click Downloads in the left pane. Make these changes:
- In the Download to: field, enter the path to the
in-progress
folder above, e.g./downloads/in-progress
. - Enable the Move completed to: checkbox, and enter the path to the
completed
folder above, e.g./downloads/completed
. - Click Apply.
- In the Download to: field, enter the path to the
- Click Network in the left pane. Make these changes:
- Disable Use Random Port under Incoming Port.
- Make note of the port number, e.g.
30039
. This is the port number that must be forwarded by your router. - Click Apply.
- Click Bandwidth in the left pane. Make these changes:
- Set the maximum download and upload speeds. These figures are in kilobytes per second. If you have a target megabit per second limit, multiply that number by 128. e.g. 1 megabit per second works out to 128 KiB/s.
- Click Daemon in the left pane.
- Double-check the daemon port. It should be the same as the one you saw during the Deluge app installation, e.g.
58846
. - Enable Allow Remote Connections.
- Double-check the daemon port. It should be the same as the one you saw during the Deluge app installation, e.g.
- Click Queue in the left pane.
- Enable Ignore slow torrents so that slow downloads don’t block faster ones.
- Click OK to dismiss the window.
Set up port forwarding
In your router, forward the Incoming Port number from the Internet to your TrueNAS device. In this example, port 30039
should have both TCP and UDP traffic forwarded to the TrueNAS IP address.
Test your Deluge installation
It’s time to test your configuration. You can view the Deluge web UI by clicking the Web UI button in the TrueNAS apps browser, or by appending the Deluge web UI port number (by default :8112
) to your TrueNAS appliance’s IP address in the web browser.
On the Deluge web UI, do the following:
- Enter the default password:
deluge
. - Select the daemon in the Connection Manager list (there is only one). It should have an Online status.
- Click Connect.
Once connected, add a sample torrent:
- Click Add.
- Click URL.
- Copy and paste this URL: https://webtorrent.io/torrents/big-buck-bunny.torrent
- Click Add.
- Click Add.
The torrent should begin downloading. Once downloaded, it should begin seeding. You should be able to see the file (the Big Buck Bunny movie) in your completed
directory.
Create Autobrr user account
You need to create a user account in the Deluge container to allow Autobrr’s process to connect to it.
- Go to the Apps section of the TrueNAS web UI.
- Ensure the Deluge app is running.
- Click the Deluge application name.
- In the Workloads section of the UI, find the Containers section.
- Click the terminal icon (the leftmost one) of the Deluge container to open a shell session.
- Accept the default shell.
- Create and write down a username and password combination, e.g.
autobrr
andpass
. - Enter the following command:
echo '<username>:<password>:10' >> /config/auth
replacing
<username>
and<password>
with the username and password you chose. e.g.echo 'autobrr:pass:10' >> /config/auth
- Check that your entry is added using the command
cat /config/auth
. The line you typed should be at the bottom of the file. - Navigate back to the
Apps
section of the TrueNAS web UI. - Stop and restart the Deluge app.
Install Autobrr
- Go to the Apps section of the TrueNAS web UI.
- Click Discover Apps.
- Search for
Autobrr
. - Click the Autobrr application.
- Click Install.
Make the following changes in the installation view:
- Enable Host Network.
- Click Install.
Once the application is running:
- Click the Autobrr application.
- Click Web UI. This should take you to the Autobrr web interface. You can also reach the web interface by appending the Autobrr web UI port (by default
:30016
) to your TrueNAS’s IP address.
In the Autobrr web UI, do the following:
- Create and write down a login username and password.
- Click Create account.
- Use the username and password you just created to log in.
- Click Settings.
- Click Clients on the list.
- Click Add new client.
In the client configuration view, make the following changes:
- Name your client, e.g.
Deluge
. - Select Deluge 2 as the client type.
- Enter
localhost
in the Host field. - Enter the Deluge daemon port in the Port field, e.g.
58846
. - Enter the username and password you created in Deluge, e.g.
autobrr
andpass
. - Click Test to test the connection2.
- Click Create.
Add Indexers
To subscribe to an RSS feed:
- Click Settings in the Autobrr web UI.
- Click Indexers.
- Click Add new.
- Select Generic RSS as the indexer type.
- Name the feed.
- Paste the RSS feed’s URL3 in the RSS URL field.
- Select the type of download provided by the feed (for SciOp, select Torrent).
- Click Save.
- Click Feeds on the settings sidebar.
- Enable the feed you just added.
To test the feed, click the three dots next to the field and click Force run. Type I understand
in the scary dialog box and click Force Run. Click Clear Feed Cache after you test it to reset its state for the next run.
Add filters
Each time you add a feed, you must add a filter to select torrents for downloading.
- Click Filters in the Autobrr web UI.
- Click Create Filter.
- Name your filter (e.g.
Download SciOp feeds
) and click Create.
Make these changes in the General tab:
- Under Indexers, check Select All.
- Under Skip duplicates profile, select Exact release.
Make these changes in the Actions tab:
- Click Add new.
- Select the Deluge v2 action.
- Name the action (e.g.
Download
). - Select the Deluge client you added.
- Click Save to save the action.
- Click Save to save the filter.
- Click Filters in the Autobrr web UI.
- Enable the filter you just added.
The next time the feed is refreshed, all new items will be added to Deluge for downloading and mirroring.
You can go to Settings/Feeds and force refresh the feed to test this out.
After a feed has been refreshed, click Releases on the Autobrr Web UI to see the items that have been scheduled for downloading. Go to the Deluge Web UI to verify that these items have been added.
Each time you add a new indexer, you must enable its feed, and add the feed entry to the filter.
Final words
Phew! That was a lot of steps. But hopefully, you will now have a working configuration. Be patient and allow the initial few torrents to download after installation before making changes.
Although these instructions are specifically for the TrueNAS Scale OS, the concepts in it are directly transferable to any other Docker-capable network appliance. The fact that TrueNAS manages these apps and releases upgrades to them over time, and provides a focused configuration view, really helps to keep the installation complexity under control (and it’s still complicated!).
One thing I have not tried is setting disk space quotas, which may be important to some people with limited storage. If you have experience setting this and managing what the system caches, please get in touch with me and I will add a link to your instructions.
-
Sometimes, for some inexplicable reason, the TrueNAS apps interface will fail to show the Web UI when you click the Web UI button, and you have to append the port number to the TrueNAS IP address to reach it. I haven’t chased this down any further to figure out why. ↩
-
If the test fails, view the Autobrr log via the TrueNAS Apps web UI to read the error message. ↩
-
To add a SciOp feed, copy one of the feed URLs from https://sciop.net/feeds, e.g. https://sciop.net/rss/tag/science.rss ↩