Create OpenStack Tomcat Cartridge in Apache Stratos

  • By Manula Thantriwatte
  • 3 Sep, 2013

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/jre1.6.x/bin/java" 1
    • sudo update-alternatives --install "/usr/bin/javac "javac" "/usr/lib/jvm/jre1.x/bin/javac" 1
    • sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jre1.6.x/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. 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. I can download sample tomcat.xml file from here.

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