Mechanism of Action
On the Raspbmc server, a mod_rewrite rule and PHP script redirect to a random mirror when a file is requested, preserving the URI and passing it on to the mirroring server.
Becoming a CDN mirror
It is now possible to become a mirror with any web hosting servers including IIS and Apache, and thus, will not be platform dependent as no server side scripting will be needed in the serving of content. You must meet the following requirements to be a CDN mirror for the Raspbmc project:
1. You must have at least a 100Mbit connection or greater.
2. You must have an unmetered connection. This is for your own good, as the volume of downloads is very great.
3. You must synchronise with the Raspbmc server hourly. Otherwise some users may find updates not propagating for a long time.
Obviously, there may be other reasons why you would not make a suitable CDN mirror, such as if your server is offline frequently. Note: you may be removed from the CDN.
To apply to be a mirror, you should send an email
Mirroring under Linux
This guide assumes you have a working HTTP server.
First, you should verify that you have rSync on your system. In Debian or Ubuntu you can do this as follows:
apt-get update apt-get install rsync
Next, create a working folder in which you will store your password to access the rSync server and an automated script:
Create a password file, accessible by ONLY the user which will run the script. Note: if you do not heed this warning, rSync will fail.
echo "somepassword" > /var/mirror-raspbmc/passwordfile
If I was running as root (global cron), I would thus
chmod 600 /var/mirror-raspbmc/passwordfile chown root:root /var/mirror-raspbmc/passwordfile
Now, we should create the script which will synchronise with the Raspbmc server.
touch /var/mirror-raspbmc/sync.sh chmod +x /var/mirror-raspbmc/sync.sh // not technically necessary as we will invoke bash from cron. chmod 600 /var/mirror-raspbmc/sync.sh //security chown root:root /var/mirror-raspbmc/passwordfile
With your favourite text editor, add the following:
#!/bin/bash cd /var/www/mirrorlocation rsync -auP --delete --password-file=/var/mirror-raspbmc/passwordfile rsync://firstname.lastname@example.org/raspbmc-downloads/ downloads chown -R www-data:www-data
Note: substitute the location for the actual password file and ‘username’ for the username provided to you. Also ensure you substitute /var/www/mirrorlocation for the path where you are planning to serve the files from.
Run the script initially and verify that it works:
If that goes OK, then proceed to add it as a regular event.
Note: run as sudo if you are not already root to make the script run as root
Note: if your desired editor does not initialise with this command, prefix with, for example:
EDITOR=nano crontab -e
For a daily synchronisation at midnight, the following example would suffice:
@daily /bin/bash /var/mirror-raspbmc/sync.sh
I will create an application that allows synchronisation scheduling shortly.
Current CDN mirrors
Many thanks to those who are already volunteering as mirrors for the Raspbmc project. These are the people to thank for being able to install, update and enjoy Raspbmc as they allow such a great number of users.
You can view the list of mirrors from the Downloads page.
Vero is the multi-media device you've been waiting for. Click here to find out more.