Fly.io 部署
在 Fly.io 上全球边缘部署 OpenClaw
概述
Fly.io是一个全球边缘计算平台,可以在靠近用户的位置运行应用。 通过 Fly.io 部署 OpenClaw,可以获得低延迟的响应体验。
全球边缘
30+ 区域就近部署
快速部署
一条命令部署
自动扩展
按需自动扩缩容
安装 flyctl
macOS
brew install flyctlLinux
curl -L https://fly.io/install.sh | shWindows
powershell -Command "iwr https://fly.io/install.ps1 -useb | iex"登录
flyctl auth login部署应用
方法 1: 使用模板
flyctl launch --image openclaw/openclaw:latest方法 2: 使用 fly.toml
# fly.toml
app = "openclaw"
primary_region = "sin" # Singapore
[build]
image = "openclaw/openclaw:latest"
[env]
TZ = "Asia/Shanghai"
[http_service]
internal_port = 8080
force_https = true
[[vm]]
cpu_kind = "shared"
cpus = 1
memory_mb = 512部署
# 首次部署
flyctl launch
# 后续更新
flyctl deploy配置选项
设置 Secrets
flyctl secrets set ANTHROPIC_API_KEY="sk-ant-xxx..."
flyctl secrets set CLAWDBOT_TELEGRAM_TOKEN="123456:ABC..."
# 查看已设置的 secrets
flyctl secrets list持久化存储
# 创建 Volume
flyctl volumes create openclaw_data --size 1 --region sin
# 在 fly.toml 中挂载
[mounts]
source = "openclaw_data"
destination = "/data"扩展缩放
# 扩展到多个实例
flyctl scale count 2
# 调整机器规格
flyctl scale vm shared-cpu-2x
# 添加更多区域
flyctl regions add hkg nrt监控管理
# 查看状态
flyctl status
# 查看日志
flyctl logs
# SSH 进入机器
flyctl ssh console
# 监控面板
flyctl dashboard价格说明
- 免费额度: 3 个共享 CPU 实例
- shared-cpu-1x: ~$1.94/月
- 存储: $0.15/GB/月
轻度使用通常在免费额度内。