部署到 Azure
在 Azure VM 或 Azure Container Apps 上部署 nostrfy — 逐步說明,含 systemd、TLS 與動態公開 IP 的注意事項。
選項:VM(推薦),或 Container Apps。
選項 1:虛擬機器(推薦)
- 建立 VM:Ubuntu 24.04 LTS,
Standard_B1s(1 GB)或Standard_B2s(2 GB)起步。選擇離使用者近的區域。 - 網路安全性群組(NSG):為 TCP
8080(以及443用於 TLS)加入入站規則。將 SSH 規則限制為你的 IP。 - 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- 驗證:
sh
curl http://<public-ip>:8080/health- 加入 TLS(
wss://)用 certbot + nginx(如 VPS 指南)或帶憑證的 Azure Application Gateway。
選項 2:Azure Container Apps
Container Apps 從倉庫的 Dockerfile 建置(它會下載預編譯的
發行二進位檔):
- 從 GitHub 倉庫建立 Container App(或將映像推送到 ACR)。
- 連接埠:將容器連接埠設為
8080。 - 記憶體:至少 1 GB。
- 持久儲存:在
/data掛載 Azure Storage 檔案共用 以存放 LMDB 資料。 - TLS:Container Apps 在應用 URL 上提供
https://— 設定relay.public_url = "wss://<app>.<region>.azurecontainerapps.io"(或 自訂網域)。