Using snapshots with reprepro to enable rollbacks
I'm using reprepro
to maintain a Private Package Archive of internal packages. There is no straightforward way to keep multiple version of a package available using reprepro
(see here), but it does have a snapshot facility that sort of works.
But only sort of. I don't see a good way to go back to a snapshot version. There is a command restore
documented, but it doesn't seem to work (reprepro version 4.8.2 on Ubuntu 12.4.1 LTS).
I can access the snapshot via apt-get
as described in the man page, by editing sources.list
to include something like
deb method://as/without/snapshot codename/snapshots/name main
but this means I need to update all the servers with a new sources.list to change their snapshots.
What I'd like to do is maintain a "safe" distribution that I can configure from any snapshot on "stable" and always have servers pull from "safe". Then to do a rollback I just roll back "safe" and have the servers remove and re-install the packages. (I say remove and reinstall because it seems too hard to get them to downgrade just the private packages without touching the public packages.) Or something like that.
The main goal is to have an automated way to get a server farm to revert to an older version of the packages. I'm open to suggestions.
How are people handling this?
Is there a way to get reprepro
snapshots to work the way I'd like?
Solution 1:
I'd do this by using an LVM logical volume backing the repository. It's probably best to put this on a separate filesystem than root anyways. Steps to do this would be:
- If LVM is not installed, install and configure it.
- Create a logical volume for your repository.
- Format with filesystem of choice.
- Mount in appropriate location.
- Move repository onto it.
At this point, you can trivially snapshot the entire repository by creating logical volume snapshots. If desired, you could just set up rolling snapshots nightly.
If you're feeling particularly daring, you could use filesystem-level snapshots with BTRFS or ZFS, but those are both less mature on Linux at the moment.
- The Reference: http://www.tldp.org/HOWTO/LVM-HOWTO/
- A Less Verbose Guide: http://www.thegeekstuff.com/2010/08/how-to-create-lvm/