部署概览
nostrfy 如何分发以及如何部署 — Fly.io、AWS、Google Cloud、Azure、DigitalOcean 或任意 VPS,含 TLS、systemd 和容器说明。
一个二进制,多个平台
nostrfy 提供 x86_64 和 aarch64 的预编译二进制(GitHub
发布资产,由 install.sh 校验和验证)、一个 下载这些二进制的容器镜像(无需编译),以及主要平台的部署指南。
平台
| 平台 | 类型 | 指南 |
|---|---|---|
| Fly.io | 托管平台(容器、卷、TLS) | fly.md |
| Digital Ocean | Droplet(VM)或 App Platform | deploy/digitalocean.md |
| AWS | EC2(VM)、Lightsail 或 ECS | deploy/aws.md |
| Google Cloud | Compute Engine(VM)或 Cloud Run | deploy/gcp.md |
| Azure | VM 或 Container Apps | deploy/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 指南)。