Day 83- Project 4(Docker Swarm)
2 min read
Project Description
The project aims to deploy a web application using Docker Swarm, a container orchestration tool that allows for easy management and scaling of containerized applications.
The project will utilize Docker Swarm's production-ready features such as load balancing, rolling updates, and service discovery to ensure high availability and reliability of the web application.
The project will involve creating a Dockerfile to package the application into a container and then deploying it onto a Swarm cluster.
The Swarm cluster will be configured to provide automated failover, load balancing, and horizontal scaling to the application.
The goal of the project is to demonstrate the benefits of Docker Swarm for deploying and managing containerized applications in production environments.
prerequisite:
EC2 instances(2 to 3 instances) - Swarm Manager and Swarm worker(we can increase no. of workers as much as we want) and allow port 8000 and 2377
Docker is installed in all the instances.
Steps
run
sudo Docker swarm init
in Swarm ServerPaste the command in all worker server
To check the node is connected
run
sudo docker node ls
run the command to create a service
sudo docker service create --name django-app-service --replicas 3 --publish 8001:8001 trainwithshubham/react-django-app:latest
now run
sudo docker service ls
Now, just visit public_ip_addr of any node at port 8001
To detach any worker from the master just run
sudo docker swarm leave
on the worker serveryou can see it on the master server as a node is down
Done!!๐