From 5598661b1cfa1a7dbf18ddb882f7ca5a0e141a6c Mon Sep 17 00:00:00 2001 From: jinhojang6 Date: Sat, 24 Jun 2023 00:58:03 +0900 Subject: [PATCH 1/4] style: doc consistency --- packages/docusaurus-playground/docs/test.md | 189 ++++++++++++++---- .../src/client/css/custom.scss | 6 +- .../client/theme/Admonition/styles.module.css | 2 +- .../theme/DocItem/Layout/styles.module.scss | 12 ++ 4 files changed, 163 insertions(+), 46 deletions(-) diff --git a/packages/docusaurus-playground/docs/test.md b/packages/docusaurus-playground/docs/test.md index 3484e49..3b290f0 100644 --- a/packages/docusaurus-playground/docs/test.md +++ b/packages/docusaurus-playground/docs/test.md @@ -1,62 +1,163 @@ --- -title: Run Nwaku in a Docker Container +title: Run a Nwaku Node --- -This guide provides detailed steps to build and run a `nwaku` node in a Docker container. If you prefer a pre-configured setup that includes a monitoring dashboard, see the [Run Nwaku with Docker Compose](/guides/nwaku/run-docker-compose) guide. +Nwaku is a lightweight and robust Nim client for running a Waku node, equipped with tools to monitor and maintain a running node. Nwaku is highly configurable, enabling operators to select the [protocols](/overview/concepts/protocols) they want to support based on their needs, motivations, and available resources. -## Prerequisites +This guide provides detailed steps to download, build, configure, and connect a `nwaku` node to the Waku Network. It also includes interacting with the node and finding its addresses. -Ensure [Docker](https://www.docker.com/) is installed on your system using the appropriate instructions provided in the [Docker documentation](https://docs.docker.com/engine/install/). +## Get the Binary -## Get Docker Image +To run a node, you must have the `nwaku` binary. Nwaku provides multiple options for acquiring the node binary: -The Nwaku Docker images are available on the Docker Hub public registry under the [statusteam/nim-waku](https://hub.docker.com/r/statusteam/nim-waku) repository. Please visit [statusteam/nim-waku/tags](https://hub.docker.com/r/statusteam/nim-waku/tags) for images of specific releases. +#### Download the Binary -Pull the latest docker image: +| | Description | Documentation | +| ------------------ | ------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| Precompiled Binary | Download a precompiled binary of the `nwaku` node | [Download Nwaku Binary](https://github.com/waku-org/nwaku/tags) | +| Nightly Release | Try the latest `nwaku` updates without compiling the binaries | [Download Nightly Release](https://github.com/waku-org/nwaku/releases/tag/nightly) | + +#### Build the Binary + +You can build the node binary directly from the [nwaku source code](https://github.com/waku-org/nwaku). To learn more, please refer to the [Build Nwaku from Source](/guides/nwaku/build-source) guide. + +#### Run the Binary in Docker + +| | Description | Documentation | +| ---------------- | ---------------------------------------- | ----------------------------------------------------------------- | +| Docker Container | Run a `nwaku` node in a Docker Container | [Run Nwaku in a Docker Container](/guides/nwaku/run-docker) | +| Docker Compose | Run a `nwaku` node with Docker Compose | [Run Nwaku with Docker Compose](/guides/nwaku/run-docker-compose) | + +:::tip +You can run the `nwaku` binaries and Docker images on cloud service providers like [Google Cloud](https://cloud.google.com/), [Microsoft Azure](https://azure.microsoft.com/), [Amazon Web Services](https://aws.amazon.com/), and [DigitalOcean](https://www.digitalocean.com/). +::: + +## Run the Node + +Once you have gotten the `nwaku` binary, run it using the [default configuration](/guides/reference/node-config-methods#default-configuration-values): ```bash -docker pull statusteam/nim-waku -``` +# Run with default configuration +./build/wakunode2 -You can also build the Docker image locally: - -```bash -# Clone the repository -git clone --recurse-submodules https://github.com/waku-org/nwaku -cd nwaku - -# Build docker image -make docker-image -``` - -## Run Docker Container - -Run `nwaku` in a new Docker container: - -```bash -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 arguments for your [node configuration options](/guides/reference/node-config-options) - -Run `nwaku` using the most typical configuration: - -```bash -docker run -i -t -p 60000:60000 -p 9000:9000/udp statusteam/nim-waku \ - --dns-discovery:true \ - --dns-discovery-url:enrtree://AOGECG2SPND25EEFMAJ5WF3KSGJNSGV356DSTL2YVLLZWIV6SAYBM@prod.waku.nodes.status.im \ - --discv5-discovery \ - --nat:extip:[YOUR PUBLIC IP] # or, if you are behind a nat: --nat=any +# See available command line options +./build/wakunode2 --help ``` :::tip -To find your public IP, use: +For more advanced configurations like enabling other protocols or maintaining a consistent `PeerID`, please refer to the [Node Configuration Methods](/guides/reference/node-config-methods) guide. +::: -```bash -dig TXT +short o-o.myaddr.l.google.com @ns1.google.com | awk -F'"' '{ print $2}' +## Bootstrap the Node + +To join the Waku Network, nodes must [bootstrap](/overview/reference/glossary#bootstrapping) for an entry point before discovering more peers. Nwaku provides multiple [peer discovery](/overview/concepts/peer-discovery) mechanisms: + +| | Description | Documentation | +| ------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ | +| Static Peers | Configure the bootstrap nodes that `nwaku` should establish connections upon startup | [Configure Static Peers](/guides/nwaku/configure-discovery#configure-static-peers) | +| DNS Discovery | Enable `nwaku` to bootstrap nodes using the [DNS Discovery](/overview/concepts/dns-discovery) mechanism | [Configure DNS Discovery](/guides/nwaku/configure-discovery#configure-dns-discovery) | +| Discv5 | Enable `nwaku` to discover peers using the [Discv5](/overview/concepts/discv5) mechanism | [Configure Discv5](/guides/nwaku/configure-discovery#configure-discv5) | + +:::tip +You can configure a `nwaku` node to use multiple peer discovery mechanisms simultaneously. +::: + +## Interact with the Node + +You can interact with a running `nwaku` node through the [JSON RPC API](https://rfc.vac.dev/spec/16/), such as querying the node information using the `get_waku_v2_debug_v1_info` method: + +```mdx-code-block +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; ``` -We recommend using explicit port mappings (`-p`) when exposing ports accessible from outside the host (listening and discovery ports, API servers). + + + +```bash +curl --location --request GET 'http://localhost:8545' \ +--header 'Content-Type: application/json' \ +--data '{ + "jsonrpc": "2.0", + "id": "id", + "method": "get_waku_v2_debug_v1_info", + "params": [] +}' +``` + + + + +```json +{ + "jsonrpc": "2.0", + "id": "id", + "result": { + "listenAddresses": [ + "/ip4/0.0.0.0/tcp/60000/p2p/16Uiu2HAmUbPquFQqje3jiqoB5YoiUbBya59NB4qqEzeiTNGHeA6w" + ], + "enrUri": "enr:-Iu4QCQZXZDb_JsYmLoYor0F5E_95HbIywgO_wgx2rIdDbmCJZkTzmlCr0wmMzV47lgik_tVwww5mIng90Ris83TisMBgmlkgnY0gmlwhAAAAACJc2VjcDI1NmsxoQPszztG-Ev52ZB7tk0jF8s6Md4KvyY_rhzNZokaaB_ABIN0Y3CC6mCFd2FrdTIB" + } +} +``` + + + + +:::info +The `listenAddresses` field stores the node's listening address(es), while the `enrUri` field stores the discoverable `ENR` URI for peer discovery. ::: + +## Find the Node Addresses + +You can find the addresses of a running node through its logs or by calling the `get_waku_v2_debug_v1_info` method of the [JSON RPC API](https://rfc.vac.dev/spec/16/). + +:::tip +When starting the node, `nwaku` will display all the public listening and discovery addresses at the `INFO` log level. +::: + +### Listening Addresses + +Look for the log entry that begins with `Listening on`, for example: + +```txt title="Nwaku Log Output" +INF 2023-06-15 16:09:54.448+01:00 Listening on topics="waku node" tid=1623445 file=waku_node.nim:922 full=[/ip4/0.0.0.0/tcp/60000/p2p/16Uiu2HAmQCsH9V81xoqTwGuT3qwkZWbwY1TtTQwpr3DjHU2TSwMn][/ip4/0.0.0.0/tcp/8000/ws/p2p/16Uiu2HAmQCsH9V81xoqTwGuT3qwkZWbwY1TtTQwpr3DjHU2TSwMn] +``` + +```bash +# Listening TCP transport address +/ip4/0.0.0.0/tcp/60000/p2p/16Uiu2HAmQCsH9V81xoqTwGuT3qwkZWbwY1TtTQwpr3DjHU2TSwMn + +# Listening WebSocket address +/ip4/0.0.0.0/tcp/8000/ws/p2p/16Uiu2HAmQCsH9V81xoqTwGuT3qwkZWbwY1TtTQwpr3DjHU2TSwMn +``` + +### Discoverable ENR Addresses + +A `nwaku` node can encode its addressing information in an [Ethereum Node Record (ENR)](https://eips.ethereum.org/EIPS/eip-778) following the [WAKU2-ENR](https://rfc.vac.dev/spec/31/) specification, primarily for peer discovery. + +#### ENR for DNS discovery + +Look for the log entry that begins with `DNS: discoverable ENR`, for example: + +```txt title="Nwaku Log Output" +INF 2023-06-15 16:09:54.448+01:00 DNS: discoverable ENR topics="waku node" tid=1623445 file=waku_node.nim:923 enr=enr:-Iu4QBKYj8Ovxwz4fIalxZ_1a8dOCU2WC-1LQrcBCCb4Np93f9-UuSZXn3vagJL1S3k3hwRYfOp3JSbW7_VqwtqMIeMBgmlkgnY0gmlwhAAAAACJc2VjcDI1NmsxoQOrmyV59dAzY4ZKrvrj32VOoZbLby8dCKFnXnqhIdQ0NYN0Y3CC6mCFd2FrdTIB +``` + +```bash +# ENR the node addresses are encoded in +enr:-Iu4QBKYj8Ovxwz4fIalxZ_1a8dOCU2WC-1LQrcBCCb4Np93f9-UuSZXn3vagJL1S3k3hwRYfOp3JSbW7_VqwtqMIeMBgmlkgnY0gmlwhAAAAACJc2VjcDI1NmsxoQOrmyV59dAzY4ZKrvrj32VOoZbLby8dCKFnXnqhIdQ0NYN0Y3CC6mCFd2FrdTIB +``` + +#### ENR for Discv5 + +Look for the log entry that begins with `Discv5: discoverable ENR`, for example: + +```txt title="Nwaku Log Output" +INF 2023-06-15 16:09:54.448+01:00 Discv5: discoverable ENR topics="waku node" tid=1623445 file=waku_node.nim:924 enr=enr:-IO4QDxToTg86pPCK2KvMeVCXC2ADVZWrxXSvNZeaoa0JhShbM5qed69RQz1s1mWEEqJ3aoklo_7EU9iIBcPMVeKlCQBgmlkgnY0iXNlY3AyNTZrMaEDdBHK1Gx6y_zv5DVw5Qb3DtSOMmVHTZO1WSORrF2loL2DdWRwgiMohXdha3UyAw +``` + +```bash +# ENR the node addresses are encoded in +enr:-IO4QDxToTg86pPCK2KvMeVCXC2ADVZWrxXSvNZeaoa0JhShbM5qed69RQz1s1mWEEqJ3aoklo_7EU9iIBcPMVeKlCQBgmlkgnY0iXNlY3AyNTZrMaEDdBHK1Gx6y_zv5DVw5Qb3DtSOMmVHTZO1WSORrF2loL2DdWRwgiMohXdha3UyAw +``` diff --git a/packages/logos-docusaurus-theme/src/client/css/custom.scss b/packages/logos-docusaurus-theme/src/client/css/custom.scss index 7c59e4a..2d8c885 100644 --- a/packages/logos-docusaurus-theme/src/client/css/custom.scss +++ b/packages/logos-docusaurus-theme/src/client/css/custom.scss @@ -103,7 +103,7 @@ /* Leading is the distance between two baselines */ /* TODO: add appropriate mobile leading */ --ifm-leading-desktop: 1.25; - --ifm-leading: calc(var(--ifm-leading-desktop) * 1rem); + --ifm-leading: 24px; --ifm-list-left-padding: 2rem; --ifm-list-margin: 1rem; --ifm-list-item-margin: 0.25rem; @@ -647,12 +647,16 @@ a[class^='sidebarLogo_'] { } table { + display: table; + width: 100%; + table-layout: fixed; @include lsd.typography('body2'); thead > tr { border: 1px solid rgb(var(--lsd-border-primary)); } th { + // width: 100%; text-transform: uppercase; font-weight: 400 !important; border: 1px solid rgb(var(--lsd-border-primary)); diff --git a/packages/logos-docusaurus-theme/src/client/theme/Admonition/styles.module.css b/packages/logos-docusaurus-theme/src/client/theme/Admonition/styles.module.css index 48ed4af..41e1d76 100644 --- a/packages/logos-docusaurus-theme/src/client/theme/Admonition/styles.module.css +++ b/packages/logos-docusaurus-theme/src/client/theme/Admonition/styles.module.css @@ -1,7 +1,7 @@ .admonition { display: flex; gap: 18px; - margin-bottom: 1em; + margin-bottom: 24px; border: 1px solid var(--ifm-alert-border-color); padding: 18px; } diff --git a/packages/logos-docusaurus-theme/src/client/theme/DocItem/Layout/styles.module.scss b/packages/logos-docusaurus-theme/src/client/theme/DocItem/Layout/styles.module.scss index 5b366f5..4ac0e32 100644 --- a/packages/logos-docusaurus-theme/src/client/theme/DocItem/Layout/styles.module.scss +++ b/packages/logos-docusaurus-theme/src/client/theme/DocItem/Layout/styles.module.scss @@ -33,6 +33,18 @@ .tocMobile:not(:first-of-type) { display: none; } + + h1 { + margin-bottom: 40px !important; + } + + h2 { + margin-top: 32px !important; + } + + h3 { + margin-top: 32px !important; + } } @include utils.responsive('lg', 'up') { From 2054228322591b7ebba6d8a1c9da4b1565f27495 Mon Sep 17 00:00:00 2001 From: jinhojang6 Date: Mon, 26 Jun 2023 18:34:46 +0900 Subject: [PATCH 2/4] style: update style for code in headings --- .../src/client/css/custom.scss | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/logos-docusaurus-theme/src/client/css/custom.scss b/packages/logos-docusaurus-theme/src/client/css/custom.scss index 2d8c885..05fcaf2 100644 --- a/packages/logos-docusaurus-theme/src/client/css/custom.scss +++ b/packages/logos-docusaurus-theme/src/client/css/custom.scss @@ -298,18 +298,34 @@ svg * { h1 { @include lsd.typography('h1'); + + code { + @include lsd.typography('h1'); + } } h2 { @include lsd.typography('h2'); + + code { + @include lsd.typography('h2'); + } } h3 { @include lsd.typography('h3'); + + code { + @include lsd.typography('h3'); + } } h4 { @include lsd.typography('h4'); + + code { + @include lsd.typography('h4'); + } } code { From 43002e2d7558974a0c5ab30bbd3bfc6939e52501 Mon Sep 17 00:00:00 2001 From: jinhojang6 Date: Mon, 26 Jun 2023 20:34:25 +0900 Subject: [PATCH 3/4] style: update pre code css --- .../src/client/css/custom.scss | 23 +++++-------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/packages/logos-docusaurus-theme/src/client/css/custom.scss b/packages/logos-docusaurus-theme/src/client/css/custom.scss index 05fcaf2..7c56adb 100644 --- a/packages/logos-docusaurus-theme/src/client/css/custom.scss +++ b/packages/logos-docusaurus-theme/src/client/css/custom.scss @@ -237,6 +237,8 @@ --ifm-table-stripe-background: transparent !important; --ifm-pre-border-radius: 0 !important; + --ifm-code-font-size: 100% !important; + @include utils.responsive('xl', 'down') { --container-max-width: 912px; } @@ -298,43 +300,30 @@ svg * { h1 { @include lsd.typography('h1'); - - code { - @include lsd.typography('h1'); - } } h2 { @include lsd.typography('h2'); - - code { - @include lsd.typography('h2'); - } } h3 { @include lsd.typography('h3'); - - code { - @include lsd.typography('h3'); - } } h4 { @include lsd.typography('h4'); - - code { - @include lsd.typography('h4'); - } } code { - @include lsd.typography('body1'); color: rgb(var(--lsd-text-primary)); border-radius: 0; background: rgba(255, 255, 255, 0.15); } +pre code { + @include lsd.typography('body1'); +} + a code { color: rgb(var(--lsd-text-primary)); } From 0a6eb75a3edf15e5a20965011b4f5b3e1180effb Mon Sep 17 00:00:00 2001 From: jinhojang6 Date: Mon, 26 Jun 2023 20:41:51 +0900 Subject: [PATCH 4/4] chore: update --ifm-global-spacing to 24px --- packages/logos-docusaurus-theme/src/client/css/custom.scss | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/logos-docusaurus-theme/src/client/css/custom.scss b/packages/logos-docusaurus-theme/src/client/css/custom.scss index 7c56adb..eec9e70 100644 --- a/packages/logos-docusaurus-theme/src/client/css/custom.scss +++ b/packages/logos-docusaurus-theme/src/client/css/custom.scss @@ -95,7 +95,7 @@ --ifm-h6-font-size: var(--lsd-h6-fontSize); /* Spacing. */ - --ifm-global-spacing: 0.67rem; + --ifm-global-spacing: 24px; --ifm-spacing-vertical: var(--ifm-global-spacing); --ifm-spacing-horizontal: 0.75rem; @@ -745,7 +745,6 @@ main[itemtype*='Blog'] { @include utils.responsive('sm', 'down') { :root { - --ifm-global-spacing: 0.5rem; --ifm-spacing-vertical: var(--ifm-global-spacing); --ifm-spacing-horizontal: var(--ifm-global-spacing);