Skip to content

Master Mirror Setup

David E. Wheeler edited this page Apr 27, 2011 · 6 revisions

Here's how the PGXN master mirror is set up.

It was created on a Ubuntu Linux box, so some of the details of where to get software may vary.

  • Create /etc/rsyncd.conf and set up a read-only rsync path named "pgxn":

    log file=/var/log/rsyncd
    pid file=/var/run/
        comment = PGXN Master mirror
        path = /var/www/
        use chroot = yes
        lock file = /var/lock/rsyncd
        read only = yes
        list = yes
        uid = nobody
        gid = nogroup
        strict modes = yes
        ignore errors = no
        ignore nonreadable = yes
        transfer logging = no
        timeout = 600
        refuse options = checksum dry-run
        dont compress = *.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz

    Much of this is boilerplate.

  • Create the user "rsync" and enable rsync:

    useradd -m rsync -s /bin/bash
    perl -i -pe "s/RSYNC_ENABLE=false/RSYNC_ENABLE=true/" /etc/default/rsync
    /etc/init.d/rsyncd start
  • Now folks should be able to rsync the mirror from their own boxes with something like:

      rsync -az --delete rsync:// /usr/local/pgxn
  • Next I wanted to be sure that mirrors are kept up-to-date. So I set up a daily cron job to run once a day that timestamps a file in the master mirror and then runs check_mirrors to validate all the mirrors.

      # Update the timestamp.
      perl -le 'print scalar time' > /var/www/
      echo '# Do not delete this file' >> /var/www/
      # Check all mirrors.
      /usr/local/pgxn/bin/check_mirrors /var/www/

    The script depends on the mirrors.json file, which lists all the existing mirrors. For now this file is edited manually, but will be maintained by the management application once it's written.

Something went wrong with that request. Please try again.