Add public nostr submission relay and approved-content sync #705

Merged
raucao merged 8 commits from feature/nostr_submission_relay into master 2026-11-18 11:09:47 +00:00
Owner

Adds a second strfry instance and the machinery that promotes moderated content into the members relay, for raucao/marco#97.

A new role[strfry_submission] plus the kosmos_strfry_submission cookbook run a separate relay on port 7778 with its own database (capped at a 4 GiB mapsize), fronted at submit.nostr.kosmos.org. Its write policy is the open submission policy from akkounts extras/strfry. It is deliberately not role[strfry], so nginx never adds it to the members relay's _strfry upstream.

Two promotion paths feed the production database:

  • kosmos_strfry::approved_sync runs a dedicated fail-closed sync config and a five-minute timer that pulls moderator-approved content from the nuc staging relay into the members relay. The strfry sync URL and STAGING_RELAY_URL are both derived from a single node attribute, so the policy's byte-exact source match cannot drift.
  • kosmos_strfry::member_bridge runs a live one-way strfry router (dir = "down") that subscribes to the local submission relay on loopback and writes member-authored events into the production LMDB, gated per event by the LDAP-only write policy (ldap-only-policy.ts), so no member list is maintained.

Also included: a role-scoped Node 24 install (the global Node attribute is left untouched; blossom and substr were checked and do not depend on Node), a firewall rule scoped to the openresty proxy nodes, an nginx site using tls_cert_for (gandi_dns), a runbook, and two render regression checks — one that fails if the sync template's age floor is 0, one that fails if the member bridge is not one-way or not LDAP-gated.

Status: deployed to production. The relay is live at wss://submit.nostr.kosmos.org (NIP-11 name Kosmos submission relay), both promotion paths are enabled via role[strfry_submission], and the akkounts live policy files and the DNS CNAME are in place. doc/nostr-submission-relay.md documents the deployed layout and rollback.

Adds a second strfry instance and the machinery that promotes moderated content into the members relay, for raucao/marco#97. A new `role[strfry_submission]` plus the `kosmos_strfry_submission` cookbook run a separate relay on port 7778 with its own database (capped at a 4 GiB mapsize), fronted at `submit.nostr.kosmos.org`. Its write policy is the open submission policy from akkounts `extras/strfry`. It is deliberately not `role[strfry]`, so nginx never adds it to the members relay's `_strfry` upstream. Two promotion paths feed the production database: * `kosmos_strfry::approved_sync` runs a dedicated fail-closed sync config and a five-minute timer that pulls moderator-approved content from the nuc staging relay into the members relay. The `strfry sync` URL and `STAGING_RELAY_URL` are both derived from a single node attribute, so the policy's byte-exact source match cannot drift. * `kosmos_strfry::member_bridge` runs a live one-way `strfry router` (`dir = "down"`) that subscribes to the local submission relay on loopback and writes member-authored events into the production LMDB, gated per event by the LDAP-only write policy (`ldap-only-policy.ts`), so no member list is maintained. Also included: a role-scoped Node 24 install (the global Node attribute is left untouched; blossom and substr were checked and do not depend on Node), a firewall rule scoped to the openresty proxy nodes, an nginx site using `tls_cert_for` (gandi_dns), a runbook, and two render regression checks — one that fails if the sync template's age floor is `0`, one that fails if the member bridge is not one-way or not LDAP-gated. **Status: deployed to production.** The relay is live at `wss://submit.nostr.kosmos.org` (NIP-11 name `Kosmos submission relay`), both promotion paths are enabled via `role[strfry_submission]`, and the akkounts `live` policy files and the DNS CNAME are in place. `doc/nostr-submission-relay.md` documents the deployed layout and rollback.
raucao force-pushed feature/nostr_submission_relay from 8b8dd42b48 to 8c0c7a3ca1 2026-11-17 10:12:19 +00:00 Compare
raucao added the
service
nostr
feature
labels 2026-11-17 10:19:53 +00:00
raucao added 1 commit 2026-11-17 10:23:07 +00:00
Add a second strfry instance and the machinery to promote moderated content
into the members relay, for raucao/marco#97.

New role[strfry_submission] and the kosmos_strfry_submission cookbook run a
separate relay (port 7778, own DB capped at a 4 GiB mapsize) fronted at
submit.nostr.kosmos.org, using the open submission write policy from akkounts
extras/strfry. It is deliberately not role[strfry], so nginx never adds it to
the members relay's _strfry upstream.

Add kosmos_strfry::approved_sync: a dedicated fail-closed sync config plus a
5-minute timer that pulls moderator-approved content from the nuc staging relay
into the members relay. The sync command URL and STAGING_RELAY_URL come from a
single attribute so the policy's byte-exact source match cannot drift.

Also add a role-scoped Node 22 install (the global Node attribute is
untouched), a proxy-scoped firewall rule, an nginx site, a runbook, and a
render regression check for the sync template.

Deployment is gated: approved_sync.enabled defaults to false, and the akkounts
policy files must be on the live branch before converging.
raucao force-pushed feature/nostr_submission_relay from 8c0c7a3ca1 to 511a512908 2026-11-17 10:23:07 +00:00 Compare
raucao added 1 commit 2026-11-17 15:26:10 +00:00
submit.nostr.kosmos.org is now a CNAME to lb.kosmos.org, so the "add an
A/AAAA record" step is replaced by "verify the CNAME resolves". Also record
the LMDB concurrency test result: a strfry sync ran against the same LMDB
while the live relay served 13/13 subscriptions on the nuc's :7777 mirror.
raucao added 1 commit 2026-11-17 19:29:41 +00:00
raucao added 1 commit 2026-11-17 20:32:12 +00:00
Add kosmos_strfry::member_bridge: a strfry router stream group that subscribes to the local submission relay (ws://localhost:7778) and writes member-authored events into the production database. dir = "down" keeps it strictly one-way, and pluginDown is the new LDAP-only policy (ldap-only-policy.ts) from akkounts extras/strfry, so membership is decided per event by LDAP with no member list.

The two promotion paths (approved_sync, member_bridge) are enabled as role overrides in role[strfry_submission], not in the production environment config.

Also add a render regression test for the router config and update the runbook.

Refs raucao/marco#97.
raucao added 1 commit 2026-11-17 21:19:39 +00:00
strfry raises RLIMIT_NOFILE to relay.nofiles at startup and exits if that exceeds the process hard limit. The sync config omitted nofiles, so strfry used its compiled-in default (1000000) while the systemd default here is 524288, and strfry-sync.service failed to start with:

  Unable to set NOFILES limit to 1000000, exceeds max of 524288

Set nofiles explicitly (from the production relay config, falling back to 524288, as the production template does) and extend the regression test to assert it.
raucao added 2 commits 2026-11-18 10:31:26 +00:00
The submission relay and both promotion paths are live in production, so the
runbook no longer claims that nothing has been deployed. Reframe the deployment
order and pre-go-live checks as completed, and fix the verification command:
strfry only returns the NIP-11 JSON with an Accept header, so the old
curl | jq pipeline could never work.
raucao added 1 commit 2026-11-18 11:08:41 +00:00
raucao merged commit eea6691881 into master 2026-11-18 11:09:47 +00:00
raucao deleted branch feature/nostr_submission_relay 2026-11-18 11:09:48 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kosmos/chef#705