Communitygithub.com

Uncloud クラスタ管理

Uncloud クラスタを管理する際に使用します。サービスのデプロイ、Caddy Ingress の設定、非クラスタデバイス用の静的プロキシルートの追加、ポートの公開、スケーリング、ログの確認、マシンやボリュームの管理などを `uc` CLI で行います。

Uncloud クラスタ管理 とは?

Uncloud クラスタ管理スキルは、分散型セルフホスティングプラットフォーム「Uncloud」の運用を支援するツールです。Docker コンテナ、WireGuard メッシュネットワーキング、Caddy リバースプロキシをベースにしており、中央管理サーバーを必要としません。このスキルを使用すると、`uc` CLI を通じてマシンの初期化・追加、Docker Compose を用いたサービスのデプロイ、HTTP/HTTPS/TCP/UDP ポートの公開、Caddy のカスタム設定(`x-caddy` 拡張)、サービスログの確認、スケーリング、ボリューム管理など、Uncloud クラスタのほぼすべての操作を実行できます。開発者はこのスキルを活用することで、分散環境でのアプリケーション管理を効率化し、手動設定の手間を削減できます。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/ECC/tree/main/skills/uncloud

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Uncloud クラスタ管理 は何をしますか?

uc CLI のリファレンス — Docker コンテナ、WireGuard メッシュネットワーキング、Caddy リバースプロキシを使用した分散型セルフホスティングプラットフォーム。

アクティベートするタイミング

このスキルは、Uncloud クラスタを操作するとき、特に以下の場合に使用します。

  • uc machine を使用したマシンのブートストラップや参加
  • uc deploy を使用した Compose ファイルからのサービスのデプロイ
  • Uncloud を介した HTTP、HTTPS、TCP、UDP ポートの公開
  • x-caddy、x-ports、--caddyfile を使用した Caddy Ingress の設定
  • 外部 LAN デバイスのクラスタプロキシ経由でのルーティング
  • ログ、サービス状態、ボリューム、DNS、マシン配置の確認

動作の仕組み

Uncloud は、WireGuard メッシュで接続されたピアマシン上で Docker サービスを実行します。各マシンは同等のクラスタメンバーであり、サービスはオーバーレイネットワーク上で通信し、Caddy はパブリックな HTTP/HTTPS トラフィックを終端するためにグローバルに実行されます。Compose ファイルでは、イングレス、配置、生成された Caddy 設定に Uncloud 拡張機能を使用でき、uc CLI がイメージ配布、スケジューリング、スケーリング、ログ、クラスタ状態を処理します。

例

uc machine init user@host --name machine-1
uc service run --name web -p app.example.com:8080/https nginx:latest
uc deploy

コアコンセプト

  • 中央制御プレーンなし — すべてのマシンは WireGuard で接続された同等のピア
  • Caddy はすべてのマシンでグローバルサービスとして実行され、Let's Encrypt から TLS 証明書を自動取得
  • オーバーレイネットワーク — サービスはデフォルトで 10.210.0.0/16 経由で通信し、メッシュ内で DNS を提供
  • Caddyfile は自動生成 — 直接編集せず、代わりに x-caddy / --caddyfile を使用

CLI クイックリファレンス

マシン

コマンド目的
uc machine init user@host最初のマシン / 新しいクラスタをブートストラップ
uc machine add user@host既存のクラスタにマシンを参加
uc machine lsマシンの一覧表示
uc machine update NAME --public-ip IPイングレス用のパブリック IP を更新
uc machine rm NAMEマシンを削除

主な init フラグ: --name, --network 10.210.0.0/16, --no-caddy, --no-dns, --public-ip auto|IP|none

サービス

コマンド目的
uc service ls / uc lsサービスの一覧表示
uc service run IMAGE単一コンテナサービスを実行
uc deploycompose.yaml からデプロイ
uc deploy --no-buildリビルドせずにプッシュ済みイメージをデプロイ
uc deploy --recreateサービスの強制再作成
uc scale SERVICE Nレプリカ数を設定
uc service logs SERVICEログの表示
uc service exec SERVICEコンテナへのシェルアクセス
uc service inspect SERVICE詳細情報の表示
uc service rm SERVICEサービスの削除(名前付きボリュームは保持)
uc psクラスタ全体の全コンテナを表示

イメージ

uc image push myapp:latest                    # ローカルイメージをすべてのマシンにプッシュ
uc image push myapp:latest -m machine1,machine2  # 特定のマシンにプッシュ
uc images                                     # クラスタ内のイメージ一覧

ボリューム

uc volume ls                  # すべてのボリューム
uc volume ls -m machine1      # 特定のマシン上のボリューム
uc volume create NAME -m MACHINE
uc volume rm NAME

Caddy

uc caddy config    # 現在の生成済み Caddyfile を表示(読み取り専用)
uc caddy deploy    # クラスタ全体に Caddy をデプロイ/アップグレード

DNS とコンテキスト

uc dns show        # 予約済みの *.uncld.dev ドメインを表示
uc dns reserve     # 新しいドメインを予約
uc ctx ls          # クラスタコンテキストの一覧
uc ctx use prod    # コンテキストを切り替え

ポート公開

HTTP/HTTPS(Caddy リバースプロキシ経由)

-p [ホスト名:]コンテナポート[/プロトコル]
例意味
-p 8080/https自動 サービス名.クラスタドメイン ホスト名で HTTPS
-p app.example.com:8080/httpsカスタムホスト名で HTTPS
-p 8080/httpHTTP のみ、TLS なし

TCP/UDP(ホストバインド、Caddy をバイパス)

-p [ホストIP:]ホストポート:コンテナポート[/プロトコル]@host
例意味
-p 5432:5432@host全インターフェースで TCP 5432
-p 127.0.0.1:5432:5432@hostループバックのみで TCP 5432
-p 53:5353/udp@hostUDP

Compose ファイル拡張機能

Uncloud は Docker Compose に次の拡張機能を追加します。

x-ports — ドメイン付きでポートを公開

services:
  app:
    image: app:latest
    x-ports:
      - example.com:8000/https
      - www.example.com:8000/https
      - api.example.com:9000/https

x-caddy — サービス用のカスタム Caddy 設定

services:
  app:
    image: app:latest
    x-caddy: |
      example.com {
        redir https://www.example.com{uri} permanent
      }
      www.example.com {
        reverse_proxy {{upstreams 8000}} {
          import common_proxy
        }
        basic_auth /admin/* {
          admin $2a$14$...
        }
      }

x-caddy 内で使用可能なテンプレート関数:

  • {{upstreams [service] [port]}} — 健全なコンテナ IP
  • {{.Name}} — サービス名
  • {{.Upstreams}} — 全サービス → IP のマップ

x-machines — 配置制約

services:
  db:
    image: postgres:18
    x-machines: db-machine          # 単一マシン名
  app:
    image: app:latest
    x-machines:
      - machine-1
      - machine-2

フルマルチサービス例

services:
  api:
    build: ./api
    x-ports:
      - api.example.com:3000/https
    environment:
      DATABASE_URL: postgres://db:5432/mydb

  web:
    build: ./web
    x-ports:
      - example.com:8000/https
      - www.example.com:8000/https
    environment:
      API_URL: http://api:3000

  db:
    image: postgres:18
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
    volumes:
      - db-data:/var/lib/postgresql/data
    x-machines: db-machine

volumes:
  db-data:

外部(非クラスタ)デバイスへのルーティング

実際のコンテナを実行せずに、外部デバイス(例:BMC、NAS、ルーターUI)を Caddy 経由で公開するには:

1. Caddyfile スニペットを作成(例:~/device.caddyfile):

https://device.example.com {
    reverse_proxy https://192.168.1.x {
        transport http {
            tls_insecure_skip_verify   # 自己署名 BMC 証明書に必要
        }
    }
    log
}

平文アップストリームの場合: reverse_proxy http://192.168.1.x:port

2. 名前付きサービスとして登録(no-op コンテナを使用):

uc service run \
  --name device-bmc \
  --caddyfile ~/device.caddyfile \
  registry.k8s.io/pause:3.9

pause は最小限の no-op コンテナで、何もしませんが、Uncloud に Caddyfile をアタッチするためのサービスエントリを提供します。

3. 確認:

uc caddy config   # device.example.com ブロックが表示されるはず

--caddyfile は非 @host 公開ポートと併用できません。

DNS のヒント: ワイルドカードレコード(*.yourdomain.com → cluster-public-ip)を使用すると、新しいサブドメインが即座に機能し、サービスごとに DNS を変更する必要がありません。


サービス DNS(内部)

クラスタ内のサービスは、名前で相互に解決します。

DNS 名解決先
service-name任意の健全なコンテナ
service-name.internal同上
rr.service-name.internalラウンドロビン
nearest.service-name.internalローカルマシン優先

スケーリングとグローバルサービス

uc scale web 5    # 5 レプリカ(マシン全体に分散)
uc scale web 1    # スケールダウン
services:
  caddy:
    deploy:
      mode: global   # 各マシンに 1 コンテナ

イメージタグテンプレート(compose.yaml 内)

image: myapp:{{gitdate "20060102"}}.{{gitsha 7}}
image: myapp:{{gitsha 7}}.${GITHUB_RUN_ID:-local}
関数出力
{{gitsha N}}コミット SHA の最初の N 文字
{{gitdate "format"}}Go 形式の Git コミット日付
{{date "format"}}現在の日付

一般的なワークフロー

ソースからデプロイ:

uc deploy                          # ビルド + プッシュ + デプロイ
uc build --push && uc deploy --no-build   # ステップ分割

サービスの確認:

uc inspect web
uc logs -f web
uc logs --since 1h web
uc exec web                        # シェルを開く
uc exec web /bin/sh -c "env"       # 特定のコマンドを実行

ダウンタイムゼロのデプロイ は自動的に行われます。Uncloud は古いコンテナを終了する前にヘルスチェックが完了するのを待ちます。

強制再作成:

uc deploy --recreate

よくある間違い

間違い修正方法
Caddyfile を直接編集するcompose で x-caddy を使用するか、uc service run で --caddyfile を使用する
自己署名証明書を持つ HTTPS アップストリームをプロキシするtransport http { tls_insecure_skip_verify } を追加
uc caddy config でユーザー定義ブロックが表示されないCaddy 管理ソケットに到達できない — uc inspect caddy と uc logs caddy を確認
コンテナから外部 LAN IP に到達できないCaddy コンテナのホストがターゲットネットワークにルーティングできることを確認
uc service rm 後にボリュームが失われる名前付きボリュームは保持されます。削除されるのは匿名ボリュームのみです

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/content-engine

Create platform-native content systems for X, LinkedIn, TikTok, YouTube, newsletters, and repurposed multi-platform campaigns. Use when the user wants social posts, threads, scripts, content calendars, or one source asset adapted cleanly across platforms.

affaan-m/ECC

Multi-platform content distribution across X, LinkedIn, Threads, and Bluesky. Adapts content per platform using content-engine patterns. Never posts identical content cross-platform. Use when the user wants to distribute content across social platforms.

affaan-m/fal-ai-media

Unified media generation via fal.ai MCP — image, video, and audio. Covers text-to-image (Nano Banana), text/image-to-video (Seedance, Kling, Veo 3), text-to-speech (CSM-1B), and video-to-audio (ThinkSound). Use when the user wants to generate images, videos, or audio with AI.

affaan-m/manim-video

日本語翻訳:このファイルは manim-video 用の日本語翻訳が必要です

affaan-m/remotion-video-creation

Remotion のベストプラクティス - React で動画を作成する。3D、アニメーション、音声、字幕、チャート、トランジションなどをカバーするドメイン固有の29のルール。

affaan-m/video-editing

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

agent-self-evaluation

Use after completing any non-trivial task. The agent self-rates its output on 5 axes — accuracy, completeness, clarity, actionability, conciseness — with concrete evidence per criterion. Produces a structured 1-5 scorecard with specific improvement suggestions.

agent-sort

Build an evidence-backed ECC install plan for a specific repo by sorting skills, commands, rules, hooks, and extras into DAILY vs LIBRARY buckets using parallel repo-aware review passes. Use when ECC should be trimmed to what a project actually needs instead of loading the full bundle.

ai-first-engineering

Engineering operating model for teams where AI agents generate a large share of implementation output. Use when setting team process, review gates, or ownership rules for a codebase largely written by agents.

ai-regression-testing

Regression testing strategies for AI-assisted development. Sandbox-mode API testing without database dependencies, automated bug-check workflows, and patterns to catch AI blind spots where the same model writes and reviews code. Use when adding regression coverage to AI-assisted code, or when the same model both wrote and reviewed a change.

android-clean-architecture

Clean Architecture patterns for Android and Kotlin Multiplatform projects — module structure, dependency rules, UseCases, Repositories, and data layer patterns. Use when structuring modules, layers, or data flow in an Android or KMP project.

angular-developer

Generates Angular code and provides architectural guidance. Trigger when creating projects, components, or services, or for best practices on reactivity (signals, linkedSignal, resource), forms, dependency injection, routing, SSR, accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, or CLI tooling.

関連スキル