How to deploy Rails4 to Heroku? (with ActionCable)

Thank you for continuing to follow this tutorial. If you stumble on this post and don’t know what happening, please check Part 1  ,  Part 2 and Part 3 that covers basic setup and styling. Also please check  Live Demo for the final result. If like to deep straight into code, here is the source code for all 3 parts.


Anatoly Spektor

Let me help you!

Hey, I am Anatoly, founder of this blog. I would love to help you! I have 6+ years experience in Web Development and IT Leadership. Lets work together on your project! Leave me your email and I will schedule a FREE Consultation!


  • verified heroku account
  • postgresql
  • heroku command line tool
  • git

For deployment to Heroku I will be using amazing example from heroku blog 

First of all go to your Gemfile and uncomment line:


gem 'redis', '~> 3.0'

Then run:

bundle install

Create heroku app, by going into your

heroku create notificator-rails5

Add redis to our app (it requires verified account, but redis itself is free up to 10 connections)

heroku addons:add redistogo --app notificator-rails5

Get redis url that is used for production

heroku config --app notificator-rails5 | grep REDISTOGO_URL

You will get something like this:

REDISTOGO_URL: redis://redistogo:[email protected]:9490/

Put this variable into cable.yml  (please change your redis url to the one you got from the heroku)


development: adapter: async test: adapter: async production: adapter: redis url:redis://redistogo:[email protected]:9490/

Next step is to specify websockets url path. Go to production.rb and add following lines:


config.web_socket_server_url = "wss://" config.action_cable.allowed_request_origins = [ '', /*/ ]


While you are in production.rb, we need to do a special fix for Heroku to show assets:

change from false to true:


config.assets.compile = true

add :


config.assets.digest = true

Cool! We are good to go!

Commit this and push to master:

git push heroku master

In case when its succeeds you still don’t see your website, run:

heroku rake db:migrate

to force  database migration

Please post your questions into comment section.

If you like what you see please Subscribe to my blog. If you need help with your project, please Get In Touch.

Thanks for installing the Bottom of every post plugin by Corey Salzano. Contact me if you need custom WordPress plugins or website design.

Anatoly Spektor

IT Consultant with 6 years experience in Software Development and IT Leadership. Participated in such projects as Eclipse IDE, Big Blue Button, Toronto 2015 Panam Games.

Get paid to share your bandwidth! Peer2Profit is the BEST side income for you! →