18674
|
1 ------------------------------
|
|
2 How to build an MPlayer mirror
|
|
3 ------------------------------
|
|
4
|
|
5 =======================================================================
|
18725
|
6 WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
|
18674
|
7 -----------------------------------------------------------------------
|
|
8 This is a preliminary version. Do not rely on anything here.
|
18725
|
9 Please send feedback + corrections to the mplayer-mirror mailing list.
|
18674
|
10 =======================================================================
|
|
11
|
|
12 About this document
|
|
13 ~~~~~~~~~~~~~~~~~~~
|
|
14
|
|
15 Mirroring MPlayer is quite easy but requires a few steps to be taken
|
|
16 and a few things taken care of. This document describes these steps
|
|
17 in detail so that anyone wishing to build an official or an unofficial
|
|
18 mirror can do that without much trouble.
|
|
19
|
|
20
|
|
21
|
|
22 A note on performance issues
|
|
23 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
24
|
|
25 A few of the commands used here will generate some load on our main server.
|
18725
|
26 Too many clients executing them at once will overload our server and cause
|
|
27 a performance degradation for all our users. Thus we kindly ask you to be
|
|
28 considerate about what you do. We do not want to restrict mirroring to a
|
|
29 few select people, but this requires everyone using the system described
|
|
30 here to behave.
|
18674
|
31
|
|
32
|
|
33 Outline of the mirroring system
|
|
34 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
35
|
18725
|
36 The mirroring system uses rsync to transfer the data and to perform
|
|
37 updates. A script (update_mplayer_rsync) is provided to call the rsync
|
|
38 client with the right set of parameters. This script should be run
|
|
39 periodically via cron.
|
|
40 Additionally, official mirrors should set up an ssh account so that
|
|
41 updates can be triggered when important changes on the main server
|
18674
|
42 are performed.
|
18725
|
43 Mirrors should provide their data over HTTP or FTP or both. Each official
|
|
44 mirror will be assigned a mirror number (wwwXXX.mplayerhq.hu or
|
|
45 ftpXXX.mplayerhq.hu where XXX is the mirror number). This mirror
|
|
46 number determines the hostname over which it will be reached.
|
18674
|
47
|
|
48
|
|
49 Getting the data, mirroring script and cron setup
|
|
50 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
51
|
18725
|
52 The mirroring script is located in our Subversion repository at
|
|
53
|
|
54 svn://svn.mplayerhq.hu/mplayer/trunk/DOCS/tech/mirrors/update_mplayer_rsync
|
|
55
|
|
56 or on the web at
|
|
57
|
|
58 http://svn.mplayerhq.hu/*checkout*/mplayer/trunk/DOCS/tech/mirrors/update_mplayer_rsync
|
18674
|
59
|
|
60 This script requires a working `rsync` client. The handling of the
|
|
61 lock file is done by using `lockfile` from the procmail package.
|
|
62 Using a lock file is recommended but not necessary. The temporary file
|
18725
|
63 generation is handled by `mktemp` which is available from
|
|
64 http://www.mktemp.org/mktemp/ .
|
18674
|
65
|
|
66 The script contains a few configuration variables at the begining that
|
|
67 can and should be set:
|
|
68 PATH: The $PATH to be used within the script (recommended).
|
18725
|
69 LOCK: The full path to the lock file to be used (/var/lock/mplayer-mirror-lock
|
|
70 or something similar, recommended).
|
18674
|
71 MIRROR_ROOT: The root of the mirror. This is the directory where all files
|
18725
|
72 are downloaded to (required).
|
|
73 MAILADR: The mail address where reports should be sent to (required).
|
|
74 TMPDIR: The directory where temporary files should be created.
|
|
75 If you set this explicitly, you have to uncomment the export below
|
|
76 (defaults to /tmp if not set).
|
18674
|
77
|
|
78 Install this script and set the variables according to your setup. Then run
|
18725
|
79 it once to get the first checkout of the mirror. This will require (at the
|
|
80 time of this writing - 2006-06) about 500MB of disk space.
|
18674
|
81 You should get two directories in your $MIRROR_ROOT: homepage and MPlayer.
|
18725
|
82 The former containing the HTML pages for the mirror and the latter the
|
|
83 downloadable files.
|
18674
|
84
|
18725
|
85 If this worked out OK, you should set up a cron job that periodically updates
|
18674
|
86 the files. If you run an official mirror you should run the script every
|
|
87 6h to 12h (6h recommended). If you do not run an official mirror, you should
|
|
88 not run the script more often than once a day. Please use an "odd" time
|
|
89 to run the script when it is unlikely that any other cron job is running.
|
|
90 Bad times are e.g. full hours, or minutes that are divisible by 5.
|
|
91 An example crontab line would look like this:
|
|
92 ---
|
|
93 17 1,8,13,19 * * * /path/to/update_mplayer_rsync
|
|
94 ---
|
|
95 (please change the minute and hours to something random)
|
|
96
|
|
97 You can change the rest of the script as you see fit, although it is not
|
|
98 recommended. Please DO NOT CHANGE the options of the rsync commands.
|
|
99 Especially DO NOT REMOVE the -t and -W options. These prevent calculating
|
|
100 checksums on the server side which are very expensive.
|
|
101
|
|
102
|
18725
|
103 Setting up an SSH account for update triggers
|
18674
|
104 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
105
|
18725
|
106 Official mirrors should provide an ssh-based trigger to run the update script
|
|
107 on request. This makes it possible to distribute releases and other important
|
|
108 files immediately to all mirrors.
|
18674
|
109
|
18725
|
110 The setup does not need a special user other than the one as which the update
|
|
111 script is run and does not allow running any other command.
|
18674
|
112
|
18725
|
113 First you need to create an ssh key pair by running:
|
18674
|
114 ---
|
|
115 ssh-keygen -t dsa -C MPHQ_rsync_trigger -f www#_sshkey
|
|
116 ---
|
|
117 (replace the '#' by your mirror number)
|
|
118
|
|
119 You should send the private key to us by mail and specify the host and
|
18725
|
120 user to be used. Please use a private mail of one of the admins and
|
|
121 DO NOT send the private key to the mirror mailing list.
|
18674
|
122
|
18725
|
123 The public key should be placed in the ~/.ssh/authorized_keys file of the
|
|
124 user running the updates. To restrict the ssh key to only one command place
|
|
125 the following directives at the begining of the line with the key:
|
|
126 from="*.mplayerhq.hu",command="<path_to_update_mplayer_rsync>"
|
18674
|
127 e.g.:
|
|
128 ---
|
18725
|
129 from="*.mplayerhq.hu",command="/path/to/update_mplayer_rsync" ssh-dss AAAA
|
18674
|
130 B3NzaC1kc3MAAAEBAI20yhE3/bRjzojUhhMz4DHnGhcJUiPWOfoP9CygnFOYOxJTFlxgqM3iJiHWRxgK
|
|
131 FJ/Uw40eV9K4Ww4fp2pe1guXJzKna8+6vBXaPPVEVxSyaxgtt4Xt3zpUuCnNljgArcEhwcNyOyH2RVln
|
|
132 yhyxsrKhuq5ZoNHD3caBGjZu3eOR2atPGS1NOdeN/hytIoh8T8DicPqPI29yWX9yAjnHv6wdPutwMLu6
|
|
133 [...]
|
|
134 n0Fs3CJY6/1UpgDGH7VPey0SdpJEDewltRLA+buP++2vJD/NUOeGzcRydo2NdZ1wiiaytXxkaec928JC
|
|
135 NABTeBh6NKAg4vnPvcRLKEBVdSrar/fARSbOmf3HOcsw3uZoAIE9jDGhnMKcnXfHjPZ2tZP9CHs6Wo4n
|
|
136 yDOxIfDZmJ7VJqMRc6//p5k81pkkGvawbPA63StI/Dkv/648l4XONuJc2z5gaUdjrTA8TsD/VJGiGcHl
|
|
137 mlGj3IWCBz7e4+XB3L64kFZwLCYN8kwDUAaHq4EtcMVOnQ== MPHQ_rsync_trigger
|
|
138 ---
|
|
139 (lines split for readability)
|
|
140
|
|
141
|
|
142 Setting up a webserver
|
|
143 ~~~~~~~~~~~~~~~~~~~~~~
|
|
144
|
18726
|
145 Set up Apache or whatever web server you prefer. We just have static pages,
|
|
146 so no fancy configuration is necessary. However, we need a few aliases so that
|
|
147 links on our pages work correctly. /MPlayer and /DOCS should redirect to the
|
|
148 directory with the downloadable files and /homepage should redirect to the
|
|
149 directory with the HTML pages.
|
|
150
|
|
151 Here is an example stanza to paste into your Apache configuration:
|
|
152
|
|
153 <VirtualHost www#.mplayerhq.hu>
|
|
154 DocumentRoot /path/to/htdocs
|
|
155 Options FollowSymLinks
|
|
156 Alias /homepage /path/to/htdocs
|
|
157 Alias /MPlayer /path/to/MPlayer
|
|
158 Alias /DOCS /path/to/MPlayer/DOCS
|
|
159 </VirtualHost>
|
18674
|
160
|
|
161
|
|
162 Setting up an FTP server
|
|
163 ~~~~~~~~~~~~~~~~~~~~~~~~
|
|
164
|
18726
|
165 Any FTP server will do. We use vsftpd, it's fast and secure. You should have
|
|
166 the same directory layout as we do on our server, so there should be a
|
|
167 subdirectory named 'MPlayer' (notice the capitals) that contains the
|
|
168 downloadable files.
|
18674
|
169
|
|
170
|
|
171 Mailinglist
|
|
172 ~~~~~~~~~~~
|
|
173
|
|
174 TO BE DONE
|