Skills2026年4月15日·1 分钟阅读

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 就绪

这个资产会安全暂存

这个资产会先安全暂存。复制的指令会要求 Agent 读取暂存文件,并在激活脚本、MCP 配置或全局配置前先确认。

Stage only · 29/100策略:需暂存
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Stage only
信任
信任等级:Established
入口
Kamal Guide
安全暂存命令
npx -y tokrepo@latest install 5211d45c-3908-11f1-9bc6-00163e2b0d79 --target codex

先暂存文件;激活前需要读取暂存 README 和安装计划。

TL;DR
Kamal ships Docker containers to bare metal or cloud VMs with zero-downtime deploys in a single command.
§01

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.

§02

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.

§03

How to use

  1. Install Kamal:
gem install kamal
  1. Initialize configuration:
cd my-app
kamal init
# Edit config/deploy.yml with your servers, registry, and image settings
  1. First-time setup and deploy:
kamal setup    # Installs Docker and kamal-proxy on all servers
kamal deploy   # Build, push, and deploy your app
§04

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
§05

Related on TokRepo

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.

§06

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.

常见问题

How does Kamal achieve zero downtime?+

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.

Does Kamal require Kubernetes?+

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.

What registries does Kamal support?+

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.

Can Kamal deploy to multiple servers?+

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.

Is Kamal production-ready?+

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)

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产