https://github.com/filipe-oliveiraa/message-queue
The |Message Queue System| is a simple API-based system for message management, developed as part of a project to demonstrate skills in cloud-native technologies, DevOps, and Kubernetes. This project focuses on building a functional and scalable application using best practices in development, containerization, and orchestration.
https://github.com/filipe-oliveiraa/message-queue
Last synced: 2 months ago
JSON representation
The |Message Queue System| is a simple API-based system for message management, developed as part of a project to demonstrate skills in cloud-native technologies, DevOps, and Kubernetes. This project focuses on building a functional and scalable application using best practices in development, containerization, and orchestration.
- Host: GitHub
- URL: https://github.com/filipe-oliveiraa/message-queue
- Owner: filipe-oliveiraa
- Created: 2024-12-19T19:04:06.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-12-21T19:52:51.000Z (6 months ago)
- Last Synced: 2025-02-13T18:44:12.527Z (4 months ago)
- Language: Python
- Homepage:
- Size: 35.6 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Message Queue Application
## Description
The **Message Queue Application** is a lightweight, containerized backend application built with FastAPI to efficiently handle and manage messaging queues. It demonstrates the use of modern containerization techniques with **Docker** and **Kubernetes** for deployment, scaling, and load balancing.
---
## Table of Contents
- [Getting Started](#getting-started)
- [Features](#features)
- [Running the Application](#running-the-application)
- [Local Setup](#local-setup)
- [Using Docker](#using-docker)
- [Using Kubernetes](#using-kubernetes)
- [Scaling the Application](#scaling-the-application)
- [Testing Load Balancing](#testing-load-balancing)
- [Technologies Used](#technologies-used)---
## Getting Started
### Prerequisites
1. Install **Python 3.11+**.
2. Install **Docker**.
3. Install **Minikube**.
4. Install **kubectl** for Kubernetes cluster management.---
## Features
1. **FastAPI Backend**:
- Manage message queues with lightweight endpoints.2. **Containerized Deployment**:
- Fully containerized using Docker.3. **Scalable Architecture**:
- Leverages Kubernetes for horizontal scaling.4. **Load Balancing**:
- Automatic traffic distribution across multiple pods.---
## Running the Application
### Local Setup
1. Clone the repository:
```bash
git clone
cd message-queue
```2. Install dependencies:
```bash
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
```3. Run the application locally:
```bash
uvicorn app.main:app --host 0.0.0.0 --port 8000
```### Using Docker
1. Build the Docker image:
```bash
docker build -t message-queue:latest .
```2. Run the container:
```bash
docker run -p 8000:8000 message-queue:latest
```### Using Kubernetes
1. Start Minikube and use the Docker driver:
```bash
minikube start --driver=docker
```2. Build the Docker image in Minikube's Docker environment:
```bash
eval $(minikube docker-env)
docker build -t message-queue:latest .
```3. Apply Kubernetes configurations:
```bash
kubectl apply -f kubernetes/deployment.yaml
kubectl apply -f kubernetes/service.yaml
```4. Get the Minikube service URL:
```bash
minikube service message-queue-service --url
```---
## Scaling the Application
To scale the application horizontally in Kubernetes:
1. Use the `kubectl scale` command:
```bash
kubectl scale deployment message-queue --replicas=
```
Replace `` with the desired number of pods (e.g., 3).2. Verify the scaling:
```bash
kubectl get pods
```3. Ensure functionality by testing endpoints and observing traffic distribution (see Load Balancing section).
---
## Testing Load Balancing
1. Obtain the Minikube service URL:
```bash
minikube service message-queue-service --url
```2. Send multiple requests to the service URL:
```bash
curl http://
```3. Monitor pod logs to confirm distributed requests:
```bash
kubectl logs -f
```
Replace `` with the names of different pods. Requests should be distributed across pods.4. View the enabled pods:
```bash
kubectl get pods
```
This command lists all active pods in the cluster, showing their names, statuses, and other details.---
## Technologies Used
- **FastAPI**: For the backend application.
- **SQLite**: Lightweight database for queue management.
- **Docker**: Containerization of the application.
- **Kubernetes**: Deployment, scaling, and load balancing.
- **Minikube**: Local Kubernetes cluster setup.---