1

I’m working with a legacy Rails application that requires the puma-dev tool in order to develop locally. The app needs to be able to resolve domains like client-a.myapp.test to localhost:3000.

The problem is this app is so old that me and my team need to docker-ize it in order to have any hope of standing it up locally, due to various outdated components.

The problem, continued, is that I can’t just plop puma-dev into my docker container because Linux support for the tool is extremely lacking and highly unclear how to translate the instructions to a docker environment. After struggling with that route for quite a while I decided to take another approach.

Right now I’ve created a separate docker image just for puma-dev from a golang image on dockerhub. I decided to try and run it in parallel with my other docker container, containing the ruby app, in hopes that they can work together (the ruby app serving on port 3000, with puma-dev listening), or with me ultimately listing it as a dependency in docker-compose for the ruby app and bundling them together. However, I’m not sure if that makes any sense at all to do, or if it’s at all a logically sound approach.

I guess my question is, is it possible for me to do it this way? Or, better yet, how can I get puma-dev working with Docker?

  • Creating it as a separate image and listing it as a dependency on the Rails app container should be fine. Unless that's not what you're asking? – Surya Dec 04 '19 at 08:26
  • Cool, thanks. It is what I'm asking. Basically I got to a point with the implementation and I have some debugging to do, but was unsure if that method would work for me and wanted to verify before spending hours troubleshooting. I know small amounts about both networking and Docker so I wasn't sure if there was some underlying limitation of either puma-dev or docker that would invalidate my approach. – ActiveModel_Dirty Dec 04 '19 at 14:00
  • I'm digging into this now, were you able to find a solution? For our use-case, we have a Rails app running locally with puma-dev and it works fine. I'm containerizing the Rails app but want to change our existing workflow as little as possible, so I'm trying to get puma-dev on the host machine to use the proxied port to the container. – Clinton Apr 20 '20 at 20:58
  • @Clinton I wasn't able to get it working correctly. I wound up just modifying my `/etc/hosts` to get us to a usable state for our needs. Wish I could provide you with some more detail but to be honest, this was a while ago now so most of the details have escaped me. – ActiveModel_Dirty Apr 23 '20 at 04:51

1 Answers1

0

You can use puma-dev proxy feature https://github.com/puma/puma-dev#proxy-support

Run rails server in the rails docker image and expose the port 3000, then in your host machine set a proxy for localhost:3000 with this command:

echo '3000' > ~/.puma-dev/myapp
Toni Oriol
  • 75
  • 2
  • 8