Kamal (by 37signals/Basecamp) deploys Docker containers to bare metal servers with zero-downtime. No Kubernetes, no PaaS — just SSH and Docker. It's how HEY and Basecamp deploy.
Why Kamal?
- No Kubernetes — deploy to any Linux server via SSH
- Zero downtime — rolling deploys with health checks
- Multi-server — deploy to multiple servers at once
- Traefik built-in — automatic SSL and routing
- Free — open source, works with any $5 VPS
Install
gem install kamal
# Or in your project
bundle add kamal
kamal init
Configuration
# config/deploy.yml
service: my-app
image: my-registry/my-app
servers:
web:
- 192.168.1.1
- 192.168.1.2
workers:
hosts:
- 192.168.1.3
cmd: bundle exec sidekiq
registry:
username: my-user
password:
- KAMAL_REGISTRY_PASSWORD
env:
clear:
RAILS_ENV: production
DATABASE_URL: postgres://...
secret:
- RAILS_MASTER_KEY
- STRIPE_SECRET_KEY
traefik:
options:
publish:
- "443:443"
volume:
- "/letsencrypt:/letsencrypt"
args:
entryPoints.websecure.address: ":443"
certificatesResolvers.letsencrypt.acme.email: "admin@example.com"
certificatesResolvers.letsencrypt.acme.storage: "/letsencrypt/acme.json"
certificatesResolvers.letsencrypt.acme.httpChallenge.entryPoint: web
healthcheck:
path: /healthz
port: 3000
interval: 10s
Commands
# First deploy (sets up Docker, Traefik, everything)
kamal setup
# Deploy new version
kamal deploy
# Rollback
kamal rollback
# App logs
kamal app logs
# Remote console
kamal app exec -i bash
kamal app exec -i 'rails console'
# Run one-off commands
kamal app exec 'rails db:migrate'
# Check status
kamal details
# Manage environment
kamal env push
# Manage accessories (databases, redis)
kamal accessory boot all
kamal accessory logs redis
Accessories (Databases, Redis)
# config/deploy.yml
accessories:
db:
image: postgres:16
host: 192.168.1.1
port: 5432
env:
clear:
POSTGRES_DB: myapp_production
secret:
- POSTGRES_PASSWORD
directories:
- data:/var/lib/postgresql/data
redis:
image: redis:7
host: 192.168.1.1
port: 6379
directories:
- data:/data
Kamal vs Alternatives
| Kamal | Kubernetes | Dokku | Coolify | |
|---|---|---|---|---|
| Complexity | Low | Very High | Low | Low |
| Multi-server | Yes | Yes | No | Yes |
| Zero-downtime | Yes | Yes | Yes | Yes |
| GUI | No (CLI) | Dashboard | Web UI | Web UI |
| Cost | $0 + VPS | $0 + VPS | $0 + VPS | $0 + VPS |
Resources
Need deployment or DevOps tools? Check my Apify actors or email spinov001@gmail.com.
Top comments (0)