kamal deploy
构建并部署应用到所有服务器。默认情况下,系统会构建当前已签出版本的应用。
Kamal 将使用 Traefik 代理无缝地将请求从旧版本应用迁移到新版本应用,且不会有停机时间。
部署流程如下:
- 本地及所有服务器上登录到 Docker 仓库
- 构建应用镜像,将其推送到仓库,并将其拉取到服务器上
- 确保 Traefik 已启动
- 检查镜像在其中一台服务器上启动
- 检测并停止任何过时的容器容器
- 启动新的容器并停止旧容器
- 清理旧的容器和镜像
Usage:
kamal deploy
Options:
-P, [--skip-push] # Skip image build and push
# Default: false
-v, [--verbose], [--no-verbose], [--skip-verbose] # Detailed logging
-q, [--quiet], [--no-quiet], [--skip-quiet] # Minimal logging
[--version=VERSION] # Run commands against a specific app version
-p, [--primary], [--no-primary], [--skip-primary] # Run commands only on primary host instead of all
-h, [--hosts=HOSTS] # Run commands on these hosts instead of all (separate by comma, supports wildcards with *)
-r, [--roles=ROLES] # Run commands on these roles instead of all (separate by comma, supports wildcards with *)
-c, [--config-file=CONFIG_FILE] # Path to config file
# Default: config/deploy.yml
-d, [--destination=DESTINATION] # Specify destination to be used for config file (staging -> deploy.staging.yml)
-H, [--skip-hooks] # Don't run hooks
# Default: false