GAURAV VARMA
In Feb 2023, Basecamp released Kamal (formerly MRSK) — a deployment tool designed to make zero-downtime deploys simple, fast, and infrastructure-independent.
Kamal is opinionated, Docker-based, and avoids cloud-specific lock-in by relying on SSH and Docker Compose. It’s a modern replacement for tools like Capistrano and Heroku pipelines for self-hosted Rails apps.
What is Kamal?
Kamal is an open-source deployment tool created by @dhh, inspired by the simplicity of Heroku but designed for self-hosted environments. It focuses on:
- Zero-downtime deployments
- Simple configuration
- Docker-first approach
- No vendor lock-in
- Fast rollback
Kamal deploys your Rails app as a set of containers across one or more remote servers using SSH, Docker, and Docker Compose.
How does Kamal work?
Here’s the basic flow:
- You define your app and servers in a
deploy.yml
file. - Kamal builds a Docker image locally or remotely.
- It pushes the image to your servers.
- Kamal performs a rolling update using Docker containers.
- Nginx or Traefik handles traffic routing with zero downtime.
1kamal init
2# Creates config/deploy.yml
3
4kamal deploy
5# Deploys your app across all defined servers
You can also rollback instantly:
1kamal rollback
Key Features
- ✅ Zero-downtime deploys with rolling restarts
- ✅ Docker-native with simple container orchestration
- ✅ Configurable load balancing (Nginx, Traefik, HAProxy)
- ✅ Integrated asset building
- ✅ Built-in health checks
- ✅ Environment parity with production
Why Kamal?
For years, Capistrano and cloud PaaS platforms (Heroku, Render) have dominated Rails deployments. Kamal offers:
- More control than Heroku
- Less complexity than Kubernetes
- Better developer experience than Capistrano
- Complete Docker parity with local and prod
It’s great for teams who want to:
- Host Rails apps on their own servers
- Avoid cloud lock-in
- Deploy in edge or hybrid environments
Real-World Setup Example
Your deploy.yml
might look like this:
1service: myapp
2image: myregistry.com/myapp
3servers:
4 web:
5 hosts:
6 - 192.168.0.2
7 - 192.168.0.3
8env:
9 secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
Kamal handles the build, push, and deployment process for you — all without touching AWS CLI, Terraform, or Kubernetes.
Links
Summary
Kamal is a bold step forward in Rails deployment simplicity. If you’ve ever wanted Heroku-like ease without the vendor lock-in — or you're tired of fiddling with Capistrano — Kamal is worth exploring. It makes Dockerized Rails deploys predictable, fast, and production-ready with minimal overhead.