Kamal 2 deployment: self-hosting Rails apps on a $5 VPS in 2026
Deploy production Rails applications affordably using Kamal 2. We show you how to run robust apps on budget VPS infrastructure without breaking the bank.
Why Kamal 2 Changes the Self-Hosting Game
By 2026, Kamal has matured into a genuinely practical deployment tool for Rails developers who want to escape the PaaS tax. Unlike Heroku or similar platforms, Kamal 2 lets you run your application on commodity hardware—a $5/month DigitalOcean or Hetzner VPS—while maintaining production-grade reliability, zero-downtime deployments, and automated rollbacks.
For Canadian and North American businesses, this means reducing monthly infrastructure costs from $50–$200 to under $10, while retaining full control over your stack. Kamal handles the complexity: Docker image building, asset compilation, database migration orchestration, and service restart logic.
What You'll Need Before Starting
Kamal 2 requires minimal setup, but you do need the right foundation in place:
- A Rails 7.1+ application with a Gemfile and working local development environment
- Docker installed locally (version 24.0+) for image building
- A VPS with at least 1GB RAM and 20GB storage (DigitalOcean Droplet, Hetzner Cloud, or Linode Nanode work well)
- SSH access configured with key-based authentication to your VPS
- A container registry (GitHub Container Registry, DockerHub, or a private registry like Kamal's built-in)
- Kamal 2.0+ installed locally via your Gemfile or as a standalone tool
You'll also want a domain name and either a managed database (AWS RDS, Railway) or PostgreSQL running on the same VPS.
Setting Up Kamal Configuration
Kamal 2's configuration lives in a single config/deploy.yml file. Here's a practical, minimal example:
Key sections to configure:
- Service name and image registry—Define your app name and where Kamal pushes Docker images
- Servers and roles—Specify your VPS IP, SSH user, and whether it runs web and background job services
- Environment variables—Inject
RAILS_ENV=production, database credentials, and API keys - Database migration strategy—Kamal runs migrations automatically before restarting services
- Volume mounts—For persistent storage like uploaded files or logs
- Accessory services—PostgreSQL, Redis, or other containers running on the same machine
A typical deploy.yml for a single-server setup is 40–60 lines. Kamal's templating system supports secrets management through encrypted credentials files, keeping sensitive data out of version control.
The Deployment Workflow in Practice
Once configured, deployment is straightforward. From your local machine, run kamal deploy. Kamal then:
- Builds a Docker image from your Rails app using your Dockerfile
- Pushes the image to your configured registry
- Connects to your VPS via SSH
- Pulls the new image and runs database migrations (if needed)
- Starts a new container alongside the existing one
- Health-checks the new container
- Switches traffic to the new instance
- Removes the old container
The entire process takes 2–4 minutes for a typical Rails app, with zero downtime. If something breaks, kamal rollback reverts to the previous version in seconds.
Optimizing for Minimal Hardware
Running on a $5 VPS means squeezing efficiency. Here are concrete steps:
- Use multi-stage Docker builds—Compile assets and install gems in a builder stage, then copy only runtime dependencies into the final image. This cuts image size from 800MB to 300–400MB.
- Enable Puma thread pooling—Configure Puma to use 16–32 threads on modest hardware. A single Puma process handles 50+ concurrent requests efficiently.
- Run PostgreSQL externally—On $5 hardware, database performance suffers. Move to a managed service ($10–15/month) to avoid resource contention.
- Use Redis for caching and sessions—A small Redis container (or managed service) dramatically improves perceived performance and reduces database load.
- Configure swap space—Add 2–4GB of swap on your VPS to handle traffic spikes gracefully, though this won't replace adequate RAM.
Monitoring and Maintenance
Kamal 2 includes built-in kamal logs and kamal status commands. However, for production peace of mind, layer in monitoring:
Essential tools for 2026: Datadog's free tier or New Relic's entry plan ($29/month) provide CPU, memory, and error tracking. Alternatively, set up Prometheus and Grafana directly on your VPS. Configure uptime monitoring via Checkly or UptimeRobot to catch outages immediately.
Set up automated backups for your database. If using managed PostgreSQL, enable automated snapshots. For on-server databases, use a cron job to backup to S3 (AWS or a Canadian equivalent like Linode Object Storage).
Real-World Costs and Tradeoffs
A $5 VPS deployment typically costs:
- VPS: $5–8/month
- PostgreSQL managed service: $15–25/month
- Registry storage and bandwidth: $5–10/month (or free with GitHub)
- Monitoring: $0–30/month
- Total: $25–50/month
Compare this to Heroku's $50/month for a single dyno, or AWS with managed infrastructure costs ballooning to $200+. The tradeoff is that you're responsible for OS security updates, SSL certificate renewal (automate via Kamal + Let's Encrypt), and basic system administration.
For teams new to DevOps, this might feel like a step backward. But Kamal abstracts 90% of the complexity, leaving you with a straightforward deployment tool that doesn't require Kubernetes expertise.
Common Pitfalls to Avoid
Don't skimp on database resources, even though it's tempting. A slow database kills a fast Rails app. Also, always test your Dockerfile locally before deploying—layer caching issues and missing dependencies surface early. Finally, configure log rotation in your deploy.yml; Docker containers can fill a 20GB drive with logs in days on a busy application.
Conclusion
Kamal 2 in 2026 is genuinely production-ready for Rails apps serving hundreds or thousands of users monthly. The combination of low cost, operational simplicity, and reliability makes it the go-to choice for bootstrapped teams and cost-conscious businesses across North America. If you're tired of PaaS pricing or overwhelmed by Kubernetes, Kamal deserves your attention.
Need hands-on help deploying your Rails app with Kamal 2? ElevenClicks specializes in Rails infrastructure and DevOps consulting across Canada and North America. We'll design a cost-effective, production-hardened deployment tailored to your business. Reach out today for a no-obligation infrastructure review.
Working on something similar?
ElevenClicks helps Canadian businesses build ruby on rails solutions that actually work. Book a free 30-minute call — no pitch, just honest advice.
Ontario-based · Canadian timezone · No offshore handoffs