DOCKER SWARM….
When you combine Docker container services with the Swarm Prince of Bel-Air, you should get DOCKER SWARM right? NO, not all entirety but below I will attempt to share how I created and deployed a 3 node Docker Swarm cluster with a few additional services…
First we create 3 separate instances with PRIVATE ip address, only use a public IPv4 address when you happen to stop and restart your instance.
YOU WOULD REPEAT THE SAME FOR INSTANCE 2-NODE 2 AND INSTANCE 3- NODE 3
Next would be to connect all nodes through Visual Studio Code
green box, connect to host, configure ssh host..
Once configured, now we must change our hostname for our EC2 to node1
Use the command sudo hostnamectl set-hostname node1,
REBOOT/REFRESH instance….
SAME PROCESS FOR NODE 2 AND NODE 3…..
Once in, now I have to create the WordPress service
The above meme sums up the amount of self inflicted pain I caused myself, hours of pain and basically not just locking into what the errors were saying…I will share a few error screenshots and explain thereafter…
I simply changed out nginx with WordPress
Again, as embarrassing as it looks, the solution was clearly right in front of my face MULTIPLE TIMES. It clearly stated that I was in swarm mode so the compose command would not work.
I would like to add that these errors and inability to find the solution took a toll. Why did I just LOOK at what the errors clearly said? I honestly got lost in the sauce per say of trying to compete the task quickly, that can and did cause wasted time which was a great learning experience moving forward.
A simple command… sudo docker stack deploy?
PLEASE READ….the previous command line screenshot showed that I did not have the correct command. While I tried my best to figure out the right command, I reached out to a fellow teammate seeking assistance all the while Beyoncé song “say my name” was blasting in someone car next door and immediately and near simultaneously my teammate text me saying that I needed to NAME my docker compose yaml file. Strange but thankful for the help AND knowing that I was on the right path with the musical sign next to me. That may or may not pertain to the topic at hand but I do believe that if you work hard and sincerely desire to do the right thing, signs will come your way.
Docker stack deploy -c docker-compose.yaml week17Keith shows deployment of stack with no errors and services command shows 3 replicas for WordPress and 1 for MySQL.
…..After many many attempts, I and a handful of my teammates were unsuccessful in accessing from localhost:80
This would be something out of our control based on what most have been experiencing.
There you have it, another project learning experience troubleshooting errors and building tech confidence and comradery. I appreciate you taking the time to read another chapter in my journey.
Who’s next??….Kubernetes!