Deploy Ruby on Rails without the platform tax

Rails deployment to servers you own

Push to your main branch and Hatchbox builds, migrates, and restarts your Rails app with zero downtime — on servers you own, at raw hosting prices instead of platform markup.

Includes a 7 day free trial. $15 per server per month after that — unlimited apps.

Hatchbox has provided Rails hosting on servers you own since 2016. Point it at a GitHub repository and a fresh Ubuntu server, and it does the rest — there's no build script to write. It sees rails in your Gemfile and takes it from there: Ruby versions, bundler, asset compilation, migrations, the web server, background workers, SSL certificates, and log streaming.

The Ruby version comes from your .ruby-version, .tool-versions, or Gemfile.lock. No buildpacks, no Dockerfile, no lock-in — and you keep full SSH access to a plain, boring server you can debug yourself at 3am.

Why deploy Rails with Hatchbox

Zero-downtime deploys

Each deploy builds into a fresh release directory, then flips the symlink and reloads Puma with a phased restart. Failed builds never take your site down.

Migrations run once

db:migrate runs automatically on the cron server, so it happens exactly once per deploy no matter how many web servers you're running.

Workers detected for you

Hatchbox spots Solid Queue and Sidekiq on the first deploy and adds the worker process itself. It restarts them on deploy, and again if they crash.

Encrypted credentials just work

Set RAILS_MASTER_KEY as an environment variable and your credentials.yml.enc decrypts on the server like it does locally.

What customers say

I run 15+ Rails apps and static sites with Hatchbox. My bill went from $400/month on Heroku to $28/mo with Hatchbox & DigitalOcean combined.

Donn Felker

Software Professional

If you want the most bang for your buck, Hatchbox / Hetzner / DigitalOcean is the killer combo. You can throw sooo much at this and it's crazy how inexpensive it is.

Josh Pigford

Serial Entrepreneur

Applications deployed
24,000+
Deployments run
2 million+
Deploying since
2016

Read more customer stories

How to deploy a Rails app

Four steps from an empty server to a live site. Most people finish in under half an hour.

  1. Connect a server

    Add a DigitalOcean, Hetzner, AWS, Linode, or Vultr API key and let Hatchbox provision a server, or point it at any existing machine running Ubuntu LTS.

  2. Connect your repository

    Authorize GitHub and pick the repo and branch. Hatchbox installs a webhook so every push to that branch can deploy automatically.

  3. Set your environment variables

    Add RAILS_MASTER_KEY, DATABASE_URL, and anything else your app reads from the environment.

  4. Deploy

    Hit deploy and watch the log stream. Bundle, precompile, migrate, restart — usually a couple of minutes.

What Hatchbox does for you

Hatchbox detects Rails from rails in your Gemfile and configures the deploy itself. There's no build script to write.

Build steps it runs

  1. Installs the Ruby version from .ruby-version, .tool-versions, or Gemfile.lock
  2. Installs the matching Bundler version and your gem dependencies
  3. Runs assets:precompile if your app has it — skipped automatically for API-only apps
  4. Runs db:migrate on the cron server, so migrations happen exactly once per deploy

Processes it adds

Created on your first deploy, then kept alive and restarted on every deploy after.

bin/rails server -b 127.0.0.1 -p $PORT   # web
bin/jobs                                 # added if Solid Queue is detected
bundle exec sidekiq                      # added if Sidekiq is detected

Caddy reverse proxies to the web process and load balances across your web servers. Add or scale processes yourself whenever you need to.

Environment variables you set

Added in Hatchbox and written into every release.

RAILS_MASTER_KEY=<contents of config/master.key>
DATABASE_URL=postgres://user:pass@host/db_name

# If you use the Solid gems
QUEUE_DATABASE_URL=...
CACHE_DATABASE_URL=...
CABLE_DATABASE_URL=...

Rails deployment that's safe to run on a Friday

Getting a Rails app online once is the easy part. These are the pieces that make the hundredth deploy as boring as the first.

Deploy on push, from CI, or by hand

With auto deploy on, every push to your branch starts a deploy through the GitHub webhook. Prefer to deploy only after your tests pass? Turn auto deploy off and call your app's deploy webhook URL from the last step of your CI pipeline instead. The Deploy button in the dashboard always works too.

Health checks after every restart

Set a health check path for your app and add the HATCHBOX_WAIT_FOR_HEALTH_CHECK environment variable. After each web server restarts, Hatchbox polls that path and marks the deploy as failed if your app doesn't answer within about 30 seconds.

# config/routes.rb (Rails 7.1+ ships this route)
get "up" => "rails/health#show", as: :rails_health_check

Hooks for after a deploy, or after a failed one

Commit an executable .hatchbox/post-deploy script to run a task once, on one server, after each successful deploy. Notify Slack, warm a cache, or kick off a data backfill. A .hatchbox/failed-deploy script runs when a deploy fails.

#!/usr/bin/env bash
# .hatchbox/post-deploy
set -e
bin/rails runner 'Rails.cache.clear'

One-click rollbacks

Every deploy is kept in your app's history with its commit and full log. If a release misbehaves, hit Rollback on an earlier deploy and Hatchbox redeploys that commit. No shell session or git revert needed.

Rails deployment options compared

There are four common ways to deploy a Rails app. They differ mostly in who sets up the server and who you pay.

Topic Hatchbox Kamal Capistrano PaaS (Heroku, Render)
Where it runs Your servers, on any cloud Your servers, in Docker containers Your servers The platform's infrastructure
What you write Nothing to start. Detected from your Gemfile A Dockerfile and config/deploy.yml config/deploy.rb and server config A Procfile or service settings
Server setup Provisioned and hardened for you You, beyond installing Docker You: Ruby, web server, database Handled by the platform
Deploys and rollbacks Push to deploy, dashboard history, one-click rollback kamal deploy and kamal rollback from your machine cap deploy and cap deploy:rollback from your machine Push to deploy, rollbacks in the dashboard
What you pay $15/server/month plus your hosting bill Free, plus hosting and a container registry Free, plus hosting and your time Per dyno or service, database, and add-on

Going deeper on one of them? Read Hatchbox vs Kamal, Hatchbox vs Heroku, or Hatchbox vs Render.

Rails deployment questions

Still stuck? Ask us directly — a real person who has deployed a lot of Rails apps will answer.

Can I run multiple Rails apps on one server?

Yes, and this is where most of the savings come from. Hatchbox bills per server, not per app, so you can run as many Rails apps on a box as its memory allows without paying another dime.

Does Hatchbox support Solid Queue, Solid Cache, and Solid Cable?

Yes, and Solid Queue is detected for you — Hatchbox adds a bin/jobs process automatically on the first deploy. For the others, set QUEUE_DATABASE_URL, CACHE_DATABASE_URL, and CABLE_DATABASE_URL and the Rails 8 defaults work without further configuration.

What about Active Storage and file uploads?

Use S3, DigitalOcean Spaces, or any other object storage exactly as you would anywhere else. If you use local disk storage, keep the files in a shared directory so they survive deploys.

Can I still SSH into the server?

Always. Add your public key and you have full access. Run rails console, tail logs, inspect processes — it's your server.

How do I roll back a bad Rails deploy?

Open your app's deploy history and click Rollback on the last good deploy. Hatchbox starts a new deploy of that commit, with the same zero-downtime restart as any other deploy. Database migrations are not reversed automatically, so roll those back yourself if the bad release changed the schema.

Simple, predictable pricing.

We charge per server, not per app. Run one application or twenty on the same box — the bill doesn't change.

Start free trial

$15

/server/mo
  • Unlimited applications
  • Deploy anywhere
  • Zero downtime deployments
  • Custom domains & free SSL
  • Databases, cron jobs & background workers
  • Full SSH access to your servers
  • Real, human support
  • 7 day free trial

One server, one bill, as many apps as it can hold. Run any of these alongside your Rails app for no extra cost.

See every framework we deploy

Ready to deploy your Rails app?

Hatchbox has run more than 2 million deploys across 24,000+ applications since 2016. Start a 7 day free trial and put yours on a server you own.