Skip to content

A Food delivery system using Django, PostGIS, Kubernetes, Loki, Prometheus, Grafana, OpenTelemetry, Jaeger and Redis.

Notifications You must be signed in to change notification settings

mohamad-liyaghi/FoodAnywhere

Repository files navigation

FoodAnywhere

Table of Contents

Introduction

FoodAnywhere is a comprehensive platform designed to make food ordering and delivery easier for both customers and vendors. Vendors can easily register their restaurants, manage their menus, and add products to the system. Customers, on the other hand, can effortlessly search for nearby restaurants, browse menus, and place orders with just a few clicks.

Technologies

django postgresql postgis docker kubernetes celery redis grafana prometheus loki pytest jaeger opentelemetry

This project uses Django as the backend framework, with PostgreSQL and PostGIS for database management and geographic data handling. The application is containerized using Docker and orchestrated with Kubernetes.

For background task processing, Celery is used, with Redis serving as both the caching layer and the message broker. Monitoring and logging are handled with Grafana, Node Exporter, Promtail, and Loki, Also Jaeger is used for distributed tracing.

Testing is managed with pytest to ensure code quality and reliability.

Monitoring

This project has been set up with monitoring and logging capabilities. The following tools are used for monitoring:

Node Exporter

This tool is used to collect system metrics from the nodes in the Kubernetes cluster. It provides information about CPU, memory, disk, and network usage, among other things.

Here is an example of the Node Exporter dashboard in Grafana: Node Exporter

Loki

Loki is a log aggregation system that is used to store and query logs from the application. It is integrated with Grafana, which allows for easy visualization and querying of logs.

Here is an example of the Loki dashboard in Grafana: Loki

OpenTelemetry

This Project uses OpenTelemetry as its distributed tracing system. Jaeger is used to collect, store, and visualize traces from the application. It provides insights into the performance of the application and helps identify bottlenecks and issues.

Here is an example of the Jaeger dashboard: Jaeger

Here is an example of the metrics in grafana: Open Telemetry

Application

To make the application easier to understand, we have divided it into several components. Each component is responsible for a specific part of the application. The components are as follows:

User

This component is responsible for managing user accounts. It handles user registration, and login, as well as user profile management. Authorization is handled using JSON Web Tokens (JWT).

Active Session

To keep track of active user sessions, this component is used. It stores information about the user, the device, and the IP address of the user's current session.

Locations

To find nearby restaurants, this component is used. It stores information about the location of restaurants and provides functionality to search for restaurants based on the user's location.

Restaurants

This component handles all vendor-specific and customer-specific functionalities related to restaurants.

Some functionalities include:

Vendor Specific

  • Registering a new restaurant
  • Managing restaurant details

Customer Specific

  • Viewing Nearby Restaurants
  • Viewing Restaurant Details

Products

This component is responsible for managing and displaying products. Vendors can easily add products to their restaurant's menu, while customers can browse products and add them to their cart.

Carts

The cart component acts as a temporary storage for products that the user wants to order. It allows users to add, remove, and update products in their cart. All the items get saved in a cache until the user places an order.

Orders

The order component is responsible for managing orders for both vendors and customers. Customers can place orders, pay or cancel orders, and view their order history. Vendors can view and manage orders that have been placed at their restaurant. So they can update the status of the order.

Transactions

This component keeps track of all transactions that occur on the platform. This includes payments made by customers, refunds, and other financial transactions.

Installation

You can run FoodAnywhere either using Docker Compose or Kubernetes in either a local or production environment.

Docker Compose

To run the application using Docker Compose, follow these steps:

  1. Clone the repository
git clone https://github.com/mohamad-liyaghi/FoodAnywhere.git
  1. Change to the project directory
cd FoodAnywhere/
  1. Run the project
make run
  • To run in production mode, use the following command:
make deploy

Kubernetes

To run the application using Kubernetes, follow these steps:

  1. Clone the repository
git clone https://github.com/mohamad-liyaghi/FoodAnywhere.git
  1. Change to the project directory
cd FoodAnywhere/
  1. Create ConfigMaps
make local_confmap
  • To create ConfigMaps for production, use the following command:
make prod_confmap
  1. Deploy the application
make k8s

Run Tests

This project uses Pytest for testing. To run the tests, run the following command

make test

About

A Food delivery system using Django, PostGIS, Kubernetes, Loki, Prometheus, Grafana, OpenTelemetry, Jaeger and Redis.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages