/atg-test-01

ATG Test

Primary LanguageJavaScript

Sample Scalable Application on Kubernetes Cluster

A web application, written in NodeJS to upload, parse and process CSV files and store in S3 Bucket.

What's needed

Development

  • Cloning the repo
$ git clone https://github.com/danishbacker/atg-test-01
  • Installing dependencies
$ npm install

Docker

  • Building an image
$ docker login
$ docker build -t danishbacker/atg-test-01:prod .
  • Running containers
$ docker run -it -p 49162:3000 -d danishbacker/atg-test-01:prod
  • Push build to dockerhub
$ docker push danishbacker/atg-test-01:prod
  • Stop all containers
$ docker stop $(docker ps -a -q)

Docker Nginx Config

Note: Not working for Kubernetes deployment
TODO: Update Kubernetes Deployment and Service
  • Building an image
$ docker-compose build
  • Running containers
$ docker-compose up
  • Stopping containers
$ docker-compose down

Infrastructure

  • Starting minikube with hyperkit (recommened for mac)
$ minikube start --vm-driver=hyperkit
  • Apply
$ minikube start --vm-driver=hyperkit
  • Create or update Deployment and Serivce on Kubernetes
$ kubectl apply -f k8s
  • Update Deployment or Serivce individually
$ kubectl apply -f k8s/service.yml
  • Check deployment and services
$ kubectl get services
$ kubectl get delpoyments
$ kubectl get pods
  • Start minikube dashboard
$ minikube dashboard
  • Open application in browser
$ minikube service atg-test-01
  • Delete minikube
$ minikube stop
$ minikube delete

Test Deployment Scaling

  • Test application scaling using Apache Benchmark (Note: installed by default in mac).
$ kubectl get hpa
$ ab -c 5 -n 100 -t 1000 http://<cluster-ip-addresss>:30003/

Auto scaling diagram

Preview

App Screens

Home page

Preview

File Upload

Preview

Parse and store in S3 bucket

Preview

Bucket Policy overview

Preview

Bucket Policy details

Preview