部署到 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"(或 自定义域)。