Aptly

From Wikitech

Aptly is a simple debian repository management tool. It can be used for maintaining a simple, per-project debian repository.

Setting up

You need a packages server that'll host your packages, and then apply a role to all the instances in your project.

Server

Just apply the role role::aptly to any Debian Jessie (or Ubuntu Trusty, although that is not recommended) instance in your project. Since the server doesn't need much resources, it's ok to put this on a multi-purpose machine.

Client

You now need to point all the instances in your project to the aptly server instance. You can do this by editing your Hiera config (https://wikitech.wikimedia.org/wiki/Hiera:<projectname>to include:

classes:  
  - role::aptly::client

By default, they look for an instance named $projectname-packages (eg. tools-packages, ores-packages, etc). You can point his to any instance by setting:

role::aptly::client::servername to the name of the instance with role::aptly applied.

Adding Packages

Adding packages is fairly easy, once you've built them.

  1. ssh on to the aptly server instance
  2. Build your package
  3. do sudo aptly repo add <repo-name> <path-to-package>
  4. do sudo aptly publish --skip-signing update <repo-name>
  5. Tada!

<repo-name> is <distribution>-<projectname>, where distribution is the Debian distribution you are publishing packages for (jessie, trusty and precise are currently supported), and <projectname> is just the name of your project!

The full functionality documented at aptly.info is available. By default aptly is restricted to users with root only.

FAQ

What happens when the instance hosting the package dies?

Packages become unavailable. There's no failover mechanism for this at the moment. You can backup your /srv/aptly directory to NFS / other means if you wish.

In general, we do not have a backup solution for labs that does not involve NFS (yet). This should change in the near future.