A Cumulocity microservice starter project written in go (golang).
The project uses the unofficial github.com/reubenmiller/go-c8y Cumulocity client modules.
-
Clone the project
git clone https://github.com/reubenmiller/go-c8y-starter.git cd go-c8y-starter
-
Create an application (microservice) placeholder in Cumulocity with the requiredRoles defined in the
cumulocity.json
-
Set the microservice's bootstrap credentials (get the bootstrap credentials from Cumulocity)
Bash
export APPLICATION_NAME= export C8Y_HOST= export C8Y_BOOTSTRAP_TENANT= export C8Y_BOOTSTRAP_USER= export C8Y_BOOTSTRAP_PASSWORD=
PowerShell
$env:C8Y_HOST = "" $env:C8Y_BOOTSTRAP_TENANT = "" $env:C8Y_BOOTSTRAP_USER = "" $env:C8Y_BOOTSTRAP_PASSWORD = ""
-
Start the application
go run cmd/main/main.go
- Ctrl-c does not work to kill the application. You will have to manually stop the process by either killing your console, or the process itself.
Pre-requisites
- Install
jq
. Used to extract the microservice version from the cumulocity.json - Install
zip
. Used by microservice script to create a zip file which can be uploaded to Cumulocity
Build the Cumulocity microservice zip file by executing
make build-microservice