AWS へのデプロイ
nostrfy を AWS EC2、Lightsail、ECS/Fargate にデプロイ — systemd、リバースプロキシ背後の TLS、本番チェックリストをステップバイステップで解説します。
選択肢: EC2(VM、推奨)、Lightsail(よりシンプルなVM)、または ECS/Fargate(コンテナ)。
オプション1: EC2(推奨)
- インスタンスを起動: Amazon Linux 2023またはUbuntu 24.04 LTS、
t3.small(2 GB RAM)で開始できます。ユーザーに近いリージョンを選んでください。 - セキュリティグループ: インバウンドTCP
8080(TLS用に443も)を許可。SSHルールは自分のIPに制限してください。 - SSH で接続し、汎用VPS ガイドに従ってください:
sh
ssh -i your-key.pem ec2-user@<public-ip> # Ubuntu の場合は ubuntu@<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ガイドの通り)、またはACM証明書付きのApplication/Network Load Balancerを使用 — その後relay.public_urlを設定して再起動します。
オプション2: Lightsail
Lightsail インスタンスは EC2 ガイドとまったく同じです — ネットワーキングタブにファイアウォールルールがあります:
TCP 8080を開いてください。
オプション3: ECS / Fargate(コンテナ)
リポジトリのDockerfileはビルド時に事前ビルド済みリリースバイナリをダウンロードします:
- イメージをECRにプッシュ: sh
docker buildx build --platform linux/amd64,linux/arm64 -t <account>.dkr.ecr.<region>.amazonaws.com/nostrfy . /dataにEFSボリュームをマウントしたECSサービス(Fargate、1タスク)を作成します(LMDB永続化 — ないと再デプロイ時にデータが失われます)。- ポート
8080を公開し、前段にTLS用のALB + ACM証明書を配置します。 - 組み込みの
deploy/nostrfy.container.toml設定は、独自のnostrfy.tomlを/etc/nostrfy/nostrfy.tomlにマウントすることで上書きできます(例: イメージにコピーするフォーク)。
Elastic IP
インスタンスを停止/起動する場合はElastic IPをアタッチしてください — そうしないとパブリックIPが変わり、public_urlが壊れます。