First you need to create a CDN enabled container. You can do this using
Libcloud or the new Rackspace control panel. Depending on how frequently
you are going update your APT repository it is also recommended to lower the
container TTL from the default value of 3 days to 900 seconds.
After you have created a CDN enabled container you need to install Python script
I wrote which allows you to sychronize files from a local directory to a container
hosted in one of the Storage providers supported by Libcloud.
Next we are going to create a dummy APT repository::
Add a test package using reprepro:
And test the script:
If everything went well, you should see an output similar to this one:
After the upload has finished, you can test the repository by adding it to your
APT sources list:
We are also going to disable APT HTTP request pipeling. This step is required,
because a nginx proxy running in front of the CDN doesn’t seem to support
HTTP/1.1 pipelining. If you skip this test apt-get update will still work, but
it will get stuck on [Waiting for headers] for a longer period of time.
You can test that everything is working by issuing the following command:
You should get an output similar to this one:
That is it. To make sure your container is always up to date, you need
synchronize it every time you add a new packages. This can be achieved in
multiple ways:
adding a script which runs synchronize command after adding a package
adding a cron job which periodically runs the sync command