add node config methods guide
This commit is contained in:
parent
7b54f92d28
commit
ea000a6fb7
|
@ -0,0 +1,97 @@
|
|||
---
|
||||
title: Node Configuration
|
||||
---
|
||||
|
||||
Nwaku can be configured using a combination of the following methods:
|
||||
|
||||
1. Command line options and flags
|
||||
2. Environment variables (recommended)
|
||||
3. [TOML](https://toml.io/) configuration file (currently the only supported format)
|
||||
4. Default values
|
||||
|
||||
:::info
|
||||
Note the precedence order: Each configuration method overrides the one below it (e.g., command line options override environment variables and configuration files).
|
||||
:::
|
||||
|
||||
## Command Line Options
|
||||
|
||||
Node configuration is primarily done using command line options, which override other methods. Specify configuration options by providing them in this format after the binary name:
|
||||
|
||||
```bash
|
||||
wakunode2 --tcp-port=65000
|
||||
```
|
||||
|
||||
When running your node with Docker, provide the command line options after the image name in this format:
|
||||
|
||||
```bash
|
||||
docker run statusteam/nim-waku --tcp-port=65000
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
Nodes can be configured using environment variables by prefixing the variable name with `WAKUNODE2_` and using the command line option in [SCREAMING_SNAKE_CASE](https://en.wiktionary.org/wiki/screaming_snake_case) format.
|
||||
|
||||
To set the `--tcp-port` configuration, the `wakunode2` binary should be called in this format:
|
||||
|
||||
```bash
|
||||
WAKUNODE2_TCP_PORT=65000 wakunode2
|
||||
```
|
||||
|
||||
When running your node with Docker, start the node using the `-e` command option:
|
||||
|
||||
```bash
|
||||
docker run -e "WAKUNODE2_TCP_PORT=65000" statusteam/nim-waku
|
||||
```
|
||||
|
||||
:::info
|
||||
This is the second configuration method in order of precedence. [Command line options](#command-line-options) override environment variables.
|
||||
:::
|
||||
|
||||
## Configuration File
|
||||
|
||||
Nodes can be configured using a configuration file following the [TOML](https://toml.io/en/) format:
|
||||
|
||||
```toml title="TOML Config File" showLineNumbers
|
||||
log-level = "DEBUG"
|
||||
tcp-port = 65000
|
||||
```
|
||||
|
||||
The `--config-file` command line option lets you specify the configuration file path:
|
||||
|
||||
```bash
|
||||
wakunode2 --config-file=[TOML CONFIGURATION FILE]
|
||||
```
|
||||
|
||||
You can also specify the configuration file via environment variables:
|
||||
|
||||
```bash
|
||||
# Using environment variables
|
||||
WAKUNODE2_CONFIG_FILE=[TOML CONFIGURATION FILE] wakunode2
|
||||
|
||||
# Using environment variables with Docker
|
||||
docker run -e "WAKUNODE2_CONFIG_FILE=[TOML CONFIGURATION FILE]" statusteam/nim-waku
|
||||
```
|
||||
|
||||
:::info
|
||||
This is the third configuration method in order of precedence. [Command line options](#command-line-options) and [environment variables](#environment-variables) override configuration files.
|
||||
:::
|
||||
|
||||
## Configuration Default Values
|
||||
|
||||
The default configuration is used if no other options are specified. To see the default values of all configuration options, run `wakunode2 --help`:
|
||||
|
||||
```bash
|
||||
$ wakunode2 --help
|
||||
Usage:
|
||||
|
||||
wakunode2 [OPTIONS]...
|
||||
|
||||
The following options are available:
|
||||
|
||||
--config-file Loads configuration from a TOML file (cmd-line parameters take precedence).
|
||||
--log-level Sets the log level for process. Supported levels: TRACE, DEBUG, INFO, NOTICE,
|
||||
WARN, ERROR or FATAL [=logging.LogLevel.INFO].
|
||||
--tcp-port TCP listening port. [=60000].
|
||||
|
||||
<...>
|
||||
```
|
|
@ -47,7 +47,7 @@ docker run [OPTIONS] [IMAGE] [ARG...]
|
|||
|
||||
- `OPTIONS` are your selected [Docker options](https://docs.docker.com/engine/reference/commandline/run/#options)
|
||||
- `IMAGE` is the image and tag you pulled from the registry or built locally
|
||||
- `ARG...` is the list of `nwaku` arguments for your [chosen nwaku configuration](https://github.com/waku-org/nwaku/blob/master/docs/operators/how-to/configure.md)
|
||||
- `ARG...` is the list of `nwaku` arguments for your [chosen node configuration](/guides/nwaku/configuration)
|
||||
|
||||
To run `nwaku` in a Docker container using the most typical configuration, use:
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ Before running a `nwaku` node, it is necessary to build it. Nwaku provides multi
|
|||
| | Description | Documentation |
|
||||
| - | - | - |
|
||||
| Precompiled Binary | Download a precompiled binary of the `nwaku` node | [Download Nwaku Binary](https://github.com/waku-org/nwaku/tags) |
|
||||
| Build Source | Build a `nwaku` node directly from the source code | [Build Nwaku from Source](/guides/nwaku/build-from-source) |
|
||||
| Build Source | Build a `nwaku` node directly from the source code | [Build Nwaku from Source](/guides/nwaku/build-source) |
|
||||
| Docker Container | Build and run a `nwaku` node in a Docker Container | [Run Nwaku in Docker Container](/guides/nwaku/run-docker) |
|
||||
| Docker Compose | Build and run a `nwaku` node with Docker Compose | [Run Nwaku with Docker Compose](/guides/nwaku/run-docker-compose) |
|
||||
|
||||
|
@ -48,7 +48,7 @@ By default, a `nwaku` node is configured to do the following:
|
|||
- Enable the `Store` protocol as a client, allowing it to query peers for historical messages but not store any message itself.
|
||||
|
||||
:::tip
|
||||
For more advanced configurations like enabling other protocols or maintaining a consistent `PeerID`, please refer to the [Configuration Methods](https://github.com/waku-org/nwaku/blob/master/docs/operators/how-to/configure.md) guide.
|
||||
For more advanced configurations like enabling other protocols or maintaining a consistent `PeerID`, please refer to the [Node Configuration](/guides/nwaku/configuration) guide.
|
||||
:::
|
||||
|
||||
## Connect the Node
|
||||
|
|
|
@ -61,9 +61,10 @@ const sidebars = {
|
|||
id: "guides/run-nwaku-node",
|
||||
},
|
||||
items: [
|
||||
"guides/nwaku/build-from-source",
|
||||
"guides/nwaku/build-source",
|
||||
"guides/nwaku/run-docker",
|
||||
"guides/nwaku/run-docker-compose",
|
||||
"guides/nwaku/configuration",
|
||||
]
|
||||
},
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue