Skip to content

Milestone 2

Tyler Citrin edited this page Mar 3, 2019 · 23 revisions

Revised architecture diagram and user stories

Please refer Home

Task accomplished

  • Revamped UI
  • CI/CD using Apache Jenkins
  • Service registry and discovery using Zookeeper

Revamped UI

To improve user experience we modified the front end.

CI/CD using Jenkins

We created 6 Jetstream instances as follow:

  1. Apache Jenkins server
  2. Zookeeper and zookeeper API gateway server
  3. Diet and fitness microservices
  4. Media microservices
  5. Main application server
  6. React UI server

We have created a single pipeline for each service to build and test. Each pipeline is built using scripted pipeline which includes try-catch to ensure that the builds can be compiled and executed successfully on the Jenkins server. This prevents failed builds from being deployed on the production server. We saved server ip in Jenkins environment variable to make scripts reusable.

Each pipeline runs automatically when a commit is pushed to the respective branch. We perform poll SCM which checks for update every minute.

Service registry and discovery using Zookeeper

We installed Zookeeper in standalone mode. After installation, we tried to create a Zookeeper REST application using zookeeper discovery package in java. But we faced some issues that we weren't able to resolve. We researched about Curator in Java and kazoo in python. We decided to implement the Zookeeper rest application in python using flask and kazoo. We created RegisterApplication(register_service branch) to register and deregister service. This application will be installed on each service to register and deregister itself.

Improvements from Project 1

  • We worked on the front end to make it more user-friendly. We also improved diet and fitness microservices to increase security.
  • The project need not be manually installed on one machine to be able to work completely and can be accessed from anywhere.
  • We have embraced the distributed systems architecture to enhance the project's scalability and availability.

Steps to run the project

  • Jenkins Server: http://149.165.170.222:8080 (Credentials have been mailed to the peer reviewers and AIs)

  • Insert a dummy commit in the following branches to see the Jenkins pipeline build, test on the development server and deploy on their respective production servers

Development Branches are as follows:

Zookeeper Service Discovery

Branch URL: https://github.com/airavata-courses/Gateway-Falcons/tree/service-discovery

Jenkins Pipeline Name: ZookeeperPipeline

Jenkins Pipeline URL: http://149.165.170.222:8080/job/ZookeeperPipeline/

Test URL: http://149.165.157.75:5000/getservice Post request: {"servicePath":"falcons/services/servicename"} e.g. {"servicePath":"falcons/services/media"}

Purpose: Zookeeper is installed on this server. This pipeline is used to deploy the zookeeper REST API application in python. This application is used by other microservices to register or deregister itself. React-UI uses this application to get the IP address of each service.


Backend Server

Branch URL: https://github.com/airavata-courses/Gateway-Falcons/tree/server-dev

Jenkins Pipeline Name: BackEnd_Pipeline

Jenkins Pipeline URL: http://149.165.170.222:8080/job/BackEnd_Pipeline/

Test URL: http://149.165.170.57:3001/

Purpose: This server is built using the NodeJS Express Framework. It involves fetching data stored on the mongo databases received from the cron jobs. It also facilitates image management from the Media management microservice. This is the only point of contact for the front end of the application to fetch and send data.


Media Service

Branch URL: https://github.com/airavata-courses/Gateway-Falcons/tree/media-service

Jenkins Pipeline Name: Java Pipeline

Jenkins Pipeline URL: http://149.165.170.222:8080/job/Java%20Pipeline/

Test URL: http://149.165.168.128:8081/greeting

Purpose: This microservice is built using Java Spring Boot. It is responsible for fetching and storing images on our cloud provider (Cloudinary).


Fitness Service

Branch URL: https://github.com/airavata-courses/Gateway-Falcons/tree/fitness-service

Jenkins Pipeline Name: FitnessPipeline

Jenkins Pipeline URL: http://149.165.170.222:8080/job/FitnessPipeline/

Test URL: http://149.165.169.72:5001/get

Purpose: This microservice is developed in Python using the Flask framework. It runs as a cron job which fetches the latest diet data from Strava API. The data includes the outdoor activities performed recently by the user which can be Biking, Running, etc.


Diet Service

Branch URL: https://github.com/airavata-courses/Gateway-Falcons/tree/diet-service

Jenkins Pipeline Name: Dietpipeline

Jenkins Pipeline URL: http://149.165.170.222:8080/job/Dietpipeline/

Test URL: http://149.165.169.72:5000/add

Purpose: This microservice is developed in Python using the Flask framework. It runs as a cron job which fetches the latest diet data from MyFitnessPal database. The data includes the amount of calories, nutritional information and the food items.


Front End

Branch URL: https://github.com/airavata-courses/Gateway-Falcons/tree/react-ui

Jenkins Pipeline Name: Front_End_Pipeline

Jenkins Pipeline URL: http://149.165.170.222:8080/job/Front_End_Pipeline/

Test URL: http://149.165.170.161:3000

Purpose: This is the front end of the application which displays all the integrated output of the application


Deploy Complete Application

We have also built a separate pipeline which can run all the individual pipelines and deploy the complete project on their respective production servers servers

Jenkins Pipeline Name: Deploy_Application

Jenkins Pipeline URL: http://149.165.170.222:8080/job/deploy_application/

Challenges faced

Front-end

In working with a real a client the back and forth design process was found to be very time-consuming and difficult. In the end we took a step back and found a theme layout that we suggested and eventually agreed upon.

The theme integration also took some time as it was not built specifically for our framework, there was a lot of re-factoring and customization of components in order to "fit the pieces together" of the larger puzzle.

After this we worked with the client to make quick mockups and reuse a lot of previously built pages and components to speed up the development process. We also encouraged the client to find samples of tools, widgets, etc. of related projects to either draw inspiration or directly incorporate into the project.


Deployment Issue

We are using some third-party APIs which require to store data manually before using the API to fetch request. While automating the deployment, we were facing issues to provide the input to the script. We fixed this issue by using except script.


JetStreams Instance Setup issues

We faced multiple issues while accessing different instances on JetStream which included completely getting logged out of the Ubuntu Instance 2 times and having to re-run and set up the environment favorable for the development and production purposes.

TODO for future milestones:

  • We plan to add multiple features for displaying more and more biker's data while he is cycling across the country. This includes the following information:
  • Live Location showing his exact location on an interactive map
  • Current and past Heart Rate activity
  • His recent biking activities along with maps
  • User portal to support and connect with the bikers