-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow multiple copies of the same app to run independently with different configurations #323
Labels
Comments
I think subdomains solve your problem. You can do
And then somewhere in an initializer use the subdomain to set the ENV (or equivalent best practice) |
I'm afraid that didn't work in my testing 😞 My initial experiments above suggested that the
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey there! Bit of an odd use case here, but I think this could be useful functionality to add, so consider this a feature request.
The problem
I've got a Rails app that runs in multiple different "modes", depending on the value of an
APP_MODE
ENV var at boot time. In my existing setup, I run multiple instances of the app on different ports, e.g.Puma is perfectly happy to run these multiple app modes side-by-side, and I can easily switch between them by going to
localhost:3000
orlocalhost:3001
.My unsuccessful attempt at a solution
I wanted to see if I could recreate this setup with
puma-dev
. First I calledpuma-dev link
multiple times, giving this app multiple aliases:Then I built a custom
.pumaenv
file in an attempt to set distinct ENV vars for the two different aliases:Unfortunately, rather than booting two separate instances of the app, both
api.test
andadmin_dashboard.test
still end up pointing to the same single Puma instance. I'm not particularly familiar with Go, but I suspect that the problem may be because both instances want to use the same.sock
file on disk, even though their aliases are different. (I can totally see how that makes sense for other use cases, where you might WANTadmin_dashboard.test
andapi.test
to both run off the same single instance...but there doesn't seem any way to force the opposite use case, where you intentionally want them to differ.)Workarounds
The best workaround I have right now is to have multiple separate copies of my Rails app/repo on disk, one for each app mode. This sorta works, but it's inconvenient because the multiple copies can fall out of sync with each other (e.g. if I commit an update to the "admin dashboard" copy, I need to remember to pull down that same change on the "API" copy).
It'd be awesome if
puma-dev
allowed multiple symlinks to the same directory to have distinct configurations somehow! I imagine it would be especially useful for tasks like testing Ruby upgrades – for example, allowing a developer to run the same codebase on Ruby 2.7 (ruby_27.test
) and Ruby 3.0 (ruby_30.test
) and compare the behaviors.The text was updated successfully, but these errors were encountered: