Description | Add a cartridge definition. |
Resource Path |
|
HTTP Method | POST |
Request/Response Format |
|
{ "type": "php", "provider": "apache", "category": "data", "host": "php.stratos.org", "displayName": "php", "description": "php Cartridge", "version": "7", "multiTenant": "false", "portMapping": [ { "name": "http-80", "protocol": "http", "port": "80", "proxyPort": "8280" }, { "name": "http-22", "protocol": "tcp", "port": "22", "proxyPort": "8222" } ], "deployment": { }, "iaasProvider": [ { "type": "mock", "imageId": "RegionOne/b4ca55e3-58ab-4937-82ce-817ebd10240e", "networkInterfaces": [ { "name": "network-non-routable", "networkUuid": "b55f009a-1cc6-4b17-924f-4ae0ee18db5e" } ], "property": [ { "name": "instanceType", "value": "RegionOne/aa5f45a2-c6d6-419d-917a-9dd2e3888594" }, { "name": "keyPair", "value": "reka" }, { "name": "securityGroups", "value": "default" } ] } ] }
In Stratos 4.1.1, you can specify the kubernetesPortType
as NodePort
or ClusterIP
in Port Mapping.
Access URLs are generated only for the NodePort
service type.
{ "type": "php", "category": "framework", "provider": "apache", "host": "stratos.org", "displayName": "PHP", "description": "PHP Cartridge", "version": "7", "multiTenant": true, "loadBalancingIPType": "private", "metadataKeys": [], "portMapping": [ { "name": "http-80", "protocol": "http", "port": 80, "proxyPort": 8280, "kubernetesPortType": "" }, { "name": "http-80", "protocol": "https", "port": 443, "proxyPort": 8243, "kubernetesPortType": "" } ], "iaasProvider": [ { "type": "mock", "imageId": "ap-southeast-1/ami-2e0d5a7c", "property": [ { "name": "instanceType", "value": "m1.medium" }, { "name": "keyPair", "value": "xxxxxxxx" } ], "networkInterfaces": [ { "networkUuid": "fb9c21f4-0672-48b2-8279-77334bb63a53" }, { "networkUuid": "1e43f86f-4165-4f2e-8017-dd4cfb5548b0" } ] }, { "type": "kubernetes", "imageId": "stratos/php:4.1.0", "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" } ], "networkInterfaces": [] } ] }
For information on all the properties that can be used in a cartridge definition, see the Cartridge Property Definitions.
> POST /api/cartridges HTTP/1.1
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8| zlib/1.2.5
> Host: localhost:9443
> Accept: */*
> Content-Type: application/json
> Content-Length: 1232
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
< HTTP/1.1 201 Created
< Date: Sat, 21 Mar 2015 00:17:44 GMT
< Location: https://localhost:9443/api/cartridges/php
< Content-Type: application/json
< Transfer-Encoding: chunked
< Server: WSO2 Carbon Server
<
{"status":success,"message":"Cartridge added successfully: [cartridge-type] php"}
curl -X POST -H "Content-Type: application/json" -d @'<JSON_PAYLOAD>' -k -v -u admin:admin https://<STRATOS_HOST>:<STRATOS_HTTPS_PORT>/api/cartridges
<JSON_PAYLOAD>
value.
<STRATOS_HOST>
is localhost.
However, if you are using a public IP, the respective IP address or domain needs to be specified.<STRATOS_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
.
For example:
cd <STRATOS_SOURCE_HOME>/samples curl -X POST -H "Content-Type: application/json" -d @'cartridges/mock/php.json' -k -v -u admin:admin https://localhost:9443/api/cartridges
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 |
HTTP status code | 100, 201, 400, 409, 500 |
Location header URL |
|