Kamal
platform.kamal
Protects against destructive Kamal 2.x operations that tear down the stack, delete accessory data directories, drop proxy routing, take the app offline, or prune the images that rollback depends on.
- 10blocking rules
- 20safe patterns
- 2Critical
- 7High
- 1Medium
[packs]
enabled = ["platform.kamal"]Evaluated when a command contains kamal.
Blocking rules
Each rule ID is platform.kamal:<name>. Use it in allowlists and [policy.rules].
Criticalkamal-accessory-removekamal accessory remove deletes the accessory container, image, AND its host data directory.
Explanation
`kamal accessory remove [NAME]` removes the accessory container and image and ALSO deletes its data directory from the host. For a database/redis/search accessory this permanently destroys the data. `kamal accessory remove all` does this across every accessory at once (highest blast radius). The common mistake is meaning the YAML block in deploy.yml, not the live Postgres/Redis data on disk. Safer alternatives: - Edit the accessory block out of deploy.yml instead of deleting live data - kamal accessory stop: take it offline reversibly (data preserved) - Back up the data directory / take a database dump before any removal
Criticalkamal-removekamal remove tears down the entire deployment, including stateful accessories.
Explanation
`kamal remove` removes the app container, kamal-proxy, and all accessory containers from the servers and logs out of the registry. Because it removes accessories, it can destroy stateful services (Postgres/Redis/search) along with the rest of the stack. It accepts `-y`/`--yes` to skip the confirmation prompt, so a non-interactive agent run has no safety net. A wrong destination (e.g. a missing `-d staging` while the shell points at production) tears down prod. Safer alternatives: - kamal details: review what is actually deployed first - kamal app remove / kamal proxy remove: scope the teardown if that is the real intent - Always pass the explicit destination (e.g. -d staging) and confirm it
Highkamal-accessory-rebootkamal accessory reboot stops, removes, and recreates the accessory container (downtime).
Explanation
`kamal accessory reboot [NAME]` stops, removes, and starts a new accessory container, causing downtime for that accessory (e.g. the database). Data survives only if a volume is mapped; an unmapped data directory is at risk. `NAME=all` reboots every accessory. Safer alternatives: - kamal accessory restart: restart the existing container without remove/recreate - kamal accessory details: confirm the target accessory before cycling it
Highkamal-accessory-stopkamal accessory stop stops the accessory (e.g. the database), erroring the app.
Explanation
`kamal accessory stop [NAME]` stops the accessory container. Stopping the database (or cache/search) errors the app until the accessory is restarted, knocking a dependency offline mid-traffic. Safer alternatives: - kamal accessory restart: cycle it without leaving it stopped - kamal accessory details / kamal accessory logs: diagnose without stopping
Highkamal-app-removekamal app remove takes the app offline by removing its containers and images.
Explanation
`kamal app remove` removes the app containers and images from the servers. The app goes offline and the images must be rebuilt or re-pulled before it can serve again. This is a frequent footgun when asked to "clean up old containers". Safer alternatives: - kamal app stale_containers: list leftover containers without removing the live app - kamal prune: remove genuinely old images/containers (still erodes rollback) - kamal app maintenance: serve a 503 reversibly instead of removing
Highkamal-app-stopkamal app stop stops the app container, causing an outage until restarted.
Explanation
`kamal app stop` stops the app container on the servers, causing an outage until `kamal app start`. There is no built-in confirmation prompt. Safer alternatives: - kamal app maintenance: serve a 503 maintenance page (reversible with kamal app live) - kamal app details: confirm the target before stopping anything
Highkamal-proxy-rebootkamal proxy reboot stops, removes, and recreates the proxy, causing a short outage.
Explanation
`kamal proxy reboot` stops, removes, and starts a new proxy container. It is documented to cause a small outage on each server. While it prompts interactively, a non-interactive agent run with `-y` skips that prompt. Safer alternatives: - kamal proxy restart: a lighter restart of the existing proxy where applicable - kamal proxy reboot --rolling: stagger the restart across servers to reduce the outage (still a reboot, so dcg gates this form too — it needs approval)
Highkamal-proxy-removekamal proxy remove drops routing for every app behind that proxy on the host.
Explanation
`kamal proxy remove` removes the kamal-proxy container and image. Every app behind that proxy on the host loses routing until the proxy is re-booted. There is no confirmation prompt for `remove`. Safer alternatives: - kamal proxy details / kamal proxy logs: diagnose the proxy without removing it - kamal proxy reboot --rolling: if a cycle is required, stagger it to limit the outage (dcg gates proxy reboots too, so this form still needs approval)
Highkamal-proxy-stopkamal proxy stop drops routing for every app behind that proxy until it is started.
Explanation
`kamal proxy stop` stops the kamal-proxy container. Every app behind that proxy on the host loses routing until `kamal proxy start`/`boot`. Safer alternatives: - kamal proxy details: confirm what the proxy is serving before stopping it - kamal proxy restart: cycle the proxy without leaving it down
Mediumkamal-prunekamal prune removes older images/containers that kamal rollback relies on.
Explanation
`kamal prune all` prunes unused images and stopped containers, `kamal prune containers` prunes stopped containers except the last n (default 5), and `kamal prune images` prunes unused images. Kamal's `rollback` relies on the older deployed images/containers, so over-pruning can strand a deployment with no rollback target. Safer alternatives: - kamal app containers / kamal app images: see what would be removed first - Confirm a known-good rollback target exists before pruning
Safe patterns
Checked first. A command that matches one is never blocked by this pack.
kamal-auditkamal-detailskamal-configkamal-secretskamal-deploykamal-redeploykamal-setupkamal-buildkamal-rollbackkamal-upgradekamal-registrykamal-lockkamal-server-bootstrapkamal-initkamal-docskamal-helpkamal-versionkamal-app-safekamal-accessory-safekamal-proxy-safe