Follow us
Breaking
Web Hosting

Kamal 2 replaces Traefik with kamal-proxy for deployments

Kamal 2 introduces kamal-proxy to provide zero-downtime deployments and automatic SSL via Let's Encrypt. This tool offers an alternative to Dokku and Fly.io by allowing teams to deploy containerized applications to any Linux server using Docker and SSH.

Share

Kamal 2 replaces Traefik with kamal-proxy to manage traffic. This new proxy provides zero-downtime deployments and automatic SSL certificates via Let’s Encrypt. It also supports running multiple applications on one server. Rails 8 includes Kamal 2 by default, providing a production Dockerfile and a config/deploy.yml file. This setup removes the manual configuration seen in previous versions. The current version, 2.12.0, adds Ruby 4.0 to the test matrix to ensure modern compatibility. The tool uses Docker containers to deploy web applications to any Linux server in any cloud environment. Kamal 2 allows for custom certificates per role when Let’s Encrypt is not suitable. For applications requiring wildcard domains, users can deploy Caddy as a Kamal accessory to handle certificates. This accessory configuration allows Caddy to manage wildcard certificates while Kamal Proxy manages application containers. The tool works for any containerized web application, including those written in languages other than Ruby or Python. It also allows for custom certificate values to be read directly from secrets.

Dokku vs Kamal 2

Teams choosing between Dokku and Kamal 2 face different operational requirements. Dokku provides a Heroku-style experience on a single Linux host using a git-push workflow. It remains free as open-source software, though teams must pay for their own VPS or bare-metal hardware. A lifetime license for Dokku Pro costs $849 and provides a web UI and HTTPS deployment. Dokku is a lightweight setup that provides value for solo developers and side projects. However, Dokku’s single-server architecture is a primary limitation for scaling and high availability.

Tool Pricing Model Requirement
Kamal 2 Open source (MIT) Docker and SSH access
Dokku Free (OSS) or $849 (Pro) Linux VPS or bare-metal
Fly.io Usage-based Configuration files
Heroku Usage-based (Eco: $5/mo) Managed runtime

Kamal 2 handles zero-downtime deployments by starting a new container with the updated application and then polling the new container’s health check endpoint to verify readiness before it switches traffic to the new version. This process ensures users do not experience downtime. If a deployment fails, Kamal keeps the old containers on the server to allow for fast rollbacks. You know the frustration of hunting for container IDs on a server after a failed deploy. Kamal 2 simplifies this by removing the need to SSH into servers to find container IDs. It also supports loading secrets for pre-connect tasks. The tool allows for configurable verbosity for hooks output. Kamal 2 uses a new approach to secrets, mapping short commands to longer Kamal invocations via an aliases section in the deploy YAML. This method improves the speed of the deployment process.

Dokku users rely on a mature plugin ecosystem and the freedom from hosted PaaS vendor lock-in. However, the initial Linux server setup and debugging failed builds can be challenging without dedicated operations experience. Scaling Dokku requires deliberate design for high availability and capacity. In contrast, Kamal 2 uses an imperative design. It replaces the declarative discovery model of Traefik with a custom-built proxy. This change allows for better control over the deployment process. Kamal 2 also includes maintenance mode and the ability to pause requests. It allows for parallel boot for roles on the same host, which speeds up the deployment process.

The decision depends on vendor lock-in

The decision between these tools depends on the preferred level of vendor lock-in. Fly.io provides invisible integration, which allows users to move applications to another platform with minimal effort. AWS requires deep integration through specific APIs, which forces engineers to rewrite business logic if they want to move to GCP. Encore falls into the deep integration category, requiring users to use their API abstractions to deploy to any environment. Kamal 2 removes the need for expensive PaaS solutions for Rails 8 users. It allows a single server to run the entire stack, including the database and job runner, using Solid adapters. This configuration allows for a single server, one database, and one kamal deploy to handle the full application load.

Dokku fits small-scale workloads better than enterprise multi-cluster needs. It requires Linux administration, SSH key configuration, and domain setup. Kamal 2 allows for easier configuration of secrets using password managers like Bitwarden or OnePassword. For users of ServiceStack, Kamal enables deployment to any Linux server with SSH through GitHub Actions. The GitHub Actions workflow can build a Docker image, push it to the GitHub Container Registry, and run deployment scripts. This workflow handles the authentication between the registry and the server using credentials in the deploy YAML.

Does the simplicity of Kamal 2 outweigh the need for managed services in larger clusters? Skip Dokku if you want the automated simplicity found in Rails 8.

Share

Technewsdaily

Senior tech writer covering AI, gadgets and cybersecurity. Breaking down the news that matters, every day.