diff --git a/.env-example b/.env-example new file mode 100644 index 0000000..d68234a --- /dev/null +++ b/.env-example @@ -0,0 +1,12 @@ +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.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/.gitignore b/.gitignore new file mode 100644 index 0000000..4c49bd7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env diff --git a/Dockerfile b/Dockerfile old mode 100755 new mode 100644 index ed2d842..144d8b9 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,7 @@ +# syntax=docker/dockerfile:latest ARG BASEIMAGE_VERSION FROM lsiobase/alpine:$BASEIMAGE_VERSION -MAINTAINER romancin - # set version label ARG BUILD_DATE ARG VERSION @@ -10,12 +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 RTORRENT_VER="v0.9.8" +ARG LIBTORRENT_VER="v0.13.8" +ARG RUTORRENT_VER="master" ARG MAXMIND_LICENSE_KEY # set env @@ -28,209 +28,213 @@ 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 || 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 && \ +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 +./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 new file mode 100755 index 0000000..a700259 --- /dev/null +++ b/build.sh @@ -0,0 +1,24 @@ +#!/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_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 \ + --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 \ + --tag "$DOCKER_REPOSITORY:latest" \ + --tag "$DOCKER_REPOSITORY:$RUTORRENT_VER" \ + -f Dockerfile . 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/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=" diff --git a/root/defaults/rutorrent-conf/config.php b/root/defaults/rutorrent-conf/config.php index fd7d9a6..ee19c41 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,31 @@ $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 + $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", "localhost", ); @@ -61,6 +84,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 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/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 && \ 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 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