├── Dockerfile ├── README.md └── rootfs ├── etc └── s6.d │ ├── .s6-svscan │ └── finish │ ├── flood │ └── run │ └── rtorrent │ └── run ├── home └── torrent │ └── .rtorrent.rc └── usr ├── flood └── config.js └── local └── bin ├── rtunrar.sh └── run.sh /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.15 2 | 3 | ARG RTORRENT_VER=0.9.8 4 | ARG LIBTORRENT_VER=0.13.8 5 | ARG FLOOD_VER=4.7.0 6 | ARG BUILD_CORES 7 | 8 | ENV UID=991 GID=991 \ 9 | FLOOD_SECRET=supersecret30charactersminimum \ 10 | WEBROOT=/ \ 11 | DISABLE_AUTH=false \ 12 | RTORRENT_SOCK=true \ 13 | PKG_CONFIG_PATH=/usr/local/lib/pkgconfig 14 | 15 | RUN NB_CORES=${BUILD_CORES-`getconf _NPROCESSORS_CONF`} \ 16 | && echo "@3.14 https://nl.alpinelinux.org/alpine/v3.14/main" >> /etc/apk/repositories \ 17 | && apk -U upgrade \ 18 | && apk add -t build-dependencies \ 19 | build-base \ 20 | git \ 21 | libtool \ 22 | automake \ 23 | autoconf \ 24 | wget \ 25 | tar \ 26 | xz \ 27 | zlib-dev \ 28 | cppunit-dev \ 29 | openssl-dev \ 30 | ncurses-dev \ 31 | curl-dev \ 32 | binutils \ 33 | linux-headers \ 34 | && apk add \ 35 | ca-certificates \ 36 | curl \ 37 | ncurses \ 38 | openssl \ 39 | gzip \ 40 | zip \ 41 | zlib \ 42 | s6 \ 43 | su-exec \ 44 | python2 \ 45 | nodejs \ 46 | npm \ 47 | unrar@3.14 \ 48 | findutils \ 49 | mediainfo \ 50 | && cd /tmp && mkdir libtorrent rtorrent \ 51 | && cd libtorrent && wget -qO- https://github.com/rakshasa/libtorrent/archive/v${LIBTORRENT_VER}.tar.gz | tar xz --strip 1 \ 52 | && cd ../rtorrent && wget -qO- https://github.com/rakshasa/rtorrent/releases/download/v${RTORRENT_VER}/rtorrent-${RTORRENT_VER}.tar.gz | tar xz --strip 1 \ 53 | && cd /tmp \ 54 | && git clone https://github.com/mirror/xmlrpc-c.git \ 55 | && cd /tmp/xmlrpc-c/advanced && ./configure && make -j ${NB_CORES} && make install \ 56 | && cd /tmp/libtorrent && ./autogen.sh && ./configure && make -j ${NB_CORES} && make install \ 57 | && cd /tmp/rtorrent && ./autogen.sh && ./configure --with-xmlrpc-c && make -j ${NB_CORES} && make install \ 58 | && strip -s /usr/local/bin/rtorrent \ 59 | && mkdir /usr/flood && cd /usr/flood && wget -qO- https://github.com/jesec/flood/archive/v${FLOOD_VER}.tar.gz | tar xz --strip 1 \ 60 | && npm install && npm cache clean --force \ 61 | && apk del build-dependencies \ 62 | && rm -rf /var/cache/apk/* /tmp/* 63 | 64 | COPY rootfs / 65 | 66 | RUN chmod +x /usr/local/bin/* /etc/s6.d/*/* /etc/s6.d/.s6-svscan/* \ 67 | && cd /usr/flood/ && npm run build 68 | 69 | VOLUME /data /flood-db 70 | 71 | EXPOSE 3000 49184 49184/udp 72 | 73 | LABEL description="BitTorrent client with WebUI front-end" \ 74 | rtorrent="rTorrent BiTorrent client v$RTORRENT_VER" \ 75 | libtorrent="libtorrent v$LIBTORRENT_VER" \ 76 | maintainer="Wonderfall " 77 | 78 | CMD ["run.sh"] 79 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ⚠️**THIS IMAGE IS DEPRECATED, USE https://github.com/Wonderfall/docker-rtorrent INSTEAD** ⚠️ 2 | 3 | ## wonderfall/rtorrent-flood 4 | 5 | ### What is this image? 6 | This image was made for my own use a few years ago and while it is being updated, the structure hasn't changed much. I do not trust third-party Dockerfiles, and so should you: consider this repository as a base for your own Docker setup. If you want to do it "the Docker way", you should consider using proper containers for Flood and rtorrent, and use docker-compose. 7 | 8 | ### Security 9 | As many images from the time it was first made, this image follows the principle of degrading privileges. It runs first as root to ensure permissions are set correctly and then only makes use of the UID/GID of your choice. While I agree it's not perfect (due to Linux insecurity), it seemed the best security/comfort balance at the time and it'll remain so for a while. 10 | 11 | ### Main features 12 | - Based on Alpine Linux. 13 | - rTorrent and libtorrent are compiled from source. 14 | - Provides by default a solid configuration. 15 | - [Flood](https://github.com/jesec/flood), a modern web UI for rTorrent with a Node.js backend and React frontend (jesec fork). 16 | - Automatically unpack RAR releases (so Sonarr can deal with them). 17 | 18 | ### Build-time variables 19 | - **RTORRENT_VER** : rtorrent version 20 | - **LIBTORRENT_VER** : libtorrent version 21 | - **MEDIAINFO_VER** : libmediainfo version 22 | - **BUILD_CORES** : number of cores used during build 23 | 24 | ### Environment variables 25 | - **UID** : user id (default : 991) 26 | - **GID** : group id (defaut : 991) 27 | - **FLOOD_SECRET** : flood secret key (defaut : supersecret30charactersminimum) (CHANGE IT) 28 | - **WEBROOT** : context path (base_URI) (default : /) 29 | - **RTORRENT_SOCK** : true or false (default : true, if false rtorrent listens on 0.0.0.0:5000) 30 | - **PKG_CONFIG_PATH** : `/usr/local/lib/pkgconfig` (don't touch) 31 | - **DISABLE_AUTH** : disables Flood built-in authentication system (default : false) 32 | 33 | ### Note 34 | - Run this container with tty mode enabled. In your `docker-compose.yml`, add `tty: true`. If you don't do this, [rtorrent will use 100% of CPU](https://github.com/Wonderfall/dockerfiles/issues/156). 35 | - Connect Flood UI to rTorrent through `Unix socket`. Enter `/tmp/rtorrent.sock` as rTorrent Socket. If SCGI is used, configure accordingly. 36 | 37 | ### Ports 38 | - **49184** 39 | - **3000** (use a reverse proxy) 40 | 41 | ### Tags 42 | - **latest** : latest versions of rTorrent/libtorrent/Flood. 43 | 44 | ### Volumes 45 | - **/data** : your downloaded torrents, session files, symlinks... 46 | - **/flood-db** : Flood databases. 47 | 48 | ### My docker-compose 49 | 50 | ```yaml 51 | rtorrent: 52 | image: wonderfall/rtorrent-flood 53 | container_name: rtorrent 54 | restart: unless-stopped 55 | tty: true 56 | security_opt: 57 | - no-new-privileges:true 58 | ports: 59 | - 49184:49184 60 | - 49184:49184/udp 61 | environment: 62 | - UID=1000 63 | - GID=1000 64 | - FLOOD_SECRET=supersecret 65 | # - RTORRENT_SOCK=false 66 | volumes: 67 | - /home/docker/flood:/flood-db 68 | - /home/media/torrents:/data 69 | networks: 70 | - http_network 71 | - rtorrent_network 72 | labels: 73 | - traefik.enable=true 74 | - traefik.http.routers.rtorrent.entrypoints=http 75 | - traefik.http.routers.rtorrent.rule=Host(`box.domain.tld`) 76 | - traefik.http.routers.rtorrent.middlewares=https-redirect@file 77 | - traefik.http.routers.rtorrent-secure.entrypoints=https 78 | - traefik.http.routers.rtorrent-secure.rule=Host(`box.domain.tld`) 79 | - traefik.http.routers.rtorrent-secure.tls=true 80 | - traefik.http.routers.rtorrent-secure.middlewares=secure-headers@file,hsts-headers@file 81 | - traefik.http.routers.rtorrent-secure.tls.certresolver=http 82 | - traefik.http.routers.rtorrent-secure.service=rtorrent 83 | - traefik.http.services.rtorrent.loadbalancer.server.port=3000 84 | - traefik.docker.network=http_network 85 | ``` 86 | -------------------------------------------------------------------------------- /rootfs/etc/s6.d/.s6-svscan/finish: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | exit 0 4 | -------------------------------------------------------------------------------- /rootfs/etc/s6.d/flood/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd /usr/flood 3 | exec npm start 4 | -------------------------------------------------------------------------------- /rootfs/etc/s6.d/rtorrent/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export TERM="xterm" 3 | export HOME="/home/torrent" 4 | export PWD="/home/torrent" 5 | cd /home/torrent 6 | exec rtorrent 7 | -------------------------------------------------------------------------------- /rootfs/home/torrent/.rtorrent.rc: -------------------------------------------------------------------------------- 1 | scgi_local = /tmp/rtorrent.sock 2 | 3 | encoding_list = UTF-8 4 | port_range = 49184-49184 5 | port_random = no 6 | check_hash = no 7 | directory = /data/torrents 8 | session = /data/.session 9 | encryption = allow_incoming, try_outgoing, enable_retry 10 | trackers.use_udp.set = yes 11 | dht.mode.set = off 12 | protocol.pex.set = no 13 | 14 | min_peers = 1 15 | max_peers = 100 16 | min_peers_seed = 1 17 | max_peers_seed = 50 18 | max_uploads = 15 19 | 20 | network.xmlrpc.size_limit.set = 10000000 21 | 22 | schedule = watch_directory,1,1,"load.start=/data/.watch/*.torrent" 23 | schedule = scgi_permission,0,0,"execute.nothrow=chmod,\"g+w,o=\",/tmp/rtorrent.sock" 24 | schedule = insufficient_disk_space,1,30,close_low_diskspace=500M 25 | 26 | method.set_key=event.download.finished,unrar,"execute={/usr/local/bin/rtunrar.sh,$d.base_path=}" 27 | method.set_key=event.download.inserted_new,loaded_time,"d.custom.set=addtime,$cat=$system.time=;d.save_full_session=" 28 | -------------------------------------------------------------------------------- /rootfs/usr/flood/config.js: -------------------------------------------------------------------------------- 1 | let connectionSettings = { 2 | client: 'rTorrent', 3 | version: 1, 4 | }; 5 | 6 | if (process.env.RTORRENT_SOCK === 'true' || process.env.RTORRENT_SOCK === true) { 7 | Object.assign(connectionSettings, { 8 | type: 'socket', 9 | socket: '/tmp/rtorrent.sock', 10 | }); 11 | } else { 12 | Object.assign(connectionSettings, { 13 | type: 'tcp', 14 | host: process.env.RTORRENT_SCGI_HOST || 'localhost', 15 | port: process.env.RTORRENT_SCGI_PORT || 5000, 16 | }); 17 | } 18 | 19 | const CONFIG = { 20 | baseURI: process.env.WEBROOT || '/', 21 | dbCleanInterval: 1000 * 60 * 60, 22 | dbPath: '/flood-db/', 23 | tempPath: '/tmp/', 24 | authMethod: process.env.DISABLE_AUTH === 'true' || process.env.DISABLE_AUTH === true ? 'none' : 'default', 25 | floodServerHost: '0.0.0.0', 26 | floodServerPort: 3000, 27 | maxHistoryStates: 30, 28 | torrentClientPollInterval: 1000 * 5, 29 | torrentClientPollIntervalIdle: 1000 * 60 * 15, 30 | secret: process.env.FLOOD_SECRET || 'supersecret30charactersminimum', 31 | configUser: connectionSettings 32 | }; 33 | 34 | module.exports = CONFIG; 35 | -------------------------------------------------------------------------------- /rootfs/usr/local/bin/rtunrar.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ -d $1 ]; then 4 | find $1 -name '*.rar' -execdir unrar e {} \; 5 | fi 6 | -------------------------------------------------------------------------------- /rootfs/usr/local/bin/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | mkdir -p /data/torrents 4 | mkdir -p /data/.watch 5 | mkdir -p /data/.session 6 | 7 | rm -f /data/.session/rtorrent.lock 8 | 9 | chown -R $UID:$GID /data /home/torrent /tmp /usr/flood/dist /flood-db /etc/s6.d 10 | 11 | if [ ${RTORRENT_SOCK} = "false" ]; then 12 | sed -i -e 's|^scgi_local.*$|scgi_port = 0.0.0.0:5000|' /home/torrent/.rtorrent.rc 13 | fi 14 | 15 | exec su-exec $UID:$GID /bin/s6-svscan /etc/s6.d 16 | --------------------------------------------------------------------------------