woe-sim
woe-sim copied to clipboard
Where On Earth IoT devices activity simulator
Where on Earth Simulator (woe-sim) Microservice
This microservice simulates geographically distributed IoT devices. This service simulates the creation, state, and deletion of IoT devices.
Via the map UI provided by the woe-twin microservice, requests to create and delete IoT devices or requests to change the state of existing devices are processed by this microservice. These processed requests are then sent as simulated device telemetry messages to the woe-twin microservice.
-
Where on Earth Simulator (woe-sim) Microservice
-
Deploy the woe-sim microservice
- Setup a Kubernetes cluster
- Create the Kubernetes namespace
- Setup a database for the woe-sim microservice
- Setup Docker repository
- Build and push the Docker image
- Deploy the Docker image to the Kubernetes cluster
- Check if the pods are running
- Create a Load Balancer to enable external access
- Design notes
-
Deploy the woe-sim microservice
Deploy the woe-sim microservice
Follow these instructions for installing and running the woe-sim microservice.
First, clone the weo-sim Github project.
git clone https://github.com/mckeeh3/woe-sim.git
Setup a Kubernetes cluster
See Setup Kubernetes for instructions on setting up a Kubernetes cluster in various environments.
Create the Kubernetes namespace
The namespace only needs to be created once.
kubectl create namespace woe-sim
namespace/woe-sim created
Set this namespace as the default for subsequent kubectl
commands.
kubectl config set-context --current --namespace=woe-sim
Context "kind-kind" modified.
Setup a database for the woe-sim microservice
See Setup a database for instructions on setting up a Cassandra or PostgreSQL database in various environments.
Setup Docker repository
See Setup a container registry for instructions on setting up a Docker image registry.
Build and push the Docker image
From the woe-sim project directory.
Build the project, which will create a new Docker image.
mvn clean package docker:push
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 36.566 s
[INFO] Finished at: 2021-05-22T14:59:56-04:00
[INFO] ------------------------------------------------------------------------
Deploy the Docker image to the Kubernetes cluster
Select the deployment file for the database environment that you are using.
For Cassandra deployed to the Kubernetes cluster using helm.
kubectl apply -f kubernetes/woe-sim-helm-cassandra.yml
For PostgreSQL deployed to the Kubernetes cluster using helm.
kubectl apply -f kubernetes/woe-sim-helm-postgresql.yml
deployment.apps/woe-sim created
role.rbac.authorization.k8s.io/pod-reader created
rolebinding.rbac.authorization.k8s.io/read-pods created
Check if the pods are running
This may take a few moments.
kubectl get pods
NAME READY STATUS RESTARTS AGE
woe-sim-77dfcc864b-6cvrg 1/1 Running 0 3h10m
woe-sim-77dfcc864b-trmz7 1/1 Running 0 3h10m
woe-sim-77dfcc864b-vf78s 1/1 Running 0 3h10m
Create a Load Balancer to enable external access
See Setup a load balancer for instructions on setting up a Kubernetes load balancer in various environments.
Next, deploy the woe-twin microservice.
Design notes
TODO