Deploys Mantis and necessary services with Helm and Kubernetes.
By default, the chart starts the following services:
- Mantis Control Plane - This is the main service that runs the Mantis Control Plane.
- Mantis API - This is the API service that exposes Mantis API.
- Mantis Agent - Two mantis agents are started by default. These are the agents that run the Mantis jobs.
- Mantis Publisher - This is a sample service that publishes events to Mantis.
These steps use minikube to deploy Mantis locally. You can use any Kubernetes cluster to deploy the Mantis chart.
- Install Docker Desktop
- Install minikube
- Install helm
-
Start minikube
minikube start
-
Point docker-cli to Docker running in minikube
eval $(minikube -p minikube docker-env)
From this point on,
dockercommand points to minikube's Docker instance. -
Use Helm to deploy the Mantis stack on minikube
cd mantis-stack helm upgrade --install mantis-stack .
-
You can now look at minikube dashboard via the following command to verify if all the pods are running successfully. The pods may take a few minutes to start up.
minikube dashboard
-
By default, the Mantis stack starts the
SharedMrePublishEventSourcesource job that allows services to publish events to Mantis. You can verify that the job is running successfully by looking at the Mantis UI. For this, set up port-forwarding to the Mantis API service. Mantis API service is exposed on port 7001. You can port-forward a local port to port 7001 of container usingkubectl port-forward deployment.apps/mantis-api 7001
You can now access Mantis UI with
http://localhost:7001as theMantis Master API URL. You can verify that theSharedMrePublishEventSourcejob is running successfully by looking at the Jobs tab in the UI or by looking at the job cluster status on the Job Cluster Page. -
You can now run MQL (Mantis Query Language) queries against the Mantis Publisher service to verify that the events are being published. For this, let's run the following queries which should only propagate android events from the publisher service.
SELECT * FROM defaultStream where e["deviceType"] == "android"
To run the query, you can use the MQL Query UI on the Job Cluster Page.
http://localhost:7001/api/v1/jobconnectbyid/SharedMrePublishEventSource-1?clientId=sundaram&subscriptionId=sundaram&criterion=SELECT%20%2A%20FROM%20defaultStream%20where%20e%5B%22deviceType%22%5D%20%3D%3D%20%22android%22
-
We need a Docker registry to host the images that can be read from within the minikube cluster. To achieve this, start a local Docker registry in minikube Docker (the
dockercommand is talking to minikube Docker)docker run -d -p 5001:5000 --restart=always --name registry registry:2
We tunnel port
5001to5000, you can choose any available port. -
Build Docker images from your checked out version of Mantis codebase. The images are automatically pushed to the local Docker registry used by Minikube as long as the shell has Minikube’s environment.
# Run this command from mantis root directory ./gradlew dockerPushImage -
Make local changes to
mantis-controlplane/values.yamlto fetch local image. Update theimagevalue:image: localhost:5001/netflixoss/mantiscontrolplaneserver:latest -
Update Helm charts to pick up
values.yamlchanges# Run this command from mantis-stack directory helm dependency update -
Verify the services are running with Kubernetes CLI
kubectl get all
- To make calls to mantis-master, you can port-forward a local port to port 8100 of container using
kubectl port-forward deployment.apps/mantis-controlplane 8100