From 050d9ce9db4263d28d2d6f6a7dabd8805b232649 Mon Sep 17 00:00:00 2001 From: Jolly-Pirate <4613678+Jolly-Pirate@users.noreply.github.com> Date: Sat, 18 Feb 2023 13:04:55 -0500 Subject: [PATCH 01/17] MAINTAINER (deprecated) MAINTAINER has been deprecated --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) mode change 100755 => 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile old mode 100755 new mode 100644 index ed2d842..aa63208 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,6 @@ ARG BASEIMAGE_VERSION FROM lsiobase/alpine:$BASEIMAGE_VERSION -MAINTAINER romancin - # set version label ARG BUILD_DATE ARG VERSION From 0034e4e8d23d9d3d54360fcb22e948a3f4b5e502 Mon Sep 17 00:00:00 2001 From: Jolly-Pirate <4613678+Jolly-Pirate@users.noreply.github.com> Date: Sat, 18 Feb 2023 13:46:48 -0500 Subject: [PATCH 02/17] RUTORRENT_VER Add RUTORRENT_VER argument for specific version. "--depth 1" only pulls the master branch, which can be behind on the most recent version. --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index aa63208..2479864 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,7 @@ ARG CURL_VER="7.88.0" ARG GEOIP_VER="1.1.1" ARG RTORRENT_VER ARG LIBTORRENT_VER +ARG RUTORRENT_VER ARG MAXMIND_LICENSE_KEY # set env @@ -110,8 +111,8 @@ ldconfig /usr/bin && ldconfig /usr/lib && \ mkdir -p \ /usr/share/webapps/rutorrent \ /defaults/rutorrent-conf && \ - git clone --depth 1 https://github.com/Novik/ruTorrent.git \ - /usr/share/webapps/rutorrent/ && \ +git clone https://github.com/Novik/ruTorrent.git \ + /usr/share/webapps/rutorrent/ && cd /usr/share/webapps/rutorrent && git checkout $RUTORRENT_VER && \ mv /usr/share/webapps/rutorrent/conf/* \ /defaults/rutorrent-conf/ && \ rm -rf \ @@ -122,7 +123,6 @@ ldconfig /usr/bin && ldconfig /usr/lib && \ # QuickBox Theme git clone --depth 1 https://github.com/QuickBox/club-QuickBox /usr/share/webapps/rutorrent/plugins/theme/themes/club-QuickBox && \ git clone --depth 1 https://github.com/Teal-c/rtModern-Remix.git /usr/share/webapps/rutorrent/plugins/theme/themes/rtModern-Remix && \ - # ruTorrent plugins cd /usr/share/webapps/rutorrent/plugins/ && \ git clone --depth 1 https://github.com/orobardet/rutorrent-force_save_session force_save_session && \ From f4bd821994d0d75df18a7f3ca173e6a809071c9a Mon Sep 17 00:00:00 2001 From: Jolly-Pirate <4613678+Jolly-Pirate@users.noreply.github.com> Date: Sat, 18 Feb 2023 13:52:17 -0500 Subject: [PATCH 03/17] build.sh and .env Build script with override variables stored in .env. This provides a more flexible setup without having to update Dockerfile with frequent versions. --- .env-example | 7 +++++++ .gitignore | 1 + build.sh | 25 +++++++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 .env-example create mode 100644 .gitignore create mode 100644 build.sh diff --git a/.env-example b/.env-example new file mode 100644 index 0000000..fa57662 --- /dev/null +++ b/.env-example @@ -0,0 +1,7 @@ +BASEIMAGE_VERSION="3.14" +MAXMIND_LICENSE_KEY="yourlicensekey" +MEDIAINF_VER="22.12" +CURL_VER="7.88.0" +RTORRENT_VER="v0.9.8" +LIBTORRENT_VER="v0.13.8" +RUTORRENT_VER="v4.0.1-hotfix" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c49bd7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..7bc03fc --- /dev/null +++ b/build.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +if [[ -f .env ]]; then + source .env +else + echo "Missing .env, copying example .env from template. Edit it before running build.sh again." + cp .env-example .env + exit +fi + +echo "Building ruTorrent $RUTORRENT_VER" +sleep 2 + +docker build --no-cache \ + --build-arg BASEIMAGE_VERSION=$BASEIMAGE_VERSION \ + --build-arg RTORRENT_VER=$RTORRENT_VER \ + --build-arg LIBTORRENT_VER=$LIBTORRENT_VER \ + --build-arg MEDIAINF_VER=$MEDIAINF_VER \ + --build-arg CURL_VER=$CURL_VER \ + --build-arg MAXMIND_LICENSE_KEY=$MAXMIND_LICENSE_KEY \ + --build-arg TARGETARCH=amd64 \ + --build-arg RUTORRENT_VER=$RUTORRENT_VER \ + --network=host \ + --tag "rutorrent:latest" \ + --tag "rutorrent:$RUTORRENT_VER" \ + -f Dockerfile . From 5dc635eb5eb9f8426523e51a8e93f6809e49e306 Mon Sep 17 00:00:00 2001 From: Jolly-Pirate <4613678+Jolly-Pirate@users.noreply.github.com> Date: Sat, 18 Feb 2023 14:37:33 -0500 Subject: [PATCH 04/17] switch to buildkit and heredocs BuildKit and heredocs reduce the clutter in Dockerfile in multiline RUN commands. https://www.docker.com/blog/introduction-to-heredocs-in-dockerfiles/ --- Dockerfile | 379 +++++++++++++++++++++++++++-------------------------- build.sh | 2 +- 2 files changed, 192 insertions(+), 189 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2479864..6f9dc0e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1.3-labs ARG BASEIMAGE_VERSION FROM lsiobase/alpine:$BASEIMAGE_VERSION @@ -27,208 +28,210 @@ ENV WAIT_NETWORK="no" ENV ENABLE_PYROSCOPE="no" # run commands -RUN NB_CORES=${BUILD_CORES-`getconf _NPROCESSORS_CONF`} && \ - apk add --no-cache \ - bash-completion \ - ca-certificates \ - fcgi \ - ffmpeg \ - geoip \ - geoip-dev \ - gzip \ - logrotate \ - nginx \ - dtach \ - tar \ - unrar \ - unzip \ - p7zip \ - sox \ - wget \ - irssi \ - irssi-perl \ - zlib \ - zlib-dev \ - libxml2-dev \ - perl-archive-zip \ - perl-net-ssleay \ - perl-digest-sha1 \ - git \ - libressl \ - binutils \ - findutils \ - zip \ - php7 \ - php7-cgi \ - php7-fpm \ - php7-json \ - php7-mbstring \ - php7-sockets \ - php7-pear \ - php7-opcache \ - php7-apcu \ - php7-ctype \ - php7-dev \ - php7-phar \ - php7-zip \ - php7-openssl \ - php7-bcmath \ - php7-session \ - php7-curl \ - python2 \ - python3 \ - py3-pip && \ +RUN <> /etc/php7/php.ini && \ +cd /usr/share/webapps/rutorrent/plugins/ +git clone --depth 1 https://github.com/orobardet/rutorrent-force_save_session force_save_session +git clone --depth 1 https://github.com/AceP1983/ruTorrent-plugins +mv ruTorrent-plugins/* . +rm -rf ruTorrent-plugins +apk add --no-cache cksfv +mkdir "filemanager" +curl https://codeload.github.com/nelu/rutorrent-filemanager/tar.gz/master | tar -xzf - --overwrite-dir --strip-components=1 -C "filemanager" +mkdir "filemanager-share" +curl https://codeload.github.com/nelu/rutorrent-filemanager-share/tar.gz/master | tar -xzf - --overwrite-dir --strip-components=1 -C "filemanager-share" +mkdir "filemanager-media" +curl https://codeload.github.com/nelu/rutorrent-filemanager-media/tar.gz/master | tar -xzf - --overwrite-dir --strip-components=1 -C "filemanager-media" +chmod 775 -R "/usr/share/webapps/rutorrent/plugins/" +cd /usr/share/webapps/rutorrent/ +cd /tmp +git clone --depth 1 https://github.com/mcrapet/plowshare.git +cd plowshare/ +make install +cd .. +rm -rf plowshare* +apk add --no-cache unzip bzip2 +cd /usr/share/webapps/rutorrent/plugins/ +git clone --depth 1 https://github.com/Gyran/rutorrent-pausewebui pausewebui +git clone --depth 1 https://github.com/Gyran/rutorrent-ratiocolor ratiocolor +sed -i 's/changeWhat = "cell-background";/changeWhat = "font";/g' /usr/share/webapps/rutorrent/plugins/ratiocolor/init.js +git clone --depth 1 https://github.com/Micdu70/rutorrent-instantsearch instantsearch +git clone --depth 1 https://github.com/xombiemp/rutorrentMobile mobile +rm -rf ipad +git clone --depth 1 https://github.com/Micdu70/rutorrent-addzip addzip +git clone https://github.com/stickz/rutorrent-discord +cd rutorrent-discord +git checkout ruTorrentFixes +cd .. +mv rutorrent-discord/* . +rm -rf rutorrent-discord +git clone --depth 1 https://github.com/Micdu70/geoip2-rutorrent geoip2 +rm -rf geoip +mkdir -p /usr/share/GeoIP +cd /usr/share/GeoIP +wget -O GeoLite2-City.tar.gz "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=$MAXMIND_LICENSE_KEY&suffix=tar.gz" +wget -O GeoLite2-Country.tar.gz "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=$MAXMIND_LICENSE_KEY&suffix=tar.gz" +tar xzf GeoLite2-City.tar.gz +tar xzf GeoLite2-Country.tar.gz +rm -f *.tar.gz +mv GeoLite2-*/*.mmdb . +cp *.mmdb /usr/share/webapps/rutorrent/plugins/geoip2/database/ +pecl install geoip-${GEOIP_VER} +chmod +x /usr/lib/php7/modules/geoip.so +echo ";extension=geoip.so" >>/etc/php7/php.ini + # install autodl-irssi perl modules - perl -MCPAN -e 'my $c = "CPAN::HandleConfig"; $c->load(doit => 1, autoconfig => 1); $c->edit(prerequisites_policy => "follow"); $c->edit(build_requires_install_policy => "yes"); $c->commit' && \ - curl -L http://cpanmin.us | perl - App::cpanminus && \ - cpanm HTML::Entities XML::LibXML JSON JSON::XS && \ +perl -MCPAN -e 'my $c = "CPAN::HandleConfig"; $c->load(doit => 1, autoconfig => 1); $c->edit(prerequisites_policy => "follow"); $c->edit(build_requires_install_policy => "yes"); $c->commit' +curl -L http://cpanmin.us | perl - App::cpanminus +cpanm HTML::Entities XML::LibXML JSON JSON::XS + # compile xmlrpc-c -cd /tmp && \ -git clone --depth 1 https://github.com/mirror/xmlrpc-c.git && \ -cd /tmp/xmlrpc-c/stable && \ -./configure --build=${TARGETARCH}-unknown-linux-gnu --with-libwww-ssl --disable-wininet-client --disable-curl-client --disable-libwww-client --disable-abyss-server --disable-cgi-server && make -j ${NB_CORES} && make install && \ +cd /tmp +git clone --depth 1 https://github.com/mirror/xmlrpc-c.git +cd /tmp/xmlrpc-c/stable +./configure --build=${TARGETARCH}-unknown-linux-gnu --with-libwww-ssl --disable-wininet-client --disable-curl-client --disable-libwww-client --disable-abyss-server --disable-cgi-server && make -j ${NB_CORES} && make install + # compile libtorrent -if [ "$RTORRENT_VER" == "v0.9.4" ] || [ "$RTORRENT_VER" == "v0.9.6" ]; then apk add -X http://dl-cdn.alpinelinux.org/alpine/v3.6/main -U cppunit-dev==1.13.2-r1 cppunit==1.13.2-r1; fi && \ -cd /tmp && \ -mkdir libtorrent && \ -cd libtorrent && \ -wget -qO- https://github.com/rakshasa/libtorrent/archive/${LIBTORRENT_VER}.tar.gz | tar xz --strip 1 && \ -./autogen.sh && ./configure && make -j ${NB_CORES} && make install && \ +if [ "$RTORRENT_VER" == "v0.9.4" ] || [ "$RTORRENT_VER" == "v0.9.6" ]; then apk add -X http://dl-cdn.alpinelinux.org/alpine/v3.6/main -U cppunit-dev==1.13.2-r1 cppunit==1.13.2-r1; fi +cd /tmp +mkdir libtorrent +cd libtorrent +wget -qO- https://github.com/rakshasa/libtorrent/archive/${LIBTORRENT_VER}.tar.gz | tar xz --strip 1 +./autogen.sh && ./configure && make -j ${NB_CORES} && make install + # compile rtorrent -cd /tmp && \ -mkdir rtorrent && \ -cd rtorrent && \ -wget -qO- https://github.com/rakshasa/rtorrent/archive/${RTORRENT_VER}.tar.gz | tar xz --strip 1 && \ -./autogen.sh && ./configure --with-xmlrpc-c && make -j ${NB_CORES} && make install && \ +cd /tmp +mkdir rtorrent +cd rtorrent +wget -qO- https://github.com/rakshasa/rtorrent/archive/${RTORRENT_VER}.tar.gz | tar xz --strip 1 +./autogen.sh && ./configure --with-xmlrpc-c && make -j ${NB_CORES} && make install + # compile mediainfo packages -curl -o \ -/tmp/libmediainfo.tar.gz -L \ - "http://mediaarea.net/download/binary/libmediainfo0/${MEDIAINF_VER}/MediaInfo_DLL_${MEDIAINF_VER}_GNU_FromSource.tar.gz" && \ -curl -o \ -/tmp/mediainfo.tar.gz -L \ - "http://mediaarea.net/download/binary/mediainfo/${MEDIAINF_VER}/MediaInfo_CLI_${MEDIAINF_VER}_GNU_FromSource.tar.gz" && \ -mkdir -p \ - /tmp/libmediainfo \ - /tmp/mediainfo && \ -tar xf /tmp/libmediainfo.tar.gz -C \ - /tmp/libmediainfo --strip-components=1 && \ -tar xf /tmp/mediainfo.tar.gz -C \ - /tmp/mediainfo --strip-components=1 && \ -cd /tmp/libmediainfo && \ - ./SO_Compile.sh && \ -cd /tmp/libmediainfo/ZenLib/Project/GNU/Library && \ - make install && \ -cd /tmp/libmediainfo/MediaInfoLib/Project/GNU/Library && \ - make install && \ -cd /tmp/mediainfo && \ - ./CLI_Compile.sh && \ -cd /tmp/mediainfo/MediaInfo/Project/GNU/CLI && \ - make install && \ +curl -o /tmp/libmediainfo.tar.gz -L "http://mediaarea.net/download/binary/libmediainfo0/${MEDIAINF_VER}/MediaInfo_DLL_${MEDIAINF_VER}_GNU_FromSource.tar.gz" +curl -o /tmp/mediainfo.tar.gz -L "http://mediaarea.net/download/binary/mediainfo/${MEDIAINF_VER}/MediaInfo_CLI_${MEDIAINF_VER}_GNU_FromSource.tar.gz" +mkdir -p /tmp/libmediainfo /tmp/mediainfo +tar xf /tmp/libmediainfo.tar.gz -C /tmp/libmediainfo --strip-components=1 +tar xf /tmp/mediainfo.tar.gz -C /tmp/mediainfo --strip-components=1 +cd /tmp/libmediainfo +./SO_Compile.sh +cd /tmp/libmediainfo/ZenLib/Project/GNU/Library +make install +cd /tmp/libmediainfo/MediaInfoLib/Project/GNU/Library +make install +cd /tmp/mediainfo +./CLI_Compile.sh +cd /tmp/mediainfo/MediaInfo/Project/GNU/CLI +make install + # compile and install rtelegram -GOPATH=/usr go get -u github.com/pyed/rtelegram && \ +GOPATH=/usr go get -u github.com/pyed/rtelegram + # create libressl link to openssl for old alpine images -if [ "$RTORRENT_VER" == "v0.9.4" ] || [ "$RTORRENT_VER" == "v0.9.6" ] || [ "$RTORRENT_VER" == "v0.9.7" ]; then ln -s /usr/bin/openssl /usr/bin/libressl; fi && \ +if [ "$RTORRENT_VER" == "v0.9.4" ] || [ "$RTORRENT_VER" == "v0.9.6" ] || [ "$RTORRENT_VER" == "v0.9.7" ]; then ln -s /usr/bin/openssl /usr/bin/libressl; fi + # cleanup -apk del --purge \ - build-dependencies && \ -if [ "$RTORRENT_VER" == "v0.9.4" ] || [ "$RTORRENT_VER" == "v0.9.6" ]; then apk del -X http://dl-cdn.alpinelinux.org/alpine/v3.6/main cppunit-dev; fi && \ -rm -rf \ - /tmp/* +apk del --purge build-dependencies +if [ "$RTORRENT_VER" == "v0.9.4" ] || [ "$RTORRENT_VER" == "v0.9.6" ]; then apk del -X http://dl-cdn.alpinelinux.org/alpine/v3.6/main cppunit-dev; fi +rm -rf /tmp/* +EOF # add local files COPY root/ / diff --git a/build.sh b/build.sh index 7bc03fc..154d1ad 100644 --- a/build.sh +++ b/build.sh @@ -10,7 +10,7 @@ fi echo "Building ruTorrent $RUTORRENT_VER" sleep 2 -docker build --no-cache \ +DOCKER_BUILDKIT=1 docker build --no-cache \ --build-arg BASEIMAGE_VERSION=$BASEIMAGE_VERSION \ --build-arg RTORRENT_VER=$RTORRENT_VER \ --build-arg LIBTORRENT_VER=$LIBTORRENT_VER \ From 3642010d31d94d4945d061bc41dd5176b16b24fe Mon Sep 17 00:00:00 2001 From: Jolly-Pirate <4613678+Jolly-Pirate@users.noreply.github.com> Date: Sat, 18 Feb 2023 15:31:59 -0500 Subject: [PATCH 05/17] environment variables defaults - Add DOCKER_REPOSITORY environment variable to the build.sh - Change buildkit version to latest - Edit environment variables defaults to Dockerfile --- .env-example | 1 + Dockerfile | 10 +++++----- build.sh | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.env-example b/.env-example index fa57662..010d515 100644 --- a/.env-example +++ b/.env-example @@ -5,3 +5,4 @@ CURL_VER="7.88.0" RTORRENT_VER="v0.9.8" LIBTORRENT_VER="v0.13.8" RUTORRENT_VER="v4.0.1-hotfix" +DOCKER_REPOSITORY="rutorrent/romancin" diff --git a/Dockerfile b/Dockerfile index 6f9dc0e..b73a457 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -# syntax=docker/dockerfile:1.3-labs +# syntax=docker/dockerfile:latest ARG BASEIMAGE_VERSION FROM lsiobase/alpine:$BASEIMAGE_VERSION @@ -9,13 +9,13 @@ ARG BUILD_CORES ARG TARGETARCH LABEL build_version="Romancin version:- ${VERSION} Build-date:- ${BUILD_DATE}" -# package version +# package version defaults, can be overridden in the .env file when using build.sh ARG MEDIAINF_VER="22.12" ARG CURL_VER="7.88.0" ARG GEOIP_VER="1.1.1" -ARG RTORRENT_VER -ARG LIBTORRENT_VER -ARG RUTORRENT_VER +ARG RTORRENT_VER="v0.9.8" +ARG LIBTORRENT_VER="v0.13.8" +ARG RUTORRENT_VER="master" ARG MAXMIND_LICENSE_KEY # set env diff --git a/build.sh b/build.sh index 154d1ad..493e338 100644 --- a/build.sh +++ b/build.sh @@ -20,6 +20,6 @@ DOCKER_BUILDKIT=1 docker build --no-cache \ --build-arg TARGETARCH=amd64 \ --build-arg RUTORRENT_VER=$RUTORRENT_VER \ --network=host \ - --tag "rutorrent:latest" \ - --tag "rutorrent:$RUTORRENT_VER" \ + --tag "$DOCKER_REPOSITORY:latest" \ + --tag "$DOCKER_REPOSITORY:$RUTORRENT_VER" \ -f Dockerfile . From 64ebd724972db142fc582787f5fb5c1818ac548f Mon Sep 17 00:00:00 2001 From: drakos <4613678+Jolly-Pirate@users.noreply.github.com> Date: Sun, 19 Feb 2023 01:23:16 -0500 Subject: [PATCH 06/17] fix executable flag --- build.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 build.sh diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 From 5265164346236e30d4d189baa20233b8584206d4 Mon Sep 17 00:00:00 2001 From: Jolly-Pirate <4613678+Jolly-Pirate@users.noreply.github.com> Date: Sun, 19 Feb 2023 02:34:40 -0500 Subject: [PATCH 07/17] fix dubious ownership errors --- root/etc/cont-init.d/30-getautodl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/root/etc/cont-init.d/30-getautodl b/root/etc/cont-init.d/30-getautodl index 19e5a73..ac91e5e 100644 --- a/root/etc/cont-init.d/30-getautodl +++ b/root/etc/cont-init.d/30-getautodl @@ -17,6 +17,16 @@ chown -R abc:abc /usr/share/webapps/rutorrent/plugins/autodl-irssi/) ln -s /config/.irssi/scripts/autodl-irssi.pl /config/.irssi/scripts/autorun/autodl-irssi.pl && \ chown -R abc:abc /config/.irssi ) +# fix dubious ownership errors when running the container +#fatal: detected dubious ownership in repository at '/usr/share/webapps/rutorrent/plugins/autodl-irssi' +#To add an exception for this directory, call: +# git config --global --add safe.directory /usr/share/webapps/rutorrent/plugins/autodl-irssi +#fatal: detected dubious ownership in repository at '/config/.irssi/scripts' +#To add an exception for this directory, call: +# git config --global --add safe.directory /config/.irssi/scripts +git config --global --add safe.directory /usr/share/webapps/rutorrent/plugins/autodl-irssi +git config --global --add safe.directory /config/.irssi/scripts + # get updated trackers for irssi-autodl wget --quiet -O /tmp/trackers.zip https://github.com/autodl-community/autodl-trackers/archive/master.zip && \ [[ ! -d /config/.irssi/scripts/AutodlIrssi/trackers ]] && mkdir -p /config/.irssi/scripts/AutodlIrssi/trackers && \ From b2894015fc97209345e141b76127fe6867c670a9 Mon Sep 17 00:00:00 2001 From: Jolly-Pirate <4613678+Jolly-Pirate@users.noreply.github.com> Date: Mon, 20 Feb 2023 01:20:54 -0500 Subject: [PATCH 08/17] Fix ssl in nginx The default SSL_ENABLED is off when running the container. However, when choosing to enable it with SSL_ENABLED="yes" after it was ran with no ssl, the ssl didn't work. This fix allows toggling between non-ssl and ssl when stopping/removing and restarting the container. Also, I deleted the redundant nginx_ssl.conf file, since the only difference with nginx.conf was the listening port; I enabled toggling the listening port with a sed command. --- root/defaults/nginx_ssl.conf | 144 --------------------------------- root/etc/cont-init.d/20-config | 16 ++-- root/etc/cont-init.d/40-ssl | 3 +- 3 files changed, 11 insertions(+), 152 deletions(-) delete mode 100644 root/defaults/nginx_ssl.conf diff --git a/root/defaults/nginx_ssl.conf b/root/defaults/nginx_ssl.conf deleted file mode 100644 index 7f7b021..0000000 --- a/root/defaults/nginx_ssl.conf +++ /dev/null @@ -1,144 +0,0 @@ -user abc; -worker_processes 1; -pid /run/nginx.pid; - -events { - worker_connections 768; - # multi_accept on; -} - -http { -upstream backendrutorrent { - server unix:/run/php/php-fpm-rutorrent.sock; -} -upstream backendrtorrent { - server unix:/run/php/.rtorrent.sock; -} - - ## - # Basic Settings - ## - - sendfile on; - tcp_nopush on; - tcp_nodelay on; - keepalive_timeout 65; - types_hash_max_size 2048; - # server_tokens off; - - # server_names_hash_bucket_size 64; - # server_name_in_redirect off; - - client_max_body_size 0; - client_body_temp_path /tmp 1 2; - - include /etc/nginx/mime.types; - include /config/nginx/conf.d/*.conf; - default_type application/octet-stream; - -server { - listen 443 ssl default_server; - root /var/www/localhost/rutorrent; - index index.html index.htm index.php; - - server_name _; - client_max_body_size 0; - - auth_basic "Restricted Content"; - auth_basic_user_file /config/nginx/.htpasswd; - - location / { - access_log /config/log/nginx/rutorrent.access.log; - error_log /config/log/nginx/rutorrent.error.log; - location ~ .php$ { - fastcgi_split_path_info ^(.+\.php)(.*)$; - fastcgi_pass backendrutorrent; - fastcgi_index index.php; - fastcgi_intercept_errors on; - fastcgi_ignore_client_abort off; - fastcgi_connect_timeout 60; - fastcgi_send_timeout 180; - fastcgi_read_timeout 180; - fastcgi_buffer_size 128k; - fastcgi_buffers 4 256k; - fastcgi_busy_buffers_size 256k; - fastcgi_temp_file_write_size 256k; - include /etc/nginx/fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - } -} - - location /RPC2 { - access_log /config/log/nginx/rutorrent.rpc2.access.log; - error_log /config/log/nginx/rutorrent.rpc2.error.log; - include /etc/nginx/scgi_params; - scgi_pass backendrtorrent; -} -} - ## - # Logging Settings - ## - - # access_log /config/log/nginx/access.log; - # error_log /config/log/nginx/error.log; - - ## - # Gzip Settings - ## - - gzip on; - gzip_disable "msie6"; - - # gzip_vary on; - # gzip_proxied any; - # gzip_comp_level 6; - # gzip_buffers 16 8k; - # gzip_http_version 1.1; - # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; - - ## - # nginx-naxsi config - ## - # Uncomment it if you installed nginx-naxsi - ## - - #include /etc/nginx/naxsi_core.rules; - - ## - # nginx-passenger config - ## - # Uncomment it if you installed nginx-passenger - ## - - #passenger_root /usr; - #passenger_ruby /usr/bin/ruby; - - ## - # Virtual Host Configs - ## - # include /etc/nginx/conf.d/*.conf; - # include /defaults/site-confs/*; -} - - -#mail { -# # See sample authentication script at: -# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript -# -# # auth_http localhost/auth.php; -# # pop3_capabilities "TOP" "USER"; -# # imap_capabilities "IMAP4rev1" "UIDPLUS"; -# -# server { -# listen localhost:110; -# protocol pop3; -# proxy on; -# } -# -# server { -# listen localhost:143; -# protocol imap; -# proxy on; -# } -#} -daemon off; diff --git a/root/etc/cont-init.d/20-config b/root/etc/cont-init.d/20-config index 17d9134..96361e9 100644 --- a/root/etc/cont-init.d/20-config +++ b/root/etc/cont-init.d/20-config @@ -40,13 +40,15 @@ cd /defaults/rutorrent-conf || exit cd "${PREV_DIR}" || exit -[[ ! -e /config/nginx/nginx.conf ]] && \ - if [ "$SSL_ENABLED" == "yes" ] - then - cp /defaults/nginx_ssl.conf /config/nginx/nginx.conf - else - cp /defaults/nginx.conf /config/nginx/nginx.conf - fi +[[ ! -e /config/nginx/nginx.conf ]] && cp /defaults/nginx.conf /config/nginx/nginx.conf + +if [ "$SSL_ENABLED" == "yes" ] +then + sed -i 's/listen 80/listen 443 ssl/g' /config/nginx/nginx.conf +else + sed -i 's/listen 443 ssl/listen 80/g' /config/nginx/nginx.conf +fi + [[ ! -e /config/nginx/.htpasswd ]] && \ cp /defaults/.htpasswd /config/nginx/.htpasswd diff --git a/root/etc/cont-init.d/40-ssl b/root/etc/cont-init.d/40-ssl index ca30d9a..34f04bf 100644 --- a/root/etc/cont-init.d/40-ssl +++ b/root/etc/cont-init.d/40-ssl @@ -31,7 +31,7 @@ then -subj "/C=XX/ST=XXXX/L=XXXX/O=XXXX/CN=localhost" \ -keyout "/config/nginx/key.pem" \ -out "/config/nginx/cert.pem" \ - -days 825 -nodes -sha256 + -days 1825 -nodes -sha256 # 5 year certificate fi if [ ! -e "/config/nginx/conf.d/basic.conf" ] || [ ! -e "/config/nginx/conf.d/ssl.conf" ] @@ -39,5 +39,6 @@ then cp /defaults/conf.d/* /config/nginx/conf.d/ fi else + rm -f /config/nginx/conf.d/*.conf exit 0 fi From 97c296b11c1170e0caeae2d0d7edad889b89eeed Mon Sep 17 00:00:00 2001 From: Jolly-Pirate <4613678+Jolly-Pirate@users.noreply.github.com> Date: Tue, 21 Feb 2023 09:16:50 -0500 Subject: [PATCH 09/17] update default config.php Adapted from the latest ruTorrent v4.0.2 config.php --- .env-example | 2 +- root/defaults/rutorrent-conf/config.php | 51 +++++++++++++++++-------- 2 files changed, 36 insertions(+), 17 deletions(-) diff --git a/.env-example b/.env-example index 010d515..b2f5e7e 100644 --- a/.env-example +++ b/.env-example @@ -4,5 +4,5 @@ MEDIAINF_VER="22.12" CURL_VER="7.88.0" RTORRENT_VER="v0.9.8" LIBTORRENT_VER="v0.13.8" -RUTORRENT_VER="v4.0.1-hotfix" +RUTORRENT_VER="v4.0.2" DOCKER_REPOSITORY="rutorrent/romancin" diff --git a/root/defaults/rutorrent-conf/config.php b/root/defaults/rutorrent-conf/config.php index fd7d9a6..c42f2ff 100644 --- a/root/defaults/rutorrent-conf/config.php +++ b/root/defaults/rutorrent-conf/config.php @@ -2,27 +2,36 @@ // configuration parameters // for snoopy client - @define('HTTP_USER_AGENT', 'Mozilla/5.0 (Windows NT 6.0; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0', true); - @define('HTTP_TIME_OUT', 30, true); // in seconds - @define('HTTP_USE_GZIP', true, true); + $httpUserAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36'; + $httpTimeOut = 30; // in seconds + $httpUseGzip = true; $httpIP = null; // IP string. Or null for any. + $httpProxy = array + ( + 'use' => false, + 'proto' => 'http', // 'http' or 'https' + 'host' => 'PROXY_HOST_HERE', + 'port' => 3128 + ); - @define('RPC_TIME_OUT', 5, true); // in seconds - - @define('LOG_RPC_CALLS', false, true); - @define('LOG_RPC_FAULTS', true, true); + // for xmlrpc actions + $rpcTimeOut = 5; // in seconds + $rpcLogCalls = false; + $rpcLogFaults = true; // for php - @define('PHP_USE_GZIP', false, true); - @define('PHP_GZIP_LEVEL', 2, true); + $phpUseGzip = false; + $phpGzipLevel = 2; $schedule_rand = 10; // rand for schedulers start, +0..X seconds - $do_diagnostic = true; + $do_diagnostic = true; // Diagnose ruTorrent. Recommended to keep enabled, unless otherwise required. + $al_diagnostic = true; // Diagnose auto-loader. Set to "false" to make composer plugins work. + $log_file = '/config/log/rutorrent/rutorrent.log'; // path to log file (comment or leave blank to disable logging) $saveUploadedTorrents = true; // Save uploaded torrents to profile/torrents directory or not - $overwriteUploadedTorrents = false; // Overwrite existing uploaded torrents in profile/torrents directory or make unique name + $overwriteUploadedTorrents = false; // Overwrite existing uploaded torrents in profile/torrents directory or make unique name $topDirectory = '/downloads'; // Upper available directory. Absolute path with trail slash. $forbidUserSettings = false; @@ -39,17 +48,23 @@ $XMLRPCMountPoint = "/RPC2"; // DO NOT DELETE THIS LINE!!! DO NOT COMMENT THIS LINE!!! + $throttleMaxSpeed = 327625*1024; // DO NOT EDIT THIS LINE!!! DO NOT COMMENT THIS LINE!!! + // Can't be greater then 327625*1024 due to limitation in libtorrent ResourceManager::set_max_upload_unchoked function. + $pathToExternals = array( - "php" => '/usr/bin/php7', // Something like /usr/bin/php. If empty, will be found in PATH. + "php" => '/usr/bin/php7', // Something like /usr/bin/php. If empty, will be found in PATH. "curl" => '/usr/local/bin/curl', // Something like /usr/bin/curl. If empty, will be found in PATH. "gzip" => '/usr/bin/gzip', // Something like /usr/bin/gzip. If empty, will be found in PATH. "id" => '/usr/bin/id', // Something like /usr/bin/id. If empty, will be found in PATH. "stat" => '/bin/stat', // Something like /usr/bin/stat. If empty, will be found in PATH. - "pgrep" => '/usr/bin/pgrep', - "python" => '/usr/bin/python3', + "pgrep" => '/usr/bin/pgrep', + "python" => '/usr/bin/python3', ); - $localhosts = array( // list of local interfaces + $localHostedMode = true; // Set to true if rTorrent is hosted on the SAME machine as ruTorrent + $cachedPluginLoading = true; // Set to true to enable rapid cached loading of ruTorrent plugins + + $localhosts = array( // list of local interfaces "127.0.0.1", "localhost", ); @@ -61,6 +76,10 @@ $tempDirectory = '/config/rutorrent/profiles/tmp/'; // Temp directory. Absolute path with trail slash. If null, then autodetect will be used. - $canUseXSendFile = true; // Use X-Sendfile feature if it exist + $canUseXSendFile = false; // If true then use X-Sendfile feature if it exist $locale = "UTF8"; + + $enableCSRFCheck = false; // If true then Origin and Referer will be checked + $enabledOrigins = array(); // List of enabled domains for CSRF check (only hostnames, without protocols, port etc.). + // If empty, then will retrieve domain from HTTP_HOST / HTTP_X_FORWARDED_HOST From f62410728be55a44f8f0a480b0136c028482bc69 Mon Sep 17 00:00:00 2001 From: Jolly-Pirate <4613678+Jolly-Pirate@users.noreply.github.com> Date: Wed, 22 Feb 2023 23:38:16 -0500 Subject: [PATCH 10/17] fix tail logging logging fix for: tail: cannot open '' for reading: No such file or directory I think you forgot to add the --pid switch, which stops tailing when the process dies. Also, get the pid with pidof command, it's much simpler. --- root/etc/services.d/rutorrent/run | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/root/etc/services.d/rutorrent/run b/root/etc/services.d/rutorrent/run index fd01dfb..fc06e42 100644 --- a/root/etc/services.d/rutorrent/run +++ b/root/etc/services.d/rutorrent/run @@ -14,5 +14,6 @@ do sleep 1s done -rtorrent_pid=$(< /config/rtorrent/rtorrent_sess/rtorrent.lock | cut -d '+' -f 2) -tail -n 1 -f /config/log/rtorrent/rtorrent.log "$rtorrent_pid" +rtorrent_pid=$(pidof rtorrent) +echo "rtorrent running with pid $rtorrent_pid" +tail -f /config/log/rtorrent/rtorrent.log --pid=$rtorrent_pid From cdc70ea4b0d72d7b2fa3289dbd0df12144ffa147 Mon Sep 17 00:00:00 2001 From: Jolly-Pirate <4613678+Jolly-Pirate@users.noreply.github.com> Date: Thu, 23 Feb 2023 03:10:37 -0500 Subject: [PATCH 11/17] remove network=host network=host doesn't do anything when building, only when running a container --- build.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/build.sh b/build.sh index 493e338..56c2da2 100755 --- a/build.sh +++ b/build.sh @@ -19,7 +19,6 @@ DOCKER_BUILDKIT=1 docker build --no-cache \ --build-arg MAXMIND_LICENSE_KEY=$MAXMIND_LICENSE_KEY \ --build-arg TARGETARCH=amd64 \ --build-arg RUTORRENT_VER=$RUTORRENT_VER \ - --network=host \ --tag "$DOCKER_REPOSITORY:latest" \ --tag "$DOCKER_REPOSITORY:$RUTORRENT_VER" \ -f Dockerfile . From c013fba3a61b7a9ded4d5a13d2594ac33686f622 Mon Sep 17 00:00:00 2001 From: Jolly-Pirate <4613678+Jolly-Pirate@users.noreply.github.com> Date: Tue, 28 Feb 2023 17:23:13 -0500 Subject: [PATCH 12/17] session_save Save the session every 12 hours instead of the default 20 minutes. This 300 sec setting is too fast and will thrash the disks. https://github.com/rakshasa/rtorrent/wiki/Performance-Tuning#session-save https://github.com/rakshasa/rtorrent/issues/180#issuecomment-55140832 --- root/defaults/rtorrent.rc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/root/defaults/rtorrent.rc b/root/defaults/rtorrent.rc index 2fd3dcc..6bfb3d7 100644 --- a/root/defaults/rtorrent.rc +++ b/root/defaults/rtorrent.rc @@ -172,8 +172,8 @@ schedule2 = monitor_diskspace, 15, 60, ((close_low_diskspace,1000M)) #method.insert = d.move_to_complete, simple, "d.directory.set=$argument.1=; execute=mkdir,-p,$argument.1=; execute=mv,-u,$argument.0=,$argument.1=; d.save_full_session=" #method.set_key = event.download.finished,move_complete,"d.move_to_complete=$d.data_path=,$d.custom1=" -# Commit session data -schedule2 = session_save, 240, 300, ((session.save)) +# Save the session every 12 hours instead of the default 20 minutes. +schedule2 = session_save, 1200, 43200, ((session.save)) # Erase data when torrent deleted (no need erasedata plugin on ruTorrent) #method.set_key = event.download.erased,delete_erased,"execute=rm,-rf,--,$d.data_path=" From 8060c15a274f8d1f1b090655cb05b2095de9536e Mon Sep 17 00:00:00 2001 From: Jolly-Pirate <4613678+Jolly-Pirate@users.noreply.github.com> Date: Thu, 2 Mar 2023 11:09:26 -0500 Subject: [PATCH 13/17] install nano --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index b73a457..4575f38 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,6 +44,7 @@ apk add --no-cache \ tar \ unrar \ unzip \ + nano \ p7zip \ sox \ wget \ From 94d1b632bc38a5b6af950c055a94e957e88b4bd5 Mon Sep 17 00:00:00 2001 From: Jolly-Pirate <4613678+Jolly-Pirate@users.noreply.github.com> Date: Thu, 16 Mar 2023 18:44:00 -0400 Subject: [PATCH 14/17] remove extra libtool --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4575f38..369d5a3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -95,7 +95,6 @@ apk add --no-cache --virtual=build-dependencies \ make \ ncurses-dev \ build-base \ - libtool \ subversion \ linux-headers \ curl-dev \ From af721bca060e606a01941194587edb8bdb3a5514 Mon Sep 17 00:00:00 2001 From: Jolly-Pirate <4613678+Jolly-Pirate@users.noreply.github.com> Date: Sat, 25 Mar 2023 21:56:03 -0400 Subject: [PATCH 15/17] fix for building master branches rtorrent and libtorrent master branches removed autogen.sh. We need to use autoreconf before running ./configure. Also, the package autoconf-archive is needed to avoid errors during the autoreconfg step. --- Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 369d5a3..a409be2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -85,6 +85,7 @@ apk add --no-cache \ # install build packages apk add --no-cache --virtual=build-dependencies \ autoconf \ + autoconf-archive \ automake \ cppunit-dev \ perl-dev \ @@ -195,14 +196,16 @@ cd /tmp mkdir libtorrent cd libtorrent wget -qO- https://github.com/rakshasa/libtorrent/archive/${LIBTORRENT_VER}.tar.gz | tar xz --strip 1 -./autogen.sh && ./configure && make -j ${NB_CORES} && make install +./autogen.sh || autoreconf -vfi +./configure && make -j ${NB_CORES} && make install # compile rtorrent cd /tmp mkdir rtorrent cd rtorrent wget -qO- https://github.com/rakshasa/rtorrent/archive/${RTORRENT_VER}.tar.gz | tar xz --strip 1 -./autogen.sh && ./configure --with-xmlrpc-c && make -j ${NB_CORES} && make install +./autogen.sh || autoreconf -vfi +./configure --with-xmlrpc-c && make -j ${NB_CORES} && make install # compile mediainfo packages curl -o /tmp/libmediainfo.tar.gz -L "http://mediaarea.net/download/binary/libmediainfo0/${MEDIAINF_VER}/MediaInfo_DLL_${MEDIAINF_VER}_GNU_FromSource.tar.gz" From 4cf9aab320b2d5679e7f93db80012b1b07b4bf91 Mon Sep 17 00:00:00 2001 From: Jolly-Pirate <4613678+Jolly-Pirate@users.noreply.github.com> Date: Mon, 3 Apr 2023 13:38:22 -0400 Subject: [PATCH 16/17] add BUILDKIT_PROGRESS setting for docker build --- .env-example | 4 ++++ Dockerfile | 2 +- build.sh | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.env-example b/.env-example index b2f5e7e..d68234a 100644 --- a/.env-example +++ b/.env-example @@ -6,3 +6,7 @@ RTORRENT_VER="v0.9.8" LIBTORRENT_VER="v0.13.8" RUTORRENT_VER="v4.0.2" DOCKER_REPOSITORY="rutorrent/romancin" + +# Set type of progress output (auto, plain, tty). +# Use plain to show container output (default "auto"). +BUILDKIT_PROGRESS=auto diff --git a/Dockerfile b/Dockerfile index a409be2..144d8b9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -204,7 +204,7 @@ cd /tmp mkdir rtorrent cd rtorrent wget -qO- https://github.com/rakshasa/rtorrent/archive/${RTORRENT_VER}.tar.gz | tar xz --strip 1 -./autogen.sh || autoreconf -vfi +./autogen.sh || autoreconf -vfi ./configure --with-xmlrpc-c && make -j ${NB_CORES} && make install # compile mediainfo packages diff --git a/build.sh b/build.sh index 56c2da2..a700259 100755 --- a/build.sh +++ b/build.sh @@ -10,7 +10,7 @@ fi echo "Building ruTorrent $RUTORRENT_VER" sleep 2 -DOCKER_BUILDKIT=1 docker build --no-cache \ +DOCKER_BUILDKIT=1 BUILDKIT_PROGRESS=$BUILDKIT_PROGRESS docker build --no-cache \ --build-arg BASEIMAGE_VERSION=$BASEIMAGE_VERSION \ --build-arg RTORRENT_VER=$RTORRENT_VER \ --build-arg LIBTORRENT_VER=$LIBTORRENT_VER \ From 224c9203fafdf1cbb83b0f13fc2ea6322bf216e1 Mon Sep 17 00:00:00 2001 From: Jolly-Pirate <4613678+Jolly-Pirate@users.noreply.github.com> Date: Tue, 18 Apr 2023 17:35:39 -0400 Subject: [PATCH 17/17] improved rutorrent performance --- root/defaults/rutorrent-conf/config.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/root/defaults/rutorrent-conf/config.php b/root/defaults/rutorrent-conf/config.php index c42f2ff..ee19c41 100644 --- a/root/defaults/rutorrent-conf/config.php +++ b/root/defaults/rutorrent-conf/config.php @@ -62,7 +62,15 @@ ); $localHostedMode = true; // Set to true if rTorrent is hosted on the SAME machine as ruTorrent - $cachedPluginLoading = true; // Set to true to enable rapid cached loading of ruTorrent plugins + + $cachedPluginLoading = true; // Set to true to enable rapid cached loading of ruTorrent plugins + $pluginJSCacheExpire = 3*60; // Sets duration ruTorrent plugin javascript cache is valid for in minutes + // Default is 3 hours which equals 3 hours * 60 minutes due to caching issues + // Optionally raise this value and clear web browser cache when upgrading versions + + $miscCacheExpire = 3*60*24; // Sets duration ruTorrent miscellaneous web browser cache is valid for in minutes + // The goal here to avoid keeping stale content in the web browser + // Default is 3 days which equals 3 days * 60 minutes * 24 hours $localhosts = array( // list of local interfaces "127.0.0.1",