Azure へのデプロイ

Azure VM または Azure Container Apps に nostrfy をデプロイ — systemd、TLS、動的パブリック IP の注意点を含めてステップごとに解説します。

選択肢: VM(推奨)、または Container Apps。

オプション 1: 仮想マシン(推奨)

  1. VM を作成: Ubuntu 24.04 LTS、開始時は Standard_B1s (1 GB) または Standard_B2s (2 GB)。ユーザーに近いリージョンを選んでください。
  2. ネットワーク セキュリティ グループ (NSG): TCP 8080 (TLS 用に 443 も)の受信規則を追加します。SSH 規則は自分の IP に制限してください。
  3. SSH で接続し、汎用の VPS ガイドに従います:
sh
ssh <user>@<public-ip>
curl -fsSL https://raw.githubusercontent.com/iqbqioza/nostrfy/main/install.sh | sh
sudo mkdir -p /etc/nostrfy
sudo curl -fsSL -o /etc/nostrfy/nostrfy.toml \
  https://raw.githubusercontent.com/iqbqioza/nostrfy/main/deploy/nostrfy.toml
sudo nano /etc/nostrfy/nostrfy.toml                 # name、public_url、private_key を設定します
sudo curl -fsSL -o /etc/systemd/system/nostrfy.service \
  https://raw.githubusercontent.com/iqbqioza/nostrfy/main/deploy/nostrfy.service
sudo systemctl daemon-reload
sudo systemctl enable --now nostrfy
  1. 検証:
sh
curl http://<public-ip>:8080/health
  1. TLS (wss://) を追加: certbot + nginx で(VPS ガイド と同様に)、または証明書付きの Azure Application Gateway を使用します。
Azure VM のパブリック IP は割り当て解除で変わることがあります
relay.public_url を有効に保つため、静的パブリック IP を使用してください。

オプション 2: Azure Container Apps

Container Apps はリポジトリの Dockerfile からビルドします(事前ビルド済みリリースバイナリをダウンロードするもの):

  1. Container App を作成: GitHub リポジトリから作成します(またはイメージを ACR にプッシュ)。
  2. ポート:コンテナポートを 8080 に設定します。
  3. メモリ: 最低 1 GB。
  4. 永続ストレージ: LMDB データ用に Azure Storage ファイル共有 を /data にマウントします。
  5. TLS: Container Apps はアプリ URL に https:// を提供します — relay.public_url = "wss://<app>.<region>.azurecontainerapps.io" を設定します(またはカスタムドメイン)。
リレーをゼロにスケールさせてはいけません
最小レプリカ = 1 に設定してください。組み込みの deploy/nostrfy.container.toml は、独自の nostrfy.toml を /etc/nostrfy/nostrfy.toml にマウントして置き換えることができます。