Skip to content

Car Rental System - Configuring and Deploying a Microservices Application

License

Notifications You must be signed in to change notification settings

profjordanov/kubernetes-playground

Repository files navigation

Car Rental System

PRs Welcome Codacy Badge Build Status

Car dealers can publish their cars for rent. Each car ad must contain manufacturer, model, category, image, and price per day. Categories have a description and must be one of the following - economy, compact, estate, minivan, SUV, and cargo van. Additionally, each vehicle must list the following options: with or without climate control, number of seats, and transmission type. The system allows users to filter the cars by category, manufacturer, and price range anonymously. Ads can be sorted by manufacturer or by price. When a user chooses a car, she needs to call the dealer on the provided phone and make the arrangement. The dealer then needs to edit the car ad as “currently unavailable” manually. The system must not show the unavailable cars.

The application uses the following technologies:

  • RabbitMQ as an event bus and message broker.
  • SQL Server 2019 as a database provider.
  • ASP.NET Core 3.1 running on Kestrel as a web server for all services except the user client.
  • SignalR for the real-time notifications service.
  • Angular running on nginx for the front-end user client.

Application Architecture

  • Event Bus – a message queue system allowing communication between the back-end services in an asynchronous manner.
  • Identity Service – a restful API providing functionality for authentication and authorization. This service has its own database.
  • Dealers Service – a restful API providing functionalities for dealers to create profiles and publish car ads. Exposes endpoints for searching and viewing car ads. This service has its own database and communicates with the event bus.
  • Statistics Service – a restful API providing functionalities for storing and retrieving usage statistics – the total car ads in the system, for example. This service has its own database and communicates with the event bus.
  • Notifications Service – a web service, which sends notifications to the client through web sockets. Communicates with the event bus.
  • User Client – a front-end service, which serves a single-page application to the end-users. Communicates with the identity, dealers, statistics, and notifications services to receive and visualize data.
  • Admin Client – a front-end service, which is used by the business administrators. Communicates with the identity, dealers, and statistics services to receive and visualize data.
  • Watchdog Client – periodically calls all the other services to validate their health state and availability

Kubernetes

  • container management system
  • orchestrator for our application
  • solving challenges from having distributed applications
  • managing containers at scale
  • consider the high-level operations you do with code
  • similar in terms of cloud operations (write instructions and the cluster transfers them to the cloud machines)

Key Kubernetes Concepts

  • Node – a machine running your pods. Part of the cluster’s physical infrastructure.
  • Pod – an application running containers on your nodes. The smallest unit of deployment. Provides resource limitations. You should never deploy pods directly.
  • ConfigMap – contains visible key-value pair configuration. Useful for application settings.
  • Secret – contains secret key-value pair configuration. Useful for passwords, connection strings, and more.
  • Persistent Volume Claim – used for requesting dynamically provisioned storage. Persistence depends on the infrastructure.
  • StatefulSet – deployment manifest for pods that have a state. Useful for databases, cache servers, and more.
  • Deployment – deployment manifest for pods with stateless servers. Useful for API servers. Allows easy pod updating, scaling, and replicating.
  • Service – provides an internal or external networking interface for the cluster. Supports load balancing.
  • Pod health - configure liveness, readiness, and startup probes.
  • Rolling Update – configure zero-down deployments.
  • Autoscalers – horizontal and vertical autoscaling.
  • Ingress – reverse proxy and its configuration.
  • Annotations – add metadata to your pods.
  • Init Containers – understand the concept of initialization containers.
  • Node Affinity – node affinity works in detail.
  • Monitoring – advanced monitoring tools like Prometheus and Grafana.
  • Service Accounts – cluster authorization.

Getting Started

Run local Kubernetes cluster from '.k8s' folder:

  • kubectl apply -f ..environment\
  • kubectl apply -f .\databases\
  • kubectl apply -f .\event-bus\
  • kubectl apply -f .\web-services\
  • kubectl apply -f .\clients\

Delete all Kubernetes objects:

  • kubectl delete all --all
  • kubectl delete pvc --all

Some others:

  • kubectl config current-context - make sure Kubernetes it is up and running
  • kubectl get sc - default storage class in the cluster
  • kubectl get pods
  • kubectl describe pods {pod-name}
  • kubectl delete pods {pod-name}
  • kubectl logs {pod-name}
  • kubectl get services
  • kubectl describe services {service-name}
  • kubectl get pv - persistent volumes

About

Car Rental System - Configuring and Deploying a Microservices Application

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published