The project application, Udagram - an Image Filtering application, allows users to register and log into a web client, post photos to the feed, and process photos using an image filtering microservice. It has two components:
- Frontend - Angular web application built with Ionic framework
- Backend RESTful API - Node-Express application
In this project you will:
- Refactor the monolith application to microservices
- Set up each microservice to be run in its own Docker container
- Set up a Travis CI pipeline to push images to Dockerhub
- Deploy the Dockerhub images to the Kubernetes cluster
Udagram allows users to register and log into a web client, post photos to the feed, and process photos using an image filtering microservice.
The project is split into four parts:
- The Frontend, an Ionic client web application which consumes the RestAPI feed and user.
- The RestAPI Feed Backend, a Node-Express feed microservice.
- The RestAPI User Backend, a Node-Express user microservice.
- The reverse proxy server, a NGINX proxy server.
Required tools need to be install:
Open your bash profile to store your application variables at OS level to use them within and across applications:
open ~/.profile
Copy and Paste the bash scripts bellow with your values:
export DB_USERNAME=your postgress username;
export DB_PASSWORD=your postgress password;
export DB_NAME=your postgress database;
export DB_HOST=your postgress host;
export AWS_REGION=your aws region;
export AWS_PROFILE=your aws profile;
export AWS_MEDIA_BUCKET=your aws bucket name;
export JWT_SECRET=your jwt secret;
export ACCESS_CONTROL_ALLOW_ORIGIN=url of the frontend;
Source your .profile to execute your bash scripts automatically whenever a new interactive shell is started:
source ~/.profile
To run the docker images, 2 options:
-
- Get Docker existing images from Docker Hub
-
- Build the new Docker images
The project's images are available on Docker Hub :
- quyetnn1102/udagram-api-feed
- quyetnn1102/udagram-api-user
- quyetnn1102/udagram-frontend
- quyetnn1102/udagram-reverseproxy
Just push these images executing this script:
docker pull quyetnn1102/udagram-api-feed:latest
docker pull quyetnn1102/udagram-api-user:latest
docker pull quyetnn1102/udagram-reverseproxy:latest
docker pull quyetnn1102/udagram-frontend:latest
Build the docker images by following the documentation in udagram-deployment/docker
Check images available : docker images
Run your docker containers: docker-compose up
Browse the frontend application : http://localhost:8100/
Create your cluster following the instruction
Your cluster is created and visible in the AWS Console/EKS:
Setup the kubernetes environment by following the documentation in udagram-deployment/k8s
kubectl apply -f env-secret.yaml
kubectl apply -f aws-secret.yaml
kubectl apply -f env-secret.yaml
kubectl apply -f env-configmap.yaml
kubectl apply -f backend-feed-deployment.yaml
kubectl apply -f backend-user-deployment.yaml
kubectl apply -f frontend-deployment.yaml
kubectl apply -f reverseproxy-deployment.yaml
kubectl apply -f backend-feed-service.yaml
kubectl apply -f backend-user-service.yaml
kubectl apply -f reverseproxy-service.yaml
kubectl apply -f frontend-service.yaml
kubectl expose deployment reverseproxy --type=LoadBalancer --name=publicreverseproxy
kubectl expose deployment frontend --type=LoadBalancer --name=publicfrontend
kubectl logs <podId>
Browse the frontend application : http://a136666f5bd234f6a948339558acd6ef-1456095971.us-west-2.elb.amazonaws.com/
- Sign up for Travis and connect your Github application repository to TravisCL.
- Have a look to the config file that will be read by Travis, at the root of the repository. It needs some environment variables.
- Add your environment variables to the project repository in Travis by selecting the setting option.
- Commit and Push your changes trigger a Travis build.
- Check the build status page to see if your build passes or fails according to the return status of the build command by visiting TravisCL and selecting your repository.