Code Monkey home page Code Monkey logo

cv-example-app's Introduction

Harness Continuous Verification Example Application

Thanks for checking out the Harness Continuous Verification Sample Application. This application is designed to be run in conjunction with a Prometheus Health Source with Harness.

What The Example Application Does

  • Generates Metrics to default Micrometer [Spring Boot] Prometheus Registry.
  • Has a 'stable' and 'unstable' version. Can be triggered via a Docker Tag e.g during a deployment or on-the-fly via the REST endpoints.

Modifying Application

Can modify this application to test out your needs. A few items that are needed.

  • OpenJDK 19 - brew install openjdk
  • Maven 3 - brew install maven

Running Locally

mvn spring-boot:run

Can toggle explore the endpoints:

  • localhost:8082
  • localhost:8082/actuator
  • localhost:8082/actuator/prometheus
  • localhost:8082/run-unstable
  • localhost:8082/run-stable

Docker Build

Can have two tags, for stable and unstable. Can change the entry point [comment/un-comment] which first metric to use -> main/src/main/java/io/harness/cv/example/app/CvExampleApp.java and re-build and re-push to a Docker Registry of your choice.

  • Docker Install - brew install docker
docker build --platform linux/amd64 -t rlachhman/cv-example-app:stable .
docker push rlachhman/cv-example-app:stable  

docker build --platform linux/amd64 -t rlachhman/cv-example-app:unstable .
docker push rlachhman/cv-example-app:unstable  

Deploying to Kubernetes with Harness

Can leverage the harness-cv-example-deployment.yaml and values.yaml to deploy in Harness to pick the specific stable or unstable tag. The Deployment YAML also creates a LoadBalancer Service. With a public cloud this can be a public IP or using something locally like Minikube can run minikube tunnel and head to the public IP e.g kubectl get services. This is most likely local host or 127.0.0.1:8082] to view the application.

Installing Prometheus

Installing Prometheus from Helm is easy.

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts

helm repo update

helm upgrade --install prometheus prometheus-community/prometheus \
--namespace prometheus --create-namespace

For an example, you can also expose over NodePort.

kubectl expose deployment -n prometheus prometheus-server --type=NodePort --name=prometheus-service

Then browse to node_public_ip:nodeport.

e.g

#Node External IP
kubectl get nodes -o wide

#NodePort for prometheus-service
kubectl get svc -n prometheus

Metrics

There are two metrics that can be modified.

  • CV_Counter_Example_total
  • CV_Gauge_Example{}

In the stable version these are flat. In the un-stable versions these metrics increment up every 15 seconds. Can modify src/main/java/io/harness/cv/example/app/GenerateUnstableMetrics.java and change the amount, time, or add another Actuator Metric which will be wired to Prometheus for you.

cv-example-app's People

Contributors

ravilach avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.