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 |
Description | Add 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 |
Parameter definition
Short option | Long option | Description | Required | Example value |
---|---|---|---|---|
-p | --resource-path | Folder path where the JSON file that defines the cartridge is stored. | Yes | <PRIVATE_PAAS_SAMPLES>/common/samples/ |
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
Description | Add a cartridge definition. |
Resource Path |
|
HTTP Method | POST |
Request/Response Format |
|
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
|
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 URL | https://<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:
- Click Configurations on the home page.
- Click Cartridges.
- Click ADD CARTRIDGE.
- Enter the required details. For property definitions, see Cartridge property definitions.
- Click SAVE CARTRIDGE DEFINITION.
Adding a cartridge via the JSON editor
Follow the instructions below to add a cartridge:
- Click Configurations on the home page.
- Click Cartridges.
- Click ADD CARTRIDGE.
- Click on the editor control to switch to the JSON editor. The JSON code format to add a cartridge will appear.
- 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.
- Code the cartridge definition using JSON. For property definitions, see Cartridge property definitions.
- 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" } ] }