Skip to content

Commit

Permalink
Debug and log features
Browse files Browse the repository at this point in the history
  • Loading branch information
rgaudin committed Jan 14, 2025
1 parent 0587715 commit 209844c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
2 changes: 2 additions & 0 deletions bittorrent-seeder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ ENV QBT_MAX_CONNECTIONS=500
ENV QBT_MAX_CONNECTIONS_PER_TORRENT=100
ENV QBT_MAX_UPLOADS=20
ENV QBT_MAX_UPLOADS_PER_TORRENT=5
ENV QBT_MAX_ACTIVE_CHECKING_TORRENTS=1
ENV QBT_MODE=BG


COPY entrypoint.sh /usr/local/bin/entrypoint
Expand Down
19 changes: 10 additions & 9 deletions bittorrent-seeder/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

function start_qbt {
function configure_qbt {
echo "Starting a qbittorrent-nox process (set NO_DAEMON if you dont want to)"

QBT_HOST="${QBT_HOST:-localhost}"
Expand All @@ -12,6 +12,7 @@ function start_qbt {
QBT_MAX_CONNECTIONS_PER_TORRENT="${QBT_MAX_CONNECTIONS_PER_TORRENT:-100}"
QBT_MAX_UPLOADS="${QBT_MAX_UPLOADS:-20}"
QBT_MAX_UPLOADS_PER_TORRENT="${QBT_MAX_UPLOADS_PER_TORRENT:-5}"
QBT_MAX_ACTIVE_CHECKING_TORRENTS="${QBT_MAX_ACTIVE_CHECKING_TORRENTS:-1}"

if [ "x${QBT_PASSWORD}" = "x" ]; then
QBT_PASSWORD=$(gen-password)
Expand All @@ -34,6 +35,7 @@ Session\Port=${QBT_TORRENTING_PORT}
Session\Preallocation=true
Session\QueueingSystemEnabled=false
Session\SSL\Port=30154
Session\MaxActiveCheckingTorrents=${QBT_MAX_ACTIVE_CHECKING_TORRENTS}
[LegalNotice]
Accepted=true
Expand Down Expand Up @@ -61,7 +63,7 @@ FileLogger\Backup=true
FileLogger\DeleteOld=true
FileLogger\Enabled=true
FileLogger\MaxSizeBytes=1048576
FileLogger\Path=/var/log
FileLogger\Path=/data/log
GUI\Notifications\TorrentAdded=false
EOF
Expand All @@ -82,16 +84,15 @@ max_active_downloads = 2 # set max active downloads
EOF

mkdir -p ~/.config/qbt && touch ~/.config/qbt/.qbt.toml


# qbittorrent-nox --help
qbittorrent-nox --save-path=/data --daemon
rc=$?
echo "rc=${rc}"
}

if [ "x${NO_DAEMON}" = "x" ]; then
start_qbt
configure_qbt
if [ "${QBT_MODE}" = "FG" ]; then
exec qbittorrent-nox
else
qbittorrent-nox --daemon
fi
fi

exec "$@"
5 changes: 5 additions & 0 deletions bittorrent-seeder/seeder-start-restart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

CONTAINER_NAME="seeder" # name of docker container
IMAGE="ghcr.io/kiwix/bittorrent-seeder:latest" # docker image to use
QBT_MODE=BG # when not in NO_DAEMON, value is BG (default) or FG. if FG, qbt is the process and kiwix-seeder must be ran manually using exec commands

DATA_PATH=$(pwd)/kiwix-seeder # path to store ZIM files (and incomplete .!qB ones) in (there's no hierarchy)
MAX_STORAGE="10GiB" # maximum disk-space to use
Expand All @@ -23,6 +24,7 @@ QBT_MAX_CONNECTIONS=500
QBT_MAX_CONNECTIONS_PER_TORRENT=100
QBT_MAX_UPLOADS=20
QBT_MAX_UPLOADS_PER_TORRENT=5
QBT_MAX_ACTIVE_CHECKING_TORRENTS=1
# END OF CONFIG

if [ -f /etc/seeder.config ]; then
Expand All @@ -47,6 +49,7 @@ echo ">starting seeder container"
docker run \
--name $CONTAINER_NAME \
-v $DATA_PATH:/data \
-v $DATA_PATH/cache:/root/.config/kiwix-seeder \
-p $QBT_TORRENTING_PORT:$QBT_TORRENTING_PORT \
-p $QBT_TORRENTING_PORT:$QBT_TORRENTING_PORT/udp \
-p $WEBUI_PORT:80 \
Expand All @@ -57,6 +60,8 @@ docker run \
-e QBT_MAX_CONNECTIONS_PER_TORRENT=$QBT_MAX_CONNECTIONS_PER_TORRENT \
-e QBT_MAX_UPLOADS=$QBT_MAX_UPLOADS \
-e QBT_MAX_UPLOADS_PER_TORRENT=$QBT_MAX_UPLOADS_PER_TORRENT \
-e QBT_MAX_ACTIVE_CHECKING_TORRENTS=$QBT_MAX_ACTIVE_CHECKING_TORRENTS \
-e QBT_MODE=$QBT_MODE \
-e MAX_STORAGE=$MAX_STORAGE \
-e SLEEP_INTERVAL=$SLEEP_INTERVAL \
--restart unless-stopped \
Expand Down

0 comments on commit 209844c

Please sign in to comment.