2010-04-12 10:56:17 +00:00
|
|
|
------------------------------
|
2006-06-10 20:48:06 +00:00
|
|
|
How to build an MPlayer mirror
|
2010-04-12 10:56:17 +00:00
|
|
|
------------------------------
|
2006-06-10 20:48:06 +00:00
|
|
|
|
2007-03-24 09:46:12 +00:00
|
|
|
This document might be inacurate or even incomplete, please
|
|
|
|
send feedback + corrections to the mplayer-mirror mailing list.
|
2006-06-10 20:48:06 +00:00
|
|
|
|
|
|
|
About this document
|
|
|
|
~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
Mirroring MPlayer is quite easy but requires a few steps to be taken
|
|
|
|
and a few things taken care of. This document describes these steps
|
|
|
|
in detail so that anyone wishing to build an official or an unofficial
|
|
|
|
mirror can do that without much trouble.
|
|
|
|
|
|
|
|
|
|
|
|
A note on performance issues
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
A few of the commands used here will generate some load on our main server.
|
2006-06-16 11:17:04 +00:00
|
|
|
Too many clients executing them at once will overload our server and cause
|
|
|
|
a performance degradation for all our users. Thus we kindly ask you to be
|
|
|
|
considerate about what you do. We do not want to restrict mirroring to a
|
|
|
|
few select people, but this requires everyone using the system described
|
|
|
|
here to behave.
|
2006-06-10 20:48:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
Outline of the mirroring system
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2006-06-16 11:17:04 +00:00
|
|
|
The mirroring system uses rsync to transfer the data and to perform
|
|
|
|
updates. A script (update_mplayer_rsync) is provided to call the rsync
|
|
|
|
client with the right set of parameters. This script should be run
|
|
|
|
periodically via cron.
|
|
|
|
Additionally, official mirrors should set up an ssh account so that
|
|
|
|
updates can be triggered when important changes on the main server
|
2006-06-10 20:48:06 +00:00
|
|
|
are performed.
|
2006-06-16 11:17:04 +00:00
|
|
|
Mirrors should provide their data over HTTP or FTP or both. Each official
|
|
|
|
mirror will be assigned a mirror number (wwwXXX.mplayerhq.hu or
|
|
|
|
ftpXXX.mplayerhq.hu where XXX is the mirror number). This mirror
|
2007-04-03 11:03:14 +00:00
|
|
|
number determines the hostname over which it can be reached directly.
|
|
|
|
|
|
|
|
All mirrors are put into our DNS round-robin for the www.mplayerhq.hu and
|
|
|
|
ftp.mplayerhq.hu names and should be set up to respond to these names as well.
|
2006-06-10 20:48:06 +00:00
|
|
|
|
|
|
|
|
2007-04-07 10:07:46 +00:00
|
|
|
Requirements
|
|
|
|
~~~~~~~~~~~~
|
|
|
|
The requirements for any (official) mirror are:
|
|
|
|
1) rsync installed and some way to run the sync script periodicaly (eg cron)
|
2008-07-24 21:23:52 +00:00
|
|
|
2) subscribing to the mplayer-mirror mailing list (see below)
|
2007-04-07 10:07:46 +00:00
|
|
|
|
|
|
|
The requirements for a full website mirror are:
|
|
|
|
1) 500MB of free disk space (for the ftp and homepage directories).
|
|
|
|
2) A network connection with about 5Mbit/s sustained bandwidth.
|
|
|
|
3) A simple webserver that allows redirections and virtual server,
|
|
|
|
no PHP or CGI needed as all pages are static.
|
|
|
|
|
|
|
|
The requirements for a full ftp mirror are:
|
|
|
|
1) 500MB of free disk space (for the ftp directory).
|
|
|
|
2) (No bandwidth data for a ftp only server available)
|
|
|
|
|
|
|
|
|
2006-06-10 20:48:06 +00:00
|
|
|
Getting the data, mirroring script and cron setup
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2006-06-16 11:17:04 +00:00
|
|
|
The mirroring script is located in our Subversion repository at
|
|
|
|
|
|
|
|
svn://svn.mplayerhq.hu/mplayer/trunk/DOCS/tech/mirrors/update_mplayer_rsync
|
|
|
|
|
|
|
|
or on the web at
|
|
|
|
|
|
|
|
http://svn.mplayerhq.hu/*checkout*/mplayer/trunk/DOCS/tech/mirrors/update_mplayer_rsync
|
2006-06-10 20:48:06 +00:00
|
|
|
|
|
|
|
This script requires a working `rsync` client. The handling of the
|
|
|
|
lock file is done by using `lockfile` from the procmail package.
|
|
|
|
Using a lock file is recommended but not necessary. The temporary file
|
2006-06-16 11:17:04 +00:00
|
|
|
generation is handled by `mktemp` which is available from
|
|
|
|
http://www.mktemp.org/mktemp/ .
|
2006-06-10 20:48:06 +00:00
|
|
|
|
2007-12-23 21:22:02 +00:00
|
|
|
The script contains a few configuration variables at the beginning that
|
2006-06-10 20:48:06 +00:00
|
|
|
can and should be set:
|
|
|
|
PATH: The $PATH to be used within the script (recommended).
|
2006-06-16 11:17:04 +00:00
|
|
|
LOCK: The full path to the lock file to be used (/var/lock/mplayer-mirror-lock
|
|
|
|
or something similar, recommended).
|
2006-06-10 20:48:06 +00:00
|
|
|
MIRROR_ROOT: The root of the mirror. This is the directory where all files
|
2006-06-16 11:17:04 +00:00
|
|
|
are downloaded to (required).
|
|
|
|
MAILADR: The mail address where reports should be sent to (required).
|
|
|
|
TMPDIR: The directory where temporary files should be created.
|
|
|
|
If you set this explicitly, you have to uncomment the export below
|
|
|
|
(defaults to /tmp if not set).
|
2006-06-10 20:48:06 +00:00
|
|
|
|
|
|
|
Install this script and set the variables according to your setup. Then run
|
2006-06-16 11:17:04 +00:00
|
|
|
it once to get the first checkout of the mirror. This will require (at the
|
|
|
|
time of this writing - 2006-06) about 500MB of disk space.
|
2006-06-10 20:48:06 +00:00
|
|
|
You should get two directories in your $MIRROR_ROOT: homepage and MPlayer.
|
2006-06-16 11:17:04 +00:00
|
|
|
The former containing the HTML pages for the mirror and the latter the
|
|
|
|
downloadable files.
|
2006-06-10 20:48:06 +00:00
|
|
|
|
2006-06-16 11:17:04 +00:00
|
|
|
If this worked out OK, you should set up a cron job that periodically updates
|
2006-06-10 20:48:06 +00:00
|
|
|
the files. If you run an official mirror you should run the script every
|
|
|
|
6h to 12h (6h recommended). If you do not run an official mirror, you should
|
|
|
|
not run the script more often than once a day. Please use an "odd" time
|
|
|
|
to run the script when it is unlikely that any other cron job is running.
|
|
|
|
Bad times are e.g. full hours, or minutes that are divisible by 5.
|
|
|
|
An example crontab line would look like this:
|
|
|
|
---
|
|
|
|
17 1,8,13,19 * * * /path/to/update_mplayer_rsync
|
|
|
|
---
|
|
|
|
(please change the minute and hours to something random)
|
|
|
|
|
|
|
|
You can change the rest of the script as you see fit, although it is not
|
|
|
|
recommended. Please DO NOT CHANGE the options of the rsync commands.
|
|
|
|
Especially DO NOT REMOVE the -t and -W options. These prevent calculating
|
|
|
|
checksums on the server side which are very expensive.
|
|
|
|
|
|
|
|
|
2006-06-16 11:17:04 +00:00
|
|
|
Setting up an SSH account for update triggers
|
2006-06-10 20:48:06 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2006-06-16 11:17:04 +00:00
|
|
|
Official mirrors should provide an ssh-based trigger to run the update script
|
|
|
|
on request. This makes it possible to distribute releases and other important
|
|
|
|
files immediately to all mirrors.
|
2006-06-10 20:48:06 +00:00
|
|
|
|
2006-06-16 11:17:04 +00:00
|
|
|
The setup does not need a special user other than the one as which the update
|
|
|
|
script is run and does not allow running any other command.
|
2006-06-10 20:48:06 +00:00
|
|
|
|
2006-06-16 11:17:04 +00:00
|
|
|
First you need to create an ssh key pair by running:
|
2006-06-10 20:48:06 +00:00
|
|
|
---
|
|
|
|
ssh-keygen -t dsa -C MPHQ_rsync_trigger -f www#_sshkey
|
|
|
|
---
|
|
|
|
(replace the '#' by your mirror number)
|
|
|
|
|
|
|
|
You should send the private key to us by mail and specify the host and
|
2006-06-16 11:17:04 +00:00
|
|
|
user to be used. Please use a private mail of one of the admins and
|
|
|
|
DO NOT send the private key to the mirror mailing list.
|
2006-06-10 20:48:06 +00:00
|
|
|
|
2006-06-16 11:17:04 +00:00
|
|
|
The public key should be placed in the ~/.ssh/authorized_keys file of the
|
|
|
|
user running the updates. To restrict the ssh key to only one command place
|
2007-12-23 21:22:02 +00:00
|
|
|
the following directives at the beginning of the line with the key:
|
2006-06-16 11:17:04 +00:00
|
|
|
from="*.mplayerhq.hu",command="<path_to_update_mplayer_rsync>"
|
2006-06-10 20:48:06 +00:00
|
|
|
e.g.:
|
|
|
|
---
|
2006-06-16 11:17:04 +00:00
|
|
|
from="*.mplayerhq.hu",command="/path/to/update_mplayer_rsync" ssh-dss AAAA
|
2006-06-10 20:48:06 +00:00
|
|
|
B3NzaC1kc3MAAAEBAI20yhE3/bRjzojUhhMz4DHnGhcJUiPWOfoP9CygnFOYOxJTFlxgqM3iJiHWRxgK
|
|
|
|
FJ/Uw40eV9K4Ww4fp2pe1guXJzKna8+6vBXaPPVEVxSyaxgtt4Xt3zpUuCnNljgArcEhwcNyOyH2RVln
|
|
|
|
yhyxsrKhuq5ZoNHD3caBGjZu3eOR2atPGS1NOdeN/hytIoh8T8DicPqPI29yWX9yAjnHv6wdPutwMLu6
|
|
|
|
[...]
|
|
|
|
n0Fs3CJY6/1UpgDGH7VPey0SdpJEDewltRLA+buP++2vJD/NUOeGzcRydo2NdZ1wiiaytXxkaec928JC
|
|
|
|
NABTeBh6NKAg4vnPvcRLKEBVdSrar/fARSbOmf3HOcsw3uZoAIE9jDGhnMKcnXfHjPZ2tZP9CHs6Wo4n
|
|
|
|
yDOxIfDZmJ7VJqMRc6//p5k81pkkGvawbPA63StI/Dkv/648l4XONuJc2z5gaUdjrTA8TsD/VJGiGcHl
|
|
|
|
mlGj3IWCBz7e4+XB3L64kFZwLCYN8kwDUAaHq4EtcMVOnQ== MPHQ_rsync_trigger
|
|
|
|
---
|
|
|
|
(lines split for readability)
|
|
|
|
|
|
|
|
|
|
|
|
Setting up a webserver
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2006-06-16 11:39:23 +00:00
|
|
|
Set up Apache or whatever web server you prefer. We just have static pages,
|
|
|
|
so no fancy configuration is necessary. However, we need a few aliases so that
|
|
|
|
links on our pages work correctly. /MPlayer and /DOCS should redirect to the
|
2009-01-20 23:23:53 +00:00
|
|
|
directory with the downloadable files.
|
2006-06-16 11:39:23 +00:00
|
|
|
|
|
|
|
Here is an example stanza to paste into your Apache configuration:
|
|
|
|
|
|
|
|
<VirtualHost www#.mplayerhq.hu>
|
|
|
|
DocumentRoot /path/to/htdocs
|
2006-07-30 22:59:12 +00:00
|
|
|
Options FollowSymLinks Indexes
|
2006-06-16 11:39:23 +00:00
|
|
|
Alias /MPlayer /path/to/MPlayer
|
|
|
|
Alias /DOCS /path/to/MPlayer/DOCS
|
2006-10-27 22:47:41 +00:00
|
|
|
AddDefaultCharset off
|
2006-06-16 11:39:23 +00:00
|
|
|
</VirtualHost>
|
2006-06-10 20:48:06 +00:00
|
|
|
|
2007-04-03 11:03:14 +00:00
|
|
|
<VirtualHost www.mplayerhq.hu>
|
|
|
|
DocumentRoot /path/to/htdocs
|
|
|
|
Options FollowSymLinks Indexes
|
|
|
|
Alias /MPlayer /path/to/MPlayer
|
|
|
|
Alias /DOCS /path/to/MPlayer/DOCS
|
|
|
|
AddDefaultCharset off
|
|
|
|
</VirtualHost>
|
|
|
|
|
2006-10-27 22:47:41 +00:00
|
|
|
The AddDefaultCharset directive is necessary because newer versions of Apache
|
|
|
|
appear to default to defining a standard charset. This breaks our documentation
|
|
|
|
translations, which are written in different encodings.
|
|
|
|
|
2007-04-03 11:03:14 +00:00
|
|
|
The second VirtualHost is necessary for the DNS round-robin address.
|
2008-07-22 16:27:20 +00:00
|
|
|
To check whether this VirtualHost works, you can add a temporary entry into
|
|
|
|
your /etc/hosts file:
|
|
|
|
|
|
|
|
1.2.3.4 www.mplayerhq.hu
|
|
|
|
|
|
|
|
Replace the IP address by the real IP address of your mirror. Do not forget to
|
|
|
|
remove the entry after you finish testing.
|
|
|
|
|
|
|
|
|
|
|
|
Webserver checklist
|
|
|
|
~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
After setting up the web server, please verify that the following things work
|
|
|
|
both for your mirror address (www#.mplayerhq.hu) and the DNS round-robin
|
|
|
|
address (www.mplayerhq.hu):
|
|
|
|
|
|
|
|
- The virtual host is reachable by its address.
|
2009-01-20 23:23:53 +00:00
|
|
|
- The MPlayer and DOCS subdirectories work.
|
2008-07-22 16:27:20 +00:00
|
|
|
- The man pages and documentation are served with the correct content-type.
|
|
|
|
Try Russian or Chinese, you will notice breakage immediately.
|
2007-04-03 11:03:14 +00:00
|
|
|
|
2006-06-10 20:48:06 +00:00
|
|
|
|
|
|
|
Setting up an FTP server
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2008-07-24 21:24:51 +00:00
|
|
|
Any FTP server will do. We use vsftpd, it is fast and secure. The setup is
|
|
|
|
similar to the web server setup. The FTP server should listen on both its mirror
|
|
|
|
address (ftp#.mplayerhq.hu) and the DNS round-robin address (ftp.mplayerhq.hu).
|
|
|
|
All our mirrors are public, so you should allow anonymous access.
|
|
|
|
|
|
|
|
You should have the same directory layout as we do on our server, so there
|
|
|
|
should be a subdirectory named 'MPlayer' (notice the capitals) that contains
|
|
|
|
the downloadable files.
|
2006-06-10 20:48:06 +00:00
|
|
|
|
|
|
|
|
2008-07-24 21:23:52 +00:00
|
|
|
Mailing list
|
|
|
|
~~~~~~~~~~~~
|
2006-06-10 20:48:06 +00:00
|
|
|
|
2007-04-07 10:07:46 +00:00
|
|
|
All official mirror admins are required to subscribe to the mplayer-mirror
|
2008-07-24 21:23:52 +00:00
|
|
|
mailing list. It's used to coordinate the efforts and distribute information
|
2007-04-07 10:07:46 +00:00
|
|
|
among all admins. It is also very low traffic. Please use the webinterface
|
|
|
|
on http://lists.mplayerhq.hu/mailman/listinfo/mplayer-mirror to subscribe.
|
2008-07-22 16:27:20 +00:00
|
|
|
Please do not top-post on this mailing list.
|