Deploying a Multi-Container Voting Application Using Docker Compose


In this project, I deployed and tested a cloud-native microservices application using Docker Compose. The application is a real-time voting platform where users cast votes and view the results in a live dashboard.

The system demonstrates key DevOps and cloud fundamentals:

  • Containerization of multi-language services (Python, Node.js, .NET)

  • Redis message queue

  • PostgreSQL database integration

  • Stateless microservices communication

  • Scaling worker services using Docker Compose

  • Observability with live logs and DB verification

This workflow reflects modern distributed systems architecture and hands-on container orchestration practice.


🏗 Architecture Overview

Component

Technology

Purpose

Vote App

Python + Flask

User UI for casting votes

Result App

Node.js

Displays live vote results

Redis Queue

Redis

Stores votes temporarily as messages

Workers

.NET

Consume queue messages and update DB

Database

PostgreSQL

Stores persistent vote records

Orchestration

Docker Compose

Manages and networks the services


Architecture Flow

User → Vote UI → Redis Queue → Worker → PostgreSQL → Results UI

⚙️ Setup & Execution

Step 1 — Clone the Repo

https://github.com/PianoDude299/DockVoter.git cd example-voting-app

Step 2 — Build and Start Containers



docker compose build docker compose up -d



Step 3 — Validate Running Services

docker compose ps

Expected output shows services like:

  • vote (Flask)

  • result (Node)

  • redis

  • db (Postgres)

  • worker (dotnet)


💻 Accessing the Application

ServiceURL
Voting UIhttp://localhost:8080
Results Dashboardhttp://localhost:8081

I accessed the Voting UI and chose my custom poll option: Cats vs Dogs



Votes updated live in the Results UI confirming correct system behavior.




📦 Scaling Workers

To demonstrate container scaling, I launched 3 worker containers:

docker compose up --scale worker=3 -d docker compose ps

This simulates horizontal scaling in a microservices environment, increasing throughput for queue message processing.


🛢 Database Verification

Connected to PostgreSQL to verify persistent vote storage:

docker exec -it <db-container> psql -U postgres SELECT * FROM votes;

Output sample:

id | vote ------------------+------ 37f3306412edcb4 | a bfb16e422f4d16f | b



This verifies end-to-end data consistency.


🧠 Learning Outcomes

  • Built and deployed a multi-container microservices app

  • Used Docker Compose for orchestration

  • Connected to and queried a PostgreSQL container

  • Demonstrated real-time processing via Redis queue

  • Practiced scaling services horizontally

  • Monitored logs and validated data flow



🎯 Conclusion

This exercise provided real-world exposure to containerization concepts like:

  • Multi-service orchestration

  • Stateless microservices communication

  • Message queues and async processing

  • Service scaling

  • Docker networking and volumes

The application ran successfully and processed votes reliably, proving the architecture and deployment pipeline worked as intended.


Comments