Nothing beats a bare metal machine with FreeBSD + ZFS pool + ezjail; the really cool thing about ZFS is that you can build a "base jail" then just use ZFS to make snapshots of the base jail when creating new jails. So with that you can create versioned base jails that are running an upgraded ports tree, or more generally, an upgraded world build!
It also makes transition between application versions easy because you can run a separate database jail(s) (maybe different versions of the db?) and have a jail for app v1 running while a jail for app v2 is running at the same time.
What I would love to see is a tool for abstracting this deployment pattern on-top of ezjail. I've been considering doing this myself but my time is stretched too thin :(
This is basically what we're doing with Docker. We started with lxc but it can and will be ported to other OS virtualization backends, including jails and zones.
Create a new base image from a running container:
CONTAINER_A=$(docker run -d ubuntu apt-get install curl)
docker wait $CONTAINER_A
docker commit $CONTAINER_A shykes/my-ubuntu-with-curl
CONTAINER_B=$(docker run -d shykes/my-ubuntu-with-curl curl --help)
Share your new image for the rest of the world to enjoy: docker push shykes/my-ubuntu-with-curl
Transition between application versions: V1=$(docker run -d shykes/myapp:v1)
V2=$(docker run -d shykes/myapp:v2)
docker stop $V1
Transition between database versions (sharing of persistent data): V1=$(docker run -d shykes/mydb:v1)
V2=$(docker run -d -volumes-from=$V1 shykes/mydb:v2)
docker stop $V1Of course, Illumos has zones, ZFS, KVM, and DTrace. But it's much less widely used than even FreeBSD.
btrfs also supports this, and that support is built into some LXC commands (lxc-clone, for instance.) Docker just relies on filesystem overlays and bind-mounts instead, though, so it doesn't really have need for full persisted-to-disk subtrees of the instantiated version (it's more like it holds the base version and the persisted delta on disk, and only brings them together in memory.)
But how do we put the idea of immutable infrastructure into practice on bare-metal servers? One option would be to set up one's own virtualization infrastructure, such as Xen or KVM. But that would undermine the I/O performance and resource consolidation advantages of running on bare metal. Docker looks promising; we just need to discover the best practices for running specific kinds of services (e.g. web applications) on top of it.