Feel free to raise an issue with me if you have any questions 🤗
Discussion
sure
quick feedback no rush - basic stuff working + looking ok and looking mainly for 2 most important thing - more RATE LIMIT n FILTERS in .env (stop junk bots kind 1 notes by some blacklist npub) and postgres+grafana stats time series graphs - on top of metrics (if can add here also) - thanks
maybe some kind dynamic limit / filter in db or something -
# Optional: Maximum number of subscriptions per client (default: 20)
MAX_SUBSCRIPTIONS_PER_CLIENT=20
# Optional: Limit for the throttler (default: 100)
THROTTLER_LIMIT=60
# Optional: Time-to-live (TTL) for the throttler (default: 1000)
THROTTLER_TTL=1000
# Optional: Time-to-live (TTL) for event handling result cache in milliseconds, set to 0 to disable caching (default: 300000)
EVENT_HANDLING_RESULT_CACHE_TTL=300000
# Optional: Time-to-live (TTL) for filter result cache in milliseconds, set to 0 to disable caching (default: 10000)
FILTER_RESULT_CACHE_TTL=10000
# Optional: Enable/disable event message handling (default: true)
EVENT_MESSAGE_HANDLING_ENABLED=true
# Optional: Enable/disable request message handling (default: true)
REQ_MESSAGE_HANDLING_ENABLED=true
You can prevent some bots by adding BLACKLIST=pubkey1,pubkey2 in the .env file. This feature was recently added and hasn't been documented yet. WHITELIST is also supported if needed.
I'm still considering the metrics monitoring feature. Prometheus + Grafana would be powerful, but it would also increase the complexity of deploying a relay. I believe ease of deployment is important for decentralization. So for now, only some simple monitoring charts are provided.
just see reply - great to hear Thanks - so demo relay not yet attacked !
think ur current BUILT-IN metrics is good enough - maybe add something critical like spam alert
grafana + postgresql should be OPTIONAL for advance admins they install those separately but relaydb should have necessary tables
prometheus not sure what extra advantage it has as data source since can do visualization using postgresql as data-source also
Spam are a headache, and I haven't come up with a particularly good solution yet.
The advance admins indeed require more detailed metrics. This feature is in the planning phase. 🚀
Cool - feel free to look below - for advance Noise/Spam/Attacks there no fixed rule or code - its done based on after identification - anyway to limit ? max_message_length = 5120 and max_event_time_older_than_now = 94608000 like this - ref - code.pobblelabs.org/fossil/nostr_relay/doc/tip/docs/dynamic_lists.md and github.com/rnostr/rnostr/blob/main/rnostr.example.toml
The way nostr_relay sets up whitelists and blacklists through filters is cool, and I'm thinking of adding this feature. If you want to set some basic limitations now, you can check if there's what you want in https://github.com/CodyTseng/nostr-relay-nestjs/blob/master/example.env. Actually, I think the best way to resist spam is POW, but most clients don't support it.
that will nice - so far my test nestjs all good overall - few times hammering it nostr-rs-bench caused some issue in system - unless someone banging it garbage high frequency txt payload - thats kind need to stop or discarded
Thank you very much for your feedback. I'll take some time to test with nostr-rs-bench to what the issue is.
POW is nice - will test - also what 2 means ?
# Optional: Upper limit for created_at field (default: )
# CREATED_AT_UPPER_LIMIT=
# Optional: Lower limit for created_at field (default: )
# CREATED_AT_LOWER_LIMIT=
They are event.created_at limitations. https://github.com/nostr-protocol/nips/pull/897