Configuring a reverse proxy for Ruby application

I am using Puma on a MRI Ruby web application and typically I have set up a reverse proxy to help out. I don’t know if that is necessary with Fly, or if I should set up a different nginx application and direct traffic. I’ve only set this up on a digital ocean droplet so it has lived on the same server. Is there a way to host nginx on the same server as my application?

After watching this video on configuring a App’s Dockerfile they explore the Docker directory that was added and it has the nginx.conf file.

My launch command provided no Docker directory, and was just using the Heroku buildpack.

Not familiar with Ruby/Puma (there are others on the forum who are, may be they’ll reply), but typically one won’t really need a reverse proxy in front of their Fly app.

You can setup a different Fly app just to run Ngnix but that’s only making your architecture a bit complicated. I’d avoid it, if I can.

  1. That said, the idiomatic way to run Ngnix as a separate app is via multi-process Fly apps. Each process of a multi-process Fly app gets its own VM, and can be scaled independently of other processes. Caveat: This feature has been ‘in preview’ since time immemorial.

  2. Another way is via multi-process Fly machines, which runs all declared processes in the same VM. Caveat: Pretty raw and new, but I’d prefer it over other solutions listed here.

  3. Or, run multiple processes in a Fly app yourself, with the help of process supervisor like overmind or s6.

1 Like