/kamal-skills:setupfrom kamal-skills
Install Kamal and ship your first deploy on a new project. Use when the user is starting with Kamal for the first time and says "install Kamal," "set up Kamal on this project," "kamal init," "get started with Kamal," "deploy my app for the first time," "bootstrap my servers," or "run kamal setup." Covers `gem install kamal`, the dockerized install alias, `kamal init` (config/deploy.yml, .kamal/secrets, .kamal/hooks), writing the first config (service, image, servers, registry, builder, env), filling in .kamal/secrets, bootstrapping Docker with `kamal server bootstrap`, and the first `kamal setup`. For the full set of configuration keys, see config. For routine releases after setup, see deploy. For secrets files and vault adapters, see secrets. For registry providers, see registry.
Ships in kamal-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are an expert in deploying applications with Kamal. Your goal is to take a
user from nothing to a running first deploy: install the tool, generate the
config, fill in the values, and run the first kamal setup against their
servers.
Check what already exists before asking questions:
config/deploy.yml is present, read it first and work from the values the
user already has instead of starting from scratch..kamal/secrets is present, read it to see which secrets are already
wired up (do not echo secret values back to the user).Then confirm the essentials you will need:
kamal setup connects over SSH (root by default,
authenticated by your SSH key).git archive of HEAD, not your
working tree; commit every file the image needs before deploying (see the
preflight note in Step 5).If you have a Ruby environment available, install Kamal globally:
gem install kamal
If you do not have Ruby installed, you can run Kamal from a Docker container instead. On macOS:
alias kamal='docker run -it --rm -v "${PWD}:/workdir" -v "/run/host-services/ssh-auth.sock:/run/host-services/ssh-auth.sock" -e SSH_AUTH_SOCK="/run/host-services/ssh-auth.sock" -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/basecamp/kamal:latest'
The dockerized path has limitations (the secret adapters and host environment variables are not available in the container). For the Linux alias and the full list of limitations, see references/dockerized-install.md.
Inside your app directory, run:
kamal init
This creates the files you need to deploy:
Created configuration file in config/deploy.yml
Created .kamal/secrets file
Created sample hooks in .kamal/hooks
| File | Purpose |
|---|---|
config/deploy.yml | Main deploy configuration |
.kamal/secrets | Secrets referenced by the config |
.kamal/hooks | Sample lifecycle hooks |
No Dockerfile yet? Kamal builds the standard
Dockerfileat your project root. Rails generates one withrails new; most other frameworks (Node/Next.js, Django, Go) do not — write one beforekamal setup, or build without one via buildpacks (see the build skill). A good shape is multi-stage: a deps stage that installs dependencies, a build stage that compiles the app, and a slim runner stage that copies only the built output. Common footguns: native modules often ship prebuilt binaries, so try building without a C toolchain before adding one; the framework's build step usually doesn't need runtime secrets or database access — verify by building with them absent instead of threading them through as build args; and run migrations from an ENTRYPOINT script at container start, not at build time — volumes aren't mounted during the image build.
config/deploy.ymlEdit the generated config/deploy.yml. A first deploy can be as simple as this:
service: hey
image: 37s/hey
servers:
- 192.168.0.1
- 192.168.0.2
registry:
username: registry-user-name
password:
- KAMAL_REGISTRY_PASSWORD
builder:
arch: amd64
env:
secret:
- RAILS_MASTER_KEY
What each key does:
| Key | Description |
|---|---|
service | Required. Used as the container name prefix. |
image | The Docker image name. It is pushed to the configured registry. |
servers | The servers to deploy to. A plain list is implicitly assigned to the web role. |
registry | Docker registry configuration. The password references a secret (looked up by name), not a literal value. |
builder | Builder options. The starter config sets arch: amd64. |
env | Environment variables. Names under secret are provided through your secrets file. |
The default registry is Docker Hub; you can change it with registry/server.
For every available configuration key, see the config skill.
App ships its own stack definition? If the project has a production
docker-compose.yml, Helm chart, or upstream install docs, treat it as the contract: map every service it runs to a Kamal accessory, an external service, or an explicit user-approved omission. Never silently drop or swap a component because the host looks too small — surface the constraint and let the user choose before deploying. See "Mirroring an existing stack" in the accessories skill.
Every deploy replaces the app container — anything written to the container's own filesystem (a SQLite database, uploaded files, anything else meant to persist) is discarded with the old container. Mount a named volume for any path that must survive:
volumes:
- "myapp_data:/app/data"
Point your app's writable paths at the mounted directory (e.g.
DATABASE_URL=file:/app/data/production.db), and chown that path to the container's
runtime user in the Dockerfile — Docker copies ownership from the image into a newly
created named volume on first use. Then confirm the data actually survives a redeploy
(run kamal deploy again and check) before trusting it — a plain docker restart keeps
the same container and proves nothing.
.kamal/secretsThe registry/password and any env/secret entries above are looked up by name
in your environment and in .kamal/secrets. Set the registry password in your
environment, then edit .kamal/secrets to read it (plus RAILS_MASTER_KEY for
a production Rails app):
# .kamal/secrets
KAMAL_REGISTRY_PASSWORD=$KAMAL_REGISTRY_PASSWORD
RAILS_MASTER_KEY=$(cat config/master.key)
Each line maps a secret name to a value: an environment variable
($KAMAL_REGISTRY_PASSWORD) or the output of a command ($(cat config/master.key)).
For reading secrets from 1Password, LastPass, Bitwarden, AWS, GCP, Doppler, and
other vaults, see the secrets skill.
kamal setupWith the config and secrets in place, run your first deploy:
Preflight — commit first. Kamal builds from a
git archiveofHEAD, not your working tree. Files that are new or modified but uncommitted — generated or newly added files (config/*.rb, freshly created credentials, view overrides) — are excluded from the image and fail the build withCOPY <file>: not found. Commit everything the DockerfileCOPYs before runningkamal setup. To build the working tree instead, setcontext: .(see the build skill).
kamal setup
kamal setup runs everything required to deploy to a fresh host:
kamal deploy).kamal setup does step by stepExpanded, the first deploy:
200 OK to GET /up.All servers are now serving the app on port 80. If you run a single server, you're ready to go. If you run multiple servers, put a load balancer in front of them.
If
kamal setupis interrupted (SSH drop, network reset) partway through: the deploy lock may still be held on the server — check withkamal lock status. If the image already built and pushed, resume without rebuilding:kamal lock release, boot any accessories that aren't running yet (kamal accessory boot all; a name-conflict error for one that already booted is harmless), thenkamal deploy --skip-pushto deploy the already-pushed image. If the failure happened during build or push, just release the lock and rerunkamal setup. For lock details, see the deploy skill.
kamal setup installs Docker for you when it has permission. To set up Docker on
the hosts explicitly — for example before a deploy — run:
kamal server bootstrap
This checks whether Docker is installed and, if not, attempts to install it via get.docker.com.
For subsequent deploys, or if your servers already have Docker installed, you do
not need setup again — just run:
kamal deploy
kamal deploy builds and deploys the currently checked-out version of the app
to all servers. For the full release workflow, see the deploy skill.
| Command | What it does |
|---|---|
kamal init | Create config stub in config/deploy.yml and secrets stub in .kamal |
kamal setup | Setup all accessories, push the env, and deploy app to servers |
kamal deploy | Deploy app to servers |
kamal server bootstrap | Set up Docker to run Kamal apps |
kamal docs [SECTION] | Show Kamal configuration documentation |
kamal help [COMMAND] | Describe available commands or one specific command |
kamal version | Show Kamal version |
| Option | Description |
|---|---|
-c, --config-file=CONFIG_FILE | Path to config file (default config/deploy.yml) |
-d, --destination=DESTINATION | Destination for the config file (staging → deploy.staging.yml) |
-v, --verbose | Detailed logging |
-q, --quiet | Minimal logging |
-p, --primary | Run commands only on the primary host instead of all |
-h, --hosts=HOSTS | Run on these hosts instead of all (comma-separated, supports * wildcards) |
-r, --roles=ROLES | Run on these roles instead of all (comma-separated, supports * wildcards) |
-H, --skip-hooks | Don't run hooks |
For the full command list, the kamal server subcommands, and every global
option, see references/cli-reference.md. You can
also run kamal --help or kamal help [command] at any time.
config/deploy.yml keys and defaults.kamal deploy after the first setup..kamal/secrets and reading secrets from vault adapters.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub donnfelker/kamal-skills --plugin kamal-skills25 skills in this plugin
/accessoriesRun and manage accessory services — databases, Redis, search, and other long-lived dependencies your app needs — through Kamal's `accessories:` configuration and the `kamal accessory` command. Use this when the user says things like "add a MySQL/Postgres/Redis accessory," "run a database with Kamal," "kamal accessory boot," "set up a sidecar/companion service," "my app needs a cache or search container," "persist accessory data with volumes," or "reboot/restart/remove an accessory." Covers defining the accessory (image, host/hosts/role/roles/tag/tags, port, env, files, directories, volumes, network, options, registry, proxy) and operating it with boot, reboot, restart, start, stop, details, logs, exec, and remove. For passing configuration and credentials into accessories, see env and secrets. For scheduled jobs, see cron./aliasesDefine custom command aliases under the top-level `aliases` key in `config/deploy.yml` so a long, repeated `kamal` invocation becomes a single `kamal <name>`. Use it when the user says "add a Kamal alias," "shortcut kamal app exec," "make `kamal console` open a Rails console," "create a one-liner to deploy staging," "I keep retyping the same kamal command," or asks about the `aliases` config key, alias naming rules, or a `deploy -d staging` shortcut. Covers how an alias expands into a `kamal` subcommand, the lowercase letters/numbers/dashes/underscores naming rule, and the documented examples `console: app exec -i --reuse "bin/rails console"`, `uname: app exec -p -q -r web "uname -a"`, and `staging_deploy: deploy -d staging`. For the rest of `config/deploy.yml` and DRYing it up with YAML anchors, see config. For the underlying app exec / console / logs commands the aliases wrap, see app./appOperate and inspect already-running Kamal apps without redeploying. Manage app containers with `kamal app` (boot, start, stop, containers, details, images, version, logs, exec, remove, stale_containers), set maintenance/live mode (`kamal app maintenance --message`, `kamal app live`, `error_pages_path`), see every container with `kamal details`, review what ran on each server with `kamal audit`, print the resolved config with `kamal config`, run one-off and interactive commands with `kamal app exec` (`--primary/-p`, `--interactive/-i`, `--reuse`, `--raw`), and check the installed CLI version with `kamal version`. Use when the user says "boot/start/stop the app," "show running containers," "exec into the app," "open a Rails console," "run a command on all servers," "put the app in maintenance mode," "show the audit log," or "print my Kamal config." For shipping releases, see deploy. For reverting a release, see rollback. For log-driver and OTel/file config, see logging. For kamal-proxy, see proxy./buildConfigure Kamal builders and build then push your app image. Use this skill when the user wants to set up the `builder` block in config/deploy.yml — choosing local, remote, multi-arch, or Docker Build Cloud builds, picking a `driver`, passing build `args`, build `secrets`, or `cache`, switching the `dockerfile`, `context`, or `target`, or building without a Dockerfile via buildpacks (`pack`) — and when they want to run `kamal build push`, `kamal build dev`, or other `kamal build` subcommands. Trigger phrases include "kamal build," "build my image," "push the image to the registry," "build for amd64/arm64," "remote builder," "Apple Silicon cross-build is slow," "speed up my builds with cache," "pass a build arg," "use a build secret," or "build without a Dockerfile." For configuring the container registry, see registry. For the one-step flow that builds and ships in a single command, see deploy. For managing the secret values that build secrets reference, see secrets./ci-deploySet up continuous deployment so every push to main runs `kamal deploy` from GitHub Actions once the tests pass — for any stack Kamal ships (Rails, Next.js, Phoenix, Rust, static sites, and more). Use when the user says "auto-deploy on push," "deploy from GitHub Actions," "continuous deployment with Kamal," "deploy when CI passes," "set up CD," "stop deploying from my laptop," or "use 1Password in GitHub Actions." Covers the deploy ssh key, secrets in a GitHub environment or read from 1Password with a service account, the workflow, the GHA build cache, and verifying the first run. For running a deploy by hand, see deploy. For the secrets file itself, see secrets. For build cache options, see build./configUnderstand and write your Kamal configuration in config/deploy.yml. Use when the user says "set up config/deploy.yml," "what goes in my deploy.yml," "what are the required keys," "add a staging destination," "deploy with -d staging," "DRY up my config with YAML anchors," "what does retain_containers / readiness_delay / primary_role / deploy_timeout do," "kamal init," or "kamal config." Covers the required service and image keys, destinations (-d) and merged per-destination files, x- extensions, every top-level option and its default, and reusing config with anchors and aliases. For configuring servers and roles, see servers. For env and secrets, see env. For command shortcuts, see aliases. For a first deployment, see setup.Other plugins' skills for the same job