├── docker_files ├── run_nginx.sh ├── rutorrent_conf │ ├── .htaccess │ ├── access.ini │ ├── plugins.ini │ └── config.php ├── run_fpm.sh ├── run_rtorrent.sh ├── nginx.conf ├── .rtorrent.rc └── Dockerfile ├── mounted ├── download │ └── README.md ├── complete │ └── README.md ├── session │ └── README.md ├── watch │ └── README.md └── README.md ├── .gitignore ├── docker-compose.yml └── README.md /docker_files/run_nginx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec nginx -------------------------------------------------------------------------------- /docker_files/rutorrent_conf/.htaccess: -------------------------------------------------------------------------------- 1 | deny from all -------------------------------------------------------------------------------- /mounted/download/README.md: -------------------------------------------------------------------------------- 1 | Files that are being downloaded -------------------------------------------------------------------------------- /mounted/complete/README.md: -------------------------------------------------------------------------------- 1 | Files that are downloaded (finished) -------------------------------------------------------------------------------- /docker_files/run_fpm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec php5-fpm --nodaemonize 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | mounted/**/*torrent* 2 | mounted/**/*iso* 3 | mounted/**/*meta* 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /mounted/session/README.md: -------------------------------------------------------------------------------- 1 | the torrent files for all open downloads will be stored in this directory -------------------------------------------------------------------------------- /mounted/watch/README.md: -------------------------------------------------------------------------------- 1 | Put your rtorrent files here and rtorrent will automatically start to dowload them -------------------------------------------------------------------------------- /docker_files/run_rtorrent.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export HOME="/root" 3 | rm -f /root/mounted/session/rtorrent.lock 4 | exec rtorrent > /dev/null 2>&1 5 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | torrent: 2 | build: ./docker_files 3 | container_name: torrent 4 | command: /sbin/my_init 5 | volumes: 6 | - ./mounted:/root/mounted 7 | ports: 8 | - "0.0.0.0:80:80" 9 | -------------------------------------------------------------------------------- /mounted/README.md: -------------------------------------------------------------------------------- 1 | This folder contains directories for: 2 | - download : Files that are being downloaded 3 | - complete : Files that are downloaded (finished) 4 | - watch : Put your rtorrent files here and rtorrent will automatically start to dowload them 5 | - .session : the torrent files for all open downloads will be stored in this directory -------------------------------------------------------------------------------- /docker_files/rutorrent_conf/access.ini: -------------------------------------------------------------------------------- 1 | ;; ruTorrent permissions. 2 | ;; All flags are assumed to be "yes" by default. 3 | 4 | [settings] 5 | showDownloadsPage = yes 6 | showConnectionPage = yes 7 | showBittorentPage = yes 8 | showAdvancedPage = yes 9 | 10 | [tabs] 11 | showPluginsTab = yes 12 | 13 | [statusbar] 14 | canChangeULRate = yes 15 | canChangeDLRate = yes 16 | 17 | [dialogs] 18 | canChangeTorrentProperties = yes -------------------------------------------------------------------------------- /docker_files/rutorrent_conf/plugins.ini: -------------------------------------------------------------------------------- 1 | ;; Plugins' permissions. 2 | ;; If flag is not found in plugin section, corresponding flag from "default" section is used. 3 | ;; If flag is not found in "default" section, it is assumed to be "yes". 4 | ;; 5 | ;; For setting individual plugin permissions you must write something like that: 6 | ;; 7 | ;; [ratio] 8 | ;; enabled = yes ;; also may be "user-defined", in this case user can control plugin's state from UI 9 | ;; canChangeToolbar = yes 10 | ;; canChangeMenu = yes 11 | ;; canChangeOptions = no 12 | ;; canChangeTabs = yes 13 | ;; canChangeColumns = yes 14 | ;; canChangeStatusBar = yes 15 | ;; canChangeCategory = yes 16 | ;; canBeShutdowned = yes 17 | 18 | [default] 19 | enabled = user-defined 20 | canChangeToolbar = yes 21 | canChangeMenu = yes 22 | canChangeOptions = yes 23 | canChangeTabs = yes 24 | canChangeColumns = yes 25 | canChangeStatusBar = yes 26 | canChangeCategory = yes 27 | canBeShutdowned = yes -------------------------------------------------------------------------------- /docker_files/nginx.conf: -------------------------------------------------------------------------------- 1 | daemon off; 2 | worker_processes 1; 3 | user www-data www-data; 4 | 5 | events {worker_connections 100;} 6 | http { 7 | server_tokens off; 8 | include mime.types; 9 | default_type application/octet-stream; 10 | sendfile on; 11 | keepalive_timeout 240; 12 | gzip on; 13 | gzip_http_version 1.0; 14 | gzip_proxied any; 15 | gzip_min_length 500; 16 | gzip_disable "MSIE [1-6]\."; 17 | gzip_types text/plain 18 | text/css 19 | text/csv 20 | text/xml 21 | text/javascript 22 | text/comma-separated-values 23 | application/x-javascript 24 | application/atom+xml 25 | application/xml 26 | application/ecmascript 27 | application/javascript 28 | application/json 29 | application/pdf 30 | application/postscript 31 | image/svg+xml; 32 | error_log /dev/null; 33 | access_log /dev/null; 34 | 35 | server { 36 | listen 0.0.0.0:80; 37 | error_log /dev/null; 38 | access_log /dev/null; 39 | root /var/www/rutorrent; 40 | location / { 41 | index index.html; 42 | } 43 | location /RPC2 { 44 | include scgi_params; 45 | scgi_pass 127.0.0.1:5050; 46 | } 47 | location /php { 48 | include fastcgi_params; 49 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 50 | fastcgi_pass unix:/var/run/php5-fpm.sock; 51 | # fastcgi_param REQUEST_METHOD $request_method; 52 | fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; 53 | } 54 | } 55 | 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #docker-rtorrent-rutorrent 2 | 3 | [![Join the chat at https://gitter.im/Micka33/docker-rtorrent-rutorrent](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Micka33/docker-rtorrent-rutorrent?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 4 | 5 | a docker containing ruTorrent ready to use. 6 | 7 | ## Dependency 8 | 9 | - [Docker](https://www.docker.com/) 10 | - [Mac OS X](https://docs.docker.com/installation/mac/) 11 | - [Ubuntu](https://docs.docker.com/installation/ubuntulinux/) 12 | - [Red Hat Enterprise Linux](https://docs.docker.com/installation/rhel/) 13 | - [CentOS](https://docs.docker.com/installation/centos/) 14 | - [Debian](https://docs.docker.com/installation/debian/) 15 | - [Gentoo](https://docs.docker.com/installation/gentoolinux/) 16 | - [Google Cloud Platform](https://docs.docker.com/installation/google/) 17 | - [Rackspace Cloud](https://docs.docker.com/installation/rackspace/) 18 | - [Amazon EC2](https://docs.docker.com/installation/amazon/) 19 | - [IBM Softlayer](https://docs.docker.com/installation/softlayer/) 20 | - [Arch Linux](https://docs.docker.com/installation/archlinux/) 21 | - [FrugalWare](https://docs.docker.com/installation/frugalware/) 22 | - [Fedora](https://docs.docker.com/installation/fedora/) 23 | - [openSUSE](https://docs.docker.com/installation/openSUSE/) 24 | - [CRUX Linux](https://docs.docker.com/installation/cruxlinux/) 25 | - [Microsoft Windows](https://docs.docker.com/installation/windows/) 26 | 27 | 28 | ## Install it 29 | 30 | ```bash 31 | git clone https://github.com/Micka33/docker-rtorrent-rutorrent.git 32 | cd docker-rtorrent-rutorrent 33 | sudo docker build -t rutorrent_image ./docker_files 34 | ``` 35 | 36 | ## Run it 37 | 38 | ```bash 39 | docker run --name rutorrent -d -p 80:80 -p 0.0.0.0:63256:63256 -v `pwd`/mounted:/root/mounted rutorrent_image 40 | OR 41 | docker-compose run --service-ports --rm torrent 42 | ``` 43 | 44 | ## Debug it 45 | ```bash 46 | docker-compose run --service-ports --rm torrent /sbin/my_init -- /bin/bash 47 | ``` 48 | -------------------------------------------------------------------------------- /docker_files/rutorrent_conf/config.php: -------------------------------------------------------------------------------- 1 | rtorrent link through unix domain socket 34 | // (scgi_local in rtorrent conf file), change variables 35 | // above to something like this: 36 | // 37 | // $scgi_port = 0; 38 | // $scgi_host = "unix:///tmp/rpc.socket"; 39 | 40 | $XMLRPCMountPoint = "/RPC2"; // DO NOT DELETE THIS LINE!!! DO NOT COMMENT THIS LINE!!! 41 | 42 | $pathToExternals = array( 43 | "php" => '', // Something like /usr/bin/php. If empty, will be found in PATH. 44 | "curl" => '', // Something like /usr/bin/curl. If empty, will be found in PATH. 45 | "gzip" => '', // Something like /usr/bin/gzip. If empty, will be found in PATH. 46 | "id" => '', // Something like /usr/bin/id. If empty, will be found in PATH. 47 | "stat" => '', // Something like /usr/bin/stat. If empty, will be found in PATH. 48 | ); 49 | 50 | $localhosts = array( // list of local interfaces 51 | "127.0.0.1", 52 | "localhost", 53 | ); 54 | 55 | $profilePath = '../share'; // Path to user profiles 56 | $profileMask = 0777; // Mask for files and directory creation in user profiles. 57 | // Both Webserver and rtorrent users must have read-write access to it. 58 | // For example, if Webserver and rtorrent users are in the same group then the value may be 0770. 59 | 60 | $tempDirectory = null; // Temp directory. Absolute path with trail slash. If null, then autodetect will be used. -------------------------------------------------------------------------------- /docker_files/.rtorrent.rc: -------------------------------------------------------------------------------- 1 | # Maximum and minimum number of peers to connect to per torrent. 2 | #min_peers = 40 3 | #max_peers = 250 4 | 5 | # Same as above but for seeding completed torrents (-1 = same as downloading) 6 | min_peers_seed = -1 7 | max_peers_seed = -1 8 | 9 | # Maximum number of simultanious uploads per torrent. 10 | max_uploads = 50 11 | 12 | # Global upload and download rate in KiB. "0" for unlimited. 13 | download_rate = 0 14 | upload_rate = 2000 15 | 16 | # Default directory to save the downloaded torrents. 17 | directory = /root/mounted/download 18 | 19 | # Default session directory. Make sure you don't run multiple instance 20 | # of seeder1rent using the same session directory. Perhaps using a 21 | # relative path? 22 | session = /root/mounted/session 23 | 24 | # Watch a directory for new torrents, and stop those that have been 25 | # deleted. 26 | schedule = watch_directory,5,5,"load_start=/root/mounted/watch/*.torrent,d.delete_tied=" 27 | schedule = untied_directory,5,5,stop_untied= 28 | 29 | # Close torrents when diskspace is low. */ 30 | schedule = low_diskspace,5,60,close_low_diskspace=100M 31 | 32 | # Stop torrents when reaching upload ratio in percent, 33 | # when also reaching total upload in bytes, or when 34 | # reaching final upload ratio in percent. 35 | # example: stop at ratio 2.0 with at least 200 MB uploaded, or else ratio 20.0 36 | #schedule = ratio,60,60,stop_on_ratio=200,200M,2000 37 | 38 | 39 | # When the torrent finishes, it executes "mv -n ~/Download/" 40 | # and then sets the destination directory to "~/Download/". (0.7.7+) 41 | #on_finished = move_complete,"execute=mv,-u,$d.get_base_path=,~/rtorrent/complete/ ;d.set_directory=~/rtorrent/complete/" 42 | 43 | system.method.set_key = event.download.finished,move_complete,"d.set_custom=donedir, /root/mounted/complete/; execute=mkdir, -p, $d.get_custom=donedir; d.set_directory=/root/mounted/download/; execute=mv, -u, \"$cat=$d.get_base_path=, $d.get_name=\", \"$cat=donedir, $d.get_name=\"" 44 | 45 | 46 | 47 | # Port range to use for listening. 48 | port_range = 63256-63256 49 | 50 | # Start opening ports at a random position within the port range. 51 | #port_random = yes 52 | 53 | scgi_port = 127.0.0.1:5050 54 | 55 | # Check hash for finished torrents. Might be usefull until the bug is 56 | # fixed that causes lack of diskspace not to be properly reported. 57 | check_hash = yes 58 | 59 | # Set whetever the client should try to connect to UDP trackers. 60 | use_udp_trackers = yes 61 | 62 | # Encryption options, set to none (default) or any combination of the following: 63 | # allow_incoming, try_outgoing, require, require_RC4, enable_retry, prefer_plaintext 64 | # 65 | # The example value allows incoming encrypted connections, starts unencrypted 66 | # outgoing connections but retries with encryption if they fail, preferring 67 | # plaintext to RC4 encryption after the encrypted handshake 68 | # 69 | encryption = allow_incoming,enable_retry,prefer_plaintext 70 | 71 | # Enable DHT support for trackerless torrents or when all trackers are down. 72 | # May be set to "disable" (completely disable DHT), "off" (do not start DHT), 73 | # "auto" (start and stop DHT as needed), or "on" (start DHT immediately). 74 | # The default is "off". For DHT to work, a session directory must be defined. 75 | # 76 | dht = disable 77 | 78 | # UDP port to use for DHT. 79 | # 80 | # dht_port = 6881 81 | 82 | # Enable peer exchange (for torrents not marked private) 83 | # 84 | peer_exchange = no 85 | -------------------------------------------------------------------------------- /docker_files/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM phusion/baseimage:latest 2 | MAINTAINER Mickael Cassy 3 | ENV HOME /root 4 | RUN /etc/my_init.d/00_regen_ssh_host_keys.sh 5 | CMD ["/sbin/my_init"] 6 | 7 | 8 | RUN apt-get -y update && apt-get -y install \ 9 | automake libtool curl gzip wget unzip libxml2 \ 10 | libxml2-dev libgd2-xpm-dev libgeoip-dev libperl-dev \ 11 | libxslt1-dev libxslt1.1 libssl-dev make g++ php5-fpm \ 12 | subversion pkg-config libcppunit-dev \ 13 | libcurl4-openssl-dev libncurses-dev php5-common \ 14 | php5-cli screen 15 | 16 | # Gets PCRE 17 | WORKDIR /install 18 | RUN (wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.36.tar.bz2) && (tar -xjf pcre-8.36.tar.bz2) && (rm pcre-8.36.tar.bz2) && \ 19 | # Gets Nginx Developer Kit 20 | (wget https://github.com/simpl/ngx_devel_kit/archive/v0.2.19.zip) && (unzip v0.2.19.zip) && (rm v0.2.19.zip) && \ 21 | # Gets Zlib 22 | (wget http://zlib.net/zlib-1.2.8.tar.gz) && (tar -xzf zlib-1.2.8.tar.gz) && (rm zlib-1.2.8.tar.gz) && \ 23 | # Installs Nginx 24 | (wget http://nginx.org/download/nginx-1.8.0.tar.gz) && (tar -xzf nginx-1.8.0.tar.gz) && (rm nginx-1.8.0.tar.gz) 25 | WORKDIR /install/nginx-1.8.0 26 | RUN (sed -i "s/static char ngx_http_server_string\[\] = \"Server: nginx\" CRLF;/static char ngx_http_server_string\[\] = \"Server: Lol web server\" CRLF;/g" /install/nginx-1.8.0/src/http/ngx_http_header_filter_module.c) && \ 27 | (sed -i "s/static char ngx_http_server_full_string\[\] = \"Server: \" NGINX_VER CRLF;/static char ngx_http_server_full_string\[\] = \"Server: Lol web server\" CRLF;/g" /install/nginx-1.8.0/src/http/ngx_http_header_filter_module.c) 28 | RUN mkdir -p /var/lib/nginx/body && \ 29 | ./configure \ 30 | --prefix=/usr/share/nginx \ 31 | --conf-path=/etc/nginx/nginx.conf \ 32 | --error-log-path=/var/log/nginx/error.log \ 33 | --http-client-body-temp-path=/var/lib/nginx/body \ 34 | --http-fastcgi-temp-path=/var/lib/nginx/fastcgi \ 35 | --http-log-path=/var/log/nginx/access.log \ 36 | --http-proxy-temp-path=/var/lib/nginx/proxy \ 37 | --http-scgi-temp-path=/var/lib/nginx/scgi \ 38 | --http-uwsgi-temp-path=/var/lib/nginx/uwsgi \ 39 | --lock-path=/var/lock/nginx.lock \ 40 | --pid-path=/run/nginx.pid \ 41 | --with-pcre-jit \ 42 | --with-debug \ 43 | --with-http_addition_module \ 44 | --with-http_dav_module \ 45 | --with-http_flv_module \ 46 | --with-http_geoip_module \ 47 | --with-http_gzip_static_module \ 48 | --with-http_image_filter_module \ 49 | --with-http_mp4_module \ 50 | --with-http_perl_module \ 51 | --with-http_random_index_module \ 52 | --with-http_realip_module \ 53 | --with-http_secure_link_module \ 54 | --with-http_stub_status_module \ 55 | --with-http_ssl_module \ 56 | --with-http_sub_module \ 57 | --with-http_xslt_module \ 58 | --with-ipv6 \ 59 | --with-sha1=/usr/include/openssl \ 60 | --with-md5=/usr/include/openssl \ 61 | --with-mail \ 62 | --with-mail_ssl_module \ 63 | --with-http_spdy_module \ 64 | --with-pcre=`pwd`/../pcre-8.36 \ 65 | --with-zlib=`pwd`/../zlib-1.2.8 \ 66 | --add-module=`pwd`/../ngx_devel_kit-0.2.19 && \ 67 | (make) && (sudo make install) && (ln -s `pwd`/objs/nginx /bin/nginx) && \ 68 | #we're not displaying our nginx version to the world 69 | (sed -i "s/nginx\/\$nginx_version;/web\/lol;/g" /etc/nginx/fastcgi.conf) 70 | 71 | # Installs libtorrent 72 | WORKDIR /rtorrent 73 | RUN (wget -O libtorrent-0.13.4.tar.gz https://github.com/rakshasa/libtorrent/archive/0.13.4.tar.gz) && \ 74 | (tar -xzf libtorrent-0.13.4.tar.gz) && (rm libtorrent-0.13.4.tar.gz) 75 | WORKDIR libtorrent-0.13.4 76 | RUN (sh autogen.sh) && (./configure) && (make) && (make install) 77 | 78 | # Installs xmlrpc 79 | RUN apt-get -y install libxmlrpc-core-c3 libxmlrpc-core-c3-dev 80 | 81 | # Installs rtorrent 82 | WORKDIR /rtorrent 83 | RUN (wget -O rtorrent-0.9.4.tar.gz https://github.com/rakshasa/rtorrent/archive/0.9.4.tar.gz) && \ 84 | (tar -xzf rtorrent-0.9.4.tar.gz) && (rm rtorrent-0.9.4.tar.gz) 85 | WORKDIR rtorrent-0.9.4 86 | RUN (sh autogen.sh) && (./configure --with-xmlrpc-c) && (make) && (make install) && (ldconfig) 87 | 88 | # Gets ruTorrent 89 | WORKDIR /var/www 90 | RUN (svn checkout http://rutorrent.googlecode.com/svn/trunk/ .) && \ 91 | (rm -rf .rutorrent/conf/) && \ 92 | # http://stackoverflow.com/questions/8751221/php-timezone-database-is-corrupt-error 93 | (mkdir -p rutorrent/usr/share/zoneinfo) && \ 94 | (cp -rf /usr/share/zoneinfo/* rutorrent/usr/share/zoneinfo/) && \ 95 | (chown -R www-data:www-data ../www) && (chmod -R 755 ../www) 96 | 97 | # Configures fpm 98 | RUN (sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g" /etc/php5/fpm/php.ini) && \ 99 | (sed -i "s/;catch_workers_output = yes/catch_workers_output = no/" /etc/php5/fpm/pool.d/www.conf) && \ 100 | (sed -i "s/;daemonize = yes/;daemonize = no/g" /etc/php5/fpm/php-fpm.conf) && \ 101 | (sed -i "s/;include=\/etc\/php5\/fpm\/*.conf/include=\/etc\/php5\/fpm\/pool.d\/*.conf/g" /etc/php5/fpm/php-fpm.conf) && \ 102 | (sed -i "s/;chroot =/chroot = \/var\/www\/rutorrent/g" /etc/php5/fpm/pool.d/www.conf) && \ 103 | # We disable the logs 104 | (sed -i 's/^error_log = .*log/error_log = \/dev\/null/g' /etc/php5/fpm/php-fpm.conf) 105 | 106 | # Creates nginx Service 107 | WORKDIR /etc/service/nginx 108 | ADD ./nginx.conf /etc/nginx/nginx.conf 109 | ADD ./run_nginx.sh /etc/service/nginx/run 110 | RUN chmod +x ./run 111 | 112 | # Creates fpm Service 113 | WORKDIR /etc/service/fpm 114 | ADD ./run_fpm.sh /etc/service/fpm/run 115 | RUN chmod +x ./run 116 | 117 | # Creates rtorrent Service 118 | WORKDIR /etc/service/rtorrent 119 | ADD ./run_rtorrent.sh /etc/service/rtorrent/run 120 | RUN chmod +x ./run 121 | 122 | # Add custom config files 123 | ADD ./rutorrent_conf/ /var/www/rutorrent/conf/ 124 | ADD .rtorrent.rc /root/.rtorrent.rc 125 | 126 | # Cleans up APT when done. 127 | RUN apt-get -y remove \ 128 | automake libtool libxml2-dev libgd2-xpm-dev \ 129 | libgeoip-dev libperl-dev libxslt1-dev libssl-dev make \ 130 | g++ pkg-config libcppunit-dev libcurl4-openssl-dev \ 131 | libncurses-dev && \ 132 | apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 133 | --------------------------------------------------------------------------------