* docs: typo in `build-essential` package name
* improvement(NIP-42): use 'restricted:' prefix for auth error msgs
* docs: add database maintenance example queries
* feat: allow logging output to file
* feat: roll over logs daily
* refactor: reorder imports
* improvement: default to logging on stdout
* fix: ensure startup SQL runs, even with zero min writers
---------
Co-authored-by: thesimplekid <tsk@thesimplekid.com>
Co-authored-by: rorp <rorp@protonmail.com>
Co-authored-by: Yuval Adam <_@yuv.al>
Co-authored-by: Jamin M <jaminmenter@outlook.com>
Co-authored-by: Greg Heartsfield <scsibug@imap.cc>
* improvement: use appropriate paths for systemd example
* improvement: add a configurable postgres write conn string
This adds a new configurable connection string for postgres writes.
* improvement: document pg connection_write config
* build: upgrade checkout action for github ci
* perf: use standard allocator, limit sqlite mmap to 4GB
This is an experimental change to see if we can reduce memory usage
with large SQLite databases. If successful, we'll do this again and
further reduce the database mmap size.
This will cause greater use of the page cache, but that is more easily
reclaimed by the kernel, and should reduce memory pressure, as well as
making it clearer how much memory the application is actually using
for connections, subscriptions, etc.
* docs: reformatting
* docs: allow host header prefix matching, required for Damus compatibility
* perf: disable sqlite mmap to reduce memory pressure
* perf: switch to jemalloc allocator
* docs: helpful ubuntu packages for building
* perf: reduce SQLite connection count and idle lifetime
On lightly loaded relays, we free up memory faster by letting idle
connections be reclaimed in 10 seconds instead of the default 10
minutes. This also sets the minimum to zero connections, instead of
always trying to hold one open.
---------
Co-authored-by: Petr Kracik <petrkr@petrkr.net>
Co-authored-by: Kieran <kieran@harkin.me>
Co-authored-by: Greg Heartsfield <scsibug@imap.cc>
This is inspired by the work of
v0l (https://github.com/v0l/nostr-rs-relay/).
A new trait abstracts the storage layer with an async API. Rusqlite
is still used with worker threads, but this allows for Postgresql or
other backends to be used.
There may be bugs, this has not been rigorously tested.
Only lowercase and even-length tag values are stored as binary BLOBs.
Previously there was an error which search results from being returned
if the tag value was mixed-case and could be interpreted as hex.
A new database migration has been created to repair the `tag` table
for existing relays.
fixes: https://todo.sr.ht/~gheartsfield/nostr-rs-relay/37
This adds a new configurable feature to restrict event publishing to
only users with NIP-05 verified metadata. Domains can be whitelisted
or blacklisted. Verification expiration and schedules are
configurable.
This upgrades the database to add a table for tracking verification
records.
When a large number of subscriptions is created with identical names,
we do not send a signal over the abandon-read channel. This
eventually leads to resource exhaustion.
Change descr to description. Add `id` for websocket URL. Use
integers for supported NIPs instead of strings. Top-level is object,
instead of the array before.
Switched to latest (git) release of secp256k1, which has more
efficient verification-only context for Schnorr. Switched to single
pre-instantiated instance of the verifier.
This adds Hyper, and a 200 response code. Prior to this, Firefox
would fail to connect. There is also a text document displayed at the
root URL to indicate this is a Nostr relay.
Fixes https://todo.sr.ht/~gheartsfield/nostr-rs-relay/15