Tutorial: Customizing your Scalarium Cloud using Chef

Scalarium brings a lot of sensible defaults when it comes to provisioning your instances, but at the same time allows you to fully customize your cloud to your needs, overwriting our defaults, and specifying your own
configuration templates to override ours. For all this we're using Chef, an open-source
tool for infrastructure management.

It is however sometimes not obvious just how much power Scalarium gives you with the above combination, so in this
tutorial we're going to show you how to fully set up and customize a cloud from scratch by adding a
Redis server to the mix, automating installation and configuration of server and clients. We'll cover everything you need to know to customize your cloud accordingly step by step. We're starting below, but here's the table of contents:

1. The Scalarium Lifecycle System
2. Cooking with Chef
3. Writing a Cookbook to set up Redis
4. Configuring Custom Cookbooks
5. Overriding Default Attributes
6. Configuring the Clients
7. Deploying an Application
8. Wrapping up

While we're going to set up Redis and a Rails application, everything is easily applicable to other components. I'm
going to explain some of the Chef essentials and Scalarium's instance lifecycle along the way, so you'll walk away with
enough knowledge to start customizing your clouds as you like. There'll be code and screenshots, explaining all the
steps required. Sign up for a Scalarium account if you haven't already.

First up, we're going to create a new cloud with two roles, one for the Rails application server, and one for Redis.
While Scalarium makes it easy to have both running on the same instance, we'll break them up into two for the heck of
it. The role for the Rails application server is the default, so go ahead and add it.

Add Rails Application Server role

Now, add a second role called "Redis" with the short name "redis". The short name will be used to identify instances of
this role from within Chef, so you can pick out instances of a specific role when provisioning or configuring your
instances. But more on that later. First, let's add the role. Select "Custom Role" from the select box and add "Redis"
and "redis" as name and short name respectively.

Add Redis Server

Now, add an instance to each role, but don't start them up just yet. By default, the Rails application server will be
provisioned to run an Apache server and Passenger to serve Rails applications. The Redis server will be blank without us
specifying a dependency or better yet, a custom setup for the role. Before we start building custom cookbooks, which are
the way to do that, let's look at what happens when you start an instance, and during its lifetime.

Next step: The Scalarium Lifecycle System