简介
Fly.io官方CLI工具,安全部署与管理全球分布式应用,支持一键部署、SSH调试、Postgres数据库管理与GitHub Actions自动化集成。
原始描述
Use the Fly.io flyctl CLI for deploying and operating apps on Fly.io. Default to read-only diagnostics (status/logs/config/releases). Only perform state-changing operations (deploys, SSH exec, secrets, scaling, machines, volumes, Postgres changes) with explicit user approval. Use when asked to deploy to Fly.io, debug fly deploy/build/runtime failures, set up GitHub Actions deploys/previews, or safely manage Fly apps and Postgres.
通过你的 Agent 添加
安装目录:flyio-cli-public/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
技能正文
name: flyio-cli-public description: "Use the Fly.io flyctl CLI for deploying and operating apps on Fly.io: deploys (local or remote builder), viewing status/logs, SSH/console, secrets/config, scaling, machines, volumes, and Fly Postgres (create/attach/manage databases). Use when asked to deploy to Fly.io, debug fly deploy/build/runtime failures, set up GitHub Actions deploys/previews, or safely manage Fly apps and Postgres."
Fly.io (flyctl) CLI
Operate Fly.io apps safely and repeatably with flyctl.
Defaults / safety
- Prefer read-only commands first:
fly status,fly logs,fly config show,fly releases,fly secrets list. - Do not run any Fly.io command that changes state (deploys, scaling, secrets set/unset, volume/db create/drop, app destroy, attach/detach) without explicit user approval.
- Read-only actions are OK without approval.
- Destructive actions (destroy/drop) always require explicit approval.
- When debugging builds, capture the exact error output and determine whether it’s a:
- build/packaging issue (Dockerfile, Gemfile.lock platforms, assets precompile)
- runtime issue (secrets, DB, migrations)
- platform issue (regions, machines, health checks)
Quick start (typical deploy)
From the app repo directory:
- Confirm which app you’re targeting
fly app listfly status -a <app>- Check
fly.tomlforapp = "..."
- Deploy
fly deploy(default)fly deploy --remote-only(common when local docker/build env is inconsistent)
- Validate
fly status -a <app>fly logs -a <app>fly open -a <app>
Debugging deploy/build failures
Common checks
fly deploy --verbose(more build logs)- If using Dockerfile builds: verify Dockerfile Ruby/version and Gemfile.lock platforms match your builder OS/arch.
Rails + Docker + native gems (nokogiri, pg, etc.)
Symptoms: Bundler can’t find a platform gem like nokogiri-…-x86_64-linux during build.
Fix pattern:
- Ensure
Gemfile.lockincludes the Linux platform used by Fly’s builder (usuallyx86_64-linux).- Example:
bundle lock --add-platform x86_64-linux
- Example:
- Ensure Dockerfile’s Ruby version matches
.ruby-version.
(See references/rails-docker-builds.md.)
Logs, SSH, console
- Stream logs:
fly logs -a <app>
- SSH console:
fly ssh console -a <app>
- Run a one-off command:
fly ssh console -a <app> -C "bin/rails db:migrate"
Secrets / config
- List secrets:
fly secrets list -a <app>
- Set secrets:
fly secrets set -a <app> KEY=value OTHER=value
- Show config:
fly config show -a <app>
Fly Postgres basics
Identify the Postgres app
fly postgres list
Attach Postgres to an app
fly postgres attach <pg-app> -a <app>
Create a database inside the cluster
fly postgres db create <db_name> -a <pg-app>fly postgres db list -a <pg-app>
Connect (psql)
fly postgres connect -a <pg-app>
GitHub Actions deploys / previews
- For production CD: use Fly’s GitHub Action (
superfly/flyctl-actions/setup-flyctl) and runflyctl deploy. - For PR previews:
- Prefer one preview app per PR and one database per PR inside a shared Fly Postgres cluster.
- Automate create/deploy/comment on PR; destroy on close.
(See references/github-actions.md.)
Bundled resources
references/rails-docker-builds.md: Rails/Docker/Fly build failure patterns + fixes.references/github-actions.md: Fly deploy + preview workflows.scripts/fly_app_from_toml.sh: tiny helper to print the Fly app name from fly.toml.
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。