I have a rails app that uses private_pub. Somehow I can't get my app to connect to private_pub.
Is there a way to bind private_pub to 0.0.0.0?
Run rails server
vagrant@vagrant:/vagrant$ rails s -b 0.0.0.0
=> Booting Thin
=> Rails 4.2.2 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Thin web server (v1.6.2 codename Doc Brown)
Maximum connections set to 1024
Listening on 0.0.0.0:3000, CTRL+C to stop
Start private_pub
vagrant@vagrant:/vagrant$ rackup private_pub.ru -s thin -E production
Thin web server (v1.6.2 codename Doc Brown)
Maximum connections set to 1024
Listening on localhost:9292, CTRL+C to stop
Chrome console log
http://localhost:9292/faye/faye.js net::ERR_EMPTY_RESPONSE
Yes, there is a way, it's documented feature. From docs:
server: The URL to use for the Faye server such as http://localhost:9292/faye.
so you can configure your config/private_pub.yml
for the environment you need like this:
development:
server: "http://0.0.0.0:9292/faye"
secret_token: "secret"
Then start a server with:
thin -C config/private_pub.yml -p 9292 start
Using rack adapter
Thin web server (v1.6.4 codename Gob Bluth)
Maximum connections set to 1024
Listening on 0.0.0.0:9292, CTRL+C to stop
I actually don't know why it doesn't catch the port number(I opened the issue in github), so I specified it explicitly.
Second option is to set a host for rackup
command(since in this way it doesn't properly handle the address):
rackup private_pub.ru -s thin -E production -o 0.0.0.0
Thin web server (v1.6.4 codename Gob Bluth)
Maximum connections set to 1024
Listening on 0.0.0.0:9292, CTRL+C to sto
You can also specify explicitly both the address and the port for thin
(as well as for rackup
) and omit config file at all(probably not a good idea since there are secret_token
and signature_expiration
options in config file which should be set):
thin -a 0.0.0.0 -p 9292 start
Using rack adapter
Thin web server (v1.6.4 codename Gob Bluth)
Maximum connections set to 1024
Listening on 0.0.0.0:9292, CTRL+C to stop