Episodes

Resources

Download Source Code

Summary

# Terminal

heroku login
heroku create drifting-ruby-example
heroku addons:create heroku-postgresql:hobby-dev
heroku addons:create heroku-redis:hobby-dev
git push heroku master

heroku domains:add example.driftingruby.com

heroku tail
heroku logs
heroku logs -t
heroku run bundle exec rails runner "puts User.first"

heroku pg:backups:capture
heroku pg:backups:download
pg_restore --verbose --clean --no-acl --no-owner -h postgres -U postgres -d template_development latest.dump

# config/database.yml
production:
  <<: *default
  url: <%= ENV['DATABASE_URL'] %>

# config/initializers/sidekiq.rb
Sidekiq.configure_server do |config|
  config.redis = { url: ENV.fetch("REDIS_URL") { 'redis://localhost:6379/0'  }}
end

Sidekiq.configure_client do |config|
  config.redis = { url: ENV.fetch("REDIS_URL") { 'redis://localhost:6379/0'  }}
end

# config/cable.yml
production:
  adapter: redis
  url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
  channel_prefix: template_production

# Procfile
web: bundle exec puma -C config/puma.rb
worker: bundle exec sidekiq
release: bundle exec rails db:migrate