Follow us
Breaking
Web Hosting

Choosing between Dokku, Fly.io, and Kamal 2 for container deployment

Kamal 2 introduces Kamal Proxy to replace Traefik, enabling zero downtime deployments and automatic SSL via Let's Encrypt. Teams must weigh the full environmental control offered by Dokku against the managed convenience and usage-based pricing of Fly.io.

Share

The shift to Kamal 2 and Kamal Proxy

Kamal 2 replaces Traefik with a custom tool called Kamal Proxy. This switch simplifies the stack because Traefik was once the most complex and misunderstood part of the Kamal system. Kamal Proxy achieves zero downtime deployments through a poll of the /up endpoint for container health. Once the proxy detects a healthy container, it switches traffic and drains requests from the old container. You can host multiple applications on one server by providing a host option. This prevents port conflicts between services. Kamal Proxy provides automatic SSL through Let’s Encrypt if you deploy to a single server and set the host. You must ensure port 443 is reachable for the Let’s Encrypt challenge to succeed. If you need wildcard certificates for multi-tenant applications, you must use Caddy as a Kamal accessory. Kamal 2 works with any Linux server and automates the installation of Docker. It acts like Capistrano for containers because it uses simple docker run commands. Teams that want to avoid the complexity of Kubernetes often look toward Kamal because it uses simple docker run commands to deploy web applications to any Linux server with zero downtime by automating the installation of Docker and the setup of the container network. Some critics argue that Kamal simply recreates the complexity of Kubernetes. They claim it walks backwards into the very complexity it sought to avoid. The proxy also manages request and response buffering. You can set a maximum request body size, which defaults to 1GB. The proxy also allows path-based routing to mount services under different path prefixes. You can specify these paths as a list or a comma-separated string. The proxy also hits the /up endpoint once every second until the deployment hits a timeout. You can also use custom SSL certificates from secrets by passing a hash mapping the certificate_pem and private_key_pem to the secret names. If the certificate or key is missing or invalid, deployments fail. The proxy can also configure request logging. You can specify which request and response headers to log. By default, the proxy logs the Cache-Control, Last-Modified, and User-Agent headers.

Alternative PaaS options

Dokku and Fly.io provide alternatives to expensive PaaS solutions. Dokku is a free, open-source, self-hosted platform that uses Docker to manage applications. You can deploy via git push and use Heroku buildpacks to build your code. Dokku allows you to run managed containers alongside other containers via Docker Compose on the same host. You can also add support for extra features through plugins. Dokku provides the ability to scale processes and is a good choice for developers who want full control over their environment. Fly.io is a managed service that runs applications on Machines in various global regions. This architecture reduces latency for users. Fly.io uses a usage-based pricing model. You pay for vCPU, memory, and persistent volume storage. A simple API with 1 vCPU, 2GB RAM, and 10GB of storage costs about $17 to $22 monthly. Fly.io provides a free tier with 3 shared VMs, 3GB of storage, and 100GB of egress. You pay $0.15 per GB per month for persistent volumes. Additional IPv4 addresses cost $2 per month. Egress costs $0.05 per GB after the first 100GB.

Feature Dokku Fly.io
Deployment Git push Fly CLI
Model Self-hosted Managed
Cost Free (Software) Usage-based
Runtime Docker Micro-VMs

Evaluating deployment paths

I see teams weigh the control of Dokku against the convenience of Fly.io. You know that choosing between self-hosting and a managed service involves a trade-off between effort and cost. Dokku provides full control over your environment but requires more effort for deployment and management. Fly.io provides an easier way to launch apps but has a steep learning curve if your team is not fluent in Docker. Fly.io pricing can be unpredictable because you pay for every resource used. One such cost is the $0.15 per GB monthly charge for persistent volumes. Inter-region communication via replication also counts as egress on the sending side. You can also face costs for additional IPv4 addresses at $2 per month. Does the reduction in latency from Fly.io justify the unpredictable monthly bills? Stick with Dokku if you require absolute environmental control.

Share

Technewsdaily

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