All Collections Frameworks Ruby on Rails

Ruby on Rails

How to deploy Ruby on Rails apps with Hatchbox

Updated

Build Steps

When Hatchbox detects rails in the Gemfile in the repository, it will trigger the Rails build process.

  1. Install the Ruby version from .ruby-version, .tool-versions, or Gemfile.lock
  2. Install the correct Bundler version and dependencies
  3. Check for assets:precompile and run it (API-only apps won't have this)
  4. Check for db:migrate and run it on the cron server (so it only runs once a deploy)

After building, Hatchbox will add a process for the Rails server on the first deploy.

Hatchbox will also add processes for Sidekiq and Solid Queue if detected as well.

Multiple Database Support

Rails ships with the Solid gems by default: solid_queue, solid_cache, and solid_cable. For production, your Rails application needs a database configured for each.

Assign a database for each using the matching environment variable name:

  • DATABASE_URL
  • QUEUE_DATABASE_URL
  • CACHE_DATABASE_URL
  • CABLE_DATABASE_URL