- - -

how 2 torrent with docker and servarr

originally posted on 2024-12-29

tags: [coding, project]
- - -

before we start, i - once again - want to make it very clear that this guide is for educational purposes only.

at no point in this blog will i condone the use of torrents for illegal purposes.

...okay, let's get started.
this will be a high-level guide on how to set up torrenting with qbittorrent and various servarr components.


but...why are you writing this?

i heard about torrenting at first in a comedy sketch by Ronny Chieng around 3-4 years ago. at the time, i had no idea what torrenting was. however, i heard that it could be used to download movies and games for free.

because of this, i looked into it a bit more. i found out that torrenting - fundamentally - was a way to download files from multiple sources at once. to me, this seemed really cool!


what is torrenting?

torrenting is a way to download files from multiple sources at once. it's typically used for downloading larger files.

torrenting uses a peer-to-peer (p2p) file sharing protocol. this means that it uses a decentralized network of computers to share files.

the way it works is that you download a small file called a "torrent file". this file contains information about the file you want to download. when you open this file in a torrent client, the client will connect to multiple sources and download the file in parts from each source (known as "peers"). this can make downloading these large files much faster.

after you have downloaded the file, you can also become a "seeder". this means that you are now hosting the file for others to download. this way, it makes it easier for other people to download the file!

users typically upload their torrent files to a torrent index site. these sites are like search engines for torrents.

pretty cool for a file sharing protocol, right? well, let's make sure to also know the possible risks and downsides.


  • when you are torrenting, other people will be able to see your ip address. this can be a security risk, as people can use this information to track you down.

  • it is completely possible to torrent corrupted or malicious files. this is why it is important to use a trusted torrent index site.

  • your internet service provider (isp) can see that you are torrenting. this can lead to them throttling your internet speed if you use too much bandwidth.

  • torrenting is not illegal in itself. however, it is often used for illegal purposes. this is why it is important to make sure that you are torrenting legally.


cool, now let's set this stuff up.


docker containers used in this guide

i used these docker containers:


  • qbittorrentvpn - an open-source torrent client with vpn integration
    - the vpn part is important so that you can allow yourself to be guarded from potentially malicious downloads.
  • sonarr - a personal video recorder (pvr) for usenet and bittorrent users
  • prowlarr - an indexer manager for usenet and bittorrent users

if you want a media server, you can also use jellyfin or emby.
the media server does not need to be explicitly connected to the other three containers - it just needs to know what directory to look in for media files.
i personally chose to use jellyfin.


setting up the containers

the architecture of the containers' persistant storage volumes looks as follows:

Loading...

this architecture is important and (hopefully) self-explanatory. it works in tandem with the docker-compose file to make sure that the containers can access the correct directories.

my docker-compose file looks like this:

Loading...

to give a brief overview of what this file does:


qbittorrentvpn

this container is the torrent client. it is set up to use a vpn (nordvpn in this case) to protect the user from potentially malicious downloads. in order to use this container, you will need to have a nordvpn account. you can also use other vpn providers, but you will need to change the environment variables accordingly.

the volumes are attached such that qbittorrent will download files to the /data directory.
the config files are stored in the /config directory. the docker container will look for the openvpn config files in its /config/openvpn directory.

the container is set up to use the port 8081 for the webui. this is because i already have something running on my host machine on port 8080.


sonarr

this container uses port 8989 for the webui. this container will communicate with the other two containers. it will look in the /data directory for downloads (which is also used in qbittorrent) and process them into the /tv directory.


prowlarr

this container uses port 9696 for the webui. this container is an indexer manager. it will look in the /config directory for its config files.


jellyfin

this container uses ports 8096 and 8920 for the webui. this container is a media server. it will look in the /movies and /tv directories for media files.
right now, the movies directory is not being used.


in general, three of these contaienrs have a tz environment variable. this is to set the timezone of the container. it doesn't matter too much, but it can be useful for logging purposes. make sure to set it to your timezone.


the ideal process

the ideal process for this setup is as follows:


  • the user goes onto the sonarr webui and add a series (again, must be legally obtainable) that you want to watch.
  • sonarr asks prowlarr for the series' indicies to search through.
  • sonarr displays results to the user.
  • the user selects the series they want to download.
  • sonarr sends the download request to qbittorrent, which then downloads the stuff.
  • sonarr sees the download in the /data directory and processes it to the /tv directory.
  • the media server (jellyfin) sees the new file in the /tv directory and adds it to the library.

this way, the user can have a seamless experience of downloading and watching stuff.


qbittorrent configuration

upon starting qbittorrent and visiting <LAN IP>:8081, you will be greeted with a login screen.
the default username is admin and the default password will be randomly generated. it will be accessible through the file /config/qbittorerent/supervisord.log.

the first thing you will want to do is change the password. you can do this by going to the settings page and changing the password.


qbittorrent settings page

the settings page for qbittorrent


after this, you will want to change the download directory. in this case, we mapped it to /data.


qbittorrent download directory

the download directory for qbittorrent


before you start torrenting anything, you will want to make sure that the vpn is connected.
a simple way to do this is by running curl ifconfig.io in the qbittorrent container.

Loading...

if the ip address that is returned is not your own, then the vpn is working.


sonarr and prowlarr configuration

we will configure prowlarr first in order to get the indicies for sonarr.

visit <LAN IP>:9696, set up your account, and then you can start adding indicies using the "add indexer" button from the indexers tab.


prowlarr indexers

the indexers tab in prowlarr


you can add as many indexers as you want. just make sure to add ones that are legal and safe.


from here, we need to connect prowlarr to sonarr. navigate to the settings > apps tab and add a new application (sonarr).


prowlarr apps

the apps tab in prowlarr


upon clicking the sonarr button, you will be greeted with a page that asks for the both servers' urls and api key.
in this case, the urls will be http://prowlar:9696 and
http://sonarr:8989. the api key can be found in the sonarr
settings > general page.


sonarr api key

the api key in sonarr



prowlarr sonarr connection

the sonarr connection page in prowlarr


after this, we are done with prowlarr. now, we move to...


sonarr configuration (pt 2)

upon starting sonarr and visiting <LAN IP>:8989, you will have to make an account.

after this, you will be greeted with the sonarr dashboard. if everything went well with the prowlarr connection, you should see the indicies that you added in prowlarr in the settings > indexers tab.

from here, we need to connect sonarr to qbittorrent. navigate to the
settings > download clients tab and add a new client (qbittorrent). use the credentials that you set up in the qbittorrent settings page.


sonarr and qbittorrent connection

connecting sonarr to qbittorrent in sonarr


once this is complete, go to the
settings > media management tab and add the /tv directory as the root folder. this will be the directory that sonarr will process the downloads to.

that should be everything for sonarr!

now, we move to the final step...


jellyfin configuration

upon starting jellyfin and visiting <LAN IP>:8096, you will have to make an account.

the configuration itself is pretty simple. just make a new library and point it to the /tv directory.


now what?

well, that's it! you should now have a fully functioning partially-automated torrenting setup.

you can now go to sonarr and add a series. view that series, and click the person-looking icon to view and download torrents. when the torrents are downloaded, they will be viewable in jellyfin.


conclusion

pretty cool! i hope this guide was helpful.

there are also other things you can do with torrenting. however, i will not be covering them due to legal implications.

as stated before, this guide is for educational purposes only.

if you have any questions (or concerns), feel free to reach out to me via email. i will be happy to help.

cheers!


just a funny discord image

another day another banger