How to Deploy ActionCable and Rails 5 To Production Discussion
Nice! This is pretty much what we also recommend in our upcoming Action Cable integration documentation.
One thing that I'd like to add is that you will need to configure config/cable.yml to specify either redis or postgresql as adapter. Rails 5 is going to default to the in-process 'async' adapter, but that adapter does not work when multiple processes are involved (as is the case with Passenger).
I forgot about that until after I finished recording! The actioncable-examples repository that I cloned still used the Redis adapter default, so I totally overlooked that change. Great to know.
@honglilai:disqus @excid3:disqus so, does that mean if we are not specifying either redis or postgresql as adapter, the chat message couldn't be saved into our app database?
The chat message would still be saved, but the notification wouldn't be broadcasted to all the clients connected to the WebSocket.
Thanks Chris for this great tutorial! I've 2 questions:
1. Can we use this setup on Heroku?
2. Currently, I'm using Puma server on Heroku which only allow 16 concurrent connection at a time https://devcenter.heroku.co...
My question, if we use Passenger, can we get the 'unlimited' concurrent connection?
I'm going to be doing some testing on Heroku to see, but I think you'll be fine using Puma on there still.
I haven't yet, was hoping that the first release candidate would ship, but still waiting on that. I put these episodes out and then like the next week a bunch changed so I didn't want to be making too many immediately outdated episodes.
Yeah. That makes sense. I'm finding several different tutorials teaching different ways of getting ActionCable to work.
Good news! Heroku is actually really easy now.
Just tested it this morning and it's super easy to setup: https://github.com/excid3/a...
The trick is that you _must_ use the route mounted version because Heroku apps only expose one port. Just make sure you have a Redis connection added, and you should be all set.
You can try out my example app here: http://actioncable-gorails.... (just make sure you're on http, not https.
Could you please make one screencast on actioncable on heroku with all deployment options, e.g., Thin, Unicorn, Puma, Passenger etc.? Also, what would be your recommended set up? For instance, is Postgres on Heroku is sufficient or should we also deploy Redis?
Hi Chris. I looked at your github and implemented your setup. I'm still not getting it to work.
I'm using both Heroku postgres and Heroku Redis on the same app. Is that the correct way of doing it?
Thanks, I just successfully deploy to passenger and Pg as backend, my chat repository is https://github.com/Eric-Guo...
Great Tutorial. Chris, can you use a larger font while recording the screencast. The small font is hard to read. Thanks
Nice tutorial! I am trying send notification if a logged in user get invited. Any idea, how do I track if a user is logged in or not ? Any hint or help would be great.
How do I go about deploying my app on heroku, knowing that it has actioncable?
I don't believe there are any necessary changes for Heroku. You should be able to just deploy it, making sure that your allowed request origins match the domain you're running on.
I got the same problem with Diogo Wernick. I got this error:
WebSocket connection to 'ws://example.com/cable' failed: Error during WebSocket handshake: Unexpected response code: 404
And also when I open production.log on the server, I see this error:
WebSocket error occurred: One or more reserved bits are on: reserved1 = 1, reserved2 = 0, reserved3 = 0
Here is the link to the thread which has more details:
I'm using elasticbeanstalk with ruby 2.6 that comes with passenger 4.0.60.
I'm having issue with connection eastablishment.
I did some research on the internet then I found that action cable support comes after passenger 5 but we can't upgrade the passenger in elasticbeanstalk. Is there any way I can implement action cable in my current infrastructure?