Thursday, August 29, 2013

Create OpenStack Tomcat Cartridge in Apache Stratos


A Cartridge is a package of code or configuration that plugs into Stratos to offer a new PaaS Service. A Cartridge is also a Virtual Machine (VM) image plus configuration and it can operate in two modes that are namely single tenant and multi-tenant.

For more information see Cartridges.

Before create the cartridge you have to make the OpenStack image.

Create OpenStack image to support Tomcat
  • First you have to download ubuntu cloud image and upload it to OpenStack. You can download ubuntu cloud images from here.
  • After that you have to upload that image to OpenStack. Please refer creating OpenStack images for more details.
  • After successfully upload the cloud image to OpenStack you can launch instance from that image.
  • Now you need to setup the instance for Tomcat. To do that you have to install following software to that instance. You can do it by ssh to that instance.
    • java 1.6.x - refer here for more details
    • tomcat7
    • git
    • ruby
    • thrift - refer here for more details
    • xml_grep - use sudo apt-get install xml-twig-tools
  • Installing tomcat7 will install several java versions. But to this installation you need java 1.6.x. To set this as default you can use following commands.
    • sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.x/jre/bin/java" 1
    • sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.x/bin/javac" 1
    • sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.6.x/jre/bin/javaws" 1
  • After installing above prerequisites, you have to update /opt directory with following things.
    • get-launch-params.rb
    • cartridge_data_publisher_1.0.2
  • You can get above from apache stratos git repo.
  • After completing this your instance is ready. Now you can create the snapshot from that instance and make the image from that snapshot. Before creating the image you have to update /etc/rc.local file to trigger at the boot up time. For more details please refer here to get an idea about how to create OpenStack images.
Create Tomcat Cartridge
Now you are in the final stage of the Tomcat cartridge creation in apache stratos. Simply you can refer here to install apache stratos. After successful installation you can edit the tomcat.xml according to your IaaS image properties. You can download sample tomcat.xml file from here.

After doing that you can start Apache Stratos Controller and subscribe to the created Tomcat cartridge.


  1. Great article Manula, I think one step is missing. We need to update /etc/rc.local file to trigger at the boot up time before creating the image.

  2. Thank you very much Imesh pointing out this.

  3. it need apache2 as well, right? I followed this guide and found missing apache2 to run

  4. Open Stack Cloud Computing Online Training
    Introduction - Virtualization Overview - Software as a service - patform as a service - Infrastructure as a Service - Openstack – History and Overview - Q&A - OpenStack Architecture DeepDive - Components Overview - Keystone architecture - Nova architecture - Glance architecture - Quantum architecture - - Deploying OpenStack – Step by Step through CLI - Getting the pre-requisites right - Setting up MySQL, RabbitMQ - Setting up Keystone - Setting up Glance - Setting up Horizon - Creating accounts and users - Deploying OpenStack – Step by Step through CLI - Understanding Cloud Images and instances - Building an image for Cloud - Registering and uploading an image - Setting up Nova - Running an image - Creating keypairs, Security Groups - Managing Instances - Deploying OpenStack – Advanced - Multi-node Environment - Differences between single and multi-node setup - DevStack – Scripted installation for OpenStack - DevStack – Script Discussion - Log Files, Troubleshooting, Common Errors - Openstack API - Introduction - Nova APIs - Consuming the APIs – demo - openstackforums, User Groups, ML, Documentation - Openstack Foundation. - Employees to learn at their own pace and maintain control of learning “where, when and how” with boundless access 24/7by 21st Century Software Solutions.

  5. Create OpenStack image to support Tomcat Useful article. visit homepage