Skip to content

Project code for cd0354 Monolith to Microservices at Scale course taught by Justin Lee

License

Notifications You must be signed in to change notification settings

nvtoan263/cd0354-monolith-to-microservices-project

 
 

Repository files navigation

Refactor: Udagram Image Filtering Application

Udacity Cloud Developer Nanodegree - Project 3: Refactoring and Deploying the Udacity Monolith Udagram Application

Udagram is a simple cloud application developed alongside the Udacity Cloud Engineering Nanodegree. It allows users to register and log into a web client, post photos to the feed, and process photos using an image filtering microservice.

1. Refactoring the application

2. Containerization

  • Set up dockerfiles for building containers to run the backend microservices, frontend service and Nginx reverseproxy

3. Circle CI Pipeline (Not using TravisCI since it require payment info)

  • Set up Travis CI Pipeline integrated with Github repository to build and upload docker images to Dockerhub

Travis-CI build

Dockerhub Images

4. Kubernetes:

Get Deployments

Get Pods

Get Services

Get hpa

Running

Prerequisite

  1. Database: Create a PostgreSQL database on AWS RDS. The database is used to store the application's metadata
  2. Filestore(S3): Create an AWS S3 bucket. The S3 bucket is used to store images that are displayed in Udagram.

I. Run locally with docker-compose

ENV Variables: Configure the variables on set_env.sh and run the script

Note: Uncheck from git once configured git rm --cached set_env.sh

Building Images

docker-compose -f deployments/docker/docker-compose-build.yaml build --parallel

Running Images

docker-compose -f deployments/docker/docker.yaml up

II. Run in production with Kubernetes

Kubernetes Prerequisite:

Create an EKS Cluster on AWS and Set up Nodegroups on the cluster to run the kubernetes pods

Kubernetes Config:

Set up and apply kubernetes deployment configs

# Configure and updates the configs
> cp deployments/kubernetes/config/example.env-secret.yaml deployments/kubernetes/config/env-secret.yaml
> cp deployments/kubernetes/config/example.aws-secret.yaml deployments/kubernetes/config/aws-secret.yaml
> cp deployments/kubernetes/config/example.env-configmap.yaml deployments/kubernetes/config/env-configmap.yaml
# Apply configs
> kubectl apply -f deployments/kubernetes/config/env-secret.yaml
> kubectl apply -f deployments/kubernetes/config/aws-secret.yaml
> kubectl apply -f deployments/kubernetes/config/env-configmap.yaml

Create Deployments

> kubectl apply -f deployments/kubernetes/backend-feed-deployment.yaml
> kubectl apply -f deployments/kubernetes/backend-user-deployment.yaml
> kubectl apply -f deployments/kubernetes/reverseproxy-deployment.yaml
> kubectl apply -f deployments/kubernetes/frontend-deployment.yaml

Create Services

> kubectl apply -f deployments/kubernetes/backend-feed-service.yaml
> kubectl apply -f deployments/kubernetes/backend-user-service.yaml
> kubectl apply -f deployments/kubernetes/reverseproxy-service.yaml
> kubectl apply -f deployments/kubernetes/frontend-service.yaml

Create Horizotal Pod Autoscaller (HPA)

kubectl autoscale deployment backend-feed --cpu-percent=50 --min=2 --max=10
kubectl autoscale deployment backend-user --cpu-percent=50 --min=2 --max=10
kubectl autoscale deployment reverseproxy --cpu-percent=50 --min=1 --max=10
kubectl autoscale deployment udagram-frontend --cpu-percent=50 --min=1 --max=10

About

Project code for cd0354 Monolith to Microservices at Scale course taught by Justin Lee

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 80.2%
  • HTML 7.7%
  • SCSS 5.3%
  • JavaScript 4.4%
  • Dockerfile 1.5%
  • Shell 0.9%