small medium large xlarge

Docker for Rails Developers: Build, Ship, and Run Your Applications Everywhere

by

Cover image for Docker for Rails Developers

Docker for Rails Developers

Build, Ship, and Run Your Applications Everywhere

by

Docker does for DevOps what Rails did for web development—it gives you a new set of superpowers. Gone are “works on my machine” woes and lengthy setup tasks, replaced instead by a simple, consistent, Docker-based development environment that will have your team up and running in seconds. Gain hands-on, real-world experience with a tool that’s rapidly becoming fundamental to software development. Go from zero all the way to production as Docker transforms the massive leap of deploying your app in the cloud into a baby step.

Choose Your Format(s)

  • $19.95 In Stock
    • Beta: What do I get?

  • Ebooks are DRM free.

  • Ebook delivery options.

  • The Paper Book will ship on 2018-09-10 (roughly).

About this Title

Skill-meter-1-4
Pages: 180 (est)
Published: 2018-09-10
Release: B5.0 (2018-07-24)
ISBN: 978-1-68050-273-2

Docker makes life as a Ruby and Rails developer easier. It helps build, ship, and run your applications, solving major problems you face every day. It allows you to run applications at scale, adding new resources as needed. Docker provides a reliable, consistent environment that’s guaranteed to work the same everywhere.

Docker lets you do all things DevOps without needing a PhD in infrastructure and operations. Want to spin up a cluster to run your app? No problem. Scale it up or down at will? You bet. Start by running a Ruby script without having Ruby installed on the local machine. Then Dockerize a Rails application and run it using containers, including creating your own custom Docker images tailored for running Rails apps. Describe your app declaratively using Docker Compose, specifying the software dependencies along with everything needed to run the application. Then set up continuous integration, as well as your deployment pipeline and infrastructure. Along the way, find out the best practices for using Docker in development and production environments.

This book gives you a solid foundation on using Docker and fitting it into your development workflow and deployment process.

What You Need

All you need is a Windows, Mac OS X or Linux machine to do development on. This book guides you through the process of installing Docker. Some basic familiarity with Linux/Unix is recommended even if you’re using a Windows machine.

Contents & Extracts

This book is currently in beta, so the contents and extracts will change as the book is developed.

  • Introduction
  • Development
    • A Brave New World
      • Installing Docker
      • Verifying Your Install
      • Before We Begin
      • Running a Ruby Script without Ruby Installed
      • Generating a New Rails App without Ruby Installed
      • Quick Recap
    • Running a Rails App in a Container
      • How Do We Run Our Rails App?
      • Defining Our First Custom Image excerpt
      • Building Our Image
      • Running a Rails Server with Our Image
      • Reaching the App: Publishing Ports
      • Binding the Rails Server to IP Addresses
      •  Quick Recap
    • Fine-Tuning Our Rails Image
      • Naming and Versioning Our Image
      • A Default Command
      • Ignoring Unnecessary Files
      • The Image Build Cache
      • Solving a Caching Problem
      • The Finishing Touch
      • Quick Recap
    • Describing Our App Declaratively with Docker Compose
      • Getting Started with Compose
      • Launching Our App
      • Mounting a Local Volume
      • Starting and Stopping Services excerpt
      • Other Common Tasks
      • Quick Recap
    • Beyond the App: Adding Redis
      • Starting a Redis Server
      • Manually Connecting to the Redis Server
      • How Containers Can Talk to Each Other excerpt
      • Our Rails App Talking to Redis
      • Starting the Entire App with Docker Compose
      • Quick Recap
    • Adding a Database: Postgres
      • Starting a Postgres Server
      • Connecting to Postgres from a Separate Container
      • Connecting Our Rails App to Postgres
      • Using the Database in Practice
      • Decoupling Data from the Container
      • Quick Recap
    • Testing in a Dockerized Environment
      • Setting Up RSpec
      • Our First Test
      • Adding Feature Specs with Capybara
      • Running Tests That Rely on JavaScript
      • Quick Recap
    • Advanced Gem Management Strategies
      • The Downside to Our Existing Approach
      • Strategy 1: bundle add then “Commit”
      • Strategy 2: Using a Gem Cache Volume
      • Quick Recap
    • Some Minor Irritations
      •  Rails tmp/pids/server.pid Not Cleaned Up
      • Compose Intermittently Aborts with Ctrl-C
      • Quick Recap
      • Closing Thoughts on Docker in Development
  • Towards Production
    • The Production Landscape
    • Creating a Cluster
    • Deploying and Scaling Your App

Author

Rob Isenberg is CTO/product manager at evolve!, and has worked on projects for Big Media (Sky, Universal, BBC), banks (Deutsche Bank), charities (Amnesty International, Mencap), and startups (Composed, Mush, PureGroup). A huge Docker enthusiast, he’s attended DockerCon EU and is excited to help Ruby and Rails teams streamline their workflows to build the best products they can. Tweets from @robisenberg.