Back to articles
Technology Insight

Deploying Like Basecamp: A Deep Dive into Kamal 2 for Production Cloud VPS Environments

June 2, 2026

Introduction: The Hidden Cost of Container Orchestration Complexity

For nearly a decade, engineering organizations have operated under a dominant assumption: scaling a web application in production requires a complex container orchestration framework. Systems like Kubernetes (K8s) and Docker Swarm became the default architecture for modern cloud deployments. However, for many medium-sized businesses and independent SaaS platforms, this infrastructure brings significant accidental complexity, a steep learning curve, and inflated cloud resource bills.

When 37signals (the creators of Basecamp and HEY) initiated their highly publicized cloud exit, they faced a critical engineering challenge: how to achieve seamless, zero-downtime deployments across standard bare-metal servers and Cloud VPS instances without the operational burden of Kubernetes. Their answer was Kamal (formerly known as MRKPL). With the release of Kamal 2, this tool has matured into a powerful, production-ready deployment toolchain that brings the simplicity of traditional Platform-as-a-Service (PaaS) providers directly to your own self-hosted infrastructure.

What is Kamal 2 and Why Does It Matter?

At its core, Kamal 2 is an open-source, configuration-driven deployment tool designed to deploy containerized applications to any Linux host over secure SSH. It requires no agent running on the target servers, relying instead on local commands that orchestrate Docker via SSH execution.

While Kubernetes treats infrastructure as a fluid pool of dynamic resources managed by a complex control plane, Kamal 2 embraces a deterministic approach. You specify your target servers, and Kamal handles the lifecycle of building, shipping, and running your application containers. Key improvements in version 2 include a completely rewritten asset-serving strategy, enhanced multi-app hosting capabilities on a single server, and the introduction of Thrust—a lightweight, automated HTTPS proxy that replaces the previous Traefik configuration.

The Core Architectural Pillars of Kamal 2

To understand why Kamal 2 is highly efficient for production workloads, we must examine its architectural pillars:

  • Zero-Downtime Rolling Deploys: Kamal 2 achieves zero downtime by deploying new container versions alongside active ones, testing health checks, shifting traffic smoothly via the proxy, and subsequently stopping the legacy containers.
  • The Thrust Proxy: Kamal 2 integrates Thrust, a high-performance HTTP proxy engineered specifically to handle modern web traffic, automated Let's Encrypt SSL management, and instantaneous routing configuration changes without dropping active TCP connections.
  • Infrastructure Agnosticism: Because it operates purely via standard SSH and Docker, Kamal 2 works identically on AWS EC2, DigitalOcean Droplets, Hetzner Cloud, or on-premises bare-metal hardware. You are entirely immune to cloud provider lock-in.
  • Automated Rollbacks: If a production release introduces a critical bug, Kamal 2 maintains an on-server cache of previous container images. Executing a rollback takes seconds because it simply restarts the older, validated image rather than rebuilding code.

Step-by-Step Architecture Guide: Preparing Your Cloud VPS

To successfully deploy a production application using Kamal 2, you require a standard Linux Cloud VPS environment. Unlike heavy orchestration layers, the system requirements are remarkably minimal.

1. Infrastructure Requirements

Ensure your target servers meet the following baselines:

  • A clean installation of an LTS Linux distribution (such as Ubuntu 24.04 LTS or Debian 12).
  • SSH root access or a user account configured with passwordless sudo privileges.
  • A public IPv4 address with DNS records (A records) correctly pointing to your server instance.

2. Local Workstation Setup

Kamal 2 executes completely from your local development machine or continuous integration (CI) pipeline. You must install the Kamal CLI tool globally, along with Docker Desktop or Docker Engine, which is utilized to build your application images locally or via a remote builder.

Anatomy of a Production Kamal 2 Configuration

The operational logic of Kamal 2 is dictated by a single configuration file located at config/deploy.yml. Below is an enterprise-grade configuration example showcasing how Kamal 2 structures web services, environment variables, and storage volumes:

"The beauty of Kamal 2 lies in its declarative simplicity. A single human-readable YAML file completely replaces thousands of lines of Kubernetes manifests, Helm charts, and ingress definitions."

# config/deploy.yml
service: enterprise-saas-app
image: registry.digitalocean.com/my-org/app

servers:
  web:
    - 192.168.1.50
    - 192.168.1.51
  worker:
    hosts:
      - 192.168.1.52
    cmd: bundle exec sidekiq

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

env:
  clear:
    RAILS_ENV: production
    PORT: 80
  secret:
    - DATABASE_URL
    - REDIS_URL

proxy:
  ssl: true
  host: app.mycompany.com
  healthcheck: /up

volumes:
  - "/var/log/app:/app/log"

In this architecture, Kamal 2 automatically distributes incoming web traffic across two distinct web servers using the built-in proxy capabilities, while dedicating a third separate VPS instance entirely to processing background worker queues. It injects environment variables securely and maps host directories to track persistent logs.

The Deployment Workflow: What Happens Behind the Scenes

When an engineer executes the command kamal deploy, a highly coordinated orchestration workflow begins:

  • Build and Bootstrapping: Kamal connects to your local Docker daemon (or a designated remote build server) to build your application image using your project's Dockerfile. It optimizes multi-platform builds using Docker Buildx.
  • Registry Push: The newly built image is tagged with a unique Git commit SHA or version timestamp and pushed directly to your private container registry.
  • Server Preparation: Kamal SSHes into all target hosts specified in the configuration file. If Docker or the Thrust proxy are missing, Kamal automatically installs and configures them.
  • Image Pulling: Target servers concurrently pull down the new container layer from the registry, minimizing active deployment time.
  • Health Checking & Switching: The new application containers are initiated on an alternate port. Kamal performs rigorous HTTP health checks against the specified /up endpoint. Once verified, Thrust re-routes inbound web traffic to the new containers.
  • Cleanup: The old application containers are gracefully stopped and removed, leaving a pristine environment running your newest production code.
  • Comparing the Operational ROI: Kamal 2 vs. Kubernetes

    When deciding whether to adopt Kamal 2 over an enterprise orchestration standard like Kubernetes, engineering leadership must weigh the structural trade-offs:

    Operational MetricKubernetes (K8s)Kamal 2 Workflow
    Infrastructure CostsHigh (Requires control plane nodes, etcd, management tools)Zero Overhead (Runs directly on target compute nodes)
    Learning CurveExtremely Steep (Requires dedicated DevOps engineering resources)Minimal (Accessible to any developer with basic Docker knowledge)
    Configuration VolumeMassive (Dozens of YAML manifests for Pods, Services, Ingress)Single, unified deploy.yml file
    State ManagementDynamic, volatile, abstract API layersPredictable, direct host-to-container mapping via SSH

    While Kubernetes remains unmatched for hyperscale systems managing thousands of microservices with complex, dynamic resource allocation needs, Kamal 2 offers an economically and operationally superior model for standard monolithic or macro-service applications common in modern SaaS structures.

    Conclusion: Embracing Minimalist Infrastructure for Production

    Kamal 2 proves that production-grade reliability, zero-downtime scalability, and automated deployments do not require complex, distributed cloud infrastructure architectures. By utilizing standard container paradigms and combining them with the mechanical simplicity of SSH, Kamal 2 democratizes robust continuous deployment. For organizations looking to lower cloud infrastructure expenditures, remove unnecessary DevOps abstractions, and accelerate release cycles, migrating production workloads to a Cloud VPS managed by Kamal 2 represents a significant strategic advantage.

    Deploying Like Basecamp: A Deep Dive into Kamal 2 for Production Cloud VPS Environments | DPTCloud