Kamal — Zero-Downtime Docker Deploys to Any Server
Kamal is Basecamp's deploy tool that ships Docker containers to bare metal or cloud VMs with a single command, giving you Heroku-like workflows on servers you actually own.
这个资产会安全暂存
这个资产会先安全暂存。复制的指令会要求 Agent 读取暂存文件,并在激活脚本、MCP 配置或全局配置前先确认。
npx -y tokrepo@latest install 5211d45c-3908-11f1-9bc6-00163e2b0d79 --target codex先暂存文件;激活前需要读取暂存 README 和安装计划。
What it is
Kamal is Basecamp's deploy tool that ships Docker containers to bare metal servers or cloud VMs with a single command. It provides Heroku-like deployment workflows on servers you actually own. Kamal handles Docker image building, pushing to registries, rolling deploys with zero downtime via a reverse proxy, and multi-server orchestration.
Kamal targets developers and teams who want simple deployments without Kubernetes complexity. If you have a few servers and want push-button deploys, Kamal bridges the gap between manual SSH deployment and full container orchestration.
How it saves time or tokens
Kamal replaces manual deployment scripts with a single declarative config file and one command. It installs Docker and the kamal-proxy reverse proxy on your servers automatically. Rolling deploys ensure zero downtime by starting the new version before stopping the old one. Multi-server support deploys to an entire fleet simultaneously.
How to use
- Install Kamal:
gem install kamal
- Initialize configuration:
cd my-app
kamal init
# Edit config/deploy.yml with your servers, registry, and image settings
- First-time setup and deploy:
kamal setup # Installs Docker and kamal-proxy on all servers
kamal deploy # Build, push, and deploy your app
Example
# config/deploy.yml
service: my-app
image: myregistry/my-app
servers:
web:
hosts:
- 192.168.1.10
- 192.168.1.11
worker:
hosts:
- 192.168.1.12
cmd: bundle exec sidekiq
registry:
server: ghcr.io
username: my-github-user
password:
- KAMAL_REGISTRY_PASSWORD
env:
clear:
RAILS_ENV: production
secret:
- DATABASE_URL
- REDIS_URL
Related on TokRepo
- DevOps Tools — Deployment and infrastructure tools
- Self-Hosted Tools — Run applications on your own servers
This tool integrates with standard development workflows and requires minimal configuration to get started. It is available as open-source software with documentation and community support through the official repository. The project follows semantic versioning for stable releases.
For teams evaluating this tool, the key advantage is reducing manual work in repetitive tasks. The automation provided by the built-in features means less custom code to maintain and fewer integration points to manage. This translates directly to lower maintenance costs and faster iteration cycles.
Common pitfalls
- Kamal requires SSH access to target servers and Docker registry credentials; ensure SSH keys and registry auth are configured before running setup.
- The deploy.yml file contains secrets references; use environment variables or .env files rather than committing credentials to version control.
- Kamal installs its own reverse proxy (kamal-proxy); if you already have Nginx or Traefik on your servers, configure port mapping to avoid conflicts.
常见问题
Kamal uses kamal-proxy (a lightweight reverse proxy) to route traffic. During deployment, the new container starts alongside the old one. Once health checks pass, kamal-proxy switches traffic to the new container and stops the old one. Users experience no interruption.
No. Kamal deploys directly to servers via SSH and Docker. It is designed as a simpler alternative to Kubernetes for teams that do not need the complexity of container orchestration.
Kamal works with Docker Hub, GitHub Container Registry (ghcr.io), AWS ECR, Google Container Registry, and any Docker-compatible registry. Configure the registry in deploy.yml.
Yes. Define multiple hosts in deploy.yml and Kamal deploys to all of them in parallel. You can also define different server roles (web, worker) with different commands.
Yes. Kamal is used by Basecamp (37signals) to deploy their production applications including HEY and Basecamp itself. It is actively maintained and used in production by many teams.
引用来源 (3)
- Kamal GitHub— Kamal deploys Docker containers to servers with zero downtime
- Kamal Documentation— Kamal is built by Basecamp for their production deployments
- Kamal Getting Started— Kamal uses kamal-proxy for zero-downtime rolling deploys
讨论
相关资产
Sidekick — Bare Metal to Production in Minutes on Your VPS
A self-hosted deployment tool that turns a fresh VPS into a production-ready server with Docker, TLS, and zero-downtime deploys via a single CLI command.
Nginx Unit — Dynamic Polyglot Application Server
A lightweight application server by the Nginx team that runs Go, Python, Node.js, Java, Perl, PHP, Ruby, and WebAssembly apps behind a RESTful JSON API for zero-downtime configuration.
Deployer — Zero-Downtime PHP Deployment Tool
Deployer is a deployment tool for PHP projects that provides zero-downtime atomic deployments with built-in recipes for Laravel, Symfony, and other popular frameworks.
mkcert — Zero-Config Local HTTPS Development Certificates
mkcert is a simple tool that creates locally-trusted development certificates with zero configuration. No more browser security warnings in local development — just run mkcert and get valid HTTPS for localhost and any custom domain.