[Tutorial] Adding a Cartridge to Stratos

  • By Udara Liyanage
  • 8 Apr, 2014


Before creating the cartridge, puppet master has to be configured by using the following link; Apache Stratos Puppet Master setup guide

Live terminal recording of configuring a puppet master can be found through the link; live terminal recording of setting up

Let’s assume, the puppet master was configured with the values,

PUPPETMASTER-DOMAIN= puppet.udara.com


Adding a cartridge to Stratos

  1. Create an ubuntu VM in Openstack
    1. Select the image with the OS and click Launch
    2. This will lead to a popup window called Launch instance where the Flavor has to be selected
    3. Choose a key pair
  2. Log in to the machine created via SSH
  3. ssh -i udara.pem [email protected]

  4. Install unzip
  5. sudo apt-get install unzip

    This step is carried out to extract the Stratos Cartridge Agent before installing the Cartridge Agent

  6. Create the configuration script in the path; /root/bin/config.sh with the content copied from this configuration file.
  7. vim /root/bin/config.sh

    Copy the content.

    Make the script executable

    chmod +x /root/bin/config.sh

    This script installs the service you want (PHP in this case) and install and start the Puppet agent. Then puppet agent connects to puppet master and installs the other required software such as Apache2, PHP, Java and Stratos cartridge agent, etc.

  8. Create the init script in /root/bin/init.sh with the content at this init script.

    Copy and paste the content.

    Make the script executable

    chmod +x /root/bin/init.s

  9. Create the puppet-install script in /root/bin/puppetinstall/puppetinstall with the content at this script.
  10. vim /root/bin/puppetinstall/puppetinstall

    Copy and paste the content

    Make the script executable

    chmod +x /root/bin/puppetinstall/puppetinstall

  11. Create the configuration file /root/bin/stratos_sendinfo.rb with the content of stratos_sendinfo.rb
  12. Now execute the config.sh
  13. cd /root/bin


    For the questions prompt in this step should be answered with the following values;

    Since we are going to make a PHP cartridge


    As we set up the puppet master in the machine which has the IP address of192.168.18.134

    puppet master IP=

    As we setup the puppet master with the hostname

    puppet master hostname = puppet.udara.com

    [email protected]-cartridge:~/bin# ./config.sh

    This script will install and configure puppet agent, do you want to continue [y/n]y

    --2014-04-01 04:04:52--

    Connecting to connected.

    HTTP request sent, awaiting response... 404 Not Found

    2014-04-01 04:04:52 ERROR 404: Not Found.

    Please provide stratos service-name:php

    Please provide puppet master IP:

    Please provide puppet master hostname [puppet.stratos.org]:puppet.udara.com

    This process may take some time. You may have to wait, till the process complete.

    A log similar to below will be seen, once the above process is completed.

    Info: Creating state file /var/lib/puppet/state/state.yaml

    Notice: Finished catalog run in 2367.76 seconds.

  14. Create the Snapshot
  15. Now the machine is ready to become a cartridge. Required software is installed and configurations have been completed.

    Click on Create Snapshot button

    Save snapshot with a preferred name

    Snapshot is waiting to be created

    When the snapshot creation is completed, click on the snapshot to find details about it. The most important information is the ID of the image (snapshot).

    When a PHP runtime is required, the user has to subscribe to a PHP cartridge in Stratos. When a PHP cartridge is subscribed, behind the scene, Stratos creates an instance from the image ID retrieved earlier. Since PHP is already installed and configured at the snapshot creating stage, PHP runtime will be available when Stratos spawn an instance from that snapshot.

Deploy the cartridge JSON in Stratos

Below is the cartridge JSON which is need to be deployed in Stratos. It is notable that the image ID is same as the snapshot ID, created above.

     "type": "php",
     "provider": "apache",
     "host": "udara.com",
     "displayName": "PHP",
     "description": "PHP Cartridge",
     "version": "5.0",
     "multiTenant": "false",
     "portMapping": [
           "protocol": "http",
           "port": "80",
           "proxyPort": "8280"
           "protocol": "https",
           "port": "443",
           "proxyPort": "8243"
     "deployment": {
      "iaasProvider": [
         "type": "openstack",
         "imageId": "RegionOne/ac859fc9-d0dc-4f4fb084-bada02ad5129",
         "maxInstanceLimit": "5",
         "property": [
            "name": "instanceType",
            "value": "RegionOne/4"
            "name": "keyPair",
            "value": "stratos-s4"

Please refer to the cartridge deployment guide of Stratosfor more information.