title: what is the correct way to set up puma, rails and nginx with docker?
body: <p>I have a Rails application which is using Puma. I'm using nginx for load balancing. I would like to dockerize and deploy to a DigitalOcean (Docker) droplet.</p>
  
  <p>After reading lots of blogs and examples (most of which are a year old and that's a long time in the Docker world), I'm still confused about 2 things. Let's say that I select a DigitalOcean box with 4 CPUs. How am I supposed to set up the Rails containers? Should I set up 4 different containers, where Puma is configured with 1 worker process? Or should I set up 1 container where Puma is configured with 4 worker processes?</p>
  
  <p>And the second thing I'm confused about: should I run nginx inside the Rails container, or should I run them in separate containers?</p>
  
  <p>These 2 questions allow 4 permutations that I diagramed below.</p>
  
  <p>option 1
  <a href="https://i.stack.imgur.com/ikI6M.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ikI6M.png" alt="option 1"></a></p>
  
  <p>option 2
  <a href="https://i.stack.imgur.com/F8rLE.png" rel="noreferrer"><img src="https://i.stack.imgur.com/F8rLE.png" alt="option 2"></a></p>
  
  <p>option 3
  <a href="https://i.stack.imgur.com/0qgRV.png" rel="noreferrer"><img src="https://i.stack.imgur.com/0qgRV.png" alt="option 3"></a></p>
  
  <p>option 4
  <a href="https://i.stack.imgur.com/orBaH.png" rel="noreferrer"><img src="https://i.stack.imgur.com/orBaH.png" alt="option 4"></a></p>