Deploying with Kamal 2 on Cloud VPS: How Basecamp Powers Production Applications Without Kubernetes
Introduction: The Complexity Tax of Modern Deployments
For the past decade, container orchestration has been dominated by a single narrative: if you are running production applications, you need Kubernetes (K8s). This consensus has driven engineering teams worldwide to invest massive amounts of time, money, and cognitive overhead into managing complex control planes, service meshes, and YAML configurations. While Kubernetes is undoubtedly powerful for hyperscale infrastructures, many small-to-medium enterprises and independent software vendors find themselves paying a steep “complexity tax” for features they simply do not need.
Enter Kamal 2. Developed by 37signals (the creators of Basecamp and HEY) and championed by David Heinemeier Hansson (DHH), Kamal 2 represents a philosophical shift in software deployment. It is an open-source tool designed to deploy containerized applications to any bare-metal or Cloud Virtual Private Server (VPS) with absolutely zero downtime, completely bypassing the need for complex orchestrators like Kubernetes or Docker Swarm. This comprehensive guide explores how Kamal 2 works, why Basecamp uses it for their multi-million dollar production platforms, and how you can implement it on your own Cloud VPS infrastructure.
The Core Philosophy Behind Kamal 2
Kamal 2 operates on a remarkably elegant premise: SSH and Docker are all you really need to deploy applications reliably. Instead of running a continuous, heavy agent or control plane on your target servers, Kamal is a client-side CLI tool. It connects to your remote servers over secure shell (SSH), builds or pulls your Docker images, configures your network via a lightweight reverse proxy, and boots up your new containers while seamlessly draining traffic from the old ones.
By treating servers as simple, static IP targets, Kamal eliminating the stateful synchronization problems common in cluster orchestrators. This approach yields several major benefits for business infrastructure:
- Cloud Agnosticism: You are no longer locked into proprietary cloud services like AWS ECS or Google GKE. You can deploy to standard, highly affordable Cloud VPS providers such as DigitalOcean, Hetzner, Linode, or AWS EC2.
- Drastically Lower Infrastructure Costs: Without the RAM and CPU overhead required to run Kubernetes control planes (Kubelet, etcd, API Server), you can utilize up to 95% of your server's raw compute power for your actual application.
- Simplified Cognitive Load: Your operational configuration shifts from hundreds of lines of cryptic Kubernetes YAML files to a single, easily readable configuration file:
deploy.yml.
How Kamal 2 Achieves Zero-Downtime Deployments
One of the biggest arguments for using Kubernetes in production has always been its ability to handle rolling updates and self-healing zero-downtime deployments. Kamal 2 achieves this exact same gold-standard production reliability through its built-in proxy system called Kamal Proxy (which replaced Traefik from Kamal 1).
When you initiate a deployment via kamal deploy, the following sequence happens seamlessly behind the scenes:
- Image Preparation: Kamal ensures your latest application Docker image is built and pushed to your container registry (e.g., Docker Hub, GitHub Packages, or a private registry).
- New Container Initialization: Kamal logs into your target Cloud VPS servers via SSH and pulls the new image. It boots up the new container on a new, isolated port alongside the existing, running production container.
- Health Checking: Kamal waits for the new container to pass an explicit, configurable health check endpoint (e.g.,
/upor/health) to guarantee the application is fully booted and stable. - Traffic Swapping: Kamal Proxy dynamically redirects incoming HTTP/HTTPS traffic to the new container.
- Graceful Draining & Termination: The old container is allowed a pre-configured grace period to finish processing active requests before Kamal stops and removes it.
“We don't need an army of cloud engineers to keep our apps running. Kamal gives us the control, flexibility, and cost savings of running on bare metal or simple VPS with the ease of a modern PaaS.” — 37signals Engineering Philosophy
Step-by-Step Architecture for a Cloud VPS Deployment
Setting up Kamal 2 on a production-ready Cloud VPS involves a clean, structured architecture. Typically, your setup will consist of one or more web servers, an optional separate database node (or a managed database service), and a container registry.
1. Prerequisites and Initial Server Hardening
Before executing Kamal commands, your target Cloud VPS needs a minimalist setup. All that is required on the remote machine is a standard Linux distribution (such as Ubuntu LTS), an open SSH port configured with your public SSH key, and an installed instance of Docker. Kamal can even handle the Docker installation for you automatically during its initial setup phase.
2. Crafting the Perfect deploy.yml
The entire deployment strategy is governed by the config/deploy.yml file located within your application repository. A typical production configuration for a web application looks like this:
service: my-core-app
image: myregistryuser/my-core-app
servers:
web:
- 192.168.1.50
- 192.168.1.51
proxy:
ssl: true
host: app.yourdomain.com
registry:
username: REGISTRY_USERNAME
password: REGISTRY_PASSWORD
env:
secret:
- DATABASE_URL
- RAILS_MASTER_KEYThis clean structure explicitly defines the service name, the target deployment image, the destination server IP addresses, and proxy configurations including automated SSL handling.
3. Executing the Production Deployment Pipeline
With your configuration finalized, deploying your application to production requires just a single command run from your local terminal or continuous integration (CI) runner:
kamal setupThis initial command installs Docker on your servers (if missing), configures Kamal Proxy, pulls your environment variables securely, and bootstraps the application. For all subsequent updates, running kamal deploy will execute the zero-downtime rolling update sequence automatically.
Kamal 2 vs. Kubernetes: A Business and Technical Comparison
To help CTOs and technical leads make an informed architectural decision, it is vital to contrast Kamal 2 directly with Kubernetes across key operational metrics:
| Feature / Metric | Kamal 2 | Kubernetes (K8s) |
|---|---|---|
| Infrastructure Costs | Extremely Low (Raw VPS cost only) | High (Control plane overhead + managed service fees) |
| Learning Curve | Hours (Simple SSH + Docker concepts) | Months (Complex certifications, vast ecosystem) |
| Zero-Downtime Updates | Yes (Handled natively by Kamal Proxy) | Yes (Handled by Pod Lifecycle & Services) |
| Resource Utilization | ~95% available for application | ~70-80% due to cluster agent overhead |
| Maintenance Overhead | Near zero (No control plane upgrades needed) | Continuous (API deprecations, node upgrades) |
Conclusion: Reclaiming Simplicity in Production DevOps
Kamal 2 proves that you do not need to adopt the operational complexity of hyper-scalable tech giants to achieve reliable, secure, and zero-downtime web application deployments. By utilizing simple Linux VPS instances coupled with a client-side SSH deployment flow, you can slash your cloud computing bills, eradicate unnecessary maintenance overhead, and allow your engineering team to focus on what truly matters: shipping features that deliver business value.
If your team is looking to break free from high cloud bills and the endless maintenance cycle of modern container orchestrators, migrating your production infrastructure to Kamal 2 on a reliable Cloud VPS is a highly strategic, production-proven alternative.
