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.
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!
Pre-requisites:
- 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:
notificator/Gemfile
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)
notificator/config/cable.yml
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:
notificator/config/environments/production.r
config.web_socket_server_url = "wss://notificator-rails5.herokuapp.com/cable" config.action_cable.allowed_request_origins = [ 'https://notificator-rails5.herokuapp.com', /http://notificator-rails5.herokuapp.com.*/ ]
While you are in production.rb, we need to do a special fix for Heroku to show assets:
change from false to true:
notificator/config/environments/production.r
config.assets.compile = true
add :
notificator/config/environments/production.r
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.