Difference between revisions of "Mirrors"

From SME Server
Jump to navigationJump to search
m
(Update to the new mirror sync script)
Line 9: Line 9:
  
 
===How to become a mirror site?===
 
===How to become a mirror site?===
If you or your company has some spare bandwidth and would like to be included in mirror.contribs.org, you can use rsync to do something like this:
+
If you or your company has some spare bandwidth and would like to be included in mirror.contribs.org, become a mirror by following these steps:
  
  rsync -aHhimOSz --partial --timeout 300 --delay-updates --delete-after --delete \
+
====Preparing your system====
  --max-delete 1000 distro.ibiblio.org::smeserver/ /home/smeserver/
+
<ol><li>Create a storage location for mirror
 +
  mkdir -p {/path/to/your/data/store/}
 +
</li><li>Create a new user to perform sync<br/>If you are running SME Server you can create the user through the server-manager panel, but you will need to enable bash as the shell for this user.
 +
db accounts setprop ''{user}'' Shell /bin/bash
 +
signal-event user-modify ''{user}''
 +
</li><li>Now it is time to download the ftpsync script and all files it requires:
 +
wget http://contribs.org/ftpsync.tgz
 +
</li><li>Extract the tarball in users directory
 +
tar zxof ftpsync.tgz
 +
</li><li>Append the keys to the authorized_keys file of the user
 +
cat .ssh/pushmirror-*.pub >> .ssh/authorized_keys
 +
</li><li>Change the ownership of the directories to the new user
 +
  chown -R ''{user}'' bin etc log .ssh ''{/path/to/your/data/store/}''
 +
</li><li>Now we have installed and set things up as is required but we will need to update the configuration file to point to the storage location of the data (TO) in the config file (etc/ftpsync.conf). Use your favorite text editor for it.</li></ol>
  
Above command will download all releases including the obsolete ones as well as the contribs section, you can exclude them by using the following line:
+
====Testing your setup====
 +
<ol><li>Now it is time to perform the initial sync (and test that script does what it needs to)
 +
su - ''{user}'' -s /bin/bash
 +
~/bin/ftpsync
 +
</li><li>Now check heck the logs to see if there are any errors. Since the initial sync will take a lot of time you can best do this in a second terminal window:
 +
cd ~/log
 +
cat rsync-ftpsync.error.0
 +
</li></ol>
  
rsync -aHhimOSz --partial --timeout 300 --delay-updates --delete-after --delete \
+
====Configuring the web server====
--max-delete 1000 --exclude 'contribs/' --exclude 'obsolete/' \
+
You will need to configure your web server to make the files available to the public.
distro.ibiblio.org::smeserver/ /home/smeserver/
 
If you don't have the latest rsync then some of the options may cause issues (m,h) you are fine to remove any that aren't supported in your version of rsync.
 
  
You need to enable the FollowSymLinks option in the apache config file. If your mirror is hosted on a SME Server 7.x (or higher version), in an ibay, you should issue the following commands after creating the ibay:
+
For that you need to enable the FollowSymLinks option in the apache config file.  
 +
 
 +
If your mirror is hosted on a SME Server 7.x (or higher version), in an ibay, you should issue the following commands after creating the ibay:
  
 
  db accounts setprop {ibayname} FollowSymLinks enabled
 
  db accounts setprop {ibayname} FollowSymLinks enabled
 
  signal-event ibay-modify {ibayname}
 
  signal-event ibay-modify {ibayname}
  
Finally, just schedule a cron job to run every 2 hours that does the exact same rsync command you do to get the mirror in the first place.
+
====Keeping your mirror up-to-date====
 +
The ftpsync script allows for two sync methods: push or pull.
 +
 
 +
We prefer you configure your mirror to be setup as a push mirror because:
 +
* Sync only happens when there are changes
 +
* Changes are propagated as close to real-time as possible
 +
* Changes can be staged (sync data first, repodata second)
 +
* Less out of sync mirrors for yum
 +
 
 +
=====Configuring for push=====
 +
{{Incomplete}}
 +
 
 +
=====Configuring for pull=====
 +
We prefer you configure your mirror to be setup as a push mirror, but if you can not do so or have other ways for not doing so you can just schedule a cron job to run every 2 hours that does the exact same sync command you do to get the mirror in the first place, you can add a comment like in the example below:
 +
 
 +
1 */2  * * *  ''{user}'' ~/bin/ftpsync
  
In example:
+
====Advertising your mirror====
1 */2  * * *  root rsync -aHhimOSz --partial --timeout 300 --delay-updates --delete-after --delete  --max-delete 1000 distro.ibiblio.org::smeserver/ /home/smeserver/
+
After your mirror is synced and working properly the last thing you need to do is let us know by filing a bug report on bugs.contribs.org under the website category or by following {{BugzillaFileBug|product=SME%20web%20site|component=Mirrors|comment=I%20would%20like%20to%20host%20a%20mirror%20for%20contribs.org.%0D%0DName%20of%20site:%0DPrimary%20contact%20(name):%0DPrimary%20contact%20(email):%0DLocation%20(country):%0DBandwidth%20available:%0DSite%20URL%20(for%20releases%20dir):%0D%0DHostname%20(for%20ssh):%0DUsername%20(for%20ssh):%0DPort%20(for%20ssh):|title=<b>this link</b>}}.
 +
Please include the following in the bug report:
 +
* name of site
 +
* primary contact name/email
 +
* location/country
 +
* bandwidth available to mirror
 +
* URL to site (for freshness checks and yum)
 +
* hostname to connect to (for ssh)
 +
* port to connect to (for ssh)
 +
* username to connect with (for ssh)
  
After your mirror is synced, let us know by filing a bug report on bugs.contribs.org under the website category or by following {{BugzillaFileBug|product=SME%20web%20site|component=Mirrors|comment=I%20would%20like%20to%20host%20a%20mirror%20for%20contribs.org.%0D%0DName%20of%20site:%0DPrimary%20contact%20(name):%0DPrimary%20contact%20(email):%0DLocation%20(country):%0DBandwidth%20available:%0DSite%20URL%20(for%20releases%20dir):%0D%0DHostname%20(for%20ssh):%0DUsername%20(for%20ssh):%0DPort%20(for%20ssh):|title=<b>this link</b>}}. Thanks!
+
===Configuration options====
 +
The ftpsync configuration script has a number of options you can configure. You might have already seen some of them when you had to adjust the storage location in the configuration process.
 +
The configuration file is well documented but we will discuss some of the features here.
 +
{{Incomplete}}
  
 
===Figures===
 
===Figures===

Revision as of 18:17, 13 July 2011


Status of the contribs.org mirrors

To view the status of contribs.org mirrors, look at http://mirror.contribs.org/mirrors.

Accessing the contribs.org mirros

To access the contribs.org download mirrors, always use the URL http://mirror.contribs.org. The current releases can be found at http://mirror.contribs.org/smeserver/releases/, the contribs section can be found at: http://mirror.contribs.org/smeserver/contribs/

You will automatically be redirected to a mirror that is current within the last 8 hours.

How to become a mirror site?

If you or your company has some spare bandwidth and would like to be included in mirror.contribs.org, become a mirror by following these steps:

Preparing your system

  1. Create a storage location for mirror mkdir -p {/path/to/your/data/store/}
  2. Create a new user to perform sync
    If you are running SME Server you can create the user through the server-manager panel, but you will need to enable bash as the shell for this user. db accounts setprop {user} Shell /bin/bash signal-event user-modify {user}
  3. Now it is time to download the ftpsync script and all files it requires: wget http://contribs.org/ftpsync.tgz
  4. Extract the tarball in users directory tar zxof ftpsync.tgz
  5. Append the keys to the authorized_keys file of the user cat .ssh/pushmirror-*.pub >> .ssh/authorized_keys
  6. Change the ownership of the directories to the new user chown -R {user} bin etc log .ssh {/path/to/your/data/store/}
  7. Now we have installed and set things up as is required but we will need to update the configuration file to point to the storage location of the data (TO) in the config file (etc/ftpsync.conf). Use your favorite text editor for it.

Testing your setup

  1. Now it is time to perform the initial sync (and test that script does what it needs to) su - {user} -s /bin/bash ~/bin/ftpsync
  2. Now check heck the logs to see if there are any errors. Since the initial sync will take a lot of time you can best do this in a second terminal window: cd ~/log cat rsync-ftpsync.error.0

Configuring the web server

You will need to configure your web server to make the files available to the public.

For that you need to enable the FollowSymLinks option in the apache config file.

If your mirror is hosted on a SME Server 7.x (or higher version), in an ibay, you should issue the following commands after creating the ibay:

db accounts setprop {ibayname} FollowSymLinks enabled
signal-event ibay-modify {ibayname}

Keeping your mirror up-to-date

The ftpsync script allows for two sync methods: push or pull.

We prefer you configure your mirror to be setup as a push mirror because:

  • Sync only happens when there are changes
  • Changes are propagated as close to real-time as possible
  • Changes can be staged (sync data first, repodata second)
  • Less out of sync mirrors for yum
Configuring for push
Incomplete.png Incomplete:
This article or section needs to be expanded. Please help to fill the gaps or discuss the issue on the talk page


Configuring for pull

We prefer you configure your mirror to be setup as a push mirror, but if you can not do so or have other ways for not doing so you can just schedule a cron job to run every 2 hours that does the exact same sync command you do to get the mirror in the first place, you can add a comment like in the example below:

1 */2  * * *  {user} ~/bin/ftpsync

Advertising your mirror

After your mirror is synced and working properly the last thing you need to do is let us know by filing a bug report on bugs.contribs.org under the website category or by following this link . Please include the following in the bug report:

  • name of site
  • primary contact name/email
  • location/country
  • bandwidth available to mirror
  • URL to site (for freshness checks and yum)
  • hostname to connect to (for ssh)
  • port to connect to (for ssh)
  • username to connect with (for ssh)

Configuration options=

The ftpsync configuration script has a number of options you can configure. You might have already seen some of them when you had to adjust the storage location in the configuration process. The configuration file is well documented but we will discuss some of the features here.

Incomplete.png Incomplete:
This article or section needs to be expanded. Please help to fill the gaps or discuss the issue on the talk page


Figures

Harddisk size

The amount of physical harddisk size taken up by the contribs.org data will be about 30Gb, the /release tree, which holds the iso images and the repositories, accounts for about 6Gb of said amount. The /contribs tree will account for a little over 1Gb of the total. The obsolete directory accounts for 16Gb, and the testing directory which include the next version SME8 is 7Gb big.


If you are short in space you can easily save 16Gb with --exclude="obsolete/" and 7Gb more with --exclude="testing/"

Bandwith

Due to the small number of mirrors, the bandwidth routed to your servers will be in the order of 200Gb/month on average, which translates to about 80kB/s.