360 Secure SkillHub
360 安全技能中心

Fly.io

该 Skill 是一份 Fly.io 操作参考,覆盖登录鉴权、应用查看与部署、日志、Secrets、扩缩容、Machines 管理、SSH 执行命令以及 Fly Postgres 的创建与连接,并列出 VM 规格、区域和部署建议。主要面向使用 flyctl 进行应用部署与运维的开发者。

dwhite-oss
dwhite-oss
热度 40.42
最近更新 2026-05-11 17:37:27
分类:开发依赖:代码执行 / 第三方 API应用场景:DevOps / API 集成

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add fly-io
Metadata
name
fly-io
description
Deploy and manage applications on Fly.io using the flyctl CLI and Machines API. Use when asked to deploy an app, scale machines, check app status, view logs, manage secrets, create/destroy machines, set environment variables, run commands in a container, or manage Fly Postgres databases. Requires flyctl installed and authenticated via `fly auth login`.

Fly.io Skill

Fly.io is managed via the flyctl CLI (alias: fly) and the Machines REST API.

Auth

fly auth login          # opens browser
fly auth token          # print current token
export FLY_API_TOKEN=$(fly auth token)

App Management

fly apps list                          # list all apps
fly status -a <app-name>               # app health + machine states
fly info -a <app-name>                 # app details, IPs, regions
fly open -a <app-name>                 # open in browser

Deploy

fly deploy                             # deploy from current dir (uses fly.toml)
fly deploy --image registry/image:tag  # deploy a specific image
fly deploy --remote-only               # build remotely (no local Docker needed)
fly deploy -a <app-name>               # target specific app

Logs

fly logs -a <app-name>                 # live log stream
fly logs -a <app-name> --no-tail       # recent logs, no follow

Secrets

fly secrets set MY_KEY=value -a <app-name>
fly secrets list -a <app-name>
fly secrets unset MY_KEY -a <app-name>

Scaling

fly scale count 3 -a <app-name>                    # set machine count
fly scale memory 512 -a <app-name>                 # set RAM (MB)
fly scale vm shared-cpu-2x -a <app-name>           # change VM size
fly scale show -a <app-name>                        # current scale

Machines

fly machine list -a <app-name>
fly machine status <machine-id> -a <app-name>
fly machine restart <machine-id> -a <app-name>
fly machine stop <machine-id> -a <app-name>
fly machine destroy <machine-id> -a <app-name>

Run a Command (one-off)

fly ssh console -a <app-name>                      # interactive shell
fly ssh console -a <app-name> -C "ls -la /app"    # run single command

Postgres

fly postgres create --name myapp-db                # create Postgres cluster
fly postgres connect -a myapp-db                   # psql shell
fly postgres attach myapp-db -a <app-name>         # attach DB to app (sets DATABASE_URL)

VM Sizes

shared-cpu-1x (256MB), shared-cpu-2x (512MB), performance-1x (2GB), performance-2x (4GB)

Regions

iad (Virginia), ord (Chicago), lax (LA), sea (Seattle), ams (Amsterdam), fra (Frankfurt), sin (Singapore), syd (Sydney)

Tips

  • fly.toml is the app config — always check it before deploying
  • fly deploy --strategy rolling for zero-downtime deploys
  • Health checks in fly.toml under [checks] block