DevOps Project-4

Akash SinghAkash Singh
3 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.

project - 4 Step-By-Step Implementation.

Deploying web app using Docker Swarm. (Production Ready).

Follow the steps:

  1. first of all Go to AWS cloud and create three EC2 instance.

-> D-swarm-manager

-> D-swarm-worker-1

-> D-swarm-worker-2

2. In all three instances, inside the inbound rules, allow

-> Custom TCP — 2377 — Anywhere IPv4

-> Custom TCP — 3000 — Anywhere IPv4

3. Install docker with docker engine on all three nodes.

4. Now, Open the “Swarm Manager” node and run the command,

sudo docker swarm init

This will be creating empty swarm.

5. After initializing the swarm on the “swarm-manager” node, there will be one key generated to add other nodes into the swarm as a worker. Copy and run that key on the rest of the servers.

6. To check about all the nodes in the manager, run command on manager

sudo docker node ls

7. Now, on Manager Node we will create a service,

sudo docker service create --name flask-calculator --replicas 3 --publish 3000:3000 bandank/flask-calculator:latest

8. Now, run command

sudo docker service ls

9. Now, this service will create a container in the Manager node. To check, run the command:

sudo docker ps

10. Now, this service will be running on all three nodes. To check this, just grab the Ip Address of any of the nodes followed by port 3000. As

<Any_ip_of_3_vms>:3000

11. If you want to remove any node from the environment, just run

“sudo docker swarm leave”

From specific worker nodes.

As we removed, one of the workers and inside the status, we can see it’s down.

  • Thank you for enjoying my DevOps blog! Your positive response fuels my passion to dive deeper into technology and innovation.

  • Stay tuned for more captivating DevOps articles, where we'll explore this dynamic field together. Follow me on Hashnode and connect on

  • LinkedIn AkashSingh for the latest updates and discussions.

#90daysofdevOps#aws#docker#cloud#dockerswarm#dockercompose #happylearning

10
Subscribe to my newsletter

Read articles from Akash Singh directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Akash Singh
Akash Singh

DevOps Engineer experienced in Linux system administration, automation, and cloud deployments. Skilled in CI/CD pipelines using Jenkins, containerization with Docker, and process management using PM2. Strong in database management, troubleshooting, and problem-solving, with a focus on scalable system design and operational efficiency