Description: The Simulator webapp is a simple python (3.7) flask web app exposing a REST POST end point to control the type of simulation to run and to produce Reefer telemetry events to kafka reeferTelemetry topic.
This microservice has been implemented using the Appsody Python Flask stack.
Github repository: refarch-reefer-ml
Kafka topics consumed from: None
Kafka topics produced to:
Events reacted to: None
EDA Patterns implemented: None
Appsody will build the application by pulling the contents of the Appsody Stack it is based on and then performing the local application build inside the containerized environment:
appsody build -t <yournamespace>/kcontainer-reefer-simulator-appsody[:tag] [--push]
- You can optionally specify a container tag. If left blank,
latestwill be used.
- You can optionally supply the
--pushflag to automatically push the built image to specified remote repository.
Performing an Appsody build will update the
app-deploy.yaml file in the same directory with current information for the application image, labels, and annotations fields.
The following deployment parameters are defined in the
|KAFKA_BROKERS||YES||Comma-separated list of Kafka brokers to connect to|
|KAFKA_APIKEY||NO||API Key used to connect to SASL-secured Kafka brokers. This is required when connecting to IBM Event Streams clusters.|
|KAFKA_CERT||NO||The local path to the required certifcate file when connecting to IBM Event Streams on CP4I. See Volume Mounts below.|
|CONTAINER_TOPIC||YES||The topic name used for communication relating to the containers entity.|
|TELEMETRY_TOPIC||YES||The topic name used for communication relating to the reefer telemetry entity.|
The Voyage Management microservice requires up to one file to be injected at runtime for proper operation. As noted in the
KAFKA_CERT parameter above, these files are SSL-based certificates which are required to verfiy the identity of the external service when calling it. These files are provided as
--docker-options "-v host-src:container-dest ..." when running the microservice locally and as a Volume Mount when running the microservice on a Kubernetes cluster.
KAFKA_CERT parameter is documented in the Event Streams Certificates section of the Prerequisites page. The Appsody run command should include a parameter similar to
-v /Users/myuser/Downloads/es-cert.pem:/certs/es-cert.pem in its
--docker-options string to run this microservice locally.
appsody run --docker-options "-v /Users/myuser/Downloads/es-cert.pem:/certs/es-cert.pem" ...
When running the microservice locally, you must specify all the required deployment parameters from above as environment variables via the
--docker-options flag being passed in from the Appsody CLI command.
appsody run --docker-options "-e KAFKA_BROKERS=remotebroker1:9092,remotebroker2:9092 -e CONTAINER_TOPIC=containers -v /Users/myuser/Downloads/es-cert.pem:/certs/es-cert.pem" ...
The Appsody Operator is a required prerequisite for deploying the microservice to a remote Kubernetes or OpenShift cluster.
To deploy the microservice to a remote cluster:
appsody deploy <yournamespace>/kcontainer-reefer-simulator-appsody[:tag] --no-build
- You can omit the
--no-buildflag to have Appsody perform a build before deploying the application.
- Note: Performing a build at deploy time requires specifying the absolute container reference path, as well as the
- The neccesary deployment parameter information will be read from the
app-deploy.yamlfile in the same directory.