add store config

This commit is contained in:
LordGhostX 2023-09-14 20:56:32 +01:00
parent efc53adcf2
commit 1d6a015ce9
No known key found for this signature in database
GPG Key ID: 520CC5DC4F94FCC7
4 changed files with 47 additions and 9 deletions

View File

@ -60,6 +60,7 @@
"nwakunode",
"tlsv",
"rustup",
"storenode",
],
"flagWords": [],
"ignorePaths": [

View File

@ -66,7 +66,7 @@ The `ephemeral` option allows you to specify whether your messages should be per
```js
const encoder = createEncoder({
contentTopic: contentTopic, // message content topic
ephemeral: true, // allows messages to be stored or not
ephemeral: true, // allows messages to be persisted or not
});
```

View File

@ -15,22 +15,59 @@ To join the Waku Network, nodes must [bootstrap](/overview/reference/glossary#bo
## Configure a Domain Name
You can set up an IPv4 DNS domain name that resolves to the public IPv4 address of a node. This allows the node's publicly announced multiaddrs to use the `/dns4` scheme.
You can set up an IPv4 DNS domain name that resolves to the public IPv4 address of a node using the `dns4-domain-name` option. This allows the node's publicly announced multiaddrs to use the `/dns4` scheme.
```bash
./build/wakunode2 --dns4-domain-name=[DOMAIN NAME]
```
:::info
This example describes configuring a domain name that resolves to your node's IP address and is unrelated to [DNS Discovery](/overview/concepts/dns-discovery).
:::
For example, consider the domain name `node.example.com`, which resolves to a `nwaku` node:
```bash
./build/wakunode2 --dns4-domain-name=node.example.com
```
:::info
Nodes with a domain name and secure WebSocket configured will generate a discoverable ENR with `/wss` multiaddr and `/dns4` domain name, essential for verifying domain certificates when connecting securely.
:::
:::info
This example describes configuring a domain name that resolves to your node's IP address and is unrelated to [DNS Discovery](/overview/concepts/dns-discovery).
:::
## Configure Store Protocol and Message Store
To enable `nwaku` to be a [store service node](/overview/concepts/protocols#store), use the following configuration options:
- `store`: Enables `Waku Store` protocol on the node (disabled by default).
- `store-message-retention-policy`: Retention policy of the store node (how long messages will be persisted). Two different retention policies are supported:
- Time retention policy: `time:<duration-in-seconds>` (e.g., `time:14400`)
- Capacity retention policy: `capacity:<messages-count>` (e.g, `capacity:25000`)
- Set this option to an empty string to disable the retention policy.
- `store-message-db-url`: Database connection URL for persisting messages in the [SQLAlchemy database URL format](https://docs.sqlalchemy.org/en/20/core/engines.html#database-urls). Setting this option to an empty string will instruct the node to use the fallback in-memory message store.
```bash
./build/wakunode2 \
--store=true \
--store-message-retention-policy=[MESSAGE RETENTION POLICY] \
--store-message-db-url=[DATABASE CONNECTION URL]
```
For example, consider a `nwaku` node that is configured to be a `Store` protocol and retain messages received in the last `15,000` seconds:
```bash
./build/wakunode2 \
--store=true \
--store-message-retention-policy=time:15000 \
--store-message-db-url=sqlite://store.sqlite3
```
You can configure `nwaku` as a `Waku Store` client using the `storenode` option. This allows the node to query peers for historical messages but not store any message itself.
```bash
./build/wakunode2 --storenode=[STORE PEER MULTIADDR]
```
For example, consider a `nwaku` node that does not persist messages but can query peers for historical messages:
```bash
./build/wakunode2 --storenode=/dns4/node-01.ac-cn-hongkong-c.wakuv2.prod.statusim.net/tcp/30303/p2p/16Uiu2HAm4v86W3bmT1BiH6oSPzcsSr24iDQpSN5Qa992BCjjwgrD
```

View File

@ -38,7 +38,7 @@ docker run [OPTIONS] [IMAGE] [ARG...]
Run `nwaku` using the most typical configuration:
```bash
docker run -i -t -p 60000:60000 -p 9000:9000/udp statusteam/nim-waku:v0.19.0 \
docker run -i -t -p 60000:60000 -p 9000:9000/udp statusteam/nim-waku:v0.20.0 \
--dns-discovery=true \
--dns-discovery-url=enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@prod.waku.nodes.status.im \
--discv5-discovery=true \