├── .dockerignore ├── rootfs ├── etc │ ├── php7 │ │ ├── conf.d │ │ │ ├── geoip.ini │ │ │ ├── apcu.ini │ │ │ ├── www.ini │ │ │ └── opcache.ini │ │ └── php-fpm.conf │ ├── s6.d │ │ ├── nginx │ │ │ ├── crash │ │ │ ├── finish │ │ │ └── run │ │ ├── php7 │ │ │ ├── crash │ │ │ ├── finish │ │ │ └── run │ │ ├── rtorrent │ │ │ ├── crash │ │ │ ├── finish │ │ │ └── run │ │ └── .s6-svscan │ │ │ ├── crash │ │ │ └── finish │ ├── supervisor │ │ └── supervisord.conf │ └── nginx │ │ └── nginx.conf ├── var │ └── www │ │ └── html │ │ └── torrent │ │ ├── plugins │ │ ├── theme │ │ │ └── conf.php │ │ ├── create │ │ │ └── conf.php │ │ └── filemanager │ │ │ └── conf.php │ │ └── conf │ │ ├── plugins.ini │ │ └── config.php ├── usr │ └── local │ │ └── bin │ │ ├── postrm │ │ ├── postdl │ │ └── startup └── home │ └── torrent │ └── .rtorrent.rc ├── README.md ├── .drone.yml ├── .drone ├── push.sh ├── build.sh └── test.sh └── Dockerfile /.dockerignore: -------------------------------------------------------------------------------- 1 | README.md 2 | .drone -------------------------------------------------------------------------------- /rootfs/etc/php7/conf.d/geoip.ini: -------------------------------------------------------------------------------- 1 | extension=geoip.so 2 | -------------------------------------------------------------------------------- /rootfs/etc/s6.d/nginx/crash: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | exit 1 4 | -------------------------------------------------------------------------------- /rootfs/etc/s6.d/nginx/finish: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | exit 0 4 | -------------------------------------------------------------------------------- /rootfs/etc/s6.d/php7/crash: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | exit 1 4 | -------------------------------------------------------------------------------- /rootfs/etc/s6.d/php7/finish: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | exit 0 4 | -------------------------------------------------------------------------------- /rootfs/etc/s6.d/rtorrent/crash: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | exit 1 4 | -------------------------------------------------------------------------------- /rootfs/etc/s6.d/rtorrent/finish: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | exit 0 4 | -------------------------------------------------------------------------------- /rootfs/etc/s6.d/.s6-svscan/crash: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "crash s6" 4 | -------------------------------------------------------------------------------- /rootfs/etc/s6.d/.s6-svscan/finish: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "Stop s6" 4 | -------------------------------------------------------------------------------- /rootfs/etc/s6.d/nginx/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | /usr/sbin/nginx 4 | 5 | s6-svscanctl -qz /etc/s6.d 6 | -------------------------------------------------------------------------------- /rootfs/etc/s6.d/php7/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | /usr/sbin/php-fpm7 4 | 5 | s6-svscanctl -qz /etc/s6.d 6 | -------------------------------------------------------------------------------- /rootfs/etc/php7/conf.d/apcu.ini: -------------------------------------------------------------------------------- 1 | extension=apcu.so 2 | apc.enabled=1 3 | apc.shm_size=128M 4 | apc.ttl=7200 -------------------------------------------------------------------------------- /rootfs/var/www/html/torrent/plugins/theme/conf.php: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /rootfs/etc/s6.d/rtorrent/run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | /usr/local/bin/rtorrent -D -I 4 | 5 | s6-svscanctl -qz /etc/s6.d 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Unmaintained, please use ![mondediefr/docker-rutorrent](https://github.com/mondediefr/docker-rutorrent) 2 | -------------------------------------------------------------------------------- /rootfs/etc/php7/conf.d/www.ini: -------------------------------------------------------------------------------- 1 | post_max_size=100M 2 | upload_max_filesize=100M 3 | max_execution_time=10800 4 | max_input_time=3600 5 | expose_php=Off -------------------------------------------------------------------------------- /rootfs/var/www/html/torrent/plugins/create/conf.php: -------------------------------------------------------------------------------- 1 | > /tmp/postrm.log & 12 | -------------------------------------------------------------------------------- /rootfs/var/www/html/torrent/conf/plugins.ini: -------------------------------------------------------------------------------- 1 | [default] 2 | enabled = user-defined 3 | canChangeToolbar = yes 4 | canChangeMenu = yes 5 | canChangeOptions = yes 6 | canChangeTabs = yes 7 | canChangeColumns = yes 8 | canChangeStatusBar = yes 9 | canChangeCategory = yes 10 | canBeShutdowned = yes 11 | [ipad] 12 | enabled = no 13 | [httprpc] 14 | enabled = yes 15 | [retrackers] 16 | enabled = no 17 | [rpc] 18 | enabled = no 19 | [rutracker_check] 20 | enabled = no 21 | -------------------------------------------------------------------------------- /rootfs/etc/supervisor/supervisord.conf: -------------------------------------------------------------------------------- 1 | [supervisord] 2 | nodaemon=true 3 | logfile=/tmp/supervisor.log 4 | pidfile=/tmp/supervisor.pid 5 | 6 | 7 | [program:rtorrent] 8 | priority=2 9 | environment=TERM=xterm,HOME="/home/torrent",PWD="/home/torrent" 10 | command=rtorrent 11 | redirect_stderr=true 12 | 13 | [program:nginx] 14 | priority=2 15 | directory=/etc/nginx 16 | command=/usr/sbin/nginx 17 | redirect_stderr=true 18 | 19 | [program:php7] 20 | priority=2 21 | directory=/etc/php7 22 | command=/usr/sbin/php-fpm7 23 | redirect_stderr=true -------------------------------------------------------------------------------- /.drone.yml: -------------------------------------------------------------------------------- 1 | pipeline: 2 | build: 3 | image: xataz/docker-drone-plugin 4 | action: build 5 | volumes: 6 | - /var/run/docker.sock:/var/run/docker.sock 7 | 8 | test: 9 | image: xataz/docker-drone-plugin 10 | action: test 11 | volumes: 12 | - /var/run/docker.sock:/var/run/docker.sock 13 | 14 | push: 15 | image: xataz/docker-drone-plugin 16 | action: push 17 | environment: 18 | - UID=1000 19 | - GID=991 20 | volumes: 21 | - /var/run/docker.sock:/var/run/docker.sock 22 | - /home/xataz/.docker/config.json:/docker/.docker/config.json 23 | when: 24 | branch: master 25 | event: [push, tag, deployment] -------------------------------------------------------------------------------- /rootfs/var/www/html/torrent/plugins/filemanager/conf.php: -------------------------------------------------------------------------------- 1 | 18 | -------------------------------------------------------------------------------- /.drone/push.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## Variables 4 | CSI="\033[" 5 | CEND="${CSI}0m" 6 | CRED="${CSI}1;31m" 7 | CGREEN="${CSI}1;32m" 8 | CYELLOW="${CSI}1;33m" 9 | CBLUE="${CSI}1;34m" 10 | 11 | 12 | ## Functions 13 | f_log() { 14 | TYPE=$1 15 | MSG=$2 16 | 17 | if [ "${TYPE}" == "ERR" ]; then 18 | COLOR=${CRED} 19 | elif [ "${TYPE}" == "INF" ]; then 20 | COLOR=${CBLUE} 21 | elif [ "${TYPE}" == "WRN" ]; then 22 | COLOR=${CYELLOW} 23 | elif [ "${TYPE}" == "SUC" ]; then 24 | COLOR=${CGREEN} 25 | else 26 | COLOR=${CEND} 27 | fi 28 | 29 | echo -e "${COLOR}=${TYPE}= $TIMENOW : ${MSG}${CEND}" 30 | } 31 | 32 | 33 | # Push rtorrent-rutorrent 34 | for tag in latest filebot latest-filebot; do 35 | f_log INF "Push xataz/rtorrent-rutorrent:$tag" 36 | docker push xataz/rtorrent-rutorrent:$tag 37 | if [ $? -ne 0 ]; then 38 | f_log ERR "Push xataz/rtorrent-rutorrent:$tag failed" 39 | exit 1 40 | else 41 | f_log SUC "Push xataz/rtorrent-rutorrent:$tag successful" 42 | fi 43 | done 44 | -------------------------------------------------------------------------------- /rootfs/var/www/html/torrent/conf/config.php: -------------------------------------------------------------------------------- 1 | RPC"; 21 | $pathToExternals = array( 22 | "php" => '/usr/bin/php7', 23 | "curl" => '/usr/bin/curl', 24 | "gzip" => '/usr/bin/gzip', 25 | "id" => '/usr/bin/id', 26 | "stat" => '/usr/bin/stat', 27 | ); 28 | $localhosts = array( 29 | "127.0.0.1", 30 | "localhost", 31 | ); 32 | $profilePath = '../share'; 33 | $profileMask = 0777; 34 | $tempDirectory = null; 35 | $canUseXSendFile = true; 36 | $locale = "UTF8"; 37 | -------------------------------------------------------------------------------- /rootfs/home/torrent/.rtorrent.rc: -------------------------------------------------------------------------------- 1 | ## Logs 2 | system.daemon.set = true 3 | log.open_file = "rtorrent", "/tmp/rtorrent.log" 4 | log.add_output = "info", "rtorrent" 5 | log.add_output = "critical", "rtorrent" 6 | log.add_output = "error", "rtorrent" 7 | log.add_output = "warn", "rtorrent" 8 | log.add_output = "notice", "rtorrent" 9 | log.add_output = "debug", "rtorrent" 10 | 11 | ## General 12 | directory.default.set = /data/torrents 13 | session.path.set = /data/.session 14 | protocol.encryption.set = allow_incoming, try_outgoing, enable_retry 15 | ip = 16 | 17 | ## Network 18 | network.scgi.open_port = 0.0.0.0:5000 19 | network.port_range.set = - 20 | network.port_random.set = no 21 | pieces.hash.on_completion.set = no 22 | 23 | trackers.use_udp.set = yes 24 | dht.port = 25 | protocol.pex.set = no 26 | throttle.min_peers.normal.set = 1 27 | throttle.max_peers.normal.set = 100 28 | throttle.min_peers.seed.set = 1 29 | throttle.max_peers.seed.set = 50 30 | throttle.max_uploads.set = 15 31 | 32 | ## Divers 33 | encoding.add = utf8 34 | 35 | ## Scheduling 36 | execute2 = {sh,-c,/usr/bin/php /var/www/html/torrent/php/initplugins.php torrent &} 37 | schedule2 = watch_directory,1,1,"load.start=/data/.watch/*.torrent" 38 | schedule2 = untied_directory,5,5,"stop_untied=/data/.watch/*.torrent" 39 | schedule2 = espace_disque_insuffisant,1,30,close_low_diskspace=500M 40 | -------------------------------------------------------------------------------- /.drone/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## Variables 4 | CSI="\033[" 5 | CEND="${CSI}0m" 6 | CRED="${CSI}1;31m" 7 | CGREEN="${CSI}1;32m" 8 | CYELLOW="${CSI}1;33m" 9 | CBLUE="${CSI}1;34m" 10 | 11 | 12 | ## Functions 13 | f_log() { 14 | TYPE=$1 15 | MSG=$2 16 | 17 | if [ "${TYPE}" == "ERR" ]; then 18 | COLOR=${CRED} 19 | elif [ "${TYPE}" == "INF" ]; then 20 | COLOR=${CBLUE} 21 | elif [ "${TYPE}" == "WRN" ]; then 22 | COLOR=${CYELLOW} 23 | elif [ "${TYPE}" == "SUC" ]; then 24 | COLOR=${CGREEN} 25 | else 26 | COLOR=${CEND} 27 | fi 28 | 29 | echo -e "${COLOR}=${TYPE}= $TIMENOW : ${MSG}${CEND}" 30 | } 31 | 32 | 33 | # Build rtorrent-rutorrent 34 | f_log INF "Build xataz/rtorrent-rutorrent:latest ..." 35 | docker build -t xataz/rtorrent-rutorrent:latest . > /tmp/build.log 2>&1 36 | if [ $? -eq 0 ]; then 37 | f_log SUC "Build xataz/rtorrent-rutorrent:latest successful" 38 | else 39 | f_log ERR "Build xataz/rtorrent-rutorrent:latest failed" 40 | cat /tmp/build.log 41 | exit 1 42 | fi 43 | 44 | f_log INF "Build xataz/rtorrent-rutorrent:filebot ..." 45 | docker build --build-arg WITH_FILEBOT=YES -t xataz/rtorrent-rutorrent:filebot . > /tmp/build.log 2>&1 46 | if [ $? -eq 0 ]; then 47 | f_log SUC "Build xataz/rtorrent-rutorrent:filebot successful" 48 | docker tag xataz/rtorrent-rutorrent:filebot xataz/rtorrent-rutorrent:latest-filebot 49 | else 50 | f_log ERR "Build xataz/rtorrent-rutorrent:filebot failed" 51 | cat /tmp/build.log 52 | exit 1 53 | fi 54 | -------------------------------------------------------------------------------- /.drone/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## Variables 4 | CSI="\033[" 5 | CEND="${CSI}0m" 6 | CRED="${CSI}1;31m" 7 | CGREEN="${CSI}1;32m" 8 | CYELLOW="${CSI}1;33m" 9 | CBLUE="${CSI}1;34m" 10 | DATE_TEST=$(date +%Y%m%d) 11 | 12 | 13 | ## Functions 14 | f_log() { 15 | TYPE=$1 16 | MSG=$2 17 | 18 | if [ "${TYPE}" == "ERR" ]; then 19 | COLOR=${CRED} 20 | elif [ "${TYPE}" == "INF" ]; then 21 | COLOR=${CBLUE} 22 | elif [ "${TYPE}" == "WRN" ]; then 23 | COLOR=${CYELLOW} 24 | elif [ "${TYPE}" == "SUC" ]; then 25 | COLOR=${CGREEN} 26 | else 27 | COLOR=${CEND} 28 | fi 29 | 30 | echo -e "${COLOR}=${TYPE}= $TIMENOW : ${MSG}${CEND}" 31 | } 32 | 33 | ## Test rtorrent-rutorrent 34 | f_log INF "Run container ..." 35 | docker run -d --name test_torrent_${DATE_TEST} xataz/rtorrent-rutorrent 36 | 37 | f_log INF "Wait 10 sec ..." 38 | sleep 10 39 | 40 | docker ps | grep test_torrent_${DATE_TEST} 41 | if [ $? -ne 0 ]; then 42 | f_log ERR "Run container failed" 43 | exit 1 44 | else 45 | f_log SUC "Run container successful" 46 | fi 47 | 48 | f_log INF "Test rutorrent ..." 49 | docker exec -i test_torrent_${DATE_TEST} curl http://localhost:8080 | grep "404 Not Found" 50 | if [ $? -ne 0 ]; then 51 | f_log SUC "rutorrent is ok" 52 | else 53 | f_log ERR "rutorrent is ko" 54 | exit 1 55 | fi 56 | 57 | f_log INT "Delete container ..." 58 | docker rm -f test_torrent_${DATE_TEST} 59 | if [ $? -ne 0 ]; then 60 | f_log ERR "Delete container failed" 61 | exit 1 62 | else 63 | f_log SUC "Delete container successful" 64 | fi -------------------------------------------------------------------------------- /rootfs/usr/local/bin/postdl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # rtorrent.rc 4 | # system.method.set_key=event.download.finished,filebot,"execute={rtorrent-postprocess.sh,$d.get_base_path=,$d.get_name=,$d.get_custom1=}" 5 | 6 | TORRENT_PATH="$1" 7 | TORRENT_NAME="$2" 8 | TORRENT_LABEL="$(echo $3 | tr '[:upper:]' '[:lower:]')" 9 | 10 | 11 | case $TORRENT_LABEL in 12 | films|movies|film|movie) 13 | /filebot/filebot.sh --lang "$FILEBOT_LANG" --db TheMovieDB -script fn:amc --output "/data/Media" --action --conflict $FILEBOT_CONFLICT -non-strict --log-file amc.log --def excludeList=amc.excludes unsorted=y "movieFormat=/data/Media/Movies/" "ut_dir=$TORRENT_PATH" "ut_kind=multi" "ut_title=$TORRENT_NAME" "ut_label=Movies" | tee -a /tmp/filebot.log & 14 | ;; 15 | music|musics|musique|musiques) 16 | /filebot/filebot.sh --lang "$FILEBOT_LANG" --db ID3 -script fn:amc --output "/data/Media" --action --conflict $FILEBOT_CONFLICT -non-strict --log-file amc.log --def excludeList=amc.excludes unsorted=y music=y "musicFormat=/data/Media/Music/" "ut_dir=$TORRENT_PATH" "ut_kind=multi" "ut_title=$TORRENT_NAME" "ut_label=Music" | tee -a /tmp/filebot.log & 17 | ;; 18 | tv|"tv shows"|series|serie) 19 | /filebot/filebot.sh --lang "$FILEBOT_LANG" --db TheTVDB -script fn:amc --output "/data/Media" --action --conflict $FILEBOT_CONFLICT -non-strict --log-file amc.log --def excludeList=amc.excludes unsorted=y "seriesFormat=/data/Media/TV/" "ut_dir=$TORRENT_PATH" "ut_kind=multi" "ut_title=$TORRENT_NAME" "ut_label=TV" | tee -a /tmp/filebot.log & 20 | ;; 21 | animes) 22 | /filebot/filebot.sh --lang "$FILEBOT_LANG" --db AniDB -script fn:amc --output "/data/Media" --action --conflict $FILEBOT_CONFLICT -non-strict --log-file amc.log --def excludeList=amc.excludes unsorted=y "animeFormat=/data/Media/Animes/" "ut_dir=$TORRENT_PATH" "ut_kind=multi" "ut_title=$TORRENT_NAME" "ut_label=Anime" | tee -a /tmp/filebot.log & 23 | ;; 24 | *) 25 | /filebot/filebot.sh --lang "$FILEBOT_LANG" -script fn:amc --output "/data/Media" --action --conflict $FILEBOT_CONFLICT -non-strict --log-file amc.log --def excludeList=amc.excludes unsorted=y music=y "seriesFormat=/data/Media/TV/" "animeFormat=/data/Media/Animes/" "movieFormat=/data/Media/Movies/" "musicFormat=/data/Media/Music/" "ut_dir=$TORRENT_PATH" "ut_kind=multi" "ut_title=$TORRENT_NAME" "ut_label=$TORRENT_LABEL" | tee -a /tmp/filebot.log & 26 | ;; 27 | esac 28 | -------------------------------------------------------------------------------- /rootfs/etc/nginx/nginx.conf: -------------------------------------------------------------------------------- 1 | daemon off; 2 | worker_processes auto; 3 | pid /tmp/nginx.pid; 4 | 5 | events { 6 | worker_connections 1024; 7 | use epoll; 8 | } 9 | 10 | http { 11 | include /etc/nginx/mime.types; 12 | default_type application/octet-stream; 13 | 14 | access_log /tmp/nginx_access.log combined; 15 | error_log /tmp/nginx_error.log error; 16 | 17 | fastcgi_temp_path /tmp/fastcgi 1 2; 18 | client_body_temp_path /tmp/client_body 1 2; 19 | proxy_temp_path /tmp/proxy 1 2; 20 | uwsgi_temp_path /tmp/uwsgi 1 2; 21 | scgi_temp_path /tmp/scgi 1 2; 22 | 23 | sendfile on; 24 | keepalive_timeout 15; 25 | keepalive_disable msie6; 26 | keepalive_requests 100; 27 | tcp_nopush on; 28 | tcp_nodelay off; 29 | server_tokens off; 30 | 31 | gzip on; 32 | gzip_comp_level 5; 33 | gzip_min_length 512; 34 | gzip_buffers 4 8k; 35 | gzip_proxied any; 36 | gzip_vary on; 37 | gzip_disable "msie6"; 38 | gzip_types 39 | text/css 40 | text/javascript 41 | text/xml 42 | text/plain 43 | text/x-component 44 | application/javascript 45 | application/x-javascript 46 | application/json 47 | application/xml 48 | application/rss+xml 49 | application/vnd.ms-fontobject 50 | font/truetype 51 | font/opentype 52 | image/svg+xml; 53 | 54 | server { 55 | listen 8080 default_server; 56 | server_name _; 57 | 58 | charset utf-8; 59 | index index.html index.php; 60 | client_max_body_size 10M; 61 | 62 | error_page 500 502 503 504 /50x.html; 63 | location = /50x.html { root /usr/share/nginx/html; } 64 | root /var/www/html; 65 | 66 | location = /favicon.ico { 67 | access_log off; 68 | log_not_found off; 69 | } 70 | 71 | absolute_redirect off; 72 | 73 | location ^~ { 74 | root /var/www/html; 75 | location ~ \.php$ { 76 | fastcgi_index index.php; 77 | fastcgi_pass unix:/tmp/php-fpm.sock; 78 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 79 | include /etc/nginx/fastcgi_params; 80 | } 81 | location ~* \.(jpg|jpeg|gif|css|png|js|map|woff|woff2|ttf|svg|eot)$ { 82 | expires 30d; 83 | access_log off; 84 | } 85 | 86 | location ~ /\.svn { 87 | deny all; 88 | } 89 | 90 | location ~ /\.ht { 91 | deny all; 92 | } 93 | } 94 | 95 | location ^~ /share { 96 | root /var/www/html; 97 | location ~ \.php$ { 98 | fastcgi_index index.php; 99 | fastcgi_pass unix:/tmp/php-fpm.sock; 100 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 101 | include /etc/nginx/fastcgi_params; 102 | } 103 | satisfy any; 104 | allow all; 105 | } 106 | 107 | location /RPC { 108 | include scgi_params; 109 | scgi_pass 127.0.0.1:5000; 110 | } 111 | 112 | location ^~ /conf/ { 113 | deny all; 114 | } 115 | 116 | location ^~ /share/ { 117 | deny all; 118 | } 119 | 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /rootfs/usr/local/bin/startup: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | ## Variables 5 | CSI="\033[" 6 | CEND="${CSI}0m" 7 | CRED="${CSI}1;31m" 8 | CGREEN="${CSI}1;32m" 9 | CYELLOW="${CSI}1;33m" 10 | CBLUE="${CSI}1;34m" 11 | 12 | 13 | ## Functions 14 | f_log() { 15 | LOG_TYPE=$1 16 | LOG_MESSAGE=$2 17 | 18 | case "${LOG_TYPE}" in 19 | "INF") 20 | echo -e "${CBLUE}=INF= $(date +%Y/%m/%d-%H:%M:%S) ${LOG_MESSAGE}${CEND}" 21 | ;; 22 | "SUC") 23 | echo -e "${CGREEN}=SUC= $(date +%Y/%m/%d-%H:%M:%S) ${LOG_MESSAGE}${CEND}" 24 | ;; 25 | "WRN") 26 | echo -e "${CYELLOW}=WRN= $(date +%Y/%m/%d-%H:%M:%S) ${LOG_MESSAGE}${CEND}" 27 | ;; 28 | "ERR") 29 | echo -e "${CRED}=ERR= $(date +%Y/%m/%d-%H:%M:%S) ${LOG_MESSAGE}${CEND}" 30 | ;; 31 | esac 32 | } 33 | 34 | ## Create user torrent 35 | f_log INF "Create user torrent ..." 36 | if [ "$(grep ':'${GID}':' /etc/group)" == "" ]; then 37 | addgroup -g ${GID} torrent 38 | GROUP_NAME=torrent 39 | else 40 | GROUP_NAME=$(grep ':'${GID}':' /etc/group | cut -d: -f1) 41 | fi 42 | if [ "$(grep ${UID} /etc/passwd)" == "" ]; then 43 | adduser -h /home/torrent -s /bin/sh -G ${GROUP_NAME} -D -u ${UID} torrent 44 | USER_NAME=torrent 45 | else 46 | USER_NAME=$(grep ${UID} /etc/passwd | cut -d: -f1) 47 | fi 48 | f_log SUC "Create user torrent done" 49 | 50 | ## Create require folder 51 | 52 | mkdir -p /data/torrents /data/.watch /data/.session /config/rtorrent /config/rutorrent /config/custom_plugins /config/custom_themes /home/torrent 53 | 54 | ## Generate configuration 55 | f_log INF "Generate configuration ..." 56 | if [ "$WEBROOT" != "/" ]; then 57 | sed -i 's||'${WEBROOT}'|g' /etc/nginx/nginx.conf 58 | sed -i 's||'${WEBROOT}'|g' /etc/nginx/nginx.conf 59 | sed -i 's|||g' /etc/nginx/nginx.conf 60 | if [ "$WEBROOT" != "/torrent" ]; then 61 | mv /var/www/html/torrent /var/www/html${WEBROOT} 62 | fi 63 | sed -i 's||'${WEBROOT}'/|g' /var/www/html${WEBROOT}/conf/config.php 64 | 65 | ## Externalize rutorrent configuration 66 | if [ -d /config/rutorrent/conf ]; then 67 | rm -rf /var/www/html${WEBROOT}/conf 68 | ln -s /config/rutorrent/conf /var/www/html${WEBROOT}/conf 69 | else 70 | mv /var/www/html${WEBROOT}/conf /config/rutorrent/ 71 | ln -s /config/rutorrent/conf /var/www/html${WEBROOT}/conf 72 | fi 73 | ## Externalize rutorrent share 74 | if [ -d /config/rutorrent/share ]; then 75 | rm -rf /var/www/html${WEBROOT}/share 76 | ln -s /config/rutorrent/share /var/www/html${WEBROOT}/share 77 | else 78 | mv /var/www/html${WEBROOT}/share /config/rutorrent/ 79 | ln -s /config/rutorrent/share /var/www/html${WEBROOT}/share 80 | fi 81 | ## Add custom plugins 82 | [ "$(ls /config/custom_plugins/)" ] && for custom_plugin in $(ls /config/custom_plugins); do 83 | if [ ! -d /var/www/html${WEBROOT}/plugins/${custom_plugin} ]; then 84 | ln -s /config/custom_plugins/${custom_plugin} /var/www/html${WEBROOT}/plugins/${custom_plugin} 85 | fi 86 | done 87 | ## Add custom themes 88 | [ "$(ls /config/custom_themes/)" ] && for custom_theme in $(ls /config/custom_themes); do 89 | if [ ! -d /var/www/html${WEBROOT}/plugins/theme/themes/${custom_theme} ]; then 90 | ln -s /config/custom_themes/${custom_theme} /var/www/html${WEBROOT}/plugins/theme/themes/${custom_theme} 91 | fi 92 | done 93 | else 94 | sed -i 's||/|g' /etc/nginx/nginx.conf 95 | sed -i 's|/|/|g' /etc/nginx/nginx.conf 96 | sed -i 's||/torrent|g' /etc/nginx/nginx.conf 97 | sed -i 's||/|g' /var/www/html/torrent/conf/config.php 98 | 99 | ## Externalize rutorrent configuration 100 | if [ -d /config/rutorrent/conf ]; then 101 | rm -rf /var/www/html/torrent/conf 102 | ln -s /config/rutorrent/conf /var/www/html/torrent/conf 103 | else 104 | mv /var/www/html/torrent/conf /config/rutorrent/ 105 | ln -s /config/rutorrent/conf /var/www/html/torrent/conf 106 | fi 107 | ## Externalize rutorrent share 108 | if [ -d /config/rutorrent/share ]; then 109 | rm -rf /var/www/html/torrent/share 110 | ln -s /config/rutorrent/share /var/www/html/torrent/share 111 | else 112 | mv /var/www/html/torrent/share /config/rutorrent/ 113 | ln -s /config/rutorrent/share /var/www/html/torrent/share 114 | fi 115 | ## Add custom plugins 116 | [ "$(ls /config/custom_plugins/)" ] && for custom_plugin in $(ls /config/custom_plugins); do 117 | if [ ! -d /var/www/html/torrent/plugins/${custom_plugin} ]; then 118 | ln -s /config/custom_plugins/${custom_plugin} /var/www/html/torrent/plugins/${custom_plugin} 119 | fi 120 | done 121 | ## Add custom themes 122 | [ "$(ls /config/custom_themes/)" ] && for custom_theme in $(ls /config/custom_themes); do 123 | if [ ! -d /var/www/html/torrent/theme/themes/${custom_theme} ]; then 124 | ln -s /config/custom_themes/${custom_theme} /var/www/html/torrent/theme/themes/${custom_theme} 125 | fi 126 | done 127 | fi 128 | 129 | 130 | sed -i -e 's||'$PORT_RTORRENT'|g' -e 's||'$DHT_RTORRENT'|g' -e 's||'$(curl https://ipecho.net/plain 2> /dev/null)'|' /home/torrent/.rtorrent.rc 131 | 132 | ## externalize rtorrent configuration 133 | if [ ! -e /config/rtorrent/.rtorrent.rc ]; then 134 | mv /home/torrent/.rtorrent.rc /config/rtorrent/.rtorrent.rc 135 | ln -s /config/rtorrent/.rtorrent.rc /home/torrent/.rtorrent.rc 136 | else 137 | rtorrent -h | head -1 | grep "0.9.7" 138 | if [ $? -eq 0 ]; then 139 | grep -E "system.method.set_key|use_udp_trackers|peer_exchange" /config/rtorrent/.rtorrent.rc > /dev/null 2>&1 140 | [ $? -eq 0 ] && mv /config/rtorrent/.rtorrent.rc /config/rtorrent/.rtorrent.rc.old \ 141 | && mv /home/torrent/.rtorrent.rc /config/rtorrent/.rtorrent.rc \ 142 | && f_log INF "Migrate to 0.9.7 configuration format, backup file in /config/rtorrent/.rtorrent.rc.old" 143 | grep "system.daemon.set" /config/rtorrent/.rtorrent.rc > /dev/null 2>&1 144 | [ $? -ne 0 ] && echo "system.daemon.set = true" >> /config/rtorrent/.rtorrent.rc 145 | ln -sf /config/rtorrent/.rtorrent.rc /home/torrent/.rtorrent.rc 146 | fi 147 | fi 148 | 149 | ## Filebot 150 | if [ -e /filebot ]; then 151 | mkdir -p /data/Media/Movies 152 | mkdir -p /data/Media/TV 153 | mkdir -p /data/Media/Animes 154 | mkdir -p /data/Media/Music 155 | chown -R ${USER_NAME}:${GROUP_NAME} /filebot 156 | 157 | grep -E "method.set_key.*event.download.finished" /home/torrent/.rtorrent.rc > /dev/null 2>&1 158 | [ $? -ne 0 ] && echo 'method.set_key = event.download.finished,filebot,"execute2={/usr/local/bin/postdl,$d.base_path=,$d.name=,$d.custom1=}"' >> /home/torrent/.rtorrent.rc 159 | 160 | grep -E "method.set_key.*event.download.erased" /home/torrent/.rtorrent.rc > /dev/null 2>&1 161 | [ $? -ne 0 ] && echo 'method.set_key = event.download.erased,filebot_cleaner,"execute2=/usr/local/bin/postrm"' >> /home/torrent/.rtorrent.rc 162 | 163 | sed -e 's##'"$FILEBOT_RENAME_MOVIES"'#' \ 164 | -e 's##'"$FILEBOT_RENAME_METHOD"'#' \ 165 | -e 's##'"$FILEBOT_RENAME_MUSICS"'#' \ 166 | -e 's##'"$FILEBOT_RENAME_SERIES"'#' \ 167 | -e 's##'"$FILEBOT_RENAME_ANIMES"'#' -i /usr/local/bin/postdl 168 | 169 | chmod +x /usr/local/bin/post* 170 | fi 171 | f_log SUC "Generate configuration done" 172 | 173 | f_log INF "Install plowshare ..." 174 | if [ -e /home/torrent/.config/plowshare ]; then 175 | su-exec ${USER_NAME}:${GROUP_NAME} plowmod --update > /dev/null 2>&1 176 | res=$? 177 | else 178 | su-exec ${USER_NAME}:${GROUP_NAME} plowmod --install > /dev/null 2>&1 179 | res=$? 180 | fi 181 | [[ $? == 0 ]]; f_log SUC "Install plowshare done" || (f_log ERR "Install plowshare failed" && exit 1) 182 | 183 | f_log INF "Apply system permissions ..." 184 | mkdir -p /run/nginx 185 | for folder in /var/www /home/torrent /var/lib/nginx /etc/php7 /etc/nginx /var/log /tmp /config /etc/s6.d; do 186 | find ${folder} ! -user torrent -exec chown ${USER_NAME}:${GROUP_NAME} {} \; 187 | done 188 | find /etc/s6.d -type f -exec chmod +x {} \; 189 | 190 | f_log SUC "Apply system permissions done" 191 | 192 | if [ "$DISABLE_PERM_DATA" == "false" ]; then 193 | f_log INF "Apply data permissions ..." 194 | find /data ! -user torrent -exec chown ${USER_NAME}:${GROUP_NAME} {} \; 195 | f_log SUC "Apply data permissions done" 196 | fi 197 | 198 | ## fix path initplugins (if already have .rtorrent.rc) 199 | grep -Eq " /nginx/" /home/torrent/.rtorrent.rc 200 | if [ $? -eq 0 ]; then 201 | f_log INF "Fix path initplugins on .rtorrent.rc ..." 202 | sed -i "s# /nginx/# /var/#g" /home/torrent/.rtorrent.rc 203 | f_log SUC "Fix path initplugins done" 204 | fi 205 | 206 | rm -f /data/.session/rtorrent.lock 207 | 208 | exec su-exec ${USER_NAME}:${GROUP_NAME} $@ 209 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.8 2 | 3 | ARG BUILD_CORES 4 | ARG MEDIAINFO_VER=0.7.99 5 | ARG RTORRENT_VER=v0.9.7 6 | ARG LIBTORRENT_VER=v0.13.7 7 | ARG LIBZEN_VER=0.4.31 8 | ARG GEOIP_VER=1.1.1 9 | 10 | ENV UID=991 \ 11 | GID=991 \ 12 | WEBROOT=/ \ 13 | PORT_RTORRENT=45000 \ 14 | DHT_RTORRENT=off \ 15 | DISABLE_PERM_DATA=false \ 16 | PKG_CONFIG_PATH=/usr/local/lib/pkgconfig 17 | 18 | LABEL Description="rutorrent based on alpine" \ 19 | tags="latest" \ 20 | maintainer="xataz " \ 21 | mediainfo_version="${MEDIAINFO_VER}" \ 22 | libtorrent_version="${LIBTORRENT_VER}" \ 23 | rtorrent_version="${RTORRENT_VER}" \ 24 | libzen_version="${LIBZEN_VER}" \ 25 | build_ver="201904081410" 26 | 27 | RUN export BUILD_DEPS="build-base \ 28 | libtool \ 29 | automake \ 30 | autoconf \ 31 | wget \ 32 | libressl-dev \ 33 | ncurses-dev \ 34 | curl-dev \ 35 | zlib-dev \ 36 | libnl3-dev \ 37 | libsigc++-dev \ 38 | linux-headers \ 39 | py-pip" \ 40 | ## Download Package 41 | && if [ "$RTORRENT_VER" == "0.9.6" ]; then CPPUNIT_VER="==1.13.2-r1"; fi \ 42 | && apk upgrade --no-cache \ 43 | && apk add -X http://dl-cdn.alpinelinux.org/alpine/v3.6/main --no-cache ${BUILD_DEPS} \ 44 | ffmpeg \ 45 | libnl3 \ 46 | ca-certificates \ 47 | gzip \ 48 | zip \ 49 | unrar \ 50 | curl \ 51 | c-ares \ 52 | s6 \ 53 | geoip \ 54 | geoip-dev \ 55 | su-exec \ 56 | nginx \ 57 | php7 \ 58 | php7-fpm \ 59 | php7-json \ 60 | php7-opcache \ 61 | php7-apcu \ 62 | php7-mbstring \ 63 | php7-ctype \ 64 | php7-pear \ 65 | php7-dev \ 66 | php7-sockets \ 67 | php7-phar \ 68 | libressl \ 69 | file \ 70 | findutils \ 71 | tar \ 72 | xz \ 73 | screen \ 74 | findutils \ 75 | bzip2 \ 76 | bash \ 77 | git \ 78 | sox \ 79 | python \ 80 | cppunit-dev${CPPUNIT_VER} \ 81 | cppunit${CPPUNIT_VER} \ 82 | ## Download Sources 83 | && git clone https://github.com/esmil/mktorrent /tmp/mktorrent \ 84 | && git clone https://github.com/mirror/xmlrpc-c.git /tmp/xmlrpc-c \ 85 | && git clone -b ${LIBTORRENT_VER} https://github.com/rakshasa/libtorrent.git /tmp/libtorrent \ 86 | && git clone -b ${RTORRENT_VER} https://github.com/rakshasa/rtorrent.git /tmp/rtorrent \ 87 | && wget http://mediaarea.net/download/binary/mediainfo/${MEDIAINFO_VER}/MediaInfo_CLI_${MEDIAINFO_VER}_GNU_FromSource.tar.gz -O /tmp/MediaInfo_CLI_${MEDIAINFO_VER}_GNU_FromSource.tar.gz \ 88 | && wget http://mediaarea.net/download/binary/libmediainfo0/${MEDIAINFO_VER}/MediaInfo_DLL_${MEDIAINFO_VER}_GNU_FromSource.tar.gz -O /tmp/MediaInfo_DLL_${MEDIAINFO_VER}_GNU_FromSource.tar.gz \ 89 | && wget http://downloads.sourceforge.net/zenlib/libzen_${LIBZEN_VER}.tar.gz -O /tmp/libzen_${LIBZEN_VER}.tar.gz \ 90 | && cd /tmp \ 91 | && tar xzf libzen_${LIBZEN_VER}.tar.gz \ 92 | && tar xzf MediaInfo_DLL_${MEDIAINFO_VER}_GNU_FromSource.tar.gz \ 93 | && tar xzf MediaInfo_CLI_${MEDIAINFO_VER}_GNU_FromSource.tar.gz \ 94 | ## Compile ZenLib 95 | && cd /tmp/ZenLib/Project/GNU/Library \ 96 | && ./autogen \ 97 | && ./configure --prefix=/usr/local \ 98 | --enable-shared \ 99 | --disable-static \ 100 | && make && make install \ 101 | ## Compile mktorrent 102 | && cd /tmp/mktorrent \ 103 | && make -j ${BUILD_CORES-$(grep -c "processor" /proc/cpuinfo)} \ 104 | && make install \ 105 | ## Compile Mediainfo 106 | && cd /tmp/MediaInfo_DLL_GNU_FromSource \ 107 | && ./SO_Compile.sh \ 108 | && cd /tmp/MediaInfo_DLL_GNU_FromSource/ZenLib/Project/GNU/Library \ 109 | && make install \ 110 | && cd /tmp/MediaInfo_DLL_GNU_FromSource/MediaInfoLib/Project/GNU/Library \ 111 | && make install \ 112 | && cd /tmp/MediaInfo_CLI_GNU_FromSource \ 113 | && ./CLI_Compile.sh \ 114 | && cd /tmp/MediaInfo_CLI_GNU_FromSource/MediaInfo/Project/GNU/CLI \ 115 | && make install \ 116 | ## Compile xmlrpc-c 117 | && cd /tmp/xmlrpc-c/stable \ 118 | && ./configure \ 119 | && make -j ${NB_CORES} \ 120 | && make install \ 121 | ## Compile libtorrent 122 | && cd /tmp/libtorrent \ 123 | && ./autogen.sh \ 124 | && ./configure \ 125 | --disable-debug \ 126 | --disable-instrumentation \ 127 | && make -j ${BUILD_CORES-$(grep -c "processor" /proc/cpuinfo)} \ 128 | && make install \ 129 | ## Compile rtorrent 130 | && cd /tmp/rtorrent \ 131 | && ./autogen.sh \ 132 | && ./configure \ 133 | --enable-ipv6 \ 134 | --disable-debug \ 135 | --with-xmlrpc-c \ 136 | && make -j ${BUILD_CORES-$(grep -c "processor" /proc/cpuinfo)} \ 137 | && make install \ 138 | ## Install Rutorrent 139 | && mkdir -p /var/www \ 140 | && git clone https://github.com/Novik/ruTorrent.git /var/www/html/rutorrent \ 141 | && git clone https://github.com/nelu/rutorrent-thirdparty-plugins /tmp/rutorrent-thirdparty-plugins \ 142 | && git clone https://github.com/mcrapet/plowshare /tmp/plowshare \ 143 | && git clone https://github.com/xombiemp/rutorrentMobile.git /var/www/html/rutorrent/plugins/mobile \ 144 | && git clone https://github.com/Phlooo/ruTorrent-MaterialDesign.git /var/www/html/rutorrent/plugins/theme/themes/materialdesign \ 145 | && git clone https://github.com/Micdu70/geoip2-rutorrent /var/www/html/rutorrent/plugins/geoip2 \ 146 | && rm -rf /var/www/html/rutorrent/plugins/geoip \ 147 | && sed -i "s/'mkdir'.*$/'mkdir',/" /tmp/rutorrent-thirdparty-plugins/filemanager/flm.class.php \ 148 | && sed -i 's#.*/usr/bin/rar.*##' /tmp/rutorrent-thirdparty-plugins/filemanager/conf.php \ 149 | && mv /tmp/rutorrent-thirdparty-plugins/* /var/www/html/rutorrent/plugins/ \ 150 | && mv /var/www/html/rutorrent /var/www/html/torrent \ 151 | ## Install plowshare 152 | && cd /tmp/plowshare \ 153 | && make \ 154 | ## Install geoip files 155 | && mkdir -p /usr/share/GeoIP \ 156 | && cd /usr/share/GeoIP \ 157 | && wget https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz \ 158 | && wget https://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz \ 159 | && tar xzf GeoLite2-City.tar.gz \ 160 | && tar xzf GeoLite2-Country.tar.gz \ 161 | && rm -f *.tar.gz \ 162 | && mv GeoLite2-*/*.mmdb . \ 163 | && cp *.mmdb /var/www/html/torrent/plugins/geoip2/database/ \ 164 | && pecl install geoip-${GEOIP_VER} \ 165 | && chmod +x /usr/lib/php7/modules/geoip.so \ 166 | ## Install cfscrape 167 | && pip install cfscrape \ 168 | ## cleanup 169 | && strip -s /usr/local/bin/rtorrent \ 170 | && strip -s /usr/local/bin/mktorrent \ 171 | && strip -s /usr/local/bin/mediainfo \ 172 | && apk del -X http://dl-cdn.alpinelinux.org/alpine/v3.6/main --no-cache ${BUILD_DEPS} cppunit-dev \ 173 | && rm -rf /tmp/* 174 | 175 | ARG WITH_FILEBOT=NO 176 | ARG FILEBOT_VER=4.7.9 177 | ARG CHROMAPRINT_VER=1.4.3 178 | 179 | ENV filebot_version="${FILEBOT_VER}" \ 180 | chromaprint_ver="${CHROMAPRINT_VER}" 181 | 182 | ENV FILEBOT_RENAME_METHOD="symlink" \ 183 | FILEBOT_RENAME_MOVIES="{n} ({y})" \ 184 | FILEBOT_RENAME_SERIES="{n}/Season {s.pad(2)}/{s00e00} - {t}" \ 185 | FILEBOT_RENAME_ANIMES="{n}/{e.pad(3)} - {t}" \ 186 | FILEBOT_RENAME_MUSICS="{n}/{fn}" \ 187 | FILEBOT_LANG="fr" \ 188 | FILEBOT_CONFLICT=skip 189 | 190 | RUN if [ "${WITH_FILEBOT}" == "YES" ]; then \ 191 | apk add --no-cache openjdk8-jre java-jna-native binutils wget nss \ 192 | && mkdir /filebot \ 193 | && cd /filebot \ 194 | && wget http://downloads.sourceforge.net/project/filebot/filebot/FileBot_${FILEBOT_VER}/FileBot_${FILEBOT_VER}-portable.tar.xz -O /filebot/filebot.tar.xz \ 195 | && tar xJf filebot.tar.xz \ 196 | && ln -sf /usr/local/lib/libzen.so.0.0.0 /filebot/lib/x86_64/libzen.so \ 197 | && ln -sf /usr/local/lib/libmediainfo.so.0.0.0 /filebot/lib/x86_64/libmediainfo.so \ 198 | && wget https://github.com/acoustid/chromaprint/releases/download/v${CHROMAPRINT_VER}/chromaprint-fpcalc-${CHROMAPRINT_VER}-linux-x86_64.tar.gz \ 199 | && tar xvf chromaprint-fpcalc-${CHROMAPRINT_VER}-linux-x86_64.tar.gz \ 200 | && mv chromaprint-fpcalc-${CHROMAPRINT_VER}-linux-x86_64/fpcalc /usr/local/bin \ 201 | && strip -s /usr/local/bin/fpcalc \ 202 | && apk del --no-cache binutils wget \ 203 | && rm -rf /tmp/* \ 204 | /filebot/FileBot_${FILEBOT_VER}-portable.tar.xz \ 205 | /filebot/chromaprint-fpcalc-${CHROMAPRINT_VER}-linux-x86_64.tar.gz\ 206 | /filebot/chromaprint-fpcalc-${CHROMAPRINT_VER}-linux-x86_64 \ 207 | ;fi 208 | 209 | COPY rootfs / 210 | VOLUME /data /config 211 | EXPOSE 8080 212 | RUN chmod +x /usr/local/bin/startup 213 | 214 | ENTRYPOINT ["/usr/local/bin/startup"] 215 | CMD ["/bin/s6-svscan", "/etc/s6.d"] 216 | --------------------------------------------------------------------------------