2e9337ea3f
* Rename rust-peer to nox * Fix * Fix |
||
---|---|---|
.. | ||
configs | ||
grafana | ||
docker-compose.observability.yml | ||
docker-compose.yml | ||
ipfs.sh | ||
README.md |
Run nox with docker-compose
This guide explains how to use docker-compose to start a local network of three nox nodes.
Introduction
The nox network is a set of peer nodes that can communicate with each other to share data and execute code plus local IPFS node used by aqua-ipfs builtin. By running a local nox network, you can test your applications in a controlled environment without relying on external networks.
Prerequisites
Before you can run the nox network, you need to have Docker and docker-compose installed on your system. You can follow the official instructions for installing Docker and installing docker-compose on your operating system:
Starting local nox network
-
git clone
this repository locally and runcd deploy/docker-compose
. -
Pull the latest container images by running the following command:
docker-compose pull
-
Start the nox network by running the following command:
docker-compose up -d
This will start three nox nodes, each listening on a different port.
Accessing local nox network
To interact with the nox network, you can use the fluence-cli tool.
-
Run
fluence init
and choseminimal
project template. -
Change
hosts
key influence.yaml
to:hosts: defaultWorker: peerIds: - 12D3KooWBM3SdXWqGaawQDGQ6JprtwswEg3FWGvGhmgmMez1vRbR
-
Change
relays
key influence.yaml
to:relays: - /ip4/127.0.0.1/tcp/9991/ws/p2p/12D3KooWBM3SdXWqGaawQDGQ6JprtwswEg3FWGvGhmgmMez1vRbR - /ip4/127.0.0.1/tcp/9992/ws/p2p/12D3KooWQdpukY3p2DhDfUfDgphAqsGu5ZUrmQ4mcHSGrRag6gQK - /ip4/127.0.0.1/tcp/9993/ws/p2p/12D3KooWRT8V5awYdEZm6aAV9HWweCEbhWd7df4wehqHZXAB7yMZ
-
Run
fluence run -f 'helloWorld("Fluence")' fluence run -f 'getInfo()'
Using local nox network in your project
You must make changes to fluence.yaml
to use a local nox network:
- changing
hosts
key influence.yaml
to:hosts: defaultWorker: peerIds: - 12D3KooWBM3SdXWqGaawQDGQ6JprtwswEg3FWGvGhmgmMez1vRbR
- changing
relays
key influence.yaml
to:relays: - /ip4/127.0.0.1/tcp/9991/ws/p2p/12D3KooWBM3SdXWqGaawQDGQ6JprtwswEg3FWGvGhmgmMez1vRbR - /ip4/127.0.0.1/tcp/9992/ws/p2p/12D3KooWQdpukY3p2DhDfUfDgphAqsGu5ZUrmQ4mcHSGrRag6gQK - /ip4/127.0.0.1/tcp/9993/ws/p2p/12D3KooWRT8V5awYdEZm6aAV9HWweCEbhWd7df4wehqHZXAB7yMZ
You can try following the example workflow provided by Fluence Labs making these changes.
Here is a table with multiaddress for each node:
container | multiaddress |
---|---|
peer-1 | /ip4/127.0.0.1/tcp/9991/ws/p2p/12D3KooWBM3SdXWqGaawQDGQ6JprtwswEg3FWGvGhmgmMez1vRbR |
peer-2 | /ip4/127.0.0.1/tcp/9992/ws/p2p/12D3KooWQdpukY3p2DhDfUfDgphAqsGu5ZUrmQ4mcHSGrRag6gQK |
peer-3 | /ip4/127.0.0.1/tcp/9993/ws/p2p/12D3KooWRT8V5awYdEZm6aAV9HWweCEbhWd7df4wehqHZXAB7yMZ |
Running with observability stack
Stack consists of:
- Prometheus - TSDB that collects and stores metrics
- Loki - lightweight centralized logging solution
- Promtail - log collection agent
- Grafana - data visualization tool
To set it up run:
docker-compose -f docker-compose.yml -f docker-compose.observability.yml up -d
Grafana will have automatically preprovisioned dashboards:
- nox stats - overview of nox network
- Service metrics - detailed stats on deployed services
You can find Grafana at http://localhost:3000. To access nox logs use
Explore
tab and chose Loki
datasource.