Creating a New Cartridge
You can create a cartridge on a Virtual Machine (VM) or Docker. The following section describes the process involved in creating a cartridge:
Creating a cartridge on a Virtual Machine
The following section describes how to create a cartridge using Puppet, which is an open source configuration management utility. If required, you can use other tools, i.e, Chef, with WSO2 Private PaaS, as the orchestration layer to automate the configuration process of all cartridges.
Step 1: Create a Puppet Module
- Create Puppet scripts based on the cartridge that is being created. The Puppet scripts will define the relevant cartridge software (i.e., server software and dependent software) that are required for the cartridge.
Deploy the Puppet scripts in Puppet Master. Puppet Master will be used by all the cartridges in a WSO2 Private PaaS deployment.
Puppet Master needs to be configured prior to deploying the Puppet scripts.- If a Generic cartridge image already exists, move to step 3.
Step 2: Create a cartridge base image
For more information on creating a cartridge base image on a preferred IaaS, see: EC2, OpenStack and GCE
Step 3: Define the cartridge definition and add the cartridge
Define a cartridge definition in a JSON file. Add the cartridge either via the REST API, the CLI tool or the Private PaaS Console. For more information, see Adding a Cartridge.
Creating a cartridge on Docker
The following section describes how to create a cartridge on Docker. WSO2 Private PaaS uses Kubernetes to manage Docker containers.
Step 1: Create a base image
- Implement a Docker file.
Copy the Cartridge Agent (CA) and the required software to a preferred location. The Cartridge Agent should startup along with the container. Build a Docker image.
docker build -t wso2/base-image:4.1.0 .
List the Docker images using the following command and get the Docker
image ID
of the required Docker image.docker images
- Pull the Docker image to all the Kubernetes minions in the Kubernetes Cluster.
The docker image could be pulled using either of the following methods:If you are using the Docker hub, execute the
docker pull
command.docker pull <DOCKER_IMAGE_ID>
- Else export the Docker image to a
.tar
file.Save the new image to a
.tar
file.docker save <NEW_IMAGE_NAME> > <LOCATION_OF_OF_TAR_FILE>
For example:
docker save myppaasimage > /tmp/myppaasimage.tar
Copy the TAR (
myppaasimage.tar
) file to your new Docker instance.docker load < <LOCATION_OF_OF_TAR_FILE>
For example:
docker load < /tmp/mynewimage.tar
Step 2: Define the cartridge definition and add the cartridge
Define a cartridge definition in a JSON file. Add the cartridge either via the REST API, the CLI tool or the Private PaaS Console. For more information, see Adding a Cartridge.
Include the respective Docker image ID
found in step 1.4 in the cartridge definition.