We want to set up a continuous integration (CI) service for our project. That CI service should control all aspects of the project life, including deployment.
That is, we want a CI agent at each iteration to take a clean system (specifically Ubuntu Server), deploy our project there and run tests.
We probably would write CI service ourselves, from scratch, as our ecosystem is rather unusual. The question is: how to effectively provide clean slate system for each CI iteration?
Project deployment install a few Debian packages, configures several nginx sites, and also install some packages in a implementation language-specific package manager (LuaRocks), systemwide. Nothing more intrusive than that (I believe). So, it is more important to be able to set up a clean slate fast (within a minute on modern hardware, faster — better) than to ensure absolute isolation and cleanness.
I see two ways how to do what we need:
- Either set up a jail of some kind (like lxc, maybe).
- Or install some virtual machine that can do snapshots, and use them.
But at this point I do not have enough information to decide.
What would you advise? Any other options? Any specific tool names?
Note: The CI service would be run inside a Citrix XenServer guest. Paid solutions are OK if prices are reasonable. (Usually they are not reasonable in this field.) Remote CI solutions not OK.
Have a look at Jenkins. It has plugins that allow you to run builds in virtual machines in VMWare or VirtualBox or in the Amazon/a Eucalyptus cloud. For virtual machines run in the cloud, you can specify an init script where you could take steps like installing packages.
Take a look at Chef / Vagrant. Not sure if it will be fast enough, but something to look into.
Just in case you aren't familiar with Chef, it is a server designed to allow simple code based provisioning of servers. I'd recommend taking a look at one of the webcasts. Django Chef Webcast
Vagrant, veewee, chef-solo & knife-solo stuff I think this one covers most of what you want to do.
Vagrant Blog post A blog post showing a quick setup of a server using Vagrant.
I'd be using VM infrastructure and create a base template, or use the cloud as @LarsKotthoff suggested. Its easy to spin them up fast, and you can be sure where you started from.
However you will ultimately need something outside that VM to orchestrate what is going on (setup the machine, and kick off whatever process you want on the machine). I'd look at Jenkins for its ability to capture output of scripts for later inspection.
Although Jenkins Started as a CI server, numerous organisations I've worked with now use it for much more than that, it really is a tool to kick things off (manually or scheduled) and capture results, and validate what happened is as expected. And it's very flexible.
Jenkins has been mentioned by quite a few. You can go ground-up with scripts, but Jenkins will provide you with all the same flexibility with less overhead getting it together.
This is where virtual machine images come in handy. You can setup your clean image and have every machine launch a fork of that. The original image is never modified, but your testing won't know the difference. You should definitely be able to get a bootstrap image running in a minute's time.
If you're looking for a running multiple machines at once, check out Nimbula (I'm being shameless; I work for them). For smaller deployments, it's free and lets you pull together your own private cloud for testing... or anything else. Between Jenkins and an orchestration file, you can spin up host servers, test clients, and everything else to automatically run the full gammut of testing code without any interaction.