Deployment: Kamal 2 basics
This course walks through one Rails app's config/deploy.yml for Kamal 2, a command-line tool that deploys an app as a Docker container. It covers the servers, ssh and registry blocks, clear and secret environment variables, and running Solid Queue inside Puma. It explains kamal-proxy, automatic HTTPS with Let's Encrypt and the /up healthcheck that gates each deploy. It then covers persistent volumes, a self-managed Postgres accessory, command aliases, and a full kamal deploy traced from build to traffic swap.
What you'll learn
- ✓How deploy.yml uses ERB and environment variables for servers, SSH and the registry
- ✓How secret names in deploy.yml resolve from .kamal/secrets at deploy time
- ✓Running the Solid Queue supervisor inside Puma with SOLID_QUEUE_IN_PUMA
- ✓How kamal-proxy handles HTTPS and gates deploys with the /up healthcheck
- ✓Keeping uploads and Postgres data across deploys with volumes and a db accessory
- ✓Using aliases such as kamal console and kamal logs
What Kamal 2 automates
Open this app's Gemfile and one line, with a comment above it, names what this course is about:
Read the full lesson free →Curriculum
7 lessonsWhat Kamal 2 automates
What Kamal 2 is as a command-line gem, what it automates, and what it leaves to you.
servers, ssh and the registry
How the servers, ssh and registry blocks read environment variables and resolve secret names from .kamal/secrets.
env: clear vs secret, and running jobs inside Puma
The difference between clear and secret env values, and how Solid Queue runs inside the Puma process.
proxy, SSL and the healthcheck
How kamal-proxy provides Let's Encrypt HTTPS, forwards headers, and uses the /up healthcheck to swap containers without downtime.
The volumes and the db accessory
How volumes keep uploads across deploys and how a self-managed Postgres accessory stores its data on the host.
Aliases and the Kamal commands
How the aliases block shortens Kamal commands, and what --interactive and --reuse do for console sessions.
Putting it together: one kamal deploy, traced end to end
One kamal deploy traced step by step, from local build and push to healthcheck and traffic swap.