部署概览

nostrfy 如何分发以及如何部署 — Fly.io、AWS、Google Cloud、Azure、DigitalOcean 或任意 VPS,含 TLS、systemd 和容器说明。

一个二进制,多个平台

nostrfy 提供 x86_64 和 aarch64 的预编译二进制(GitHub 发布资产,由 install.sh 校验和验证)、一个 下载这些二进制的容器镜像(无需编译),以及主要平台的部署指南。

平台

平台类型指南
Fly.io托管平台(容器、卷、TLS)fly.md
Digital OceanDroplet(VM)或 App Platformdeploy/digitalocean.md
AWSEC2(VM)、Lightsail 或 ECSdeploy/aws.md
Google CloudCompute Engine(VM)或 Cloud Rundeploy/gcp.md
AzureVM 或 Container Appsdeploy/azure.md
任意 VPS普通 Ubuntu/Debian 服务器deploy/vps.md

VM 的通用模式

所有 VM 指南(Digital Ocean、AWS EC2、GCP、Azure、任意 VPS)都遵循相同的模式:

sh
# 1. 安装最新的发布二进制(安装本身无需 sudo)
curl -fsSL https://raw.githubusercontent.com/iqbqioza/nostrfy/main/install.sh | sh

# 2. 获取配置模板并编辑(无需克隆仓库)
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

# 3. 获取 systemd 单元并启动服务
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

# 4. 在提供商的防火墙中开放端口(通常是 8080)并验证
curl http://localhost:8080/health

上线之前

每个部署都使用相同的 nostrfy.toml 选项。上线之前,至少设置:

toml
[relay]
name = "My Relay"
public_url = "wss://relay.example.com"   # NIP-42 AUTH / NIP-62 / NIP-98 需要
private_key = ""                          # 运行 'nostrfy genkey' 并粘贴密钥

VM 还是容器?

  • VM(systemd):最简单、最便宜、完全可控。大多数中继 部署推荐。
  • 容器:在 Fly.io、Digital Ocean App Platform、AWS ECS、GCP Cloud Run 或 Azure Container Apps 上使用仓库的 Dockerfile(构建时下载发布 二进制)。LMDB 数据需要持久存储(/data)。

Blossom 媒体主机

如果设置了 blossom.host,也在 TLS 代理中将该主机名指向同一端口(nginx/Caddy 配置块见VPS 指南)。

TLS 由你的代理或提供商终止
中继本身在 8080 上提供普通 WebSocket 并遵循 X-Forwarded-Proto。