2021-12-30 22:07:21 -05:00
|
|
|
# Nostr-rs-relay configuration
|
2022-01-03 18:42:24 -05:00
|
|
|
|
|
|
|
[info]
|
2022-01-03 22:03:30 -05:00
|
|
|
# The advertised URL for the Nostr websocket.
|
|
|
|
relay_url = "wss://nostr.example.com/"
|
|
|
|
|
2022-01-03 18:42:24 -05:00
|
|
|
# Relay information for clients. Put your unique server name here.
|
|
|
|
name = "nostr-rs-relay"
|
2022-01-03 22:03:30 -05:00
|
|
|
|
2022-01-03 18:42:24 -05:00
|
|
|
# Description
|
|
|
|
description = "A newly created nostr-rs-relay.\n\nCustomize this with your own info."
|
2022-01-03 22:03:30 -05:00
|
|
|
|
2022-01-03 18:42:24 -05:00
|
|
|
# Administrative contact pubkey
|
|
|
|
#pubkey = "0c2d168a4ae8ca58c9f1ab237b5df682599c6c7ab74307ea8b05684b60405d41"
|
|
|
|
|
2022-01-16 09:34:19 -05:00
|
|
|
# Administrative contact URI
|
|
|
|
#contact = "mailto:contact@example.com"
|
2022-01-03 18:42:24 -05:00
|
|
|
|
2023-02-16 19:03:28 -05:00
|
|
|
# Favicon location. Relative to the current directory. Assumes an
|
|
|
|
# ICO format.
|
|
|
|
#favicon = "favicon.ico"
|
|
|
|
|
2022-09-11 13:44:45 -04:00
|
|
|
[diagnostics]
|
|
|
|
# Enable tokio tracing (for use with tokio-console)
|
2023-01-14 10:47:01 -05:00
|
|
|
#tracing = false
|
2022-09-11 13:44:45 -04:00
|
|
|
|
2021-12-31 12:51:57 -05:00
|
|
|
[database]
|
2023-01-22 17:26:54 -05:00
|
|
|
# Database engine (sqlite/postgres). Defaults to sqlite.
|
|
|
|
# Support for postgres is currently experimental.
|
|
|
|
#engine = "sqlite"
|
|
|
|
|
2021-12-31 12:51:57 -05:00
|
|
|
# Directory for SQLite files. Defaults to the current directory. Can
|
2021-12-31 15:08:04 -05:00
|
|
|
# also be specified (and overriden) with the "--db dirname" command
|
|
|
|
# line option.
|
2023-01-16 18:21:12 -05:00
|
|
|
#data_directory = "."
|
2021-12-30 22:07:21 -05:00
|
|
|
|
2022-09-06 07:06:01 -04:00
|
|
|
# Use an in-memory database instead of 'nostr.db'.
|
2023-01-22 17:26:54 -05:00
|
|
|
# Requires sqlite engine.
|
2022-09-06 07:06:01 -04:00
|
|
|
# Caution; this will not survive a process restart!
|
|
|
|
#in_memory = false
|
|
|
|
|
2022-02-12 10:29:25 -05:00
|
|
|
# Database connection pool settings for subscribers:
|
2022-01-25 21:39:24 -05:00
|
|
|
|
|
|
|
# Minimum number of SQLite reader connections
|
Fork Sync: Update from parent repository (#3)
* 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>
2023-05-10 04:30:18 -04:00
|
|
|
#min_conn = 0
|
2022-01-25 21:39:24 -05:00
|
|
|
|
2022-12-25 12:17:08 -05:00
|
|
|
# Maximum number of SQLite reader connections. Recommend setting this
|
|
|
|
# to approx the number of cores.
|
|
|
|
#max_conn = 8
|
2022-01-25 21:39:24 -05:00
|
|
|
|
2023-01-22 17:26:54 -05:00
|
|
|
# Database connection string. Required for postgres; not used for
|
|
|
|
# sqlite.
|
|
|
|
#connection = "postgresql://postgres:nostr@localhost:7500/nostr"
|
|
|
|
|
2023-05-01 07:20:57 -04:00
|
|
|
# Optional database connection string for writing. Use this for
|
|
|
|
# postgres clusters where you want to separate reads and writes to
|
|
|
|
# different nodes. Ignore for single-database instances.
|
|
|
|
#connection_write = "postgresql://postgres:nostr@localhost:7500/nostr"
|
2023-02-25 16:38:26 -05:00
|
|
|
|
2023-06-25 05:02:44 -04:00
|
|
|
[logging]
|
|
|
|
# Directory to store log files. Log files roll over daily.
|
|
|
|
#folder_path = "./log"
|
|
|
|
#file_prefix = "nostr-relay"
|
|
|
|
|
2023-02-11 14:26:08 -05:00
|
|
|
[grpc]
|
|
|
|
# gRPC interfaces for externalized decisions and other extensions to
|
|
|
|
# functionality.
|
|
|
|
#
|
|
|
|
# Events can be authorized through an external service, by providing
|
|
|
|
# the URL below. In the event the server is not accessible, events
|
|
|
|
# will be permitted. The protobuf3 schema used is available in
|
|
|
|
# `proto/nauthz.proto`.
|
2023-02-13 18:30:26 -05:00
|
|
|
# event_admission_server = "http://[::1]:50051"
|
2023-02-11 14:26:08 -05:00
|
|
|
|
2021-12-30 22:07:21 -05:00
|
|
|
[network]
|
|
|
|
# Bind to this network address
|
|
|
|
address = "0.0.0.0"
|
2022-01-25 21:39:24 -05:00
|
|
|
|
2021-12-30 22:07:21 -05:00
|
|
|
# Listen on this port
|
|
|
|
port = 8080
|
|
|
|
|
2022-11-04 19:05:01 -04:00
|
|
|
# If present, read this HTTP header for logging client IP addresses.
|
|
|
|
# Examples for common proxies, cloudflare:
|
|
|
|
#remote_ip_header = "x-forwarded-for"
|
|
|
|
#remote_ip_header = "cf-connecting-ip"
|
|
|
|
|
2022-11-04 20:58:28 -04:00
|
|
|
# Websocket ping interval in seconds, defaults to 5 minutes
|
|
|
|
#ping_interval = 300
|
|
|
|
|
2021-12-30 22:07:21 -05:00
|
|
|
[options]
|
|
|
|
# Reject events that have timestamps greater than this many seconds in
|
2022-09-10 21:40:10 -04:00
|
|
|
# the future. Recommended to reject anything greater than 30 minutes
|
|
|
|
# from the current time, but the default is to allow any date.
|
2021-12-31 16:19:35 -05:00
|
|
|
reject_future_seconds = 1800
|
2021-12-30 22:07:21 -05:00
|
|
|
|
|
|
|
[limits]
|
|
|
|
# Limit events created per second, averaged over one minute. Must be
|
2023-01-20 12:06:52 -05:00
|
|
|
# an integer. If not set (or set to 0), there is no limit. Note:
|
2022-12-18 00:19:48 -05:00
|
|
|
# this is for the server as a whole, not per-connection.
|
2023-01-20 12:06:52 -05:00
|
|
|
#
|
|
|
|
# Limiting event creation is highly recommended if your relay is
|
|
|
|
# public!
|
|
|
|
#
|
2023-01-27 20:02:19 -05:00
|
|
|
#messages_per_sec = 5
|
2021-12-30 22:07:21 -05:00
|
|
|
|
2023-02-03 14:08:31 -05:00
|
|
|
# Limit client subscriptions created, averaged over one minute. Must
|
|
|
|
# be an integer. If not set (or set to 0), defaults to unlimited.
|
|
|
|
# Strongly recommended to set this to a low value such as 10 to ensure
|
|
|
|
# fair service.
|
2022-12-17 10:27:29 -05:00
|
|
|
#subscriptions_per_min = 0
|
|
|
|
|
2022-12-18 00:19:48 -05:00
|
|
|
# UNIMPLEMENTED...
|
|
|
|
# Limit how many concurrent database connections a client can have.
|
|
|
|
# This prevents a single client from starting too many expensive
|
|
|
|
# database queries. Must be an integer. If not set (or set to 0),
|
|
|
|
# defaults to unlimited (subject to subscription limits).
|
|
|
|
#db_conns_per_client = 0
|
|
|
|
|
2022-12-18 13:20:57 -05:00
|
|
|
# Limit blocking threads used for database connections. Defaults to 16.
|
|
|
|
#max_blocking_threads = 16
|
2022-12-18 10:14:04 -05:00
|
|
|
|
2021-12-31 16:19:35 -05:00
|
|
|
# Limit the maximum size of an EVENT message. Defaults to 128 KB.
|
|
|
|
# Set to 0 for unlimited.
|
2022-01-25 21:39:24 -05:00
|
|
|
#max_event_bytes = 131072
|
2021-12-31 16:19:35 -05:00
|
|
|
|
|
|
|
# Maximum WebSocket message in bytes. Defaults to 128 KB.
|
2022-01-25 21:39:24 -05:00
|
|
|
#max_ws_message_bytes = 131072
|
2021-12-30 22:07:21 -05:00
|
|
|
|
2021-12-31 16:19:35 -05:00
|
|
|
# Maximum WebSocket frame size in bytes. Defaults to 128 KB.
|
2022-01-25 21:39:24 -05:00
|
|
|
#max_ws_frame_bytes = 131072
|
2021-12-30 22:07:21 -05:00
|
|
|
|
|
|
|
# Broadcast buffer size, in number of events. This prevents slow
|
2022-02-12 10:29:25 -05:00
|
|
|
# readers from consuming memory.
|
|
|
|
#broadcast_buffer = 16384
|
2021-12-30 22:07:21 -05:00
|
|
|
|
|
|
|
# Event persistence buffer size, in number of events. This provides
|
2022-02-20 12:46:24 -05:00
|
|
|
# backpressure to senders if writes are slow.
|
|
|
|
#event_persist_buffer = 4096
|
2022-01-26 22:39:03 -05:00
|
|
|
|
2022-12-24 18:16:55 -05:00
|
|
|
# Event kind blacklist. Events with these kinds will be discarded.
|
|
|
|
#event_kind_blacklist = [
|
|
|
|
# 70202,
|
|
|
|
#]
|
|
|
|
|
2023-02-25 11:20:53 -05:00
|
|
|
# Event kind allowlist. Events other than these kinds will be discarded.
|
|
|
|
#event_kind_allowlist = [
|
2023-02-25 15:05:11 -05:00
|
|
|
# 0, 1, 2, 3, 7, 40, 41, 42, 43, 44, 30023,
|
2023-02-25 11:20:53 -05:00
|
|
|
#]
|
|
|
|
|
2022-01-26 22:39:03 -05:00
|
|
|
[authorization]
|
|
|
|
# Pubkey addresses in this array are whitelisted for event publishing.
|
2022-02-12 10:29:25 -05:00
|
|
|
# Only valid events by these authors will be accepted, if the variable
|
|
|
|
# is set.
|
2022-01-26 22:39:03 -05:00
|
|
|
#pubkey_whitelist = [
|
|
|
|
# "35d26e4690cbe1a898af61cc3515661eb5fa763b57bd0b42e45099c8b32fd50f",
|
|
|
|
# "887645fef0ce0c3c1218d2f5d8e6132a19304cdc57cd20281d082f38cfea0072",
|
|
|
|
#]
|
2023-02-14 22:17:48 -05:00
|
|
|
# Enable NIP-42 authentication
|
|
|
|
#nip42_auth = false
|
2023-02-25 20:57:04 -05:00
|
|
|
# Send DMs events (kind 4) only to their authenticated recipients
|
|
|
|
#nip42_dms = false
|
2022-02-12 10:29:25 -05:00
|
|
|
|
|
|
|
[verified_users]
|
|
|
|
# NIP-05 verification of users. Can be "enabled" to require NIP-05
|
|
|
|
# metadata for event authors, "passive" to perform validation but
|
|
|
|
# never block publishing, or "disabled" to do nothing.
|
|
|
|
#mode = "disabled"
|
|
|
|
|
|
|
|
# Domain names that will be prevented from publishing events.
|
|
|
|
#domain_blacklist = ["wellorder.net"]
|
|
|
|
|
|
|
|
# Domain names that are allowed to publish events. If defined, only
|
|
|
|
# events NIP-05 verified authors at these domains are persisted.
|
|
|
|
#domain_whitelist = ["example.com"]
|
|
|
|
|
|
|
|
# Consider an pubkey "verified" if we have a successful validation
|
|
|
|
# from the NIP-05 domain within this amount of time. Note, if the
|
|
|
|
# domain provides a successful response that omits the account,
|
|
|
|
# verification is immediately revoked.
|
|
|
|
#verify_expiration = "1 week"
|
|
|
|
|
|
|
|
# How long to wait between verification attempts for a specific author.
|
|
|
|
#verify_update_frequency = "24 hours"
|
|
|
|
|
|
|
|
# How many consecutive failed checks before we give up on verifying
|
|
|
|
# this author.
|
|
|
|
#max_consecutive_failures = 20
|
2023-02-25 16:38:26 -05:00
|
|
|
|
|
|
|
[pay_to_relay]
|
|
|
|
# Enable pay to relay
|
2023-02-25 16:53:32 -05:00
|
|
|
#enabled = false
|
2023-02-25 16:41:30 -05:00
|
|
|
|
2023-02-25 16:38:26 -05:00
|
|
|
# The cost to be admitted to relay
|
2023-02-25 16:53:32 -05:00
|
|
|
#admission_cost = 4200
|
2023-02-25 16:41:30 -05:00
|
|
|
|
2023-02-25 16:38:26 -05:00
|
|
|
# The cost in sats per post
|
2023-02-25 16:53:32 -05:00
|
|
|
#cost_per_event = 0
|
2023-02-25 16:41:30 -05:00
|
|
|
|
2023-02-25 16:38:26 -05:00
|
|
|
# Url of lnbits api
|
2023-02-25 16:53:32 -05:00
|
|
|
#node_url = "<node url>"
|
2023-02-25 16:41:30 -05:00
|
|
|
|
2023-02-25 16:38:26 -05:00
|
|
|
# LNBits api secret
|
2023-02-25 16:53:32 -05:00
|
|
|
#api_secret = "<ln bits api>"
|
2023-02-25 16:41:30 -05:00
|
|
|
|
2023-02-25 16:38:26 -05:00
|
|
|
# Terms of service
|
2023-02-25 16:53:32 -05:00
|
|
|
#terms_message = """
|
|
|
|
#This service (and supporting services) are provided "as is", without warranty of any kind, express or implied.
|
|
|
|
#
|
|
|
|
#By using this service, you agree:
|
|
|
|
#* Not to engage in spam or abuse the relay service
|
|
|
|
#* Not to disseminate illegal content
|
|
|
|
#* That requests to delete content cannot be guaranteed
|
|
|
|
#* To use the service in compliance with all applicable laws
|
|
|
|
#* To grant necessary rights to your content for unlimited time
|
|
|
|
#* To be of legal age and have capacity to use this service
|
|
|
|
#* That the service may be terminated at any time without notice
|
|
|
|
#* That the content you publish may be removed at any time without notice
|
|
|
|
#* To have your IP address collected to detect abuse or misuse
|
|
|
|
#* To cooperate with the relay to combat abuse or misuse
|
|
|
|
#* You may be exposed to content that you might find triggering or distasteful
|
|
|
|
#* The relay operator is not liable for content produced by users of the relay
|
|
|
|
#"""
|
|
|
|
|
2023-02-25 16:41:30 -05:00
|
|
|
# Whether or not new sign ups should be allowed
|
2023-02-25 16:53:32 -05:00
|
|
|
#sign_ups = false
|
|
|
|
#secret_key = "<nostr nsec>"
|