DevOps & CloudDocumentedScanned
flyio-cli
Fly.io deploy, logs, SSH, secrets, scaling.
Share:
Installation
npx clawhub@latest install flyio-cliView the full skill documentation and source below.
Documentation
Fly.io (flyctl) CLI
Operate Fly.io apps safely and repeatably with flyctl.
Common tasks
- Deploy:
fly deploy/fly deploy --remote-only - Logs:
fly logs -a - SSH / run commands:
fly ssh console -a -C "…" - Secrets:
fly secrets list/set -a - Postgres:
fly postgres list/connect/db create/attach - GitHub Actions deploys / PR previews
Defaults / safety
- Prefer read-only commands first:
fly status,fly logs,fly config show,fly releases,fly secrets list. - Do not run state-changing Fly.io commands without explicit user approval (deploy/scale, secrets set/unset, volume/db create/drop, app destroy, attach/detach).
- When debugging, classify the failure as: build/packaging vs runtime vs platform.
Quick start (typical deploy)
From the app repo directory:
1) Confirm which app you’re targeting
fly app listfly status -a- Check
fly.tomlforapp = "..."
2) Deploy
fly deploy(default)fly deploy --remote-only(common when local docker/build env is inconsistent)
3) Validate
fly status -afly logs -afly open -a
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 likenokogiri-…-x86_64-linux during build.
Fix pattern:
- Ensure
Gemfile.lockincludes the Linux platform used by Fly’s builder (usuallyx86_64-linux).
bundle lock --add-platform x86_64-linux- Ensure Dockerfile’s Ruby version matches
.ruby-version.
(See
references/rails-docker-builds.md.)
Logs, SSH, console
- Stream logs:
fly logs -a
- SSH console:
fly ssh console -a
- Run a one-off command:
fly ssh console -a -C "bin/rails db:migrate"
Secrets / config
- List secrets:
fly secrets list -a
- Set secrets:
fly secrets set -a KEY=value OTHER=value
- Show config:
fly config show -a
Fly Postgres basics
Identify the Postgres app
fly postgres list
Attach Postgres to an app
fly postgres attach -a
Create a database inside the cluster
fly postgres db create -afly postgres db list -a
Connect (psql)
fly postgres connect -a
GitHub Actions deploys / previews
- For production CD: use Fly’s GitHub Action (
superfly/flyctl-actions/setup-flyctl) and runfly deploy(often with--remote-only). - For PR previews:
(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.