kamal

使用 Kamal 将 Web 应用部署到任意服务器,提供无需 Kubernetes 的零停机 Docker 部署。适用于部署到 VPS、不使用 Kubernetes 的部署、Kamal 部署、将 Rails/Node/Python 应用部署到服务器、裸机零停机部署或用 VPS 替代 Heroku。涵盖基于 Docker 的部署、通过 Traefik 实现零停机、多服务器部署、密钥管理以及附属服务配置。

仓库最近推送
GitHub Stars
219
Forks
38
Issues / PRs
7

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "kamal":https://skillpi.com/zh/skills/deepskill-888e13e7502f445542c7027e7421e25d9659aae5b0022985d664fc232c15bba8。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

使用 Kamal 将 Web 应用部署到任意服务器,提供无需 Kubernetes 的零停机 Docker 部署。适用于部署到 VPS、不使用 Kubernetes 的部署、Kamal 部署、将 Rails/Node/Python 应用部署到服务器、裸机零停机部署或用 VPS 替代 Heroku。涵盖基于 Docker 的部署、通过 Traefik 实现零停机、多服务器部署、密钥管理以及附属服务配置。

0 下载

介绍来源: third_party · TerminalSkills · 1.0.0 参考来源

SkillPi 解读

适合谁
翻译待完成,请参阅来源文档。
软件、账号及付费要求
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: kamal
description: >-
  Deploy web applications to any server with Kamal — zero-downtime Docker
  deployments without Kubernetes. Use when someone asks to "deploy to a VPS",
  "deploy without Kubernetes", "Kamal deploy", "simple Docker deployment",
  "deploy Rails/Node/Python to a server", "zero-downtime deployment to bare
  metal", or "replace Heroku with a VPS". Covers Docker-based deployment, zero
  downtime with Traefik, multi-server, secrets, and accessory services.
license: Apache-2.0
compatibility: "Requires: Docker on target server, SSH access. Deploys any Docker image."
metadata:
  author: terminal-skills
  version: "1.0.0"
  category: devops
  tags: ["deployment", "docker", "vps", "kamal", "zero-downtime"]

Kamal

Overview

Kamal (formerly MRSK) deploys containerized web apps to any server — VPS, bare metal, cloud VM — with zero downtime and no Kubernetes complexity. Created by 37signals (Basecamp/HEY), it uses Docker + Traefik to manage rolling deployments, SSL, and load balancing. Configure once in YAML, deploy with one command.

When to Use

  • Deploying to VPS/bare metal servers (Hetzner, DigitalOcean, Linode)
  • Want zero-downtime deployments without Kubernetes
  • Migrating off Heroku/Railway to self-hosted
  • Need SSL, rolling deploys, and health checks with minimal config
  • Multi-server deployment (web + worker + cron on different machines)

Instructions

Setup

gem install kamal
# Or without Ruby:
docker run -it ghcr.io/basecamp/kamal:latest

# Initialize in your project
kamal init

Configuration

# config/deploy.yml — Main deployment config
service: my-app
image: myuser/my-app

servers:
  web:
    hosts:
      - 167.235.1.100
      - 167.235.1.101
    labels:
      traefik.http.routers.my-app.rule: Host(`myapp.com`)
      traefik.http.routers.my-app-secure.entrypoints: websecure
      traefik.http.routers.my-app-secure.rule: Host(`myapp.com`)
      traefik.http.routers.my-app-secure.tls.certresolver: letsencrypt
  worker:
    hosts:
      - 167.235.1.102
    cmd: node worker.js

# Docker image registry
registry:
  server: ghcr.io
  username: myuser
  password:
    - KAMAL_REGISTRY_PASSWORD

# Environment variables
env:
  clear:
    NODE_ENV: production
    PORT: 3000
  secret:
    - DATABASE_URL
    - REDIS_URL
    - SECRET_KEY

# Traefik for load balancing + SSL
traefik:
  options:
    publish:
      - "443:443"
    volume:
      - "/letsencrypt:/letsencrypt"
  args:
    entryPoints.web.address: ":80"
    entryPoints.websecure.address: ":443"
    certificatesResolvers.letsencrypt.acme.email: admin@myapp.com
    certificatesResolvers.letsencrypt.acme.storage: /letsencrypt/acme.json
    certificatesResolvers.letsencrypt.acme.httpChallenge.entryPoint: web

# Accessories (databases, Redis, etc.)
accessories:
  db:
    image: postgres:16
    host: 167.235.1.100
    port: 5432
    env:
      secret:
        - POSTGRES_PASSWORD
    directories:
      - data:/var/lib/postgresql/data
  redis:
    image: redis:7
    host: 167.235.1.100
    port: 6379

# Health check
healthcheck:
  path: /health
  port: 3000
  max_attempts: 10
  interval: 3

Deploy

# First deployment (sets up Docker, Traefik, accessories)
kamal setup

# Subsequent deployments (zero-downtime rolling)
kamal deploy

# Deploy with specific version/tag
kamal deploy --version=abc123

# Rollback to previous version
kamal rollback

# Check status
kamal details

# View logs
kamal app logs
kamal app logs -f  # Follow

# Run one-off commands
kamal app exec "node scripts/migrate.js"
kamal app exec -i "node"  # Interactive shell

Secrets Management

# .kamal/secrets — Environment file (NOT committed to git)
KAMAL_REGISTRY_PASSWORD=ghp_xxx
DATABASE_URL=postgresql://user:pass@db:5432/myapp
REDIS_URL=redis://redis:6379
SECRET_KEY=super-secret-key

# Secrets from 1Password, AWS SSM, etc.
kamal secrets extract --adapter=1password --account=myteam --from=MyApp/Production

Examples

Example 1: Deploy a Next.js app to Hetzner

User prompt: "Deploy my Next.js app to a Hetzner VPS with SSL and zero downtime."

The agent will create a Dockerfile, configure Kamal with Traefik for SSL via Let's Encrypt, set up health checks, and deploy with kamal setup.

Example 2: Multi-server deployment with worker

User prompt: "I have a web app and a background job worker. Deploy web to 2 servers and worker to 1."

The agent will configure Kamal with separate server roles (web × 2, worker × 1), shared environment, and rolling deployment for the web servers.

Guidelines

  • kamal setup for first deploy — installs Docker, starts Traefik, deploys accessories
  • kamal deploy for updates — zero-downtime rolling deployment
  • Health check is critical — Kamal waits for /health to return 200 before switching traffic
  • Accessories for databases — Postgres, Redis managed alongside your app
  • Secrets in .kamal/secrets — never in deploy.yml or git
  • Traefik handles SSL — automatic Let's Encrypt certificates
  • Rollback is instant — kamal rollback switches to previous container
  • Works with any Docker image — not just Ruby/Rails
  • Multi-server is built-in — add hosts, Kamal deploys to all
  • No Kubernetes needed — for most apps, Kamal + VPS is simpler and cheaper

当前收录版本

1.0.0

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值85/100

亮点

  • 提供 Kamal 部署工具的使用指南,解决用户将 Web 应用部署到 VPS/裸机服务器的实际需求
  • 涵盖零停机部署、SSL、多服务器、密钥管理等实用功能,属于明确场景的通用工具,受众广泛
触发精准90/100

亮点

  • description 中列出了多种触发场景(如“部署到 VPS”、“Kamal 部署”、“简单的 Docker 部署”等),覆盖合理,边界清晰
结构规范95/100

亮点

  • 文档结构清晰,包含 Overview、When to Use、Instructions、Examples、Guidelines 等完整章节
  • 步骤划分明确,有端到端示例,frontmatter 完整,单文件未超过 500 行
执行可靠90/100

亮点

  • 提供了详细的配置示例和部署命令,工具来源明确(Kamal 官方),参数正确
  • 覆盖了主要异常(如健康检查、回滚机制),不可逆操作有明确的命令和确认流程
证据可验 (前四项均值)90/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

翻译待完成,请参阅来源文档。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。