Logo

dev-resources.site

for different kinds of informations.

DOCKER SWARM CLUSTER & NFS

Published at
7/24/2023
Categories
docekr
devops
swarm
Author
taqiyeddinedj
Categories
3 categories in total
docekr
open
devops
open
swarm
open
Author
13 person written this
taqiyeddinedj
open
DOCKER SWARM CLUSTER & NFS

Docker Swarm emerges as an excellent solution, offering a simple and scalable cluster management system. To complement this, utilizing NFS (Network File System) as a shared volume storage brings significant advantages, providing seamless data sharing and robustness across the Swarm cluster. Moreover, it is essential to emphasize the importance of referring to official documentation for both Docker Swarm and NFS, as it ensures a well-informed and successful setup.

The web app code :

Image description
My Cluster:
Image description
On the NFS Server (NFS Server Host):
The necessary steps and commands to set up an NFS server and mount the NFS share on the client node (Docker Swarm node):
Install NFS Server:
sudo yum install nfs-utils
Create the Shared Directory:
sudo mkdir -p /shared_dir
Export the Shared Directory at /etc/exports:
/shared_dir *(rw,sync,no_root_squash)
Apply the NFS Export Changes:
sudo exportfs –a
Start NFS Server:
sudo systemctl enable nfs-server
On the NFS Client (Docker Swarm Node):
sudo yum install nfs-utils
Create the Target Mount Directory:
sudo mkdir -p /mnt/shared_dir
Mount the NFS Share:
sudo mount -t nfs nfs_server:/shared_dir /mnt/shared_dir

NOTE: fro NFS3 and NFS4 you should explicitly allow Port 2049

Now we create the NFS docker volume on the worker node :
docker volume create --driver local --name website_volume --opt type=nfs4 --opt device=:/shared_dir --opt o=addr=20.111.58.70,rw,nolock
Now Create Docker service with NFS volume :
docker service create --replicas=2 --name hostname_service --restart-condition on-failure -p 80:80 --mount type=volume,source=website_volume,target=/app taqiyeddinedj/hostname_web_app

swarm Article's
30 articles in total
Favicon
Knowledgeable Agents with FalkorDB Graph RAG
Favicon
Building Swarm-based agents with AG2
Favicon
Quick tip: Using SingleStore with OpenAI's Swarm
Favicon
OpenAI Swarm: Exploring Lightweight Multi-Agent Orchestration
Favicon
Building an 🐝 OpenAI SWARM πŸ” Web Scraping and Content Analysis Streamlit Web App with πŸ‘₯ Multi-Agent Systems
Favicon
What’s an AI Agent and what are its current advantages and possible future?
Favicon
Docker Swarm
Favicon
Docker Swarm Series: #7th Advanced Managing config and secret objects
Favicon
Docker Swarm Series: #5th Troubleshooting
Favicon
Docker Swarm Series: #8th Publishing Modes
Favicon
DOCKER SWARM CLUSTER & NFS
Favicon
Docker Swarm Series: #6th Managing config and secret objects
Favicon
Docker Swarm: Simplifying Container Orchestration at Scale
Favicon
Docker Swarm Series: #4th Deploy a Stack to a swarm Cluster
Favicon
Docker Swarm Series: #3rd Deploy a highly available Container
Favicon
Docker Swarm Series: #1st Setup the Environment
Favicon
Docker in small scale production (Docker Swarm)
Favicon
How to export your complete Foursquare checkin history
Favicon
Deploy a high available etcd cluster using docker
Favicon
Time to say goodbye to Docker Swarm
Favicon
Understanding Docker, Docker Compose & Swarm
Favicon
Everything you need to know about Docker Swarm
Favicon
Zero Downtime Deployment with Docker Swarm
Favicon
Workflow on Docker Swarm
Favicon
Free docker cluster mesh with swarm and GCP
Favicon
Traefik v2 with Docker Swarm
Favicon
swarm-cronjob
Favicon
Docker Swarm Concepts, Tips, and Tricks for a Docker Beginner
Favicon
Deploying gitlab on Docker Swarm
Favicon
Adventure with Docker: Conflicts with UIDs of the container and the host

Featured ones: