{"id":4808,"date":"2016-10-21T12:24:20","date_gmt":"2016-10-21T12:24:20","guid":{"rendered":"https:\/\/blog-stg.cheesecakelabs.com\/blog\/scaling-engineers-docker-compose\/"},"modified":"2022-07-01T17:55:15","modified_gmt":"2022-07-01T17:55:15","slug":"scaling-engineers-docker-compose","status":"publish","type":"post","link":"https:\/\/blog-stg.cheesecakelabs.com\/br\/scaling-engineers-docker-compose\/","title":{"rendered":"Using Docker Compose to easily scale your engineering team"},"content":{"rendered":"<p>Onboarding new developers in a project is always nice: they bring new ideas, different expertises and outside-the box thoughts. They tend to tackle problems and create solutions in a creative way, adding even more enthusiasm to the team. But before getting down to code, they need to set up their own development environment, which can easily become a headache.<\/p>\n<p>Installing a local database, compiling the right program language version and solving library dependencies \u2013 possibly across different operating systems \u2013&nbsp;are a few tasks inside this challenge.<\/p>\n<p>Today I&#8217;ll introduce to you Docker and Compose \u2013 a container platform and its simple configuration tool \u2013 to help your team get up and running as fast as possible.<!--more--><\/p>\n<h2>&#8220;It runs on my machine&#8221;<\/h2>\n<p>Software development has quickly evolved in the past years, but it still hard to create a unique setup that works on development, staging and production. Currently&nbsp;there are three main ways of doing it:<\/p>\n<ul>\n<li><strong>Installing everything locally<\/strong> is the easier approach, but not recommended in the long run. You may run into conflicts in every part of the stack! Wrong versions, dependencies, operating system, everywhere. Also, it probably won&#8217;t match your production environment, bringing nightmares the night before deployment.<\/li>\n<li><strong>Using virtual machines<\/strong>. They provide isolation and portable development environments, but as your stack grow, they might cause overhead. Running the same operating system multiple times \u2013 and on top of each other \u2013 is not resource-wise.<\/li>\n<li><strong>Containers<\/strong>! They are awesome! You can run the <em>exact<\/em>&nbsp;same environment with a small footprint, everywhere. For the developer, it means installing the platform and running only a few commands.<\/li>\n<\/ul>\n<p>If you need more information on the process evolution, be sure to read <a href=\"https:\/\/medium.freecodecamp.com\/a-beginner-friendly-introduction-to-containers-vms-and-docker-79a9e3e119b\" target=\"_blank\" rel=\"noopener\">this<\/a>&nbsp;post, it is an awesome guide from understanding better the concept of virtual machines and containers. Also&nbsp;<a href=\"https:\/\/www.youtube.com\/user\/dockerrun\" target=\"_blank\" rel=\"noopener\">Docker Youtube&#8217;s channel<\/a> has great content about its entire stack!<\/p>\n<p>All options have their <a href=\"https:\/\/www.upguard.com\/articles\/docker-vs-vagrant\" target=\"_blank\" rel=\"noopener\">benefits and downsides<\/a>, but the software world is shifting towards a containerized approach. Why? Docker!<\/p>\n<h2>What is this blue whale?<\/h2>\n<p><img decoding=\"async\" class=\"size-full wp-image-3323 aligncenter\" src=\"https:\/\/s3.amazonaws.com\/ckl-website-static\/wp-content\/uploads\/2016\/10\/Whale-Logo332@2x_5.png\" alt=\"Docker Whale\" width=\"400\" height=\"394\">Quoting the documentation:<\/p>\n<blockquote><p>Docker containers wrap a piece of software in a complete filesystem that contains everything needed to run: code, runtime, system tools, system libraries \u2013 anything that can be installed on a server. This guarantees that the software will always run the same, regardless of its environment.<\/p><\/blockquote>\n<p>To provide its magic, Docker made Linux kernel containerization simple and accessible for everyone, providing an API to resources like <a href=\"https:\/\/en.wikipedia.org\/wiki\/Cgroups\" target=\"_blank\" rel=\"noopener\">cgroups<\/a>&nbsp;and <a href=\"https:\/\/en.wikipedia.org\/wiki\/Linux_namespaces\" target=\"_blank\" rel=\"noopener\">namespaces<\/a>. It also leverages its own characteristics, like images, registries, onion filesystem, plain text configuration file and so on. I could write about each one, but I would just be duplicating <a href=\"https:\/\/docs.docker.com\/engine\/understanding-docker\/\">this<\/a>&nbsp;amazing article from the official documentation. Be sure to check that out \ud83d\ude00<\/p>\n<p>For the developer, this means that now it is possible to have application isolation, little overhead and the same setup as their colleagues quickly and easy.<\/p>\n<p>To speed up the process even more, we will be using Compose: a tool for defining and running multi-container Docker applications. It uses a single file to declare your entire stack and just one command to bring it up.<\/p>\n<h2>Enough talk, show me the code!<\/h2>\n<p>I assume you have Docker already installed on&nbsp;your machine, but if you don&#8217;t, the installation process is&nbsp;well-documented <a href=\"https:\/\/docs.docker.com\/engine\/installation\/\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/p>\n<p>The file below is called <code>docker-compose.yml<\/code>. It is responsible for defining your containers&#8217; information like storage, networking and so on and usually lives in&nbsp;the project&#8217;s root folder. I made some comments to describe the most important lines, yet you can find useful information at the <a href=\"https:\/\/docs.docker.com\/compose\/compose-file\/\" target=\"_blank\" rel=\"noopener\">official documentation<\/a>.<\/p>\n<pre><code class=\"language-yaml\">\nversion: '2'\n# Containers are described as services\nservices:\n  # Service name\n  db:\n    # Docker image to be pulled from the registry\n    image: postgres\n    environment:\n      POSTGRES_PASSWORD: '123456A!'\n    # Named volume mapping to store database information\n    volumes:\n      - data-postgres:\/var\/lib\/postgresql\/data\n\n  web:\n    # Instead of using an image, we build our container with a Dockerfile inside the .\/web directory\n    build: .\/web\n    # Command to start the Django webserver\n    command: bash -c \"sleep 10 &amp;&amp; python manage.py runserver 0.0.0.0:8000\"\n    # Mapping of Django app code (you should point to yours)\n    volumes:\n      - \".\/django-project:\/code\"\n    # Port to listen on the localhost\n    expose:\n      - \"8000\"\n    depends_on:\n      - db\n\n# Database's volume definition\nvolumes:\n  data-postgres:\n<\/code><\/pre>\n<p>After creating it, you simply need to run <code>docker-compose up<\/code> to get your environment up and running!<\/p>\n<p>With this simple file, you are able to run a Django + PostgreSQL project within Docker containers! You may have to change some environment variables or make minor changes to get it working. You can read about a&nbsp;full configuration of a Django project, with PostgreSQL and NGINX as a reverse proxy at my <a href=\"http:\/\/deployeveryday.com\/2016\/09\/20\/composing-docker-environments.html\" target=\"_blank\" rel=\"noopener\">personal blog<\/a>.<\/p>\n<h2>Wrapping up!<\/h2>\n<p>As the title says, you can use this approach to quickly and easily&nbsp;<em>scale your engineering team<\/em>. By having Docker Compose and a <code>docker-compose.yml<\/code>&nbsp;in your project, you enable anyone to start working with your team with a few commands. Also, you create&nbsp;a&nbsp;normalized development environment&nbsp;for everyone, which can even be run in production \u2013 but this is an adventure for my next post. Stay tuned!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Onboarding new developers in a project is always nice: they bring new ideas, different expertises and outside-the box thoughts. They tend to tackle problems and create solutions in a creative way, adding even more enthusiasm to the team. But before getting down to code, they need to set up their own development environment, which can [&hellip;]<\/p>\n","protected":false},"author":65,"featured_media":8981,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[471],"tags":[1155],"class_list":["post-4808","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-engenharia","tag-tag-django-br"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Using Docker Compose to easily scale your engineering team | Cheesecake Labs<\/title>\n<meta name=\"description\" content=\"Containers \u2013 they are awesome! Using Docker Composer, all developers can run the same environment with a small footprint. Here is a quick start guide.\" \/>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using Docker Compose to easily scale your engineering team | Cheesecake Labs\" \/>\n<meta property=\"og:description\" content=\"Containers \u2013 they are awesome! Using Docker Composer, all developers can run the same environment with a small footprint. Here is a quick start guide.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog-stg.cheesecakelabs.com\/br\/scaling-engineers-docker-compose\/\" \/>\n<meta property=\"og:site_name\" content=\"Cheesecake Labs\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/cheesecakelabs\" \/>\n<meta property=\"article:published_time\" content=\"2016-10-21T12:24:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-07-01T17:55:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2016\/10\/Banner_docker.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"2000\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Cheesecake Labs\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@cheesecakelabs\" \/>\n<meta name=\"twitter:site\" content=\"@cheesecakelabs\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. tempo de leitura\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog-stg.cheesecakelabs.com\/br\/scaling-engineers-docker-compose\/\",\"url\":\"https:\/\/blog-stg.cheesecakelabs.com\/br\/scaling-engineers-docker-compose\/\",\"name\":\"Using Docker Compose to easily scale your engineering team | Cheesecake Labs\",\"isPartOf\":{\"@id\":\"https:\/\/blog-stg.cheesecakelabs.com\/br\/#website\"},\"datePublished\":\"2016-10-21T12:24:20+00:00\",\"dateModified\":\"2022-07-01T17:55:15+00:00\",\"author\":{\"@type\":\"person\",\"name\":\"Jonatas Baldin\"},\"description\":\"Containers \u2013 they are awesome! Using Docker Composer, all developers can run the same environment with a small footprint. Here is a quick start guide.\",\"breadcrumb\":{\"@id\":\"https:\/\/blog-stg.cheesecakelabs.com\/br\/scaling-engineers-docker-compose\/#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog-stg.cheesecakelabs.com\/br\/scaling-engineers-docker-compose\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog-stg.cheesecakelabs.com\/br\/scaling-engineers-docker-compose\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/blog-stg.cheesecakelabs.com\/br\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using Docker Compose to easily scale your engineering team\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blog-stg.cheesecakelabs.com\/br\/#website\",\"url\":\"https:\/\/blog-stg.cheesecakelabs.com\/br\/\",\"name\":\"Cheesecake Labs\",\"description\":\"Empresa de desenvolvimento e design de aplicativos mobile &amp; web que est\u00e1 reinventando o desenvolvimento de produtos com times remotos. N\u00f3s desenvolvemos aplicativos iOS, Android e aplica\u00e7\u00f5es Web com as melhores empresas dos EUA, do Brasil e do mundo.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/blog-stg.cheesecakelabs.com\/br\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"pt-BR\"},{\"@type\":\"Person\",\"name\":\"Jonatas Baldin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/blog-stg.cheesecakelabs.com\/br\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2016\/11\/jonatas-300x300.jpg\",\"contentUrl\":\"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2016\/11\/jonatas-300x300.jpg\",\"caption\":\"Jonatas Baldin\"},\"description\":\"10 years of experience in Marketing and Sales in the Technology sector. My main purpose is help, support and structure efficient operations and also develop independent and multidisciplinary teams.\",\"url\":\"https:\/\/blog-stg.cheesecakelabs.com\/br\/\/autor\/jonatas-baldin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using Docker Compose to easily scale your engineering team | Cheesecake Labs","description":"Containers \u2013 they are awesome! Using Docker Composer, all developers can run the same environment with a small footprint. Here is a quick start guide.","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"pt_BR","og_type":"article","og_title":"Using Docker Compose to easily scale your engineering team | Cheesecake Labs","og_description":"Containers \u2013 they are awesome! Using Docker Composer, all developers can run the same environment with a small footprint. Here is a quick start guide.","og_url":"https:\/\/blog-stg.cheesecakelabs.com\/br\/scaling-engineers-docker-compose\/","og_site_name":"Cheesecake Labs","article_publisher":"https:\/\/www.facebook.com\/cheesecakelabs","article_published_time":"2016-10-21T12:24:20+00:00","article_modified_time":"2022-07-01T17:55:15+00:00","og_image":[{"width":2000,"height":720,"url":"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2016\/10\/Banner_docker.jpg","type":"image\/jpeg"}],"author":"Cheesecake Labs","twitter_card":"summary_large_image","twitter_creator":"@cheesecakelabs","twitter_site":"@cheesecakelabs","twitter_misc":{"Escrito por":null,"Est. tempo de leitura":"4 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/blog-stg.cheesecakelabs.com\/br\/scaling-engineers-docker-compose\/","url":"https:\/\/blog-stg.cheesecakelabs.com\/br\/scaling-engineers-docker-compose\/","name":"Using Docker Compose to easily scale your engineering team | Cheesecake Labs","isPartOf":{"@id":"https:\/\/blog-stg.cheesecakelabs.com\/br\/#website"},"datePublished":"2016-10-21T12:24:20+00:00","dateModified":"2022-07-01T17:55:15+00:00","author":{"@type":"person","name":"Jonatas Baldin"},"description":"Containers \u2013 they are awesome! Using Docker Composer, all developers can run the same environment with a small footprint. Here is a quick start guide.","breadcrumb":{"@id":"https:\/\/blog-stg.cheesecakelabs.com\/br\/scaling-engineers-docker-compose\/#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog-stg.cheesecakelabs.com\/br\/scaling-engineers-docker-compose\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/blog-stg.cheesecakelabs.com\/br\/scaling-engineers-docker-compose\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog-stg.cheesecakelabs.com\/br\/"},{"@type":"ListItem","position":2,"name":"Using Docker Compose to easily scale your engineering team"}]},{"@type":"WebSite","@id":"https:\/\/blog-stg.cheesecakelabs.com\/br\/#website","url":"https:\/\/blog-stg.cheesecakelabs.com\/br\/","name":"Cheesecake Labs","description":"Empresa de desenvolvimento e design de aplicativos mobile &amp; web que est\u00e1 reinventando o desenvolvimento de produtos com times remotos. N\u00f3s desenvolvemos aplicativos iOS, Android e aplica\u00e7\u00f5es Web com as melhores empresas dos EUA, do Brasil e do mundo.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog-stg.cheesecakelabs.com\/br\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"pt-BR"},{"@type":"Person","name":"Jonatas Baldin","image":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/blog-stg.cheesecakelabs.com\/br\/#\/schema\/person\/image\/","url":"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2016\/11\/jonatas-300x300.jpg","contentUrl":"https:\/\/ckl-website-static.s3.amazonaws.com\/wp-content\/uploads\/2016\/11\/jonatas-300x300.jpg","caption":"Jonatas Baldin"},"description":"10 years of experience in Marketing and Sales in the Technology sector. My main purpose is help, support and structure efficient operations and also develop independent and multidisciplinary teams.","url":"https:\/\/blog-stg.cheesecakelabs.com\/br\/\/autor\/jonatas-baldin\/"}]}},"_links":{"self":[{"href":"https:\/\/blog-stg.cheesecakelabs.com\/br\/wp-json\/wp\/v2\/posts\/4808","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog-stg.cheesecakelabs.com\/br\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog-stg.cheesecakelabs.com\/br\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog-stg.cheesecakelabs.com\/br\/wp-json\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/blog-stg.cheesecakelabs.com\/br\/wp-json\/wp\/v2\/comments?post=4808"}],"version-history":[{"count":1,"href":"https:\/\/blog-stg.cheesecakelabs.com\/br\/wp-json\/wp\/v2\/posts\/4808\/revisions"}],"predecessor-version":[{"id":10330,"href":"https:\/\/blog-stg.cheesecakelabs.com\/br\/wp-json\/wp\/v2\/posts\/4808\/revisions\/10330"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog-stg.cheesecakelabs.com\/br\/wp-json\/wp\/v2\/media\/8981"}],"wp:attachment":[{"href":"https:\/\/blog-stg.cheesecakelabs.com\/br\/wp-json\/wp\/v2\/media?parent=4808"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog-stg.cheesecakelabs.com\/br\/wp-json\/wp\/v2\/categories?post=4808"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog-stg.cheesecakelabs.com\/br\/wp-json\/wp\/v2\/tags?post=4808"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}