DEV Community

Alex Spinov
Alex Spinov

Posted on

Kamal Has a Free Deployment Tool That Puts Docker on Any Server

Kubernetes is overkill for most apps. Heroku is expensive. Kamal (from the creators of Rails) deploys Docker containers to any server with zero-downtime — no Kubernetes, no PaaS, just SSH and Docker.

What Kamal Gives You for Free

  • Zero-downtime deploys — old container serves until new one is healthy
  • Any server — works with any VPS (Hetzner, DigitalOcean, AWS EC2)
  • Multi-server — deploy across multiple servers
  • Traefik proxy — automatic SSL, load balancing
  • Accessories — deploy databases, Redis alongside your app
  • Rolling deploys — one server at a time
  • No Kubernetes — just Docker + SSH

Quick Start

gem install kamal
kamal init
Enter fullscreen mode Exit fullscreen mode

Configuration (deploy.yml)

service: myapp
image: myuser/myapp

servers:
  web:
    hosts:
      - 192.168.1.1
      - 192.168.1.2
    labels:
      traefik.http.routers.myapp.rule: Host(`myapp.com`)

registry:
  username: myuser
  password:
    - KAMAL_REGISTRY_PASSWORD

env:
  clear:
    DATABASE_URL: postgres://...
  secret:
    - STRIPE_KEY
    - JWT_SECRET

accessories:
  db:
    image: postgres:16
    host: 192.168.1.1
    port: 5432
    env:
      clear:
        POSTGRES_DB: myapp
      secret:
        - POSTGRES_PASSWORD
    directories:
      - data:/var/lib/postgresql/data

  redis:
    image: redis:7
    host: 192.168.1.1
    port: 6379

traefik:
  options:
    publish:
      - "443:443"
    volume:
      - "/letsencrypt:/letsencrypt"
  args:
    entryPoints.websecure.address: ":443"
    certificatesResolvers.letsencrypt.acme.email: "admin@myapp.com"
    certificatesResolvers.letsencrypt.acme.storage: "/letsencrypt/acme.json"
Enter fullscreen mode Exit fullscreen mode

Deploy

# First deploy (sets up everything)
kamal setup

# Subsequent deploys
kamal deploy

# Rollback
kamal rollback

# View logs
kamal app logs

# SSH into container
kamal app exec -i bash
Enter fullscreen mode Exit fullscreen mode

How It Works

1. Build Docker image locally
2. Push to registry (Docker Hub, GHCR)
3. SSH into each server
4. Pull new image
5. Start new container
6. Health check passes → Traefik routes traffic
7. Stop old container
= Zero downtime!
Enter fullscreen mode Exit fullscreen mode

Kamal vs Kubernetes vs Heroku vs Dokku

Feature Kamal Kubernetes Heroku Dokku
Complexity Low Very High Low Low
Cost $5/mo VPS $75+/mo $7+/dyno $5/mo VPS
Zero-downtime Yes Yes Yes Plugin
Multi-server Yes Yes Yes (paid) No
SSL Automatic Manual/cert-manager Included Let's Encrypt
Database Accessories Operators Add-ons Plugins
Learning curve 30 min Weeks 10 min 1 hour

The Verdict

Kamal is deployment for the 95% of apps that don't need Kubernetes. Docker + SSH + zero-downtime. Deploy to any $5 VPS with the same reliability as expensive PaaS platforms. Made by the creators of Rails, works with any Docker app.


Need help building production web scrapers or data pipelines? I build custom solutions. Reach out: spinov001@gmail.com

Check out my awesome-web-scraping collection — 400+ tools for extracting web data.

Top comments (0)