Skip to content

iam-shan/hello-world-app

Repository files navigation

Hello World Microservices Application

This project is a Microservices application consists of there components,

  • ExpressJS module
  • SpringBoot module
  • Flask module

Each service is containerized using Docker and is deployed on Google Kubernetes Engine (GKE).
The goal of this application is to get familiar with the basic concepts of microservices architecture.
These application is currently up and running on GKE cluster.

The application is divided in 3 major services

1. Hello Service:

This micro-service is written using Java and SpringBoot Frmaework.
The service is hosted on following endpoint: http://34.94.35.116/hello

This returns a Json response with message as "Hello".

image

{
  message : "Hello"
}
Based on the usage, cluster pods may have been scaled down to save resources.

2. World Service:

This micro-service is written using Javascript and ExpressJS Frmaework.
The service is hosted on following endpoint: http://34.94.193.46/world

This returns a Json response with message as "World".

image

{
  message : "World"
}
Based on the usage, cluster pods may have been scaled down to save resources.

3. Hello-World web-application

This webapplication is written using Python and Flask Frmaework.
This app makes call to other two service endpoint and display message : "Hello World".
The web-app is hosted on : http://34.94.205.204‎

image

Based on the usage, cluster pods may have been scaled down to save resources.

Resources

The App and it's images are hosted on Google Kubernetes Engine and Artifact Registry.

Below is running status of cluster.

image

Here are the resources and links for accesing the Docker Images.\

This Docker Hub repo has all the latest docker images hosted on GKE

Getting Started

Prerequisites

  • Docker
  • Node.js
  • Python3
  • Java 17
  • VScode IDE

Running the components on local

For ExpressJs
cd express
npm install
node server.js

To build and run docker image :

docker build -t express-app .
docker run -p 3000:3000 express-app
For Springboot
cd springBoot/hello
mvn clean install
java -jar target/hello-0.0.1-SNAPSHOT.jar

To build and run docker image :

docker build -t springboot-app .
docker run -p 8080:8080 springboot-app
For Flask
cd flask_helloWorld
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python app.py

To build and run docker image :

docker build -t flask-app .
docker run -p 5000:5000 flask-app

End with an example of getting some data out of the system or using it for a little demo

Accessing the Applications

On local host

On cloud

Scaling up/down on GKE

Images are deployed on GKE.
To scale up the applications, login to gcloud through cli and run following command:

kubectl scale deployment flask-app --replicas=2
kubectl scale deployment express-app --replicas=2
kubectl scale deployment springboot-app --replicas=2

To scale down,

kubectl scale deployment flask-app --replicas=0
kubectl scale deployment express-app --replicas=0
kubectl scale deployment springboot-app --replicas=0

Authors

About

This app is part of CMPE 272 assignment.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages