This documentation is for WSO2 Private PaaS 4.1.0. View documentation for the latest release.
Adding a Cartridge - WSO2 Private PaaS 4.1.0 - WSO2 Documentation
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
||
Skip to end of metadata
Go to start of metadata

You can add a cartridge using the CLI tool, REST API or the PPaaS Console as shown below:

 

Adding a cartridge via the CLI

Overview
CLI command
add-cartridge
DescriptionAdd a cartridge definition.
Command format
add-cartridge -p <JSON_FILE_PATH>

The path to the JSON file that defines the cartridge needs to be defined as the  <JSON_FILE_PATH>  value.

Parameter definition
Short optionLong optionDescriptionRequiredExample value
-p
--resource-pathFolder path where the JSON file that defines the cartridge is stored.Yes
<PRIVATE_PAAS_SAMPLES>/common/samples/
cartridges/mock/wso2am-190/wso2am-190.json
Example

Add the cartridge that is defined in the <PRIVATE_PAAS_SAMPLES>/common/samples/cartridges/mock/wso2am-190/wso2am-190.json file.

add-cartridge -p <PRIVATE_PAAS_SAMPLES>/common/samples/cartridges/mock/wso2am-190/wso2am-190.json
Sample output
Cartridge added successfully: [cartridge-type] wso2am-190

Adding a cartridge via the REST API

Overview
DescriptionAdd a cartridge definition.
Resource Path

/cartridges

HTTP MethodPOST
Request/Response Format

application/json

Command format
curl -X POST -H "Content-Type: application/json" -d @'<JSON_PAYLOAD>' -k -v -u <USERNAME>:<PASSWORD> https://<PRIVATE_PAAS_HOST>:<PRIVATE_PAAS_HTTPS_PORT>/api/cartridges
  • The path to the JSON file that defines the deployment policy needs to be defined as the  <JSON_PAYLOAD> value.
  • By default, <USERNAME>:<PASSWORD> is admin:admin.
  • By default, <PRIVATE_PAAS_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
  • By default, <PRIVATE_PAAS_HTTPS_PORT> has been set to 9443. However, if the port offset has been incremented by n, the default port value needs to be incremented by n.
Example

Add the cartridge that is defined in the  <PRIVATE_PAAS_SAMPLES>/common/samples/cartridges/mock/wso2am-190/wso2am-190.json file.

cd <PRIVATE_PAAS_SAMPLES>/common/samples
curl -X POST -H "Content-Type: application/json" -d @'cartridges/mock/wso2am-190/wso2am-190.json' -k -v -u admin:admin https://localhost:9443/api/cartridges
Sample output
> POST /api/cartridges HTTP/1.1
> Host: localhost:9443
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 1170
> Expect: 100-continue
> 
< HTTP/1.1 100 Continue
< HTTP/1.1 201 Created
< Date: Tue, 06 Oct 2015 06:11:10 GMT
< Location: https://localhost:9443/api/cartridges/wso2am-190
< Content-Type: application/json
< Transfer-Encoding: chunked
< Server: WSO2 Carbon Server
< 
{"status":"success","message":"Cartridge added successfully: [cartridge-type] wso2am-190"}

You will come across the following HTTP status codes while adding a cartridge:

HTTP status code

100, 201, 400, 409, 500

See the descriptions of the HTTP status codes here.

Location header URLhttps://<STRATOS_HOST>:<STRATOS_HTTPS_PORT>/api/cartridges/<CARTRIDGE_TYPE>

Add a cartridge via the PPaaS Console

Adding a cartridge via the UI editor

Follow the instructions below to add a cartridge:

  1. Click Configurations on the home page.
  2. Click Cartridges.
  3. Click ADD CARTRIDGE.
  4. Enter the required details. For property definitions, see Cartridge property definitions.
  5. Click SAVE CARTRIDGE DEFINITION.
Adding a cartridge via the JSON editor

Follow the instructions below to add a cartridge:

  1. Click Configurations on the home page.
  2. Click Cartridges.
  3. Click ADD CARTRIDGE.
     
  4. Click on the editor control to switch to the JSON editor. The JSON code format to add a cartridge will appear.
  5. Optionally, check the Auto correct with schema option to ensure that you do not accidentally delete any mandatory fields from the cartridge definition JSON code.
     
  6. Code the cartridge definition using JSON. For property definitions, see Cartridge property definitions.
  7. Click SAVE CARTRIDGE DEFINITION.

 


Sample cartridge JSON

It is not required for you to define the name and value parameters under the property field in the cartridge definition, If you are running Private PaaS on the mock IaaS.

{
  "type": "wso2am-190",
  "category": "framework",
  "provider": "wso2",
  "host": "am.wso2.org",
  "displayName": "WSO2 AM 1.9.0",
  "description": "WSO2 AM 1.9.0 Cartridge",
  "version": "1.9.0",
  "multiTenant": true,
  "loadBalancingIPType": "public",
  "portMapping": [
    {
      "name": "mgt-https",
      "protocol": "https",
      "port": 9443,
      "proxyPort": 0,
      "kubernetesPortType": "NodePort"
    }
  ],
  "iaasProvider": [
    {
      "type": "mock",
      "imageId": "wso2/am:1.9.0",
      "networkInterfaces": [
        
      ]
    }
  ],
  "property": [
    
  ]
}

Define the values under the property field of the cartridge definition, if you are running Private PaaS on the EC2, Kubernetes or OpenStack IaaS

{
  "type": "wso2am-190",
  "category": "framework",
  "provider": "wso2",
  "host": "am.wso2.org",
  "displayName": "WSO2 AM 1.9.0",
  "description": "WSO2 AM 1.9.0 Cartridge",
  "version": "1.9.0",
  "multiTenant": true,
  "loadBalancingIPType": "public",
  "portMapping": [
    {
      "name": "mgt-https",
      "protocol": "https",
      "port": 9443,
      "proxyPort": 0,
      "kubernetesPortType": "NodePort"
    },
    {
      "name": "mgt-http",
      "protocol": "http",
      "port": 9763,
      "proxyPort": 0,
      "kubernetesPortType": "NodePort"
    },
    {
      "name": "pt-http",
      "protocol": "http",
      "port": 8280,
      "proxyPort": 0,
      "kubernetesPortType": "NodePort"
    },
    {
      "name": "pt-https",
      "protocol": "https",
      "port": 8243,
      "proxyPort": 0,
      "kubernetesPortType": "NodePort"
    }
  ],
  "iaasProvider": [
    {
      "type": "kubernetes",
      "imageId": "wso2/am:1.9.0",
      "networkInterfaces": [
        
      ]
    }
  ],
  "property": [
    {
      "name": "KUBERNETES_CONTAINER_CPU",
      "value": "0"
    },
    {
      "name": "KUBERNETES_CONTAINER_MEMORY",
      "value": "0"
    },
    {
      "name": "KUBERNETES_SERVICE_SESSION_AFFINITY",
      "value": "ClientIP"
    },
    {
      "name": "payload_parameter.START_CMD",
      "value": "PCA"
    },
    {
      "name": "payload_parameter.CONFIG_PARAM_PROFILE",
      "value": "Default"
    },
    {
      "name": "payload_parameter.CONFIG_PARAM_APIMGT_DB_URL",
      "value": "jdbc:mysql://192.168.30.7:3306/apim_db"
    },
    {
      "name": "payload_parameter.CONFIG_PARAM_DB_USER_NAME",
      "value": "root"
    },
    {
      "name": "payload_parameter.CONFIG_PARAM_DB_PASSWORD",
      "value": "root"
    },
    {
      "name": "payload_parameter.CONFIG_PARAM_LB_IP",
      "value": "127.0.0.1"
    }
  ]
}
  • No labels