Proxy repositories to save bandwidth

Linux repositories can be very large and normaly you don't need all packages. As of 0.7.0 repositor.io can act as a proxy to the upstream servers.

Configured as a proxy server repositor.io will build up the local mirror as the packages are requested. This means, if your package manager want to download a package, repositor.io first looks on its harddrive and if it can't find the package it will download the package from the upstream server.

To configure repositor.io as a proxy you need to configure the repository to allow proxying and start the build-in webserver.

<Repository ubuntu-precise-amd64-main>
  url       = http://de.archive.ubuntu.com/ubuntu/
  local     = ubuntu-precise-amd64-main/ubuntu
  type      = Apt
  arch      = amd64
  dist      = precise
  component = main
  proxy     = true
</Repository>

It is important that the first part of the local option is the same as the repository name. (here: ubuntu-precise-amd64-main).

To have better performance to deliver your packages we recommend to setup a webserver in front of the build-in http server.

Configure Apache as reverse proxy

To configure apache as a reverse proxy for repositor.io the following configuration snippet should get you started.

RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*) http://localhost:3000/$1 [L,P]

This rewrite rule tells apache to first check if the file is present in its document root and only if the file is not there it will give the request to repositorio. With this it is possible to reduce the load on repositorio.

To start the build-in preforking webserver please run the following command:

repositorio --repo=your-repositoy-name --server prefork

This will start a preforking webserver on port 3000. To get a help for all the options just append -- -h to the above command.

repositorio --repo=your-repositoy-name --server prefork -- -h

Now there is the problem that apache doesn't look upstream if the metadata changed. So apache is always serving old (cached) content. To update the metadata without downloading all the packages you can run the following command.

repositorio --repo=your-repository-name --update-metadata --no-update-files --mirror