Nodejs blogging app

Check it out

See the Repository

This project has evolved from a job interview task, where I had to implement hello world app that may be containerized and deployed to a kubernetes along with metrics. App includes:

  • server.js is an entrypoint that has an export enpoint available at /metrics for prometheus
  • Dockerfile for app dockerization
  • Dockerfile has a healthcheck of an app for kubernetes
  • test folder contains mocha helloworld test for CI
  • docker-compose.yml that brings up prometheus and grafana containers along with the container for the app itself.
  • prometheus.yml configuration file
  • grafana folder with mountpoints and a dashboard
  • public/ folder with bootstrap and other assets
  • deployment-kube.yml for app deployment to a kuberenetes cluster or minikube

The app is being built after a commit is pushed to a Github repo. Webhook is issued to the Jenkins instance.

Jenkins runs an item "nodejs_blogapp" that runs a helloworld mocha test and triggers another item "deploy_nodejs_blogapp" that ssh'es to the baremetal machine using a preinstalled key and issues git pull and rebuilds the docker image.

The script filters the container ID by the tag name and removes it. New one is built instead. The connections are handled by the reverse proxy