Skip to content

Commit

Permalink
added docs
Browse files Browse the repository at this point in the history
  • Loading branch information
giangndm committed Nov 18, 2024
1 parent 61ef5db commit 4d7b0d0
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/getting-started/installation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
54 changes: 54 additions & 0 deletions docs/getting-started/installation/network-discovery.md
Original file line number Diff line number Diff line change
@@ -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 |

0 comments on commit 4d7b0d0

Please sign in to comment.