Jonathan Bennett

Quick Tips for a Smooth Kamal Setup

If you’re upgrading an existing Rails app with Kamal, here are three tips to help you avoid common pitfalls:

1. Add the /up Endpoint to config/routes.rb

By default, Kamal uses /up to check if the server is ready. Ensure this is defined in your routes:

get "up" => "rails/health#show", as: :rails_health_check

2. Handle SSL Redirects for /up

Since the /up check is an HTTP request (not HTTPS), you might encounter 301 redirect errors if config.force_ssl = true is set. To fix this, allow the /up endpoint to bypass SSL redirection:

# config/environments/production.rb
config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }

3. Boot Database Accessories

If you’ve added a database as an accessory and can’t connect, it may not be booted. Run this command to get it started:

kamal accessory boot db

(Replace db with the name of your database accessory.)


Have you tried Kamal? What’s your experience been like? Hit reply and let me know!