DEV Community

Alex Spinov
Alex Spinov

Posted on

Kamal Has a Free Zero-Downtime Deployment Tool — Here's How to Use It

Kubernetes is overkill for most apps. Capistrano is outdated. Kamal (from 37signals/Basecamp) deploys Docker containers to any server with zero downtime — no orchestrator needed.

What Is Kamal?

Kamal deploys your containerized app to bare metal servers using Docker. It handles zero-downtime deploys, rolling restarts, SSL, and multi-server setups — without Kubernetes.

Quick Start

gem install kamal
kamal init
Enter fullscreen mode Exit fullscreen mode
# config/deploy.yml
service: my-app
image: my-docker-user/my-app

servers:
  web:
    hosts:
      - 1.2.3.4
      - 5.6.7.8
  worker:
    hosts:
      - 9.10.11.12
    cmd: bin/jobs

registry:
  username: my-docker-user
  password:
    - KAMAL_REGISTRY_PASSWORD

env:
  clear:
    DATABASE_URL: postgres://db.example.com/myapp
  secret:
    - RAILS_MASTER_KEY
    - STRIPE_SECRET_KEY

traefik:
  options:
    publish:
      - "443:443"
    volume:
      - "/letsencrypt:/letsencrypt"
Enter fullscreen mode Exit fullscreen mode
kamal setup    # First deploy — installs Docker, Traefik, deploys app
kamal deploy   # Subsequent deploys — zero downtime
Enter fullscreen mode Exit fullscreen mode

How Zero-Downtime Works

  1. Build new Docker image
  2. Push to registry
  3. Pull on servers
  4. Start new container
  5. Health check passes
  6. Traefik routes traffic to new container
  7. Stop old container

No dropped requests. No maintenance windows.

Key Commands

kamal deploy          # Deploy latest version
kamal rollback        # Rollback to previous version
kamal app logs        # View application logs
kamal app exec 'bash' # SSH into container
kamal env push        # Update environment variables
kamal traefik reboot  # Restart the proxy
kamal audit           # View deployment audit log
Enter fullscreen mode Exit fullscreen mode

Why Kamal

Feature Kamal Kubernetes Capistrano
Complexity Low Very high Medium
Zero downtime Yes Yes Plugin
Multi-server Yes Yes Yes
SSL Automatic Manual/Cert-Manager Manual
Learning curve 1 day Months 1 week
Cost overhead $0 Control plane cost $0

Who Uses Kamal

  • 37signals — Basecamp, HEY, ONCE
  • Any Docker app — Rails, Node.js, Go, Python

Get Started


Deploying data pipelines? My Apify actors handle deployment automatically. Custom solutions: spinov001@gmail.com

Top comments (0)