jpskill.com
🛠️ 開発・MCP コミュニティ

fly-io

Dockerアプリを世界中のFly.ioエッジ環境に展開する際に、複数リージョンの設定や永続ストレージの構築、グローバルデータベースの管理などを支援するSkill。

📜 元の英語説明(参考)

Assists with deploying applications globally on Fly.io edge infrastructure. Use when deploying Docker-based apps, configuring multi-region machines, setting up persistent storage, or managing global databases. Trigger words: fly.io, fly deploy, fly machines, fly launch, multi-region, edge deployment, flyctl.

🇯🇵 日本人クリエイター向け解説

一言でいうと

Dockerアプリを世界中のFly.ioエッジ環境に展開する際に、複数リージョンの設定や永続ストレージの構築、グローバルデータベースの管理などを支援するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o fly-io.zip https://jpskill.com/download/14912.zip && unzip -o fly-io.zip && rm fly-io.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/14912.zip -OutFile "$d\fly-io.zip"; Expand-Archive "$d\fly-io.zip" -DestinationPath $d -Force; ri "$d\fly-io.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して fly-io.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → fly-io フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Fly.io

概要

Fly.io は、30 以上の世界中のエッジリージョンにわたって Firecracker microVM にアプリケーションをデプロイし、ユーザーに 50ms 未満のレイテンシーを提供します。スケール・トゥ・ゼロのマシン、永続的な NVMe ボリューム、マルチリージョン SQLite レプリケーション用の LiteFS、およびサービス間のプライベート WireGuard ネットワークをサポートしています。

手順

  • アプリケーションをデプロイする際は、fly launch を使用してフレームワークを自動検出し、Dockerfile を生成し、次に fly deploy を使用して、ヘルスチェックによるゼロダウンタイムのローリングアップデートを行います。
  • スケーリングを構成する際は、fly.tomlauto_stop_machinesauto_start_machines を使用して、アイドル時にゼロにスケールし、受信リクエスト時に起動するようにし、ワークロードに適したマシンサイズを設定します。
  • マルチリージョンデプロイメントを管理する際は、fly scale count --region を使用してマシンを分散させ、fly-replay ヘッダーを使用して書き込みをプライマリリージョンにルーティングし、SQLite リードレプリカには LiteFS を使用します。
  • 永続的なデータを処理する際は、永続ストレージ用のボリュームをアタッチし(マシンはエフェメラルです)、マルチリージョン SQLite には LiteFS を使用し、S3 互換のオブジェクトストレージには Tigris を使用します。
  • サービスを接続する際は、WireGuard メッシュ経由のプライベートなサービス間通信には .internal DNS を使用し、内部サービスをパブリックインターネットに公開しないでください。
  • シークレットを管理する際は、暗号化されたシークレットストレージとして fly secrets set KEY=value を使用し、環境変数としてアクセスできるようにします。
  • トラブルシューティングを行う際は、リアルタイムストリーミングには fly logs を使用し、実行中のマシンにアクセスするには fly ssh console を使用し、内部サービスへのトンネルには fly proxy を使用します。

例 1: マルチリージョン Web アプリケーションのデプロイ

ユーザーリクエスト: 「Fly.io を使用して、米国、ヨーロッパ、アジアでアプリをグローバルにデプロイしたい」

アクション:

  1. fly launch で初期化し、Dockerfile を構成します。
  2. 3 つのリージョンにマシンをデプロイします: fly scale count 2 --region iad,cdg,nrt
  3. リージョン間の SQLite レプリケーション用に LiteFS をセットアップします。
  4. プライマリリージョンへの書き込みルーティング用に fly-replay ヘッダーを構成します。

出力: 3 つのリージョンにリードレプリカがあり、自動書き込みルーティングを備えたグローバルに分散されたアプリ。

例 2: コスト効率の高いステージング環境の構成

ユーザーリクエスト: 「使用されていないときにゼロにスケールする Fly.io ステージング環境をセットアップしたい」

アクション:

  1. fly launch でステージングアプリを作成します。
  2. fly.tomlauto_stop_machines = "stop"auto_start_machines = true を構成します。
  3. 永続的なデータベースストレージ用のボリュームをアタッチします。
  4. ルーティング用に適切なタイムアウトでヘルスチェックを設定します。

出力: アイドル状態のマシンを停止し、次のリクエストで 1 秒未満で起動するステージング環境。

例 3: 自動ロールバックによるカナリアデプロイメント

ユーザーリクエスト: 「Fly.io にアプリをデプロイしたいが、最初に 1 台のマシンでテストしたい。ヘルスチェックが失敗した場合は、ロールバックしたい。」

アクション:

  1. --strategy canary でデプロイして、新しいマシンを 1 台起動します。
  2. アプリのヘルスエンドポイントでカナリアマシンのヘルスチェックを行います。
  3. 正常な場合は、fly deploy --strategy rolling でプロモートして、すべてのマシンを置き換えます。
  4. 異常な場合は、fly releases rollback でロールバックします。
#!/bin/bash
# deploy-canary.sh — Fly.io の自動ロールバックによるカナリアデプロイメント
set -euo pipefail

APP="${1:?Usage: deploy-canary.sh <app-name>}"
HEALTH_PATH="${2:-/api/health}"

echo "🐤 Deploying canary..."
fly deploy --app "$APP" --strategy canary --wait-timeout 120

HEALTH_URL="https://${APP}.fly.dev${HEALTH_PATH}"
HEALTHY=false
DEADLINE=$((SECONDS + 60))

while [ $SECONDS -lt $DEADLINE ]; do
  STATUS=$(curl -s -o /dev/null -w "%{http_code}" "$HEALTH_URL" || true)
  [ "$STATUS" = "200" ] && HEALTHY=true && break
  sleep 3
done

if [ "$HEALTHY" = true ]; then
  echo "✅ Canary healthy! Promoting..."
  fly deploy --app "$APP" --strategy rolling
  echo "🎉 Production deploy complete"
else
  echo "❌ Canary failed! Rolling back..."
  fly releases rollback --app "$APP"
  echo "⏪ Rolled back"
  exit 1
fi

ガイドライン

  • コストを節約するために、開発/ステージングには auto_stop_machines = "stop" を使用します。マシンはアイドルタイムアウト後に停止します。
  • マシンが 1 秒未満のコールドスタートで受信リクエスト時に起動するように、auto_start_machines = true を維持します。
  • サービス間呼び出しには .internal DNS を使用します。内部サービスを公開しないでください。
  • マシンはエフェメラルであるため、永続的なデータはマシンファイルシステムではなく、ボリュームに保存します。
  • マルチリージョン読み取りが必要な SQLite アプリには LiteFS を使用します。PostgreSQL レプリケーションよりも簡単です。
  • リアルなタイムアウトでヘルスチェックを設定します。Fly Proxy は、モニタリングだけでなく、ルーティングにもそれらを使用します。
  • マルチリージョンセットアップで書き込み操作を行うには、プライマリリージョンにルーティングするために fly-replay ヘッダーを使用します。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Fly.io

Overview

Fly.io deploys applications to Firecracker microVMs across 30+ edge regions worldwide, providing sub-50ms latency to users. It supports scale-to-zero machines, persistent NVMe volumes, LiteFS for multi-region SQLite replication, and private WireGuard networking between services.

Instructions

  • When deploying applications, use fly launch to auto-detect the framework and generate a Dockerfile, then fly deploy for zero-downtime rolling updates with health checks.
  • When configuring scaling, use auto_stop_machines and auto_start_machines in fly.toml to scale to zero when idle and wake on incoming requests, and set machine sizing appropriate to the workload.
  • When managing multi-region deployments, use fly scale count --region to distribute machines, fly-replay header to route writes to the primary region, and LiteFS for SQLite read replicas.
  • When handling persistent data, attach volumes for durable storage (machines are ephemeral), use LiteFS for multi-region SQLite, or Tigris for S3-compatible object storage.
  • When connecting services, use .internal DNS for private service-to-service communication over the WireGuard mesh and never expose internal services to the public internet.
  • When managing secrets, use fly secrets set KEY=value for encrypted secret storage accessible as environment variables.
  • When troubleshooting, use fly logs for real-time streaming, fly ssh console to access running machines, and fly proxy to tunnel to internal services.

Examples

Example 1: Deploy a multi-region web application

User request: "Deploy my app globally with Fly.io in US, Europe, and Asia"

Actions:

  1. Initialize with fly launch and configure Dockerfile
  2. Deploy machines to three regions: fly scale count 2 --region iad,cdg,nrt
  3. Set up LiteFS for SQLite replication across regions
  4. Configure fly-replay header for write routing to the primary region

Output: A globally distributed app with read replicas in three regions and automatic write routing.

Example 2: Configure a cost-efficient staging environment

User request: "Set up a Fly.io staging environment that scales to zero when not in use"

Actions:

  1. Create a staging app with fly launch
  2. Configure auto_stop_machines = "stop" and auto_start_machines = true in fly.toml
  3. Attach a volume for persistent database storage
  4. Set health checks with appropriate timeouts for routing

Output: A staging environment that stops idle machines and wakes in sub-second on the next request.

Example 3: Canary deployment with auto-rollback

User request: "Deploy my app to Fly.io but test on one machine first. If the health check fails, roll back."

Actions:

  1. Deploy with --strategy canary to spin up a single new machine
  2. Health check the canary machine at the app's health endpoint
  3. If healthy, promote with fly deploy --strategy rolling to replace all machines
  4. If unhealthy, rollback with fly releases rollback
#!/bin/bash
# deploy-canary.sh — Fly.io canary deployment with auto-rollback
set -euo pipefail

APP="${1:?Usage: deploy-canary.sh <app-name>}"
HEALTH_PATH="${2:-/api/health}"

echo "🐤 Deploying canary..."
fly deploy --app "$APP" --strategy canary --wait-timeout 120

HEALTH_URL="https://${APP}.fly.dev${HEALTH_PATH}"
HEALTHY=false
DEADLINE=$((SECONDS + 60))

while [ $SECONDS -lt $DEADLINE ]; do
  STATUS=$(curl -s -o /dev/null -w "%{http_code}" "$HEALTH_URL" || true)
  [ "$STATUS" = "200" ] && HEALTHY=true && break
  sleep 3
done

if [ "$HEALTHY" = true ]; then
  echo "✅ Canary healthy! Promoting..."
  fly deploy --app "$APP" --strategy rolling
  echo "🎉 Production deploy complete"
else
  echo "❌ Canary failed! Rolling back..."
  fly releases rollback --app "$APP"
  echo "⏪ Rolled back"
  exit 1
fi

Guidelines

  • Use auto_stop_machines = "stop" for dev/staging to save costs; machines stop after idle timeout.
  • Keep auto_start_machines = true so machines wake on incoming requests with sub-second cold start.
  • Use .internal DNS for service-to-service calls; never expose internal services publicly.
  • Store persistent data on volumes, not the machine filesystem, since machines are ephemeral.
  • Use LiteFS for SQLite apps needing multi-region reads; it is simpler than PostgreSQL replication.
  • Set health checks with realistic timeouts; Fly Proxy uses them for routing, not just monitoring.
  • Use fly-replay header for write operations in multi-region setups to route to the primary region.