Skip to content

Example golang Cumulocity microservice starter project

License

Notifications You must be signed in to change notification settings

reubenmiller/go-c8y-starter

Repository files navigation

Introduction

A Cumulocity microservice starter project written in go (golang).

The project uses the unofficial github.com/reubenmiller/go-c8y Cumulocity client modules.

Getting Started

Starting the app locally

  1. Clone the project

    git clone https://github.com/reubenmiller/go-c8y-starter.git
    cd go-c8y-starter
  2. Create an application (microservice) placeholder in Cumulocity with the requiredRoles defined in the cumulocity.json

  3. 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 = ""
  4. Start the application

    go run cmd/main/main.go

Known Issues

  • 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.

Build

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

About

Example golang Cumulocity microservice starter project

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published