Openstack Heat makes orchestrating the deployment of multi Openstack elements a breeze using it “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 many more.
Cloudify can harness Heat to bring up the Hardware stack and basically continue from were 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 and show example of one aspect of the integration that lets Cloudify “import” Heat stack and build a Cloudify Blueprint (TOSCA inspired) on top of it.
First, we define a Heat stack and deploy it. The we will use describes a network, subnet, port and floatingIP. It builds on pre-existing Router and public network, which we will supply as Parameters to 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 it is ready, we can deploy it from the command line (if we have the openstack environment set up on our system, or we can log into Openstack web UI (Horizon) and go to the project=>Orchestration section.
Run the create stack 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:
git clone firstname.lastname@example.org:yoramw/Cloudify-Heat-Plugin.git
Update the mapping file heat_mappings.json with 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 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 “my_instance” that Heat deployed.
This server use the Cloudify bash plugin, so we will first add am 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 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 out 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 service should appear as running, which leads us to 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 that contained inside the Heat deployed server instance.