From 001df82025539bab3f5f84c779e7e2a85dcafee6 Mon Sep 17 00:00:00 2001 From: Grigoriy Dobryakov Date: Tue, 17 Nov 2015 16:53:57 +0100 Subject: [PATCH] bind puma to external IP (for remote machine) and change ws endpoint --- README.md | 3 ++- app/assets/javascripts/channels/index.coffee | 2 +- config/puma.rb | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 config/puma.rb diff --git a/README.md b/README.md index 14b2e99f..ea35f7b3 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,10 @@ You must have redis installed and running on the default port:6379 (or configure ## Starting the servers +0. Check `config/puma.rb` 1. Run `./bin/setup` 2. Run `./bin/cable` -3. Open up a separate terminal and run: `./bin/rails server` +3. Open up a separate terminal and run: `./bin/rails server` (if you want to use config/puma.rb, please run `bundle exec puma`) 4. One more terminal to run redis server: `redis-server` 4. Visit `http://localhost:3000` diff --git a/app/assets/javascripts/channels/index.coffee b/app/assets/javascripts/channels/index.coffee index 255891a0..2cba39e5 100644 --- a/app/assets/javascripts/channels/index.coffee +++ b/app/assets/javascripts/channels/index.coffee @@ -3,4 +3,4 @@ #= require_tree . @App = {} -App.cable = Cable.createConsumer 'ws://localhost:28080' +App.cable = Cable.createConsumer 'ws://' + window.location.hostname + ':28080' diff --git a/config/puma.rb b/config/puma.rb new file mode 100644 index 00000000..41860041 --- /dev/null +++ b/config/puma.rb @@ -0,0 +1,5 @@ + +# https://github.com/puma/puma/blob/master/examples/config.rb +# https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#config + +bind 'tcp://0.0.0.0:9292'