Skip to content

Commit

Permalink
- Update config templates
Browse files Browse the repository at this point in the history
- Clone book.play.dev.cardano.org version (with minor differences to avoid having to maintain a seperate submitapi config) - in preparation to point them to guild-ops repo itself
- Update node doco
  • Loading branch information
rdlrt committed Jan 25, 2024
1 parent 236d631 commit 4fff856
Show file tree
Hide file tree
Showing 50 changed files with 16,799 additions and 552 deletions.
85 changes: 58 additions & 27 deletions docs/Build/node-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,24 @@ The above would copy the binaries built into `~/.local/bin` folder.
#### Download pre-compiled Binary from Node release

While certain folks might want to build the node themselves (could be due to OS/arch compatibility, trust factor or customisations), for most it might not make sense to build the node locally.
Instead, you can download the binaries using [cardano-node release notes](https://github.com/intersectmbo/cardano-node/releases), where-in you can find the download links for every version.
Once downloaded, you would want to make it available to preferred `PATH` in your environment (if you're asking how - that'd mean you've skipped skillsets mentioned on homepage).
Instead, you can download the binaries using [cardano-node release notes](https://github.com/intersectmbo/cardano-node/releases), where-in you can find the download links for every version. This is already taken care of by `guild-deploy.sh` if you used the option to download binaries (you can always re-run with specific arguments if unsure).

### Verify

Execute `cardano-cli` and `cardano-node` to verify output as below (the exact version and git rev should depend on your checkout tag on github repository):

```bash
cardano-cli version
# cardano-cli 8.1.2 - linux-x86_64 - ghc-8.10
# cardano-cli 8.x.x - linux-x86_64 - ghc-8.10
# git rev <...>
cardano-node version
# cardano-node 8.1.2 - linux-x86_64 - ghc-8.10
# cardano-node 8.x.x - linux-x86_64 - ghc-8.10
# git rev <...>
```

#### Update port number or pool name for relative paths

Before you go ahead with starting your node, you may want to update values for `CNODE_PORT` in `$CNODE_HOME/scripts/env`. Note that it is imperative for operational relays and pools to ensure that the port mentioned is opened via firewall to the destination your node is supposed to connect from. Update your network/firewall configuration accordingly. Future executions of `guild-deploy.sh` will preserve and not overwrite these values.
Before you go ahead with starting your node, you may want to update values for `CNODE_PORT` in `$CNODE_HOME/scripts/env`. Note that it is imperative for operational relays and pools to ensure that the port mentioned is opened via firewall to the destination your node is supposed to connect from. Update your network/firewall configuration accordingly. Future executions of `guild-deploy.sh` will preserve and not overwrite these values (or atleast back up if forced to overwrite).

```bash
CNODEBIN="${HOME}/.local/bin/cardano-node"
Expand All @@ -60,60 +59,92 @@ POOL_NAME="GUILD"
```

!!! important
POOL_NAME is the name of folder that you will use when registering pools and starting node in core mode. This folder would typically contain your `hot.skey`,`vrf.skey` and `op.cert` files required. If the mentioned files are absent, the node will automatically start in a passive mode. Note that in case CNODE_PORT is changed, you'd want to re-do the deployment of systemd service as mentioned later in the guide
POOL_NAME is the name of folder that you will use when registering pools and starting node in core mode. This folder would typically contain your `hot.skey`,`vrf.skey` and `op.cert` files required. If the mentioned files are absent (expected if this is a fresh install), the node will automatically start in a relay mode.

#### Start the node

To test starting the node in interactive mode, you can use the pre-built script below (`cnode.sh`) (note that your node logs are being written to `$CNODE_HOME/logs` folder, you may not see much output beyond `Listening on http://127.0.0.1:12798`). This script automatically determines whether to start the node as a relay or block producer (if the required pool keys are present in the `$CNODE_HOME/priv/pool/<POOL_NAME>` as mentioned above). The script contains a user-defined variable `CPU_CORES` which determines the number of CPU cores the node will use upon start-up:
To test starting the node in interactive mode, we will make use of pre-built script `cnode.sh`. This script automatically determines whether to start the node as a relay or block producer (if the required pool keys are present in the `$CNODE_HOME/priv/pool/<POOL_NAME>` as mentioned above). The script contains a user-defined variable `CPU_CORES` which determines the number of CPU cores the node will use upon start-up:

```bash
######################################
# User Variables - Change as desired #
# Common variables set in env file #
######################################

#CPU_CORES=2 # Number of CPU cores cardano-node process has access to (please don't set higher than physical core count, 2-4 recommended)
#CPU_CORES=4 # Number of CPU cores cardano-node process has access to (please don't set higher than physical core count, 4 recommended)
```
You can uncomment this and set to the desired number, but be wary not to go above your physical core count.

Now let's test starting the node in interactive mode.

!!! note
At this stage, upon executing `cnode.sh`, you are expected to see the live config and a line ending with `Listening on http://127.0.0.1:12798` - this is expected, as your logs are being written to `$CNODE_HOME/logs/node.json` . If so, you should be alright to return to your console by pressing Ctrl-C. The node will be started later using instructions below using systemd (Linux's service management). In case you receive any errors, please troubleshoot and fix those before proceeding.

```bash
cd "${CNODE_HOME}"/scripts
./cnode.sh
```

Ensure you do not have any errors in the console. To stop the node, hit Ctrl-C - we will start the node as systemd later in the document.
Press Ctrl-C to exit node and return to console.

#### Modify the node to P2P mode
#### Modify the node's config files

!!! note
The section below only refer to mainnet, as Guildnet/Preview/Preprod templates already come with P2P as default mode, and do not require steps below
Now that you've tested the basic node operation, you might want to customise your config files (assuming you are in top-level folder , i.e. `cd "${CNODE_HOME}"`:

In case you prefer to start the node in P2P mode (ideally, only on relays), you can do so by replacing the config.json and topology.json files in `$CNODE_HOME/files` folder.
You can find a sample of these two files that can be downloaded using commands below:
1. files/config.json :
This file contains the logging configurations (tracers of to tune logging, paths for other genesis config files, address/ports on which the prometheus/EKG monitoring will listen, etc). Unless running more than one node on same machine (not recommended), you should be alright to use this file as-is. Note that for mainnet

```bash
cd "${CNODE_HOME}"/files
mv config.json config.json.bkp_$(date +%s)
mv topology.json topology.json.bkp_$(date +%s)
curl -sL -f "https://raw.githubusercontent.com/cardano-community/guild-operators/master/files/config-mainnet.p2p.json" -o config.json
curl -sL -f "https://raw.githubusercontent.com/cardano-community/guild-operators/alpha/files/topology-mainnet.json" -o topology.json
```
2. files/topology.json :
This file tells your node how to connect to other nodes (especially initially to start synching). You would want to update this file as below:

Once downloaded, you'd want to update config.json (if you want to update any port/path references or change tracers from default) and the topology.json file to include your core/relay nodes in `localRoots` section (replacing dummy values currently in place with `"127.0.0.1"` address. The P2P topology file provides you few public nodes as a fallback to avoid single point of reliance, being IO provided mainnet nodes. You can also remove/update any additional peers as per your preference.
* Update the `localRoots` > `accessPoints` section to include your local nodes that you want persistent connection against (eg: this could be your BP and own relay nodes).
* You'd want to update `localRoots` > `valency` to number of connections from your localRoots that you always want to keep active connection to.
* [Optional] - you can add more `publicRoots` section, tho defaults populated should work fine.
* `useLedgerAfterSlot` tells the node to use nodes from localRoots/publicRoots to sync the node initially until reaching an absolute slot number, after which - it can start attempting to connect to peers on the network.

Once updated, since you modified the file manually - there is always a chance of human errors (eg: missing comma/quotes). Thus, we would recommend you to start the node interactively once again before proceeding.
!!! important
You'd want to set `useLedgerAfterSlot` to `-1` for your Block Producing (Core) node - thereby, telling your Core node to remain in non-P2P mode.

The resultant topology file could look something like below:

``` json
{
"localRoots": [
{
"accessPoints": [
{"address": "xx.xx.xx.xx", "port": 6000 },
{"address": "xx.xx.xx.yy", "port": 6000 }
],
"advertise": false,
"valency": 2
}
],
"publicRoots": [
{
"accessPoints": [
{"address": "...", "port": 3001 },
{"address": "...", "port": 6000 }
],
"advertise": false
}
],
"useLedgerAfterSlot": 67067585
}
```

Once above two files are updated, since you modified the file manually - there is always a chance of human errors (eg: missing comma/quotes). Thus, we would recommend you to start the node interactively once again before proceeding.

```bash
cd "${CNODE_HOME}"/scripts
./cnode.sh
```

Ensure you do not have any errors in the console. To stop the node, hit Ctrl-C - we will start the node as systemd later in the document.
As before, ensure you do not have any errors in the console. To stop the node, hit Ctrl-C - we will start the node as systemd later in the document.

#### Start the submit-api

!!! note
An average pool operator may not require `cardano-submit-api` at all. Please verify if it is required for your use as mentioned [here](../build.md#components). If - however - you do run submit-api for accepting sizeable transaction load, you would want to override the default MEMPOOL_BYTES by uncommenting it in cnode.sh.

#### Start the submit-api

`cardano-submit-api` is one of the binaries built as part of `cardano-node` repository and allows you to submit transactions over a Web API. To run this service interactively, you can use the pre-built script below (`submitapi.sh`). Make sure to update `submitapi.sh` script to change listen IP or Port that you'd want to make this service available on.

```bash
Expand Down
2 changes: 1 addition & 1 deletion docs/Build/wallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The above would copy the binaries into `~/.local/bin` folder.
You can run the below to connect to a `cardano-node` instance that is expected to be already running and the wallet will start syncing.
```bash
cardano-wallet serve /
--node-socket $CNODE_HOME/sockets/node0.socket /
--node-socket $CNODE_HOME/sockets/node.socket /
--mainnet / # if using the testnet flag you also need to specify the testnet shelley-genesis.json file
--database $CNODE_HOME/priv/wallet
```
Expand Down
2 changes: 1 addition & 1 deletion docs/Scripts/env.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Most variables can be left commented to use the automatically detected or defaul
#CNODE_HOME="/opt/cardano/cnode" # Override default CNODE_HOME path (defaults to /opt/cardano/cnode)
CNODE_PORT=6000 # Set node port
#CONFIG="${CNODE_HOME}/files/config.json" # Override automatic detection of node config path
#SOCKET="${CNODE_HOME}/sockets/node0.socket" # Override automatic detection of path to socket
#SOCKET="${CNODE_HOME}/sockets/node.socket" # Override automatic detection of path to socket
#TOPOLOGY="${CNODE_HOME}/files/topology.json" # Override default topology.json path
#LOG_DIR="${CNODE_HOME}/logs" # Folder where your logs will be sent to (must pre-exist)
#DB_DIR="${CNODE_HOME}/db" # Folder to store the cardano-node blockchain db
Expand Down
102 changes: 0 additions & 102 deletions files/config-guild.json

This file was deleted.

103 changes: 0 additions & 103 deletions files/config-mainnet.json

This file was deleted.

Loading

0 comments on commit 4fff856

Please sign in to comment.