Overview
Cloudify and Opscode Chef work together to provide the greatest high qualify recipe/cookbook coverage for deployment that is possible. Cloudify works with Chef by delegating the installation (and potentially startup) phases of recipe lifecycle to Chef for individual services. Cloudify takes care of full application deployment and coordination, as well as monitoring as scaling.
This is great as far as it goes, but some shops have standardized on Chef for deployment, which makes bootstrapping Cloudify itself a problem. To unravel this conundrum, I recently authored a Chef cookbook that bootstraps Cloudify on a specified host.
The Cookbook
Creating the cookbook for Chef to deploy (and start) Cloudify management, for the most part, boils down to templating Cloudify’s “cloudify_env” script (a script not typically noticed by Cloudify users), and the individual cloud driver scripts for the various providers. The initial recipe was done for HP Cloud Services (HPCS), and uses it as the “default” recipe. The recipe (recipes/default.rb) assumes that the node is an HPCS Linux node (tested on Ubuntu 12). The recipe moves a few static files into a working directory and builds cloudify_env.sh and hp-cloud.groovy from their respective templates. All templates are driven by the default attributes file.
These attributes are equivalent to what is currently found in the hp-cloud.properties file in the hp-cloud cloud driver configuration, with a few additions to configure the operation of the Chef recipe itself (such as a working directory).
As with the HP cloud driver config, there are some key properties that must be set for the recipe to work, and a private key file that must be configured. Key settings:
- link – The URL for the Cloudify distro
- clouduser – Your API key
- cloudtenant – Your tenant ID (an hpcloud email address)
- keyfile – The private key file. This file must be placed in the recipe “files/default/upload” directory.
- keypair – The name of your private key. Typically the file name with “.pem” stripped.
- securitygroup – The name of the security group to use.
Once these are set properly, the recipe will start Cloudify management, including the REST API and the web UI.
Conclusion
This cookbook “closes the loop” on standardized devops automation for Cloudify. Whereas before Cloudify delegated to Chef for deployment support, now Chef can bootstrap Cloudify, which can then use Chef to deploy recipes, potentially using the same Chef server that Cloudify’s bootstrap was defined in. This recipe has some limitations besides only being tried on HPCS. For example, it doesn’t include provisions for deploying a cluster of Cloudify management machines. The cookbook is available on github.