OpenStack Cloud Deployments Made Easy–Heat Plugin for CloudifyPosted By: Yoram Weinreb on September 16, 2014
OpenStack Heat makes orchestrating the deployment of multiple OpenStack elements a breeze using its “stack” concept.
By defining a HOT (Heat Orchestrating Template) document that describes the stack and “creating” the stack based on the document, Heat will orchestrate the deployment of many elements including networks, subnets, ports, floating IPs, security groups, servers and much more.
Cloudify can harness Heat to bring up the hardware stack and basically continue from where the Heat deployment ends, adding software deployment workflows, monitoring and analytics for ongoing management of your deployments, on top of it.
In this post, I will explain as well as show a live example of one aspect of the integration that lets Cloudify “import” the Heat stack and build a Cloudify blueprint (that is TOSCA inspired) on top of it.
OpenStack Heat orchestration to the max. Get Cloudify. Go
First, we define a Heat stack and deploy it. The blueprint we will use describes the network, subnet, port and floating IP. It builds upon a pre-existing router and public network, which we will supply as parameters for the stack. We can either change the default value in the file or add an environment file to the deployment that will set these parameters. In our case, let’s change the default values.
Once this is ready, we can deploy it from the command line, or if we have the OpenStack environment set up in our system, or we can log into OpenStack web UI (Horizon) and go to the project=>Orchestration section.
Run the create stack command from the UI or just type:
Heat stack-create –f ./simple_stack.yaml my_stack_name
or check the web UI to make sure the stack deployment completed successfully.
Once the stack is deployed, we can run the process to import it into Cloudify.
Get the tool by running:
git clone email@example.com:yoramw/Cloudify-Heat-Plugin.git
Update the mapping file heat_mappings.json with the Cloudify management network name and the stack name.
Run the import utility:
./bin/heat_resource_fetcher -s hello_stack -m ./heat_mappings.json –output-file ./out.yaml
The out.yaml output will become the basis of our Cloudify blueprint.
Viewing the out.yaml file, we can see the different Heat element in their Cloudify representation.
In order to build the Cloudify blueprint from the out.yaml, we simply open it and add the out nodes and their relationships.
In our example, we will add a simple Python web server node that will be deployed on top of the server instance called “my_instance” that was deployed by Heat.
This server uses the Cloudify Bash plugin, so we will first add an import for this plugin in the imports and type definition sections:
# A web server configured with bash scripts
Then we will add at the end of the file, the web server node itself:
- name: http_web_server
– type: cloudify.relationships.contained_in
The web server deployment depends on a few Bash scripts and web resources. We will save this updated file into a new folder naming the file blueprint.yaml. To the same folder we will download the rest of the required resources from here.
Next we need to bootstrap the Cloudify manager into our cloud.
Download Cloudify if you do not already have it and run the following command:
cfy init openstack
A config file named Cloudify-config.yaml was generated.
Open the config file and update the parameters to suit your environment (mainly the credentials, image ID, flavor and public network).
In our case we want Cloudify to be deployed on the network Heat generated so we will update the network & subnet to the ones Heat deployed:
Next we will run the bootstrap process:
It will take a couple of minutes for the Cloudify management node to complete its provisioning.
Once it is done, we can verify that the server is ready, by running:
All services should appear as running. This leads us to the next step of uploading the blueprint we generated:
cfy blueprint upload –b hello_stack ./myblueprintfolder/blueprint.yaml
Once we uploaded the blueprint successfully, we can create an instance of a deployment from this blueprint reference:
cfy deployments create –b hello_stack –d my_stack
In order to start the deployment workflow we issue the following command:
cfy deployments execute –d my_stack install
The deployment process should take a few minutes and in the meanwhile, it is a good idea to open the web UI and view the deployment progress. It is available by typing the server IP (from the bootstrap command) in the browser.
Once all is done, you can see that Cloudify shows the Heat deployed elements representation in Cloudify with the corresponding relationships.
In addition, you can see the Cloudify deployed Python web server contained inside the Heat deployed server instance.