Skip to main content

18 How to Deploy ActionCable and Rails 5 To Production

Episode 103 · February 4, 2016

Learn how to deploy ActionCable and Rails 5 with Passenger

ActionCable Rails 5.0 Deployment Production


Resources

# If you don't have redis server already installed, 
# make sure to install that if you choose to use that as the backend
sudo apt-get install redis-server
# config/cable.yml
production:
  url: redis://localhost:6379

local: &local
  url: redis://localhost:6379

development: *local
test: *local
# config/routes.rb
mount ActionCable.server => "/cable"
# app/assets/javascripts/channels/index.coffee
App.cable = ActionCable.createConsumer("/cable")
# config/environments/production
config.action_cable.allowed_request_origins = ["https://gorails.com"]
# /etc/nginx/sites-enabled/default
server {
  listen 80;
  server_name gorails.com;

  passenger_enabled on;
  rails_env production;
  root /home/deploy/gorails/current/public;

  location /cable {
    passenger_app_group_name gorails_websocket;
    passenger_force_max_concurrent_requests_per_process 0;
  }

  error_page 500 502 503 504 /50x.html;
  location = /50x.html {
    root html;
  }
}

No transcripts available. Earn a free month

Discussion