High Leverage Rails
Introduction
Introduction to this course
Why use Ruby on Rails
Why use SQLite
Ruby on Rails + SQLite
Powering Your App with SQLite
Creating tables
Timestamps
Column types
Typeof
Ruby types
Creating table introduction
Creating table advanced
Inserting data
Updating data
Upserting data
Reading data
Virtual columns
Enums
Introduction to JSON
Indexing JSON
JSON table functions
Building a Modern Rails Application
Creating a new Rails application
Installing Solid Queue
Installing Solid Cache
Installing Solid Cable
Dockerfile
Application overview
Authentication
Base styles
Registration
Scaffolding posts
Polishing posts
Scaffolding comments
Polishing comments
Polishing models
Polishing controllers
Creating new post
Updating post
Reviewing MVP
Tagging posts
Custom tags
Friendly URLs
Full text search
Deploying & Operating Your App
Backups
Check Litestream locally
Verifying backups
Deployment options
Deploying with Hatchbox
Deployment constraints
Vertical scaling
Database access
Migrations
Watch for free

Enter your email below to watch this video

Video thumbnail
Deploying & Operating Your App
Deploying with Hatchbox

Full Course

$
129
$179
USD, one-time fee
This course came at the perfect time. I’ve recently gotten back into Rails after an 18-year hiatus, and this was a perfect refresher and shows just how much you can accomplish with Rails right out of the box.
Garrett Winder
Garrett Winder

Rails hosting made simple

Deploy apps to servers that you own and control.

Move fast and fix things

Application monitoring that helps developers get it done.

Summary

Discover how to deploy a Rails application with Hatchbox, a cost-effective and Rails-friendly platform. Learn how to connect DigitalOcean, automate deployments with GitHub, and ensure smooth production updates. Plus, see how I fixed a search error post-deployment for a seamless launch.

Video Transcript

To deploy Lorem News, I’m using Hatchbx, a platform designed specifically for hosting Rails applications.

If we look at their website, Hatchbox offers affordable pricing at $10 per month per server, with a one-week free trial. Since I’m already signed in, let’s walk through the step-by-step process of deploying our application on Hatchbox from scratch.

Setting Up a Cluster on Hatchbox

The first thing we need is a cluster. I prefer Digital Ocean as my provider, but Hatchbox also supports Hetzner, AWS, Vultr, Linode, or even your own self-managed server.

I’ll go with the default name and connect my Digital Ocean account.

How Hatchbox Works

Hatchbox lets you bring your own servers from cloud providers. Unlike Heroku, which abstracts infrastructure management, Hatchbox allows you to fully own and manage your servers, while it automates the provisioning and deployment process.

Now that I’ve authorized Digital Ocean, I’ll select a server region. Since I’m in Berlin, I’ll choose Frankfurt 1 and continue.

A cluster is essentially a namespace where your servers live. But to actually deploy our app, we need to add servers to the cluster.

Provisioning a Server on Hatchbox

Hatchbox supports all Digital Ocean server types, but for this basic app, I’ll use the cheapest $4/month server.

Important: We need to enable both the web and cron responsibilities for this server since they are required for a Rails app.

We won’t need to provision:

  • A separate database instance (since we’re using SQLite)
  • Redis, Memcached, or Elasticsearch (our caching and search needs are all handled within SQLite)

Once the server creation process starts, it takes about 5–10 minutes to complete. Instead of watching spinners, let’s fast-forward to when the server is fully set up.

Navigating the Hatchbox UI

Now that our server is created and provisioning is complete, let’s explore how to manage deployments in the Hatchbox UI.

Under server details, you’ll find:

  • Roles & responsibilities (e.g., web, cron)
  • Operating system
  • IP addresses & connection status
  • All deployed apps on this machine

One of my favorite Hatchbox features is that you can rent a large server (from Hetzner, Digital Ocean, etc.) and deploy multiple Rails apps to a single machine. This saves costs by reducing the number of servers you need, making it a great option for indie developers who run multiple projects.

Deploying Our Rails Application

Now that our server is provisioned, we can add our application.

  1. Select a cluster – We only have one, so we’ll use it.
  2. Rename the app – Let’s call it "Lorem News".
  3. Connect to GitHub – If you haven’t connected your GitHub repo, Hatchbox provides a link to do so.
  4. Specify repository details – Add the repo path, specify a branch name (if different from main), and save the configuration.
  5. Enable automatic deploys – Every time we push to main, the app will automatically redeploy. This ensures a smooth CI/CD workflow.

Deploying for the First Time

At this point, Hatchbox recommends adding a database (e.g., Postgres or MySQL), but since we’re using SQLite, we skip this step.

Similarly, we won’t configure domains or SSL certificates in this tutorial, since that depends on where you host your domain (Cloudflare, CloudFront, etc.).

Instead, we’ll deploy the app immediately. This triggers the first deployment, which takes about 5 minutes. We’ll fast-forward again to when it’s finished.

Testing the Live Application

Once deployed, we can view the app in production.

  • First Test: Signing up a new user
  • Second Test: Creating a new post
  • Third Test: Searching for posts

While testing, I ran into an issue with site-wide search—it triggered a server error.

Debugging the Search Error

To investigate the error, we:

  • Check Hatchbox logs – We navigate to Processes → Server logs to see what went wrong.
  • Find the error message – The logs show an SQLite syntax error related to an empty search query.
  • Reproduce the issue locally – Running the search command with an empty string causes an exception.
  • Fix the bug - We update the search controller to ensure it only queries when a valid search term is present. We use present? to prevent empty queries from being executed.
  • Commit & push the fix – Since we enabled automatic deployments, Hatchbox detects the new commit and starts a redeploy.

Final Deployment & Confirmation

This second deployment runs faster than the first. After a couple of minutes, the fix is live.

Now, when we search for "excited", the correct post appears, confirming that our search is working properly.

Final Thoughts on Hatchbox In less than 15 minutes, we successfully deployed Lorem News to production.

Why I love Hatchbox for Rails apps:

  • Affordable ($10/month per server)
  • Minimal complexity
  • Seamless GitHub integration
  • Multiple apps on one server
  • Automatic deployments

For indie developers or small teams, Hatchbox is a powerful and cost-effective alternative to Heroku.