Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PROTO-1706] - Audius-d Node Documentation #8325

Merged
merged 4 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/.vscode/spellright.dict
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ markdownlint
metadatas
metamask
multisig
nethermind
nft
nodejs
nonpayable
Expand Down
178 changes: 122 additions & 56 deletions docs/docs/node-operator/setup/advanced.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,92 +6,158 @@ sidebar_label: Advanced Setup
description: Audius Protocol Documentation
---

## Launching a new node from scratch
import useBaseUrl from '@docusaurus/useBaseUrl'

### Setting environment variables
## Controllers and Nodes

```bash
# to set individual environment variables
# valid service-names are "creator-node" or "discovery-provider"
audius-cli set-config creator-node
audius-cli set-config discovery-provider

# to set all the required environment variables for a service, use the --required flag
audius-cli set-config --required creator-node
audius-cli set-config --required discovery-provider
```
A key feature of `audius-ctl` is the ability to interact with and control multiple Nodes from a
single "Controller". Any computer or virtual machine can be a Controller, a laptop, a shared Virtual
Private Server for your team, or even the VM running a Node itself. Only one Controller is needed,
but Node Operators can configure as many Controllers as they would like.

---
Node Operators manage all of their Nodes, or a subset of their Nodes, from a single command line
utility. Rather than needing to access each Node directly to issue commands, a single "controller"
machine, using configuration profiles, is able to issue commands to several Nodes over ssh.

## Creator Node
### Audius Control Utility

There are four required creator node environment variables, available in the creator node section
[here](/node-operator/setup/installation#creator-node).
Installing and configuring `audius-ctl` on the Controller includes the command line utility
`audius-ctl`

The full list of variables and explanations can be found
[here](https://github.com/AudiusProject/audius-protocol/blob/main/creator-node/src/config.js).
Generally node operators will not need to modify any other environment variables.
### Suggested Configuration

### External Creator Node Postgres
```mermaid
flowchart LR
subgraph Controller
Z{{audius-ctl}}
end

If you set an external Postgres url during setup you can skip this section.
subgraph VM 3
C(Discovery Node 1)
end

If you did not set an external Postgres url during setup and you want to add one now, replace the db
url by running:
subgraph VM 2
B(Content Node 2)
end

```bash
audius-cli set-config creator-node
key : dbUrl
value : <db url>
subgraph VM 1
A(Content Node 1)
end

Z-->A
Z--->B
Z---->C
```

---
:::tip Flexible Options

## Discovery Node
While it is recommended to use an additional machine as a controller, _any_ machine can operate as a
controller.

There are two required Discovery Node environment variables, available in the Discovery Node section
[here](/node-operator/setup/installation#discovery-node).
:::

The full list of variables and explanations can be found
[here](https://github.com/AudiusProject/audius-protocol/blob/main/packages/discovery-provider/default_config.ini).
Generally node operators will not need to modify any other environment variables.
### Controller on Node

### External Discovery Node Postgres Instance
In this example, this Service Provider has elected to use the machine marked `VM 1` to both run a
node _and_ serve as the controller for all of their other nodes.

If you set an external Postgres url during setup you can skip this section.
```mermaid
flowchart LR
subgraph VM 3
C(Discovery Node 1);
end

The below is only if using a externally managed Postgres (version 11.1+) database:
subgraph VM 2
B(Content Node 2);
end

```bash
audius-cli set-config discovery-provider
key : audius_db_url
value : <audius_db_url>

# If there's no read replica, enter the primary db url for both env vars.
audius-cli set-config discovery-provider
key : audius_db_url_read_replica
value : <audius_db_url_read_replica>
subgraph VM 1
Z{{Controller}}-->A(Content Node 1);
end

Z--->B
Z---->C
```

In the managed postgres database and set the `temp_file_limit` flag to `2147483647` and run the
following SQL command on the destination db.
### Multiple Controllers

description text goes here

```mermaid
flowchart LR
subgraph Controller 2
Z2{{audius-ctl}};
end

subgraph Controller 1
Z1{{audius-ctl}};
end

subgraph VM 2
B(Content Node 2);
end

subgraph VM 1
A(Content Node 1);
end

Z1-->A;
Z1-->B;
Z2-->A;
Z2-->B;
```
CREATE EXTENSION pg_trgm;

### Using a Virtual Private Server

Keep private keys secure by requiring users interacting with Audius Nodes to log in to a Virtual
Private Server and issue commands from `audius-ctl` there.

```mermaid
flowchart LR

u1([user 1])
u2([user 2])
u3([user 3])

u1-->T
u2-->T
u3-->T

subgraph Virtual Private Server
T{{audius-ctl}}
end

subgraph Virtual Machine 2
B(Discovery Node 2);
end

subgraph Virtual Machine 1
A(Content Node 1);
end

T-->A;
T-->B;
```

---

## Launch
### Downing a Node

If for some reason you want to `down` an Audius Node, use the following command:

```bash
audius-cli launch creator-node
audius-ctl down
```

# or
:::warning All together now

audius-cli launch discovery-provider (--seed)
This command will down **ALL** of the Audius Nodes specified in the configuration. To down a single
node, pass the URL as an additional argument, like this:

# Options:
# --seed
# Seeds the database from a snapshot. Required for first-time discovery setup.
```bash
audius-ctl down creator-1.example.com
```

The same can be done with the `up` command when you are ready to start the Audius Node again.

:::
Loading