This SDK is a small Cumulocity wrapper around the tornado python web framework. It simplifies the development of small docker based microservies designed to be hosted on top of Cumulocity IoT.
$ docker build . -t <microservice-name>
$ docker save <microservice-name>:latest > image.tar
$ zip <microservice-name>.zip image.tar cumulocity.json
Every microservice in Cumulocity has unique bootstrap credentials that in the cloud are automatically injected. In order to run the docker locally you will need to inject those environment variables so it can connect to your Cumulocity tenant in the cloud.
You can either just upload the zip once or you can create an empty application via REST.
If you chose the way via REST the response on creation will contain the ID otherwise you can also see it in the URL while you are on the detail page of your application (e.g. /apps/administration/index.html#/applications/1337/properties)
You can retrieve the bootstrap credentials with the following request:
GET /application/applications/{{applicationId}}/bootstrapUser
The response will look similar to this:
{
"name": "servicebootstrap_my-microservice",
"password": "test1234",
"tenant": "mytenant"
}
In order to run the docker locally you will need to add the 3 values for the bootstrap credentials, the Cumulocity url to connect to and you need to expose the port 80 to a port on your host system. Examples:
docker run -p 8080:80 -e C8Y_BOOTSTRAP_TENANT=mytenant -e C8Y_BOOTSTRAP_USER=servicebootstrap_my-microservice -e C8Y_BOOTSTRAP_PASSWORD=test1234 -e C8Y_BASEURL=https://mytenant.cumulocity.com <microservice-name>