This project implements a microservices architecture for a blogging platform using Docker and Docker Compose. It consists of three key microservices:
- pgAdmin: A web-based interface for database administrators to manage the PostgreSQL database.
- PostgreSQL: A scalable database service that stores blog posts, user data, and transaction logs.
- 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.
- 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.
- 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.
| Technology | Purpose |
|---|---|
| Flask | Backend Web Framework (Python) |
| PostgreSQL | Database for storing blog data |
| pgAdmin | UI for PostgreSQL Management |
| Docker | Containerization |
| Docker Compose | Service Orchestration |
- Docker (must be installed)
- Docker Compose (must be installed)
- Git (for cloning the repository)
- User interacts with the Flask Blog API to create, read, update, and delete posts.
- Flask App communicates with PostgreSQL to store and retrieve blog data.
- pgAdmin is available for database queries and management.
- All services are containerized using Docker and managed with Docker Compose.
git clone https://github.com/imamaaa/microservices-blogging-platform-with-docker-compose.git
cd microservices-blogging-platform-with-docker-composedocker-compose up --build -dThis starts all services in detached mode ('-d').
- Blog API → http://localhost:8000
- pgAdmin → http://localhost:5050
- PostgreSQL → Runs internally on localhost:5432
| 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 |
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