Skip to content

Flights metasearch engine simulation using Java, GraphQL and React.js, developed for COMP30220 Distributed Systems.

Notifications You must be signed in to change notification settings

rajitbanerjee/distributed-airways

Repository files navigation

Distributed Airways

Requirements

  • Docker
  • JDK 8 and Apache Maven
  • Node.js [Note: This is only required if starting the development server for the ui/ module. Not necessary when running the services with docker-compose.]
  • kubectl for Kubernetes deployment
  • minikube for Kubernetes deployment

Getting Started

The application can be run with either Docker Compose or Kubernetes (K8s).

docker-compose

TLDR;

  • Clean build and start:
    time ./clean-start.sh && sleep 25 && open http://localhost:1337
  • [Optional] Quicker subsequent build alternative:
    docker-compose down && docker-compose up -d && sleep 25 && open http://localhost:1337

Running the services

  • Compile and run all services in Docker (detached mode) using:

    ./clean-start.sh

    This is equivalent to running:

    mvn clean install
    docker-compose down --remove-orphans
    docker-compose build --no-cache
    docker-compose up -d
  • To view the logs for any particular container, use:

    docker-compose logs $CONTAINER_NAME
  • [Optional] To run the basic CLI client, use:

    mvn exec:java -pl cli-client
  • To view the frontend, navigate to http://localhost:1337.

Kubernetes

NGINX Ingress is not included by default so the following command must be run once:

minikube addons enable ingress

Running the cluster

  • First make sure minikube is running:

    minikube start
  • Spin up services (takes around 2-5 minutes):

    kubectl apply -f k8s
  • For easy monitoring, use the Kubernetes dashboard:

    minikube dashboard
  • On another terminal, enable minikube tunnelling to make service accessible on localhost:

    minikube tunnel

Frontend: http://localhost/
Backend: http://localhost/api/graphql/

Clean up

kubectl delete deployments --all
kubectl delete services --all
kubectl delete pods --all
kubectl delete daemonset --all
kubectl delete pvc -all
kubectl delete pv -all

FAQ

  • Where are the images coming from?
    • Images are uploaded to Docker Hub and pulled when the cluster is created.
    • After making changes to any module, the docker.sh script (found at the root of individual modules) can be executed to build and push the image to Docker Hub.
    • Docker Buildx is used to create multi-platform images (to support both amd64 and arm64 processors). Setup instructions can be found in the official documentation.
  • How should the frontend/broker/individual airline services be scaled?
    • In the k8s/ directory, the appropriate .yaml file's replicas attribute can be modified.

User Interface

Team

Acknowledgements

About

Flights metasearch engine simulation using Java, GraphQL and React.js, developed for COMP30220 Distributed Systems.

Topics

Resources

Stars

Watchers

Forks