In recent years, it became easier and simpler to deploy and publish your application in the internet. Previously, you will need to purchase your own virtual machine, install libraries and then configure to deploy your application. This requires money, time, and expertise if you decide to do it yourself. Today there are lots of free (or cheap) services that will build and deploy your application in a click of a button or a code update.
“I wanted to do that but I didn’t have time!“. Have you heard yourself say this before? I am certain everyone did at some point. We all wish we have the time to do the things we want. 24 hours is not enough for a day!
But think about other people whom you admire. Perhaps its someone who leads a successful business, or someone who produces amazing works of art. These are people who spent a lot of time practicing and honing their skills. How did they find time to do these things? Why am I not as skilled as them even though all of us had the same number of hours in a day?
You just received a message from a friend asking for a favor. This has already happened more times than you wanted. You feel anxious and uncomfortable but you just can’t refuse. You’re not the kind of person who disappoints and lets other people down, are you? Defeated, you give in to your friend’s request. You have failed again to speak your truth.
What is your truth?
“You are always playing it safe. It’s ok to be honest on your feedback!“, a colleague said to me one day. I was a bit jarred. Is there anything wrong with that? “I like to keep everything in harmony as much as possible“, I thought to myself.
Regardless of your religious inclinations, or whether you believe in God or not, it is undeniable that the Bible contains many passages and teachings that are useful and practical. One such passage is from the book of Ecclesiastes in the Old Testament. In Chapter 4 it described something very profound that struck me. It is about how people keep chasing after the wind.
What does chasing after the wind mean? Have you tried doing it yourself? Perhaps not, because you know that you cannot see the wind. You cannot grasp it nor catch it. It always slips away from your hands. Since you cannot catch it at all, chasing it would be pointless.
In the previous article we learned how to create a Rails 6 Docker image and run it locally. While useful for demonstration purposes, it is not enough for a real-world web application. In addition to our main application code, there are other services that we also need, like a database, a queue system, storage and so on.
Docker Compose provides a way for us to describe how our entire application works using declarative code. Declarative code means that we specify the final state of our application, rather than specifying what steps are needed to create our application. This results in a simpler, more intuitive configuration.
Just like we used a Dockerfile to instruct Docker on how to create our custom image, we use a docker-compose.yml file when using Compose.
First, let’s take a look at a sample Compose file for a Rails 6 application: