As you may know I'm a big fun of Continuous Integration, a.k.a CI, (running every trunk commit with some unit tests and integration tests, finding that you ruined the build and earning the blame T-shirt is such a good way to start the morning :-).
Cool things you can do with CI
However, today's CI is much more from just running several tests. These days you can do almost everything with it:
- Get your latest version from trunk.
- Build the version.
- Launch a new virtual machine based on a predefined image or by installing it almost from scratch.
- Install the version on the new machine.
- Run smoke tests to provide an instant validation of the code stability.
- Run nightly builds to carefully check that the version is clean.
- Run stress tests to validate capacity and long multiple days tests to validate memory leaks.
- Notify key players with the results.
Cloud computing is basically about obtaining on demand resources through API (the GUI is a fancy stuff that can be useful but is not really a must). Therefore, you can use CI to automate every step in your testing, upload to production and rollback when needed. Some of the scenarios are:
- Performing Software Upgrade: Launching a new instance, installing the latest software version and creating an Image (AMI in AWS).
- Launching an entire new integration environment that is identical to the production environment and check its functionality as well as its correspondence with the non functional requirements.
- Launching a new environment for marketing needs.
- Managing your new version upload, by creating a script that will prepare new servers, upgrade your database servers (or RDS), add new application and web servers to the load balancer farms, and finally will remove the old server and shut them down.
- Implement Failover scenarios (DRP)
Industry Best Practices
According to Amazon (see Jinesh Varia, Technology Evangelist @Amazon Web Services document), CI and automation is the best practice to manage your cloud environment:
- Create a management server (like CruiseControl or regular CRON jobs).
- Create a build-test-deploy cycle script using the chosen management server that will generate:
What CI to choose?
There are many CI products in the market, some of them are open source and other are commercial. Here are some of leading tools, thanks to Alon Nativ advice:
- CruiseControl: a leading open source product with dozens of plugins and 3rd parties.
- Apache Continuum: an open source product with many features.
- Final Builder: a commercial and major tool in the market with great visual interface and many built in scripts and API
- JetBrains TeamCity: a commercial tool with a built in integration to Amazon AWS.
Now after going over the details, I recommend you to:
- Design your cloud environment.
- Design your baseline AMIs/Images.
- Design your upgrade, rollback and test-build-deploy scripts based on these basic AMIs.
- Implement them using your chosen Continuous Integration tool.
- Roll it out to production.