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

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Author(s): Rob Isenberg
Edition: 1 edition (February 24, 2019)
Publisher: Pragmatic Bookshelf
Year: 2019

Language: English
Pages: 240

Acknowledgements
Introduction
What Is Docker?
Why Use Docker?
Who Should Read This Book?
What’s in This Book?
How to Read This Book
Which Operating Systems Are Supported?
Online Resources
Part I. Development
1. 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
2. Running a Rails App in a Container
How Do We Run Our Rails App?
Defining Our First Custom Image
Building Our Image
Running a Rails Server with Our Image
Reaching the App: Publishing Ports
Binding the Rails Server to IP Addresses
Quick Recap
3. Fine-Tuning Our Rails Image
Naming and Versioning Our Image
A Default Command
Ignoring Unnecessary Files
The Image Build Cache
Caching Issue 1: Updating Packages
Caching Issue 2: Unnecessary Gem Installs
The Finishing Touch
Quick Recap
4. Describing Our App Declaratively with Docker Compose
Getting Started with Compose
Launching Our App
Mounting a Local Volume
Starting and Stopping Services
Other Common Tasks
Quick Recap
5. Beyond the App: Adding Redis
Starting a Redis Server
Manually Connecting to the Redis Server
How Containers Can Talk to Each Other
Our Rails App Talking to Redis
Starting the Entire App with Docker Compose
Quick Recap
6. 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
7. Playing Nice with JavaScript
The JavaScript Front-End Options
Rails JavaScript Front End with Webpacker
Compiling Assets with Webpacker
A Hello World React App
Quick Recap
8. Testing in a Dockerized Environment
Setting Up RSpec
Our First Test
Setting Up Rails System Tests
Running Tests That Rely on JavaScript
Debugging
Quick Recap
9. Advanced Gem Management
The Downside to Our Existing Approach
Using a Gem Cache Volume
Quick Recap
10. 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
Part II. Toward Production
11. The Production Landscape
The “Ops” in DevOps
Container Orchestration
A Tale of Two Orchestrators: Swarm and Kubernetes
IaaS vs. CaaS
Provisioning Your Infrastructure
CaaS Platforms
Serverless for Containers
How to Decide What’s Right for Me?
Quick Recap
12. Preparing for Production
Configuring a Production Environment
A Production Image: Precompiling Assets
Sharing Images
Quick Recap
13. A Production-Like Playground
Creating Machines
Introducing Docker Swarm
Our First (Single Node) Swarm
Describing Our App to Swarm
Migrating the Database
Deploying Our App on a Swarm
Tasks and Swarm’s Scaling Model
Scaling Up the Service
Quick Recap
14. Deploying to the Cloud
Creating a DigitalOcean Cluster
Deploying to Our DigitalOcean Swarm
Visualizing Containers
Scale Up the Web Service
Deploying to AWS Instead of DigitalOcean
Quick Recap
15. Closing Thoughts and Next Steps
What Should I Learn About Next?
A1. Platform Differences
File Ownership and Permissions
A2. Finding Images to Use
Using Docker Hub
Using the Docker CLI