imamaaa / microservices-blogging-platform-with-docker-compose

A microservices-based blogging platform using Flask, PostgreSQL, and Docker Compose. Features CRUD operations, database management via pgAdmin, and containerized deployment.

Repository from Github https://github.comimamaaa/microservices-blogging-platform-with-docker-composeRepository from Github https://github.comimamaaa/microservices-blogging-platform-with-docker-compose

Blogging Platform - Microservices Architecture

Docker
Flask
PostgreSQL

Overview

This project implements a microservices architecture for a blogging platform using Docker and Docker Compose. It consists of three key microservices:

  1. pgAdmin: A web-based interface for database administrators to manage the PostgreSQL database.
  2. PostgreSQL: A scalable database service that stores blog posts, user data, and transaction logs.
  3. Flask Blog Application: A web application that allows users to perform CRUD (Create, Read, Update, Delete) operations on blog posts.

Each service runs in its own Docker container and is managed through Docker Compose for scalability and modularity.


Architecture

  • pgAdmin: Runs on port 5050, used for managing and querying the PostgreSQL database.
  • PostgreSQL: Runs on port 5432, acting as the central storage for blog posts.
  • Flask Blog Application: Runs on port 8000, provides API endpoints for interacting with the blog platform.

Features

  • Microservices-based architecture for scalability & modularity.
  • RESTful API for CRUD operations on blog posts.
  • PostgreSQL integration for reliable data storage.
  • pgAdmin for database queries and schema management.
  • Dockerized Deployment using Docker & Docker Compose.
  • Secure & Scalable with independent services.

Tech Stack

Technology Purpose
Flask Backend Web Framework (Python)
PostgreSQL Database for storing blog data
pgAdmin UI for PostgreSQL Management
Docker Containerization
Docker Compose Service Orchestration

Prerequisites


Workflow

  1. User interacts with the Flask Blog API to create, read, update, and delete posts.
  2. Flask App communicates with PostgreSQL to store and retrieve blog data.
  3. pgAdmin is available for database queries and management.
  4. All services are containerized using Docker and managed with Docker Compose.

Getting Started

1️. Clone the Repository

git clone https://github.com/imamaaa/microservices-blogging-platform-with-docker-compose.git  
cd microservices-blogging-platform-with-docker-compose

2️. Run the Microservices using Docker Compose

docker-compose up --build -d

This starts all services in detached mode ('-d').

3️. Access the Services


API Endpoints

Method Endpoint Description
GET /posts Get all posts
GET /posts/<id> Get post by ID
POST /posts Create a new post
PUT /posts/<id> Update a post
DELETE /posts/<id> Delete a post

📦 Deployment on Docker Hub

If you want to publish the Flask application as a Docker image:

1️. Build the Docker image:

docker build -t YOUR_DOCKERHUB_USERNAME/blog-app .

2️. Push the image to Docker Hub:

docker push YOUR_DOCKERHUB_USERNAME/blog-app

About

A microservices-based blogging platform using Flask, PostgreSQL, and Docker Compose. Features CRUD operations, database management via pgAdmin, and containerized deployment.


Languages

Language:JavaScript 35.2%Language:Python 30.1%Language:HTML 21.9%Language:CSS 6.5%Language:Dockerfile 6.3%