OpenTracker
This is an ode to Dirk Engling’s OpenTracker.
It’s a BitTorrent tracker.
It’s what powered The Pirate Bay in 2007–2009.
I’ve been using it to power the downloads on http://driverpacks.net since the end of November 2010. >6 years. It facilitated 9839566 downloads since December 1, 2010 until today. That’s almost 10 million downloads!
Stability
It’s one of the most stable pieces of software I ever encountered. I compiled it in 2010, it never once crashed. I’ve seen uptimes of hundreds of days.
wim@ajax:~$ ls -al /data/opentrackertotal 456drwxr-xr-x 3 wim wim 4096 Feb 11 01:02 .drwxr-x--x 10 root wim 4096 Mar 8 2012 ..-rwxr-xr-x 1 wim wim 84824 Nov 29 2010 opentracker-rw-r--r-- 1 wim wim 3538 Nov 29 2010 opentracker.confdrwxr-xr-x 4 wim wim 4096 Nov 19 2010 src-rw-r--r-- 1 wim wim 243611 Nov 19 2010 src.tgz-rwxrwxrwx 1 wim wim 14022 Dec 24 2012 whitelist
Simplicity
The simplicity is fantastic. Getting up and running is incredibly simple: git clone git://erdgeist.org/opentracker .; make; ./opentracker
and you’re up and running. Let me quote a bit from its homepage, to show that it goes the extra mile to make users successful:
opentracker can be run by just typing
./opentracker
. This will make opentracker bind to0.0.0.0:6969
and happily serve all torrents presented to it. If ran as root, opentracker will immediately chroot to.
and drop all priviliges after binding to whatever tcp or udp ports it is requested.
Emphasis mine. And I can’t emphasize my emphasis enough.
Performance & efficiency
All the while handling dozens of requests per second, opentracker
causes less load than background processes of the OS. Let me again quote a bit from its homepage:
opentracker can easily serve multiple thousands of requests on a standard plastic WLAN-router, limited only by your kernels capabilities ;)
That’s also what the homepage said in 2010. It’s one of the reasons why I dared to give it a try. I didn’t test it on a “plastic WLAN-router”, but everything I’ve seen confirms it.
Flexibility
Its defaults are sane, but what if you want to have a whitelist?
- Uncomment the
#FEATURES+=-DWANT_ACCESSLIST_WHITE
line in theMakefile
. - Recompile.
- Create a file called
whitelist
, with one torrent hash per line.
Have a need to update this whitelist, for example a new release of your software to distribute? Of course you don’t want to reboot your opentracker
instance and lose all current state. It’s got you covered:
- Append a line to
whitelist
. - Send the
SIGHUP
UNIX signal to makeopentracker
reload its whitelist1.
Deployment
I’ve been in the process of moving off of my current (super reliable, but also expensive) hosting. There are plenty of specialized companies offering HTTP hosting2 and even rsync
hosting3. Thanks to their standardization and consequent scale, they can offer very low prices.
But I also needed to continue to run my own BitTorrent tracker. There are no companies that offer that. I don’t want to rely on another tracker, because I want there to be zero affiliation with illegal files4. This is a BitTorrent tracker that does not allow anything to be shared: it only allows the software releases made by http://driverpacks.net to be downloaded.
So, I found the cheapest VPS I could find, with the least amount of resources. For USD $13.505, I got the lowest specced VPS from a reliable-looking provider: with 128 MB RAM. Then I set it up:
ssh
‘d onto it.rsync
‘d over the files from my current server (alternatively:git clone
andmake
)- added
@reboot /data/opentracker/opentracker -f /data/opentracker/opentracker.conf
to mycrontab
. - removed the
CNAME
record fortracker.driverpacks.net
, and instead made it anA
record pointing to my new VPS. - watched
http://tracker.driverpacks.net:6969/stats?mode=tpbs&format=txt
on both the new and the old server, to verify traffic was moving over to my new cheapopentracker
VPS as the DNS changes propagated
Drupal module
Since driverpacks.net runs on Drupal, there of course is an OpenTracker Drupal module to integrate the two (I wrote it). It provides an API to:
- create
.torrent
files for certain files uploaded to Drupal - append to the OpenTracker
whitelist
file6 - parse the statistics provided by the OpenTracker instance
You can see the live stats at http://driverpacks.net/stats.
Conclusion
opentracker
is the sort of simple, elegant software design that makes it a pleasure to use. And considering the low commit frequency over the past decade, with many of those commits being nitpick fixes, it also seems its simplicity also leads to excellent maintainability. It involves the HTTP and BitTorrent protocols, yet only relies on a single I/O library, and its source code is very readable. Not only that, but it’s also highly scalable.
It’s the sort of software many of us aspire to write.
Finally, its license. A glorious license indeed!
The beerware license is very open, close to public domain, but insists on honoring the original author by just not claiming that the code is yours. Instead assume that someone writing Open Source Software in the domain you’re obviously interested in would be a nice match for having a beer with.
So, just keep the name and contact details intact and if you ever meet the author in person, just have an appropriate brand of sparkling beverage choice together. The conversation will be worth the time for both of you.
Dirk, if you read this: I’d love to buy you sparkling beverages some time :)
-
kill -s HUP <code>pidof opentracker
↩︎ -
I’m using Gandi’s Simple Hosting. ↩︎
-
Also: all my existing torrents use
http://tracker.driverpacks.net:6969/announce
as the URL. The free trackers I could find were all usingudp://
. So new leechers would then no longer be able to find the hundreds of existing seeders. Adding trackers to already-downloaded torrents is not possible. ↩︎ -
$16.34 including 21% Belgian VAT. ↩︎
-
Rather than having the Drupal module send a
SIGHUP
from within PHP, which requires elevated rights, I instead opted for a cronjob that runs every 10 minutes:*/10 * * * * kill -s HUP <code>pidof opentracker
. ↩︎