Deploying Rails 8 with Kamal: A Practical Guide
Deploying Rails 8 with Kamal: A Practical Guide
Kamal makes deploying Rails apps to bare metal servers incredibly simple. Here's how to get started.
Prerequisites
- A VPS with Docker installed (Hetzner, DigitalOcean, etc.)
- A domain pointed at your server's IP
- SSH key access
Initial Setup
kamal init
This generates a deploy.yml file. Key settings to configure:
service: myapp
image: myregistry/myapp
servers:
web:
hosts:
- 123.456.789.0
labels:
traefik.http.routers.myapp.rule: Host(`myapp.com`)
First Deploy
kamal setup
This does everything: pulls images, sets up Docker, configures SSL via Let's Encrypt, and starts your app.
Zero-Downtime Deploys
Kamal uses rolling deploys by default. New containers start before old ones stop:
kamal deploy
Database
For PostgreSQL, use a managed database (Railway, Supabase) or run it on a separate server. Kamal handles the app containers — not the database.
Monitoring
Check your app health:
kamal app logs
kamal app status
Kamal brings Heroku-like simplicity to your own infrastructure.