Single-line Onboarding Using Docker Compose

<p>All my career, I&rsquo;ve worked at various startups that have had a very similar onboarding strategy. Because the company (and product) is small enough, it&rsquo;s reasonable to ask the engineers to run the entirety of the product locally on their machine for development. If this sounds familiar, the following steps might also sound familiar:</p> <ol> <li>Download the (correct version) of the backend language</li> <li>Download the (correct version) of NPM/Node for the frontend</li> <li>Download the package manager for the backend</li> <li>Download the package manager for the frontend</li> <li>Download the (correct version) of the DB to run locally</li> <li>(optionally) download the other non-primary storage DBs (e.g. ElasticSearch, Redis)</li> <li>Install the frontend and backend dependencies</li> <li>Start the frontend server</li> <li>Start the backend server</li> <li>Start other backend processes (e.g. async workers), if needed</li> <li>Debug failures and undocumented dependencies and return to step 6</li> </ol> <p>This process is tiring, but expected. Setting up a development environment is something that takes between a few hours and a few days and should not have to be repeated. Unfortunately, it&rsquo;s also difficult to help others because computers, languages and versions change over time so they may run into errors you didn&rsquo;t encounter or you might have forgotten the errors you did encounter when you set up your environment 6 months prior. Surely there is a better way.</p> <h2>The Shortcut: Docker Compose</h2> <p>About a year ago I took&nbsp;a course on Udemy that covered Docker and deployment orchestration. While I&rsquo;ve used Docker pretty extensively in my roles, it&rsquo;s almost always been for the purpose of managing deployed environments (typically via AWS ECS).</p> <p>Docker Compose was new to me, and I hadn&rsquo;t tried to learn much about it before the course. I found the official documentation daunting and too unclear to sell me on its benefits. The course, however, quickly displayed how powerful Docker Compose could be with a relatively simple YAML file.</p> <p>Instead of needing to install the various dependencies on my host machine, I could define a few containers with the same versions of libraries and languages used in production. I could then run one command to spin up all the containers that I needed</p> <p><strong><a href="https://medium.com/singularity-energy/single-line-onboarding-using-docker-compose-971aa6ce8a">Visit Now</a></strong></p>