A step-by-step guide walks through deploying a Swift on the Server app (Vapor or Hummingbird) using Kamal 2, a Ruby-based CLI for deploying containerized apps to any SSH-accessible server without relying on a PaaS. It covers installing Kamal, provisioning a Hetzner server, creating a Dockerfile-based Swift app, writing the Kamal YAML configuration, running kamal setup and kamal deploy, and enabling automatic HTTPS via Let's Encrypt.

8m read timeFrom tuist.dev
Post cover image
Table of contents
What is Kamal?Installing KamalCreate a server on HetznerCreate a Swift on the Server appAdding Kamal configurationBonusClosing words

Questions this post answers

How do I deploy a Vapor or Hummingbird Swift server app without using a PaaS like Heroku or Fly.io?

Use Kamal, a Ruby-based CLI that deploys containerized apps to any SSH-accessible server. It requires an OCI-compliant Dockerfile, an image registry, and an SSH-accessible server such as one from Hetzner. Configuration lives in a YAML file at config/deploy.yml, and deployment happens by running kamal setup followed by kamal deploy, giving zero-downtime rollouts without PaaS costs. daily.dev surfaces practical deployment guides for developers weighing PaaS versus self-hosted setups like Kamal.

How do I enable automatic HTTPS for an app deployed with Kamal?

Add ssl: true and a host field under the proxy section in config/deploy.yml, specifying your domain name. Kamal then automatically requests a certificate from Let's Encrypt and configures its built-in proxy to serve the app over HTTPS, removing the need to manually manage certificates or a separate reverse proxy. Developers configuring TLS for self-hosted deployments can find setup walkthroughs like this on daily.dev.

What do I need before I can deploy an app with Kamal?

You need three things: an OCI-compliant container image built from a Dockerfile, a registry to push and pull that image from (Docker Hub is used by default, though GitHub Packages and DigitalOcean also work), and a server reachable over SSH. Kamal handles installing dependencies and orchestrating zero-downtime deploys once these are in place. daily.dev helps developers comparing self-hosted deployment tooling like Kamal against managed platforms.

1 Impression