Infrastructure: Kamal 2
Kamal 2 deploys an application to servers using only SSH, Docker and a reverse proxy. The lessons read one config/deploy.yml for a Rails application on a single VPS. They cover the build, registry and SSH model, and how kamal-proxy swaps containers behind a health check on /up. Accessories keep Postgres data on host paths with no published port. Later lessons cover clear and secret environment values and the everyday and recovery commands. A review of what the setup gets right and leaves to something else comes next, and a challenge on the health-check decision closes the course.
What you'll learn
- ✓How Kamal builds, pushes and starts containers over SSH
- ✓How kamal-proxy uses a health check to swap containers without a gap
- ✓Running Postgres as an accessory with data on host volumes
- ✓Separating clear configuration from secrets kept in the operator's shell
- ✓Everyday and recovery commands, including aliases with --reuse
- ✓Telling deliberate settings apart from untested defaults
What Kamal actually does
Kamal is a deployment tool that assumes you have servers and Docker, and nothing else. There's no Kubernetes, no control plane and no managed platform, just SSH and containers. That's a smaller set of moving parts than most alternatives, and it's why Kamal fits a single VPS.
Read the full lesson free →Curriculum
7 lessonsWhat Kamal actually does
How Kamal builds an image, pushes it to a registry and starts containers on servers over SSH.
The proxy and the swap
How kamal-proxy checks a new container's health on /up and switches traffic without a gap.
Accessories and the database
How accessories run Postgres with data on a host path and no port published on the host.
Secrets and the environment
How Kamal separates committed clear values from secrets whose values come from the operator's shell.
The commands you actually run
The everyday and recovery Kamal commands, including aliases that use --reuse inside the serving container.
What this setup gets right and wrong
A review of the deliberate choices in this setup, its unmeasured timeouts and the backups it leaves to something outside the deploy file.
Putting it together
A summary of deploys as container swaps, plus a challenge implementing the health-check decision in deploy_outcome.