Robert Escriva

Things I wish I learned earlier

RCOS Bittorrent Mirror

So I've finally found some time to write about the RCOS mirror I mentioned Sunday. We've managed to create a mirror that has provided 60GB to the RPI campus while only consuming 20GB from the off campus links.

In this article I'll be discussing the configuration of the tracker, the seed box, and the public www manager in hopes that others can recreate this system to spread (legal) content and save bandwidth.

The Tracker

The tracker we use is PyTracker. I posted about PyTracker in February when I first created it, and have since been testing it. It holds up under high load; its performance will depend more on lighttpd and PostgreSQL.

I've got the PyTracker software running as a FastCGI process under lighttpd. The lighttpd user is given permission to operate on the 'peers' and 'whitelist' databases.

It should be fairly straight forward to setup the tracker on any host with FastCGI or WSGI interfaces.

The Seed Box

The 'official' seed boxes are all configured the same. Each has a user dedicated to the torrents (the user 'torrent' in these examples).

The user runs rtorrent in a detached screen session. The rtorrent instance watches a particular directory for new torrents, and downloads all ISO files to a separate directory. There is no bandwidth limit set in rtorrent's config.

To prevent the seed box from running wild, iptables is configured to reject all connections the user torrent initiates that connect to off RPI's campus.

New torrents are pulled to the seedbox using rsync for the torrent files, and bittorrent for data transfer.

Providing Users with Torrents

To provide the user with torrents, I opted to make them available over flat HTML files. All the torrents have been modified to use the tracker set up under the 'tracker' section in addition to the trackers provided in the default torrents. All the torrents provided via rsync for seed boxes are modified to only use our tracker.

To accomplish this, I wrote a small script available here that will take a directory hierarchy and transform all .txt files to .html, copy all images, and perform the modifications that the torrents require.

I'm storing all torrents in a git repository for easy modification. When I push to the server, the pycms code is run to update the webroot (for users), and the rsync directory (for seed boxes).

Summary

I have given most of the details of our setup (without delving into boring configuration details). It performs rather well on our hardware (a dual core Intel with 1GB of RAM) and has already provided a significant service to the RPI community.

If you're looking to setup your own software mirror, I'd be happy to provide help with setup and configuration of the above components. Please don't solicit my help for sharing of files which you have not obtained permission to share.

RCOS Linux Mirror

It's been a busy semester so I haven't been blogging as much as I did last semester, but I've got several topics to write about in the coming weeks as classes wind down.

Last week I made public the on-campus free/open source software mirror sponsored by the Rensselaer Center for Open Source Software (RCOS) This mirror provides two very important services to the RPI community. First, it provides a complete mirror of the Ubuntu archive. Second, it provides RPI with a large collection of Linux and *BSD ISO torrents to download.

If you're on RPI's campus (128.113.0.0/16 or 128.213.0.0/16) you can access our mirror here. The mirror is restricted to only users on campus because of limitations on RPI's upstream bandwidth.

In a future article I'll describe the architecture of the torrent network and provide the software necessary for other users to create their own local free software repositories.

Copyright © 2010 Robert Escriva ¦ Powered by Firmant