generated at
strfryをdockerで立てる
著名リレー実装の一つの strfry をdockerで起動する方法。
いくつかimageが存在するが、以下は pluja/strfry を利用する例。

1. docker-compose.yml を作る
docker-compose.yml
version: '3' services: strfry: image: pluja/strfry:latest restart: unless-stopped volumes: - type: bind source: ./strfry.conf target: /etc/strfry.conf - ./strfry-db:/app/strfry-db ports: - "7777:7777"

2. strfry.conf を入手する
bash
wget https://raw.githubusercontent.com/hoytech/strfry/master/strfry.conf

3. strfry.conf の44行目付近にある relay.bind 127.0.0.1 から 0.0.0.0 に書き換える
diff
--- strfry.conf.old 2023-10-18 10:43:06 +++ strfry.conf 2023-10-18 10:33:48 @@ -41,7 +41,7 @@ relay { # Interface to listen on. Use 0.0.0.0 to listen on all interfaces (restart required) - bind = "127.0.0.1" + bind = "0.0.0.0" # Port to open for the nostr websocket protocol (restart required) port = 7777

4. 起動する
bash
docker compose up -d

5. 動作確認する
bash
echo '["REQ", "test", {"limit": 0}]' | websocat -n ws://localhost:7777 # 空のリクエスト # ["EOSE","test"] が出力される