Day 83 Project-4: Deploying Web Application with Docker Swarm ๐Ÿณ

ยท

3 min read

Day 83 Project-4: Deploying Web Application with Docker Swarm ๐Ÿณ

Project Description ๐Ÿ“

So, what's the buzz? This project is all about leveraging Docker Swarm, a powerful container orchestration tool, to deploy and manage containerized applications effortlessly. Here's a glimpse of what's in store:

  • Utilizing Docker Swarm Features: We'll be tapping into Docker Swarm's arsenal of production-ready features like load balancing, rolling updates, and service discovery to ensure our web application is highly available and reliable.

  • Packaging with Dockerfile: The project involves creating a Dockerfile to encapsulate our application into a container, laying the groundwork for seamless deployment onto a Swarm cluster.

  • Swarm Cluster Configuration: Our Swarm cluster will be configured to provide automated failover, load balancing, and horizontal scaling, ensuring our application can handle any workload thrown its way.

Implementation ๐Ÿ› ๏ธ

Now, let's walk through the steps I took to bring this project to life:

  1. Setting Up AWS Instances: I kicked off the project by creating three new instances on AWS - Swarm-manager, Swarm-worker1, and Swarm-worker2.

  2. Configuring Inbound Rules: Ensured that inbound rules for all instances allowed Custom TCP traffic on ports 2377 and 8001 from anywhere (IPv4) within the AWS console.

  3. Installing Docker Engine: Proceeded to install Docker Engine on each instance, following detailed instructions from my previous journey in Docker exploration.

  4. Initializing Docker Swarm: Logged into the Swarm-manager node and initialized Docker Swarm using the command "sudo docker swarm init", laying the foundation for our cluster.

  5. Adding Worker Nodes: Copied the generated key and executed it on Swarm-worker1 and Swarm-worker2 nodes to add them as worker nodes to the swarm.

  6. Verifying Swarm Nodes: Checked all nodes were properly added by running the command "docker swarm node ls" on the Swarm-manager node.

  7. Creating a Docker Service: Created a Docker service on the Swarm-manager node using the command "sudo docker service create --name django-app-service --replicas 3 --publish 8001:8001 trainwithshubham/react-django-app:latest".

  8. Listing Docker Services: Checked the status of Docker services within the swarm using "sudo docker service ls" on the Swarm-manager node.

  9. Checking Running Containers: Verified successful container creation across nodes by executing "sudo docker ps" on any node within the swarm.

  10. Accessing the Web App: Accessed the web application by navigating to the IP address of any node within the swarm followed by port 8001.

  11. Removing Nodes: Learned to remove a node from the environment if needed, using the command "sudo docker swarm leave" on the respective worker node.

Conclusion ๐ŸŽ‰

And there you have it! Project 4 showcases the seamless deployment of a web application using Docker Swarm on AWS, highlighting scalability, resilience, and efficient management for your applications. Stay tuned for more insightful projects and updates!

#DockerSwarm #AWS #WebDeployment #Containerization #DevOps #TechProjects #Day83 ๐Ÿš€๐Ÿ’ปโœจ

ย