.. _bnbt_service:
Bittorrent tracker (bnbt)
=========================
.. sectionauthor:: Christian Lohmaier
Bittorrent is provided by two components - one is the tracker that brings peers
together and the bittorent client that actually provides the files to other
peers.
At TDF we're using a custom build of the bnbt tracker software, and a stock
version of rtorrent. This part describes the tracker, bnbt.
Requirements
------------
1) Open Port - 6969/tcp
Installation
------------
* As the tracker is using a customized version of bnbt (the user-management stuff removed), you need to compile the source if you want to install from scratch. This needs a c compiler
.. todo:: upload the tracker's sourcecode to some resonable place
1) Checkout the source
2) cd ; make
* Create working directory for the tracker::
sudo mkdir -p /srv/tracker
sudo mkdir /srv/tracker/{allowed_torrents,archived_torrents,cbtt,torrents_sync}
* Copy bnbt binary::
sudo cp /bnbt /srv/tracker/cbtt/
* Create configuration file::
sudo echo > /srv/tracker/cbtt/bnbt.cfg < /srv/tracker/cbtt/header.html <Welcome to the BitTorrent tracker hosted at The Document Foundation
If you're looking for regular (non-bittorrent like http/ftp) downloads, you should visit http://www.documentfoundation.org/download/ instead.
In case your download doesn't start despite the main seed being available: make sure that the IP (178.63.91.70) is not blocked by your client
EOF
echo > /srv/tracker/cbtt/footer.html <Contribute by sharing your bandwidth - don't close the download immediately
EOF
* Change ownership to the user under which ID the tracker should be running::
sudo chown -R cloph: /srv/tracker/*
* Create the init script to have it launch at boot::
sudo echo > /etc/init.d/tracker <&1" ${user} | tee -a "$logfile" >&2
su -c "screen -S "${srnname}" -X screen ./bnbt" ${user} | tee -a "$logfile" >&2
}
d_stop() {
if pgrep -u ${user} -x bnbt >/dev/null ; then
pkill -u ${user} -x bnbt
else
echo -n " - not running"
fi
}
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
d_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
d_stop
echo "."
;;
restart|force-reload)
echo -n "Restarting $DESC: $NAME"
d_stop
sleep 1
d_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
EOF
sudo chmod +x /etc/init.d/rtorrent
* Enable the initscript::
sudo update-rc.d tracker defaults
* Add hooks to the :file:`/usr/local/bin/stage2pub` script to add the torrents to the tracker::
# Torrent section - if anyone goes wrong here, blame cloph
echo "downloading torrents from mirrorbrain"
rm -f /srv/tracker/torrents_sync/*.torrent*
su - cloph -c "cd /srv/active/pub && find libreoffice -type f -not -name \*md5 -not -name \*asc -not -name \*log -print0 | xargs -r -0 -I{path} wget -q --directory-prefix=/srv/tracker/torrents_sync http://download.documentfoundation.org/{path}.torrent"
echo "updating torrents for the tracker"
su - cloph -c "rsync -br --backup-dir=/srv/tracker/archived_torrents --delete --include=\*torrent /srv/tracker/torrents_sync/ /srv/tracker/allowed_torrents"
su - cloph -c "cd /srv/tracker/allowed_torrents && cp -a /srv/rtorrent/watch_images/*.torrent ." # consider box torrents as well
Start
-----
::
sudo /etc/init.d/tracker start
Stop
----
::
sudo /etc/init.d/tracker stop
Disable
-------
::
sudo update-rc.d tracker disable
Enable
------
::
sudo update-rc.d enable enable
Responsible
-----------
If something wrong or fishy, contact cloph.