Flood, modern web UI for rTorrent

15th Mar 2018 Karibu

RTorrent is probably the most powerful torrent client, but bundled with Flood, a modern Web-UI, it is the perfect match for your seedbox or server.

I probably don’t have to present rTorrent. I have written several articles around it, the previous one being on Quickbox, a script that will install and configure your seedbox (Using rTorrent) in a single command line.

I used to use Deluge, for my torrents, but since I discovered Flood, a modern, powerful and easy to install web interface for rTorrent, I’m changing my habits. 😉

Flood is using Node.js as backend and React as frontend, and here is the main features I appreciate:

  • Lightweight, intuitive and modern interface
  • Can add torrents through URL, Torrent file and RSS. (Usually, you need quite some settings for RSS. Here you can add your download rules directly in the web interface!)
  • Ability to download your torrent directly through your web interface. This is probably the best feature, since you can download the file from your seedbox, and directly get it back using “direct download” (HTTP) from Flood. (No need to have a FTP or some HTTP folder with user/password, etc..

And, well…it’s based on rTorrent 😉

Of course, you will find the usual features like labels, bandwidth limits, etc…

Let’s see how to install rTorrent and Flood for Debian 9. (Ubuntu should be pretty similar)

Installation

1) Install rTorrent

The easiest way is to use the rTorrent version in the repo. In root (or with sudo), run:

apt install rtorrent screen

 

2) Confgure rTorrent

First, create a dedicated user, to avoid running rTorrent with root:

 adduser --disabled-password rtorrent

You will need to answer few questions (or just skip them with ENTER)

Then, we will create a configuration file to define few settings and the SCGI to let Flood connect to rTorrent.

nano /home/rtorrent/.rtorrent.rc

and copy the following:

    # Where rTorrent saves the downloaded files
    directory = /srv/torrent/downloads

    # Where rTorrent saves the session
    session = /srv/torrent/.session

    # Which ports rTorrent can use (Make sure to open them in your router)
    port_range = 50000-50000
    port_random = no

    # Check the hash after the end of the download
    check_hash = yes

    # Enable DHT (for torrents without trackers)
    dht = auto
    dht_port = 6881
    peer_exchange = yes

    # Authorize UDP trackers
    use_udp_trackers = yes

    # Enable encryption when possible
    encryption = allow_incoming,try_outgoing,enable_retry

    # SCGI port, used to communicate with Flood
    scgi_port = 127.0.0.1:5000

It will work out of the box, but feel free to tweak it, especially on the download paths.

Create the mentioned folders (download and session)

mkdir /srv/torrent
mkdir /srv/torrent/downloads
mkdir /srv/torrent/.session

and set the rights permissions:

chmod 775 -R /srv/torrent 
chown rtorrent:rtorrent -R /srv/torrent 
chown rtorrent:rtorrent /home/rtorrent/.rtorrent.rc

Now, we create a SystemD startup script to ensure rtorrent is running at the startup (and it ease the control)

nano /etc/systemd/system/rtorrent.service

and add:

    [Unit]
    Description=rTorrent
    After=network.target

    [Service]
    User=rtorrent
    Type=forking
    KillMode=none
    ExecStart=/usr/bin/screen -d -m -fa -S rtorrent /usr/bin/rtorrent
    ExecStop=/usr/bin/killall -w -s 2 /usr/bin/rtorrent
    WorkingDirectory=%h

    [Install]
    WantedBy=default.target

Enable it at boot:

systemctl enable rtorrent.service

and start it up!

 systemctl start rtorrent

  If no error, you can move to the next step.

3) Install Flood

You will need NodeJS, the version 8 will work great. (Feel free to use nvm to manage your node versions) To do so, still in root (Or with sudo) run:

sudo apt install curl build-essential git
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt install -y nodejs

And then, clone their git repo

cd /srv/torrent
git clone https://github.com/jfurrow/flood.git

This should be pretty fast.

Use the template of the config file as standard configuration

cd flood
cp config.template.js config.js

Now install flood using npm

npm install

If no error, continue with:

npm install -g node-gyp
npm run build. 


4) Start Flood

Before launching Flood, we will create a systemd script to launch flood directly at startup (and easier to manage)

First, create a dedicated user that will run flood

adduser --disabled-password flood

and add the right permissions:

 chown -R flood:flood /srv/torrent/flood/

Then create the script

nano /etc/systemd/system/flood.service

and add:

    [Service]
    WorkingDirectory=/srv/torrent/flood
    ExecStart=/usr/bin/npm start
    Restart=always
    StandardOutput=syslog
    StandardError=syslog
    SyslogIdentifier=notell
    User=flood
    Group=flood
    Environment=NODE_ENV=production

    [Install]
    WantedBy=multi-user.target

add it to the boot:

systemctl enable flood

and start it!

systemctl start flood


5) Create a dedicated Virtualhost

Instead of accessing it through the IP and the port 3000, it will be much easier to access it through a domain name or subdomain name like flood.mydomain.tld To redirect a port to a subdomain, you will need the mod proxy-html and to enable proxy_http

apt install libapache2-mod-proxy-html
a2enmod proxy_http

Now create a dedicated virtualhost

nano /etc/apache2/sites-available/flood.conf

and add:

<VirtualHost *:80>

        ServerAdmin webmaster@localhost
        ServerName flood.domain.tld

        ProxyRequests Off
        <proxy>
        Require all granted
        </proxy>
        ProxyPass / http://localhost:3000/
        ProxyPassReverse / http://localhost:3000/

    ErrorLog ${APACHE_LOG_DIR}/flood_error.log
    CustomLog ${APACHE_LOG_DIR}/flood_access.log combined

</VirtualHost>

Enable the configuration and restart Apache Still in root, run:

a2ensite flood
systemctl reload apache2

And that's it, you should now have access to your Flood instance by connecting directly to your subdomain.

It will ask you to create a user/password for the first time and you’re good to go!

Your final step should be to enable HTTPS. You can directly follow my tutorial on how to install a SSL certificate with Let's Encrypt.

If you have issues, feel free to comment or to directly check their github page.

Gravatar

Loves to discover web-based apps to install on his own server@home and write articles about it

8 Comments:

Add a comment

Comments

Hi Carl, What error do you have? Can you share here or with a pad? Thanks
Written on Sat, 07 Apr 2018 10:47:29 by Karibu
no dice. I got flooded with errors following steps npm install and build. Github wasn't any help either.
Written on Sat, 07 Apr 2018 01:09:21 by Carl
Hi, it could be indeed easier to have only 1 user. I did not face this issue, but I believe it can happen indeed when creating subfolders. I guess you can first create them and do a chown -R on it. Thanks for raising this
Written on Sat, 31 Mar 2018 15:52:04 by Karibu
Thanks for the great guide/information. Are you sure about creating separate rtorrent/flood users? I'm totally into the idea of separating different applications to different users, but I think I'm running into permission issues because of it. When you add a torrent into flood, sometimes it needs to create the directory that its going to be stored in. (i.e. I save torrents in /torrenting but I want this particular torrent to go in /torrenting/linux/ubuntu/) When flood creates this directory, it has ownership of it and rtorrent can't write to it. I've tried using shared groups,setgid and default permissions with setfacl to no avail. Flood seems to be intentionally creating directories without group/other write access(making rtorrent unable to write into the directory).
Written on Fri, 30 Mar 2018 07:29:12 by Dalton
Tested on raspberry PI (Raspian) with totally sucess!! thankx bro
Written on Wed, 21 Mar 2018 22:58:28 by korzak
Article revised!!
Written on Thu, 15 Mar 2018 01:22:54 by Karibu
Hello Twisel, Let me work on it!
Written on Mon, 12 Mar 2018 23:00:07 by Karibu
Karibu, Please can you update this wonderful guide as it is now out of date and does not work. To install flood you now need version 8.x of nodejs and to install flood as the flood user. This was from the helpful last comment which seems to have been removed.
Written on Mon, 12 Mar 2018 13:32:54 by Twisel