Skip to content
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

Unable to serve the same app in different domains #85

Closed
mrsimo opened this issue Oct 14, 2016 · 2 comments
Closed

Unable to serve the same app in different domains #85

mrsimo opened this issue Oct 14, 2016 · 2 comments

Comments

@mrsimo
Copy link

mrsimo commented Oct 14, 2016

I have this use case that would be nice to support:

[~/.puma-dev] $ ls -lah
[...]
lrwxr-xr-x   1 albert  staff    23B Oct  7 19:40 harvestapp -> /Volumes/wrk/harvestapp
lrwxr-xr-x   1 albert  staff    23B Oct 14 18:26 other-domain -> /Volumes/wrk/harvestapp

We do this because we serve the standard app and the admin in different domains. Hitting the same app from both endpoints ends up in an error on the second one:

! Booting app 'harvestapp' on socket /Users/albert/.puma-dev/harvestapp/tmp/puma-dev-83010.sock
harvestapp[83184]: bash: no job control in this shell
harvestapp[83184]: [83184] Puma starting in cluster mode...
harvestapp[83184]: [83184] * Version 3.6.0 (ruby 2.3.1-p112), codename: Sleepy Sunday Serenity
harvestapp[83184]: [83184] * Min threads: 0, max threads: 1
harvestapp[83184]: [83184] * Environment: development
harvestapp[83184]: [83184] * Process workers: 4
harvestapp[83184]: [83184] * Phased restart available
harvestapp[83184]: [83184] * Listening on unix:/Users/albert/.puma-dev/harvestapp/tmp/puma-dev-83010.sock
harvestapp[83184]: [83184] Use Ctrl-C to stop
! App 'harvestapp' booted
harvestapp[83184]: [83184] - Worker 2 (pid: 83785) booted, phase: 0
harvestapp[83184]: [83184] - Worker 0 (pid: 83783) booted, phase: 0
harvestapp[83184]: [83184] - Worker 1 (pid: 83784) booted, phase: 0
harvestapp[83184]: [83184] - Worker 3 (pid: 83786) booted, phase: 0
! Booting app 'other-domain' on socket /Users/albert/.puma-dev/other-domain/tmp/puma-dev-83010.sock
! App 'other-domain' booted
other-domain[83791]: [83791] Puma starting in cluster mode...
other-domain[83791]: [83791] * Version 3.6.0 (ruby 2.3.1-p112), codename: Sleepy Sunday Serenity
other-domain[83791]: [83791] * Min threads: 0, max threads: 1
other-domain[83791]: [83791] * Environment: development
other-domain[83791]: [83791] * Process workers: 4
other-domain[83791]: [83791] * Phased restart available
other-domain[83791]: [83791] * Listening on unix:/Users/albert/.puma-dev/other-domain/tmp/puma-dev-83010.sock
other-domain[83791]: bundler: failed to load command: puma (/Users/albert/.rbenv/versions/2.3.1/gemsets/harvestapp/bin/puma)
other-domain[83791]: RuntimeError: There is already a server bound to: /Users/albert/.puma-dev/other-domain/tmp/puma-dev-83010.sock
other-domain[83791]:   /Users/albert/.rbenv/versions/2.3.1/gemsets/harvestapp/gems/puma-3.6.0/lib/puma/binder.rb:359:in `add_unix_listener'
other-domain[83791]:   /Users/albert/.rbenv/versions/2.3.1/gemsets/harvestapp/gems/puma-3.6.0/lib/puma/binder.rb:138:in `block in parse'
other-domain[83791]:   /Users/albert/.rbenv/versions/2.3.1/gemsets/harvestapp/gems/puma-3.6.0/lib/puma/binder.rb:85:in `each'
other-domain[83791]:   /Users/albert/.rbenv/versions/2.3.1/gemsets/harvestapp/gems/puma-3.6.0/lib/puma/binder.rb:85:in `parse'
other-domain[83791]:   /Users/albert/.rbenv/versions/2.3.1/gemsets/harvestapp/gems/puma-3.6.0/lib/puma/cluster.rb:393:in `run'
other-domain[83791]:   /Users/albert/.rbenv/versions/2.3.1/gemsets/harvestapp/gems/puma-3.6.0/lib/puma/launcher.rb:172:in `run'
other-domain[83791]:   /Users/albert/.rbenv/versions/2.3.1/gemsets/harvestapp/gems/puma-3.6.0/lib/puma/cli.rb:74:in `run'
other-domain[83791]:   /Users/albert/.rbenv/versions/2.3.1/gemsets/harvestapp/gems/puma-3.6.0/bin/puma:10:in `<top (required)>'
other-domain[83791]:   /Users/albert/.rbenv/versions/2.3.1/gemsets/harvestapp/bin/puma:23:in `load'
other-domain[83791]:   /Users/albert/.rbenv/versions/2.3.1/gemsets/harvestapp/bin/puma:23:in `<top (required)>'
! Killing 'other-domain' (83791)
* App 'other-domain' shutdown and cleaned up

I've tried setting up a custom puma config file and call pidfile on there, but it's not working.

It works fine if I boot the app manually and point both domains to the proper port instead, but we're trying to get an easy setup where people don't have too boot servers manually.

Thank you! ❤️

@javan
Copy link
Contributor

javan commented Oct 20, 2016

See #75 for a workaround.

@mrsimo
Copy link
Author

mrsimo commented Oct 20, 2016

Oh, I totally missed that. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants