インストールとデプロイ
このセクションでは、本番環境またはステージング環境で kanade コンポーネントをネイティブの Windows サービスとしてブートストラップする方法を詳しく説明します。
Deployment Model
本番ホストと管理対象エンドポイントは、kanade コンポーネントをバックグラウンドの Windows サービスとして実行します。これにより、高可用性と自動起動が保証されます。
| サービス名 | トリプル / バイナリ | 設定ソース | 典型的なターゲット |
|---|---|---|---|
| KanadeNats | nats-server.exe | 保護されたレジストリ / レジストリ保存の CLI フラグ | 中央サーバー |
| KanadeBackend | kanade-backend.exe | 保護されたレジストリ / 設定ファイル | 中央サーバー |
| KanadeAgent | kanade-agent.exe | 保護されたレジストリ / ローカル状態 DB | 管理対象エンドポイント |
1. Prerequisites
- Host OS: Windows 10/11 or Windows Server 2016+.
- gsudo: Required to perform elevated installations from standard user shells (or run commands from an Administrator-level PowerShell prompt).
- Network Routing: Managed endpoints must be able to reach the NATS server port (default
4222) over TCP.
2. Setting Up the NATS Server (Broker)
NATS サーバーはメッセージングのコアとして機能します。
- Stage the deployment bundle using
scripts/build-release.ps1 -Roles nats. - Deploy the service with elevation:
# Elevated PowerShell prompt & "dist\nats\deploy-nats.ps1" -NatsToken "your-secure-nats-token" -Recreate
これにより、KanadeNats サービスがインストールされ、ローカルシステムアカウントで実行されるよう構成され、JetStream データディレクトリがセットアップされ、安全な認証トークンが Windows レジストリ内にロックダウンされます。
3. Deploying the Backend API & SPA
バックエンドは、オペレーター接続を管理し、イベントログを処理します。
- Stage the backend binaries and React SPA bundle using
scripts/build-release.ps1 -Roles backend. - Deploy the service:
# Elevated PowerShell prompt & "dist\backend\deploy-backend.ps1" ` -NatsToken "your-secure-nats-token" ` -StaticToken "your-operator-spa-bearer-token" ` -ForceConfig -Recreate
-NatsToken: バックエンドをローカルの NATS サーバーに安全に接続します。-StaticToken: オペレーターの CLI/SPA ログインに必要な API ベアラートークンを定義します。
デプロイスクリプトは、KanadeBackend Windows サービスを登録し、適切な ACL を設定して、エンドポイントを検証します。
4. Installing the Agent on Target Endpoints
管理対象のすべてのエンドポイント PC にエージェントをインストールします。
- Stage the agent bundle using
scripts/build-release.ps1 -Roles agent. - Copy the contents of the
dist/agentfolder to the target PC. - On the target PC, run the installer:
# Elevated PowerShell prompt & ".\deploy-agent.ps1" -NatsToken "your-secure-nats-token" -ForceConfig -Recreate
スクリプトの動作:
- Places
kanade-agent.exeinto its destination directory. - Secures the configuration and NATS token in the Windows registry path (
HKLM:\SOFTWARE\Kanade\agent). - Registers and starts the KanadeAgent service.
サービスが起動すると、エージェントはアウトバウンド NATS 接続を確立し、コマンドストリームを購読し、オンラインのハートビートをフリートバックエンドに報告します。