This project deploys a microservices-based Voting Application on Docker Swarm.
It consists of multiple services working together to collect votes, process them, and display live results.
-
vote (Frontend – Flask)
- Accessible at http://localhost:80
- Lets users vote between two options.
-
result (Frontend – Node.js)
- Accessible at http://localhost:5001
- Displays live voting results.
-
worker (Backend – .NET Core)
- Consumes votes from Redis and updates the Postgres database.
-
redis (Queue)
- Stores incoming votes temporarily.
-
db (Postgres)
- Persists final voting results.
- Initialized with init.sql.
-
visualizer (Optional)
- Visualizes the Docker Swarm cluster.
- Accessible at http://localhost:8180
- Runs only on the Swarm manager node.
.
├── docker-stack.yml # Stack file for Docker Swarm
├── init.sql # Initializes the database schema
└── README.md # Project documentation
-
Initialize Docker Swarm:
docker swarm init
-
Deploy the stack:
docker stack deploy -c docker-stack.yml voting_stack
-
Verify running services:
docker stack services voting_stack
- Voting app → http://localhost:80
- Results app → http://localhost:5001
- Visualizer (optional) → http://localhost:8180
To remove the stack:
docker stack rm voting_stack- Ensure ports 80 and 5001 are free before deployment.
- If the database schema changes, update
init.sqland redeploy. - Visualizer runs only on Swarm manager nodes.