1

I'm following this Rails chat tutorial and successfully make it locally. But I got trouble deploying it to Amazon EC2 Linux. Error loading the faye.js

GET http://localhost:9292/faye.js net::ERR_CONNECTION_REFUSED

Do I need to configure something ? BTW I already added port 9292 for both Incoming and Outbound in Security Groups.

Thank you.

aldrien.h
  • 3,437
  • 2
  • 30
  • 52

1 Answers1

2

SOLVE

No need to add Inbound or Outbound in Amazon EC2 Security Group. To run or check the faye connection like in local development (http://localhost:9292) in Amazon EC2.

run/check faye

rails s -b 0.0.0.0

-b is for binding. See this link, https://github.com/thoughtbot/til/blob/master/docker/binding-to-0-0-0-0-in-rails.md

So, you can now access it using EC2 IP/Elastic IP like http://54.33.222.111:9292.

Then, you will see "Sure you're not looking for /faye ?"

run private_pub

rackup private_pub.ru -s thin -E production -o 0.0.0.0

-o will open ports for your EC2 IP Address.

You can also use external faye server. As here https://github.com/Hareramrai/fayeserver. But it seems a little slow in response, so I still used locally.

If you plan to use external faye server, update your private_pub.yml like:

server: "http://ramfayeserver.herokuapp.com/faye"
secret_token: "batkaro"
aldrien.h
  • 3,437
  • 2
  • 30
  • 52