From e6a40d17a370096dfcdf244d400e50e86e22ebc4 Mon Sep 17 00:00:00 2001 From: LordGhostX Date: Wed, 14 Jun 2023 13:08:58 +0100 Subject: [PATCH] add run docker guide --- .cspell.json | 3 +- docs/guides/nwaku/build-from-source.md | 13 ++++-- docs/guides/nwaku/run-docker.md | 58 ++++++++++++++++++++++++ docs/guides/run-nwaku-node.md | 6 +-- docs/overview/concepts/content-topics.md | 2 +- sidebars.js | 1 + 6 files changed, 73 insertions(+), 10 deletions(-) create mode 100644 docs/guides/nwaku/run-docker.md diff --git a/.cspell.json b/.cspell.json index ac06451..e9dd786 100644 --- a/.cspell.json +++ b/.cspell.json @@ -42,7 +42,8 @@ "wakunode", "autoplay", "classwide", - "devel" + "devel", + "statusteam" ], "flagWords": [], "ignorePaths": [ diff --git a/docs/guides/nwaku/build-from-source.md b/docs/guides/nwaku/build-from-source.md index ca23f0a..43adfb7 100644 --- a/docs/guides/nwaku/build-from-source.md +++ b/docs/guides/nwaku/build-from-source.md @@ -2,7 +2,7 @@ title: Build Nwaku from Source --- -Nwaku offers the option of building a node from the source when you want to access the latest development version or a specific commit of nwaku. If you prefer a more stable version, [download a pre-compiled binary](https://github.com/waku-org/nwaku/tags) instead. +This guide provides detailed steps to build a nwaku node from the source to access the latest development version or a specific commit of nwaku. If you prefer a more stable version, [download a pre-compiled binary](https://github.com/waku-org/nwaku/tags) instead. :::info Nwaku can be built and run on Linux and macOS, while Windows support is currently experimental. @@ -16,6 +16,8 @@ Nwaku can be built and run on Linux and macOS, while Windows support is currentl ## Install Dependencies +To clone and build nwaku, you will need the standard developer tools, including a C compiler, Make, Bash, and Git. + #### Linux To install the dependencies on common Linux distributions, run the following: @@ -44,7 +46,7 @@ dnf install @development-tools ```bash # using your favorite AUR helper -yourAURhelper -S base-devel +[AUR HELPER] -S base-devel ``` @@ -66,7 +68,8 @@ Get the source code from the GitHub repository. The default branch is `master`, git clone https://github.com/waku-org/nwaku cd nwaku ``` -:::info + +:::tip You can use `git tag -l` to check specific version tags. ::: @@ -78,7 +81,7 @@ To build the nwaku binary, run the following: make wakunode2 ``` -The first `make` invocation updates all Git submodules. After each `git pull`, run `make update` to keep the submodules updated in the future. +The first `make` invocation updates to all Git submodules. After each `git pull`, run `make update` to keep the submodules updated in the future. ```bash make update wakunode2 @@ -95,7 +98,7 @@ Nwaku will create the `wakunode2` binary in the `./build/` directory. To learn more about running nwaku, please refer to: - [Run a Nwaku Node](/guides/run-nwaku-node#run-the-node) -- [Run Nwaku in Docker Container](https://github.com/waku-org/nwaku/blob/master/docs/operators/docker-quickstart.md) +- [Run Nwaku in Docker Container](/guides/nwaku/run-docker) - [Run Nwaku on DigitalOcean Droplet](https://github.com/waku-org/nwaku/blob/master/docs/operators/droplet-quickstart.md) ## Run Test Suite diff --git a/docs/guides/nwaku/run-docker.md b/docs/guides/nwaku/run-docker.md new file mode 100644 index 0000000..64f8812 --- /dev/null +++ b/docs/guides/nwaku/run-docker.md @@ -0,0 +1,58 @@ +--- +title: Run Nwaku in Docker Container +--- + +This guide provides detailed steps to build and run a nwaku node in a Docker container. + +## Prerequisites + +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/). For example, you can use Docker's convenience script for installation: + +```bash +curl -fsSL https://get.docker.com -o get-docker.sh +sudo sh get-docker.sh +``` + +## Get Docker Image + +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. + +To pull the latest image, run the following: + +```bash +docker pull statusteam/nim-waku +``` + +You can also build the Docker image locally using: + +```bash +git clone --recurse-submodules https://github.com/waku-org/nwaku +cd nwaku +docker build -t statusteam/nim-waku:latest . +``` + +## Run Docker Container + +To run nwaku in a new Docker container, run the following: + +```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 nwaku arguments for your [chosen nwaku configuration](https://github.com/waku-org/nwaku/blob/master/docs/operators/how-to/configure.md) + +:::tip +We recommend using explicit port mappings (`-p`) when exposing ports accessible from outside the host (libp2p listening ports, discovery, HTTP server). +::: + +To run nwaku in a Docker container using the [default configuration](/guides/run-nwaku-node#run-the-node), run the following: + +```bash +docker run -i -t -p 60000:60000 -p 8545:8545 statusteam/nim-waku +``` + +:::tip +The `docker run` command automatically pulls the specified image from Docker Hub if it is not already available locally. +::: \ No newline at end of file diff --git a/docs/guides/run-nwaku-node.md b/docs/guides/run-nwaku-node.md index 8bd1ae7..7dfd1ee 100644 --- a/docs/guides/run-nwaku-node.md +++ b/docs/guides/run-nwaku-node.md @@ -15,7 +15,7 @@ Before running a nwaku node, it is necessary to build it. Nwaku provides multipl | Source Code | Build a `nwaku` node directly from the source code | [Build Nwaku from Source](/guides/nwaku/build-from-source) | | Precompiled Binary | Download a precompiled binary of the `nwaku` node | [Download Nwaku Binary](https://github.com/waku-org/nwaku/tags) | | Nightly Release | Try out the latest `nwaku` updates without compiling the binaries | [Download Nightly Release](https://github.com/waku-org/nwaku/releases/tag/nightly) | -| Docker Container | Build and run a `nwaku` node in a Docker Container | [Run Nwaku in Docker Container](https://github.com/waku-org/nwaku/blob/master/docs/operators/docker-quickstart.md) | +| Docker Container | Build and run a `nwaku` node in a Docker Container | [Run Nwaku in Docker Container](/guides/nwaku/run-docker) | | DigitalOcean Droplet | Build and run a `nwaku` node on a DigitalOcean Droplet | [Run Nwaku on DigitalOcean Droplet](https://github.com/waku-org/nwaku/blob/master/docs/operators/droplet-quickstart.md) | :::info @@ -43,7 +43,7 @@ By default, a `nwaku` node is configured to do the following: - Enable the `Relay` protocol for relaying messages. - Enable the `Store` protocol as a client, allowing it to query peers for historical messages but not store any message itself. -:::info +:::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. ::: @@ -57,7 +57,7 @@ To join the Waku Network, nodes must connect with peers. Nwaku provides multiple | DNS Discovery | Enable `nwaku` to locate peers to connect to using the `DNS Discovery` mechanism | [Configure DNS Discovery](https://github.com/waku-org/nwaku/blob/master/docs/operators/how-to/configure-dns-disc.md) | | Discv5 | Enable `nwaku` to locate peers to connect to using the `Discv5` mechanism | [Configure Discv5](https://github.com/waku-org/nwaku/blob/master/docs/operators/how-to/connect.md#option-3-discover-peers-using-waku-discovery-v5) | -:::info +:::tip You can configure a `nwaku` node to use multiple peer discovery mechanisms simultaneously. ::: diff --git a/docs/overview/concepts/content-topics.md b/docs/overview/concepts/content-topics.md index e03cbc9..cd03201 100644 --- a/docs/overview/concepts/content-topics.md +++ b/docs/overview/concepts/content-topics.md @@ -20,7 +20,7 @@ For instance, if your dApp is called `SuperCrypto` and it allows users to receiv - `/supercrypto/1/notification/proto` - `/supercrypto/1/private-message/proto` -:::info +:::tip While you can choose any encoding format for your `Content Topic`, we highly recommend using Protocol Buffers (`proto`) because of its efficiency. Choosing a lightweight format ensures optimal performance of your dApp. ::: diff --git a/sidebars.js b/sidebars.js index 3e26b61..db507ac 100644 --- a/sidebars.js +++ b/sidebars.js @@ -62,6 +62,7 @@ const sidebars = { }, items: [ "guides/nwaku/build-from-source", + "guides/nwaku/run-docker", ] }, ],