From 4d7b0d0dee82dcd6fb68dbc9c507a8abef142d14 Mon Sep 17 00:00:00 2001 From: Giang Minh Date: Mon, 18 Nov 2024 12:11:50 +0700 Subject: [PATCH] added docs --- docs/getting-started/installation/README.md | 2 + .../installation/network-discovery.md | 54 +++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 docs/getting-started/installation/network-discovery.md diff --git a/docs/getting-started/installation/README.md b/docs/getting-started/installation/README.md index 6d3d01e7..72cf4f1f 100644 --- a/docs/getting-started/installation/README.md +++ b/docs/getting-started/installation/README.md @@ -35,3 +35,5 @@ Or you can use some tools to deploy atm0s-media-server: - [Kubernetes](./kubernetes.md) - [Docker Compose](./docker-compose.md) + +About network discovery, please refer to [Network Discovery](./network-discovery.md) for more details with your own use-case. diff --git a/docs/getting-started/installation/network-discovery.md b/docs/getting-started/installation/network-discovery.md new file mode 100644 index 00000000..db26aa87 --- /dev/null +++ b/docs/getting-started/installation/network-discovery.md @@ -0,0 +1,54 @@ +# Network Discovery + +We have two ways to discover other nodes in the network: + +- Manually specify the seeds +- Query the node API + +## Manually specify the seeds + +Each time we start the node, we can manually specify the seeds. + +``` +cargo run -- --sdn-zone-id 0 --sdn-zone-node-id 1 --seeds 1@/ip4/127.0.0.1/udp/10001 media +``` + +This way is simple and easy to understand, but it's not flexible and is inconvenient to manage. + +## Query the node API + +We can use the node API to get the addresses of other nodes and then start the node with those addresses. + +``` +cargo run -- --sdn-zone-id 0 --sdn-zone-node-id 1 --seeds-from-node-api "http://localhost:3000/api/node/address" media +``` + +This way is flexible and convenient to manage, and we can also use it to dynamically get the addresses of other nodes. +A common use case is when deploying with docker-compose or kubernetes - we only need to set up the loadbalancer to point to the HTTP API of nodes, then use the API to provide addresses to other nodes. + +For example, we might have a loadbalancer config like this: + +| Zone | Node Type | Address | +| ---- | --------- | -------------------------------- | +| 0 | Console | http://console.atm0s.cloud | +| 0 | Gateway | http://gateway.zone0.atm0s.cloud | +| 1 | Gateway | http://gateway.zone1.atm0s.cloud | +| 2 | Gateway | http://gateway.zone2.atm0s.cloud | + +``` +http://console.atm0s.cloud/api/node/address +http://gateway.zone1.atm0s.cloud/api/node/address +http://gateway.zone2.atm0s.cloud/api/node/address +``` + +Then we can start nodes with config like this: + +| Zone | Node Type | Seeds From API | +| ---- | --------- | ------------------------------------------------- | +| 0 | Gateway | http://console.atm0s.cloud/api/node/address | +| 0 | Media | http://gateway.zone0.atm0s.cloud/api/node/address | +| 1 | Gateway | http://console.atm0s.cloud/api/node/address | +| 1 | Media | http://gateway.zone1.atm0s.cloud/api/node/address | +| 2 | Gateway | http://console.atm0s.cloud/api/node/address | +| 2 | Media | http://gateway.zone2.atm0s.cloud/api/node/address | +