From 5b74809ce2946a07f742a147bc5b5d6f5af9e9b0 Mon Sep 17 00:00:00 2001 From: rdlrt <3169068+rdlrt@users.noreply.github.com> Date: Fri, 26 Jul 2024 12:48:50 +1000 Subject: [PATCH] 1. Split guild-deploy option for force overwrite of config and scripts 2. Update node-cli documentation to include sample topology.json for Core node 3. Update upgrade.md for generic instructions and update basics.md for guild-deploy updates 4. Rename valency to hotValency in topology samples as valency is supposedly deprecated --- docs/Build/node-cli.md | 51 ++++++++++--- docs/basics.md | 30 ++++---- docs/upgrade.md | 76 +++++++++----------- files/configs/guild/topology.json | 4 +- files/configs/mainnet/topology.json | 10 +-- files/configs/preprod/topology.json | 6 +- files/configs/preview/topology.json | 6 +- files/configs/sanchonet/topology.json | 4 +- scripts/cnode-helper-scripts/cnode.sh | 5 +- scripts/cnode-helper-scripts/guild-deploy.sh | 58 +++++++-------- 10 files changed, 140 insertions(+), 110 deletions(-) diff --git a/docs/Build/node-cli.md b/docs/Build/node-cli.md index c41075c4b..7f91c55b1 100644 --- a/docs/Build/node-cli.md +++ b/docs/Build/node-cli.md @@ -1,4 +1,5 @@ !!! info "Reminder !!" + Unless there is a very particular reason you want to compile (eg: running on non-popular OS flavor), you DO NOT "need" to build node binaries - `guild-deploy.sh` already provides an option to download pre-compiled binaries. Ensure the [Pre-Requisites](../basics.md#pre-requisites) are in place before you proceed. ### Build Instructions @@ -40,10 +41,10 @@ Execute `cardano-cli` and `cardano-node` to verify output as below (the exact ve ```bash cardano-cli version -# cardano-cli 8.x.x - linux-x86_64 - ghc-8.10 +# cardano-cli 9.x.x - linux-x86_64 - ghc-8.10 # git rev <...> cardano-node version -# cardano-node 8.x.x - linux-x86_64 - ghc-8.10 +# cardano-node 9.x.x - linux-x86_64 - ghc-8.10 # git rev <...> ``` @@ -106,7 +107,7 @@ This file tells your node how to connect to other nodes (especially initially to !!! important On BP, 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, and ensure `PeerSharing` is to `false`. -The resultant topology file could look something like below: +The resultant topology file on a relay could look something like below: ``` json { @@ -118,25 +119,29 @@ The resultant topology file could look something like below: { "address": "backbone.mainnet.emurgornd.com", "port": 3001 + }, + { + "address": "backbone.mainnet.cardanofoundation.org", + "port": 3001 } ], "localRoots": [ { "accessPoints": [ - {"address": "xx.xx.xx.xx", "port": 6000 }, - {"address": "xx.xx.xx.yy", "port": 6000 } + {"address": "xx.xx.xx.xx", "port": 6000 , "description": "Core"}, + {"address": "zz.zz.zz.zz", "port": 6000 , "description": "Relay2"} ], "advertise": false, "trustable": true, - "valency": 2 + "hotValency": 2 }, { "accessPoints": [ {"address": "node-dus.poolunder.com", "port": 6900, "pool": "UNDR", "location": "EU/DE/Dusseldorf" }, {"address": "node-syd.poolunder.com", "port": 6900, "pool": "UNDR", "location": "OC/AU/Sydney" }, {"address": "194.36.145.157", "port": 6000, "pool": "RDLRT", "location": "EU/DE/Baden" }, - {"address": "152.53.18.60", "port": 6000, "pool": "RDLRT", "location": "NA/US/StLouis" }, - {"address": "148.72.153.168", "port": 16000, "pool": "AAA", "location": "US/StLouis" }, + {"address": "95.216.38.251", "port": 6000, "pool": "RDLRT", "location": "EU/FI/Helsinki" }, + {"address": "148.72.153.168", "port": 16000, "pool": "AAA", "location": "NA/US/StLouis" }, {"address": "78.47.99.41", "port": 6000, "pool": "AAA", "location": "EU/DE/Nuremberg" }, {"address": "relay1-pub.ahlnet.nu", "port": 2111, "pool": "AHL", "location": "EU/SE/Malmo" }, {"address": "relay2-pub.ahlnet.nu", "port": 2111, "pool": "AHL", "location": "EU/SE/Malmo" }, @@ -146,7 +151,7 @@ The resultant topology file could look something like below: ], "advertise": false, "trustable": false, - "valency": 5, + "hotValency": 5, "warmValency": 10 } ], @@ -156,7 +161,33 @@ The resultant topology file could look something like below: "advertise": false } ], - "useLedgerAfterSlot": 119160667 + "useLedgerAfterSlot": 128908821 +} +``` + +Similarly, a typical topology file on a Core could look something like below: + +``` json +{ + "bootstrapPeers": [], + "localRoots": [ + { + "accessPoints": [ + {"address": "yy.yy.yy.yy", "port": 6000, "description": "Relay1"}, + {"address": "zz.zz.zz.zz", "port": 6000, "description": "Relay2"} + ], + "advertise": false, + "trustable": true, + "hotValency": 2 + } + ], + "publicRoots": [ + { + "accessPoints": [], + "advertise": false + } + ], + "useLedgerAfterSlot": -1 } ``` diff --git a/docs/basics.md b/docs/basics.md index 181d29f57..171f37497 100644 --- a/docs/basics.md +++ b/docs/basics.md @@ -8,18 +8,19 @@ The architecture for various components are already described at [docs.cardano.o While we do not intend to hand out step-by-step instructions, the tools are often misused as a shortcut to avoid ensuring base skillsets mentioned on home page. Some of the common gotchas that we often find SPOs to miss out on: - It is imperative that pools operate with highly accurate system time, in order to propogate blocks to network in a timely manner and avoid penalties to own (or at times other competing) blocks. Please refer to sample guidance [here ](https://ubuntu.com/server/docs/network-ntp) for details - the precise steps may depend on your OS. -- Ensure your Firewall rules at Network as well as OS level are updated according to the usage of your system, you'd want to whitelist the rules that you really need to open to world (eg: You might need node, SSH, and potentially secured webserver/proxy ports to be open, depending on components you run). +- Ensure your Firewall rules at Network as well as OS level are updated according to the usage of your system, you'd want to whitelist the rules that you really need to open to world (eg: You might need node and SSH ports to be open to relays and perhaps home workstation on core, while open node to internet on relays, depending on your topology and configuration that you run). - Update your SSH Configuration to prevent password-based logon. - Ensure that you use offline workflow, you should never require to have your offline keys on online nodes. The tools provide you backup/restore functionality to only pass online keys to online nodes. #### Pre-Requisites !!! info "Reminder !!" - You're expected to run the commands below from same session, using same working directories as indicated and using a `non-root user with sudo access`. You are expected to be familiar with this as part of pre-requisite skill sets for stake pool operators. + You're expected to run the commands below from same session, using same working directories as indicated and using a `non-root user with sudo access`. You are expected to be familiar with this as part of pre-requisite skill sets for stake pool operators. ##### Set up OS packages, folder structure and fetch files from repo {: #os-prereqs} -The pre-requisites for Linux systems are automated to be executed as a single script. To download the pre-requisites scripts, execute the below: +The pre-requisites for Linux systems are automated to be executed as a single script. This script uses opt-in election of what you'd like the script to do. The defaults without any arguments will only update static part of script contents for you. +To download the pre-requisites scripts, execute the below: ```bash mkdir "$HOME/tmp";cd "$HOME/tmp" @@ -30,11 +31,14 @@ curl -sS -o guild-deploy.sh https://raw.githubusercontent.com/cardano-community/ chmod 755 guild-deploy.sh ``` -Please familiarise with the syntax of `guild-deploy.sh` before proceeding. The usage syntax can be checked using `./guild-deploy.sh -h` , sample output below: +!!! info "Important !!" + Please familiarise with the syntax of `guild-deploy.sh` before proceeding (using -h as below). The exact parameters you want to run with is dependent on your, below are only sample instructions + +The usage syntax can be checked using `./guild-deploy.sh -h` , sample output below: ``` bash -Usage: guild-deploy.sh [-n ] [-p path] [-t ] [-b ] [-u] [-s [p][b][l][m][f][d][c][o][w][x]] +Usage: guild-deploy.sh [-n ] [-p path] [-t ] [-b ] [-u] [-s [p][b][l][m][d][c][o][w][x][f][s]] Set up dependencies for building/using common tools across cardano ecosystem. The script will always update dynamic content from existing scripts retaining existing user variables @@ -48,18 +52,18 @@ The script will always update dynamic content from existing scripts retaining ex b Install OS level dependencies for tools required while building cardano-node/cardano-db-sync components (Default: skip) l Build and Install libsodium fork from IO repositories (Default: skip) m Download latest (released) binaries for mithril-signer, mithril-client (Default: skip) - f Force overwrite entire content of scripts and config files (backups of existing ones will be created) (Default: skip) - d Download latest (released) binaries for bech32, cardano-address, cardano-node, cardano-cli, cardano-db-sync and cardano-submit-api binaries (Default: skip) - c Install/Upgrade CNCLI binary (Default: skip) # (1)! - o Install/Upgrade Ogmios Server binary (Default: skip) - w Install/Upgrade Cardano Hardware CLI (Default: skip) - x Install/Upgrade Cardano Signer binary (Default: skip) + d Download latest (released) binaries for bech32, cardano-address, cardano-node, cardano-cli, cardano-db-sync and cardano-submit-api (Default: skip) + c Download latest (released) binaries for CNCLI (Default: skip) + o Download latest (released) binaries for Ogmios (Default: skip) + w Download latest (released) binaries for Cardano Hardware CLI (Default: skip) + x Download latest (released) binaries for Cardano Signer binary (Default: skip) + f Force overwrite config files (backups of existing ones will be created) (Default: skip) + s Force overwrite entire content [including user variables] of scripts (Default: skip) ``` 1. If you receive an error for `glibc`, it would likely be due to the build mismatch between pre-compiled binary and your OS, which is not uncommon. You may need to compile cncli manually on your OS as per instructions [here](https://github.com/cardano-community/cncli/blob/develop/INSTALL.md#compile-from-source) - make sure to copy the output binary to `"${HOME}/.local/bin"` folder. -This script uses opt-in election of what you'd like the script to do (as against previous version that used to try and auto-detect versions). The defaults without any arguments will only update static part of script contents for you. A typical example install to install most components but not overwrite static part of existing files for preview network would be: ``` bash @@ -82,7 +86,7 @@ Lastly, if you'd want to update your scripts but not install any additional depe ##### Folder structure -Running the script above will create the folder structure as per below, for your reference. You can replace the top level folder `/opt/cardano/cnode` by editing the value of `CNODE_HOME` in `~/.bashrc` and `$CNODE_HOME/files/env` files: +Running the script above will create the folder structure as per below, for your reference. You do NOT require `CNODE_HOME` to be set on shell level as scripts will derive the parent folder and assign it at runtime, the addition in `~/.bashrc` is only for your ease to switch to right folder: /opt/cardano/cnode # Top-Level Folder diff --git a/docs/upgrade.md b/docs/upgrade.md index 4bee21198..19ca86091 100644 --- a/docs/upgrade.md +++ b/docs/upgrade.md @@ -1,59 +1,45 @@ -??? example "One-Time major upgrade for Koios Scripts from 20-Jan-2023 (expand for details)" - - The scripts on guild-operators repository have gone through quite a few changes to accomodate for the below: - - - Replace `prereqs.sh` with `guild-deploy.sh` using minimalistic approach (i.e. anything you need to deploy is now required to be specified using command-line arguments). The old `prereqs.sh` is left as-is but will no longer be maintained. - - Improve handling of environment variables for top level folder. Prior to this point, those who were using multiple deployments on same machine were required to have their session's environment set (for instance, using `prereqs.sh -t pvnode` would have created folder structure as `/opt/cardano/pvnode` and replaced `CNODE_HOME` references within scripts with `PVNODE_HOME`. This will no longer be required. The deriving of top level folder will be done relative to scripts folder. Thus, parent of the folder containing `env` file will automatically be treated as top level folder, and no longer depend on external environment variable. One may still use them for their own comfort to switch directories. - - The above also helps for manual download of script from github as it will no longer require substituting `CNODE_HOME` references. - - Consolidate binaries deployment to `"${HOME}"/.local/bin`. Previously, we could have had binaries deployed to various locations (`"${HOME}"/.cabal/bin` for node/CLI binaries, `"${HOME}"/.cargo/bin` for cncli binary, `"${HOME}"/bin` for downloaded binaries). This occured because of different compilers used different default locations for their output binariess (cargo for rust, cabal for Haskell, etc). The guild-deploy.sh/cabal-build-all.sh scripts will now provision the binaries to be made available to "${HOME}"/.local/bin instead. Ofcourse, as before, you can still customise the location of binaries using variables (eg: `CCLI`, `CNCLI`, `CNODE_HOME`) in `env` file. - - Add option to download pre-compiled binaries instead of compiling them - and accordingly - options in `guild-deploy.sh`, giving users both the options. - - Some of the above required us to add breaking changes to some scripts, but hopefully the above explains the premise for those changes. To ease this one-time upgrade process for existing deployments, we have tried to come up with the guide below, feel free to edit this file to improve the documents based on your experience. Again, apologies in advance to those who do not agree with the above changes (the old code would ofcourse remain unimpacted at tag `legacy-scripts`, so if you'd like to stick to old scripts , you can use `-b legacy-scripts` for your tools to switch back). - -### Steps for Ugrading +### Steps for Upgrading !!! warning - Make sure you go through upgrade steps for your setup in a non-mainnet environment first! + Make sure you go through upgrade steps for your setup in a non-mainnet environment first!! -- Download the latest `guild-deploy.sh` (checkout new syntax with `guild-deploy.sh -h`) to update all the scripts and files from the guild template. The scripts modified with user content (`env`, `gLiveView.sh`, `topologyUpdater.sh`, `cnode.sh`, etc) will be backed up before overwriting. The backed up files will be in the same folder as the original files, and will be named as *`${filename}_bkp`*. More static files (genesis files or some of the scripts themselves) will not be backed up, as they're not expected to be modified. +- Download the latest `guild-deploy.sh` (always double check syntax of the script with `guild-deploy.sh -h`). The scripts modified with user content (`env`, `gLiveView.sh`, `topologyUpdater.sh`, `cnode.sh`, etc) will be backed up before overwriting. The backed up files will be in the same folder as the original files, and will be named as *`${filename}_bkp`*. More static files (genesis files or some of the scripts themselves) will not be backed up, as they're not expected to be modified. !!! warning "Remember" - Please add any environment-specific parameters (eg: custom top level folder, network flag, etc) to the execution command below, similar to prereqs.sh (check new syntax using `guild-deploy.sh -h`) + You are expected to provide appropriate environment-specific parameters (eg: custom top level folder [-p], alternate name for top level folder [-t], network flag [-n], etc) to the examples that pertain to your use case -- A basic (minimal) run of the guild-deploy script that will only update current scripts on mainnet using default paths: +- Depending on node release, you may be able to simply perform an update-in-place of scripts and node, or for some cases, you may need to overwrite configs as well. Some Examples below: -``` bash -mkdir "$HOME/tmp";cd "$HOME/tmp" -curl -sS -o guild-deploy.sh https://raw.githubusercontent.com/cardano-community/guild-operators/master/scripts/cnode-helper-scripts/guild-deploy.sh -chmod 700 guild-deploy.sh -./guild-deploy.sh -s f -b master -``` + - A typical run of the guild-deploy script that will perform update in place of current scripts on mainnet and update binaries (alongwith re-compiling libsodium dependencies). In this scenario no config files or user variables in scripts are overwritten. This is typically relevant on minor patch releases of node upgrade: -- Source your bashrc file again , and ensure `"${HOME}"/.local/bin` is now part of your $PATH environment variable. + ``` bash + mkdir "$HOME/tmp";cd "$HOME/tmp" + curl -sfS -o guild-deploy.sh https://raw.githubusercontent.com/cardano-community/guild-operators/master/scripts/cnode-helper-scripts/guild-deploy.sh && chmod 700 guild-deploy.sh + ./guild-deploy.sh -s dl -b master -n mainnet -t cnode -p /opt/cardano/cnode + ``` -``` bash -source "${HOME}"/.bashrc -echo "${PATH}" -``` + - Another scenario would be when you're required to overwrite configs (eg: node-8.1.2 to node-9.1.0 introduced change in genesis/config/topology file formats). In this case, you'd want to overwrite your config files as well. You should follow changelog in node release notes to verify if you'd need to overwrite configs. Note that every time you do this, you may need to re-add your customisations - if any - to the relevant config files (typically - almost always, you'd have to update the topology.json when overwriting configs). There are backups created of original file in `"${CNODE_HOME}"/files` folder if you'd like to compare/reuse previous version. -- Check and add back your customisations to config files (or simply restore from automatically created backup of your config/topology files). + ``` bash + mkdir "$HOME/tmp";cd "$HOME/tmp" + curl -sfS -o guild-deploy.sh https://raw.githubusercontent.com/cardano-community/guild-operators/master/scripts/cnode-helper-scripts/guild-deploy.sh && chmod 700 guild-deploy.sh + ./guild-deploy.sh -s dlf -b master -n mainnet -t cnode -p /opt/cardano/cnode + ``` -- Since one of the basic changes we start to recommend as part of this revamp is moving your binaries to `"${HOME}"/.local/bin`, you would want to *move* the binaries below from current location: - - "${HOME}"/.cabal/bin - Binaries built by `cabal build all` script (eg: `cardano-node`, `cardano-cli`, `bech32`, `cardano-address`, `cardano-submit-api`, `cardano-db-sync` - - "${HOME}"/.cargo/bin - Binaries built by `cardano install` (eg: `cncli`) - - "${HOME}"/bin - Downloaded binaries from previous `prereqs.sh` (eg: `cardano-hw-cli`) +!!! warning "Beware" + When upgrading node, depending on node versions (especially for major release) - you'd likely have to wait for node to revalidate/replay ledger. This can take a few hours. Please always plan ahead, do it first on a relay to ensure you've got "${CNODE_HOME}/db" folder ready to copy over (while source and target node have been shutdown) - prior to starting on upgrade on new machine. If mithril for target node version is ready, you can also use [mithril-client](../Scripts/mithril-client.md) to download snapshot instead of replaying, which may save you some time -You can move the binaries by using mv command (for example, if you dont have any other files in these folders, you can use the command below: - -!!! note "Note" - Ideally, you should shutdown services (eg: cnode, cnode-dbsync, etc) prior to running the below to ensure they run from new location (you can also re-deploy them if you haven't done so in a while, eg: `./cnode.sh -d`). At the end of the guide, you can start them back up. +- Once guild-deploy script has been run, source your bashrc file again (or restart session), and ensure `"${HOME}"/.local/bin` is part of your $PATH environment variable. If your shell does not auto-run bashrc, you may want to set it a call to "${HOME}"/.bashrc in your `.profile` ``` bash -mv -t "${HOME}"/.local/bin/ "${HOME}"/.cabal/bin/* "${HOME}"/.cargo/bin/* "${HOME}"/bin/* +source "${HOME}"/.bashrc +echo "${PATH}" ``` -- We've found users often confuse between $PATH variable resolution between multiple shell sessions, systemd, etc. To avoid this, edit the following files and uncomment and set the following variables to the appropriate paths as per your deployment (eg: `CCLI="${HOME}"/.local/bin/cardano-cli` if following above): +### Troubleshooting {: #troubleshooting} + +- We've found users often confuse between $PATH variable resolution between multiple shell sessions, systemd, etc. While if you only used this guide, the binaries should be in "${HOME}/.local/bin", you may have manually downloaded to another location before. To avoid this, you can edit the following files and uncomment and set the following variables to the appropriate paths as per your deployment (eg: `CCLI="${HOME}"/.local/bin/cardano-cli` if following above): - env : CCLI, CNCLI, CNODEBIN - [If applicable] dbsync.sh: DBSYNCBIN @@ -66,8 +52,14 @@ mv -t "${HOME}"/.local/bin/ "${HOME}"/.cabal/bin/* "${HOME}"/.cargo/bin/* "${HOM whereis bech32 cardano-address cardano-cli cardano-db-sync cardano-hw-cli cardano-node cardano-submit-api cncli ogmios ``` -The above might result in some lines having more than one entry (eg: you might have `cardano-cli` in `"${HOME}"/.cabal/bin` and `"${HOME}"/.local/bin`) - for which you'd want to delete the reference(s) not in `"${HOME}"/.local/bin` , while for other cases - you might have no values (eg: you may not use `cardano-db-sync`, `cncli`, `ogmios` and/or `cardano-hw-cli`. You need not take any actions for the binaries you do not use. +For some cases - you might have no values (eg: you may not use `cardano-db-sync`, `cncli`, `ogmios` and/or `cardano-hw-cli`. You need not take any actions for the binaries you do not use. + +- If you are having trouble connecting to node post upgrade from gLiveView, typically the first issue you'd want to eliminate is whether you missed that node might need ledger replay/revalidation (which could take hours as indicated earlier on the page). You can check the node status via `sudo systemctl status cnode`. If the node shows as up, you can monitor logs via `tail -100f "${CNODE_HOME}/logs/node.json`. If you're unable to start node using systemd itself, you can check the systemd output via `sudo journalctl -xeu cnode.service` and scroll back until you see a startup attempt with reason (typically this could be a couple of pages back). If nothing obvious (eg: showing files used as `/files/config.json` instead of `$CNODE_HOME/files/config.json` )comes up from there, you'd want to view node logs to see if there is something recorded in `node.json` instead. + +### Unintended update-in-place {: #unintended} + +Let's say you accidentally did an update of the files that you didnt intend to and want to revert all your scripts to previous state. While you have the backups of the scripts created while doing in-place update, you can always make use of branch flag that most scripts that perform update-in-place provide (eg: for gLiveView.sh that you want to restore to 8.1.2 state), this would be `-b node-8.1.2`. The available tags that can be used can be visited [here](https://github.com/cardano-community/guild-operators/tags) -### Support/Improvements +### Support/Improvements {: #support} -Hope the guide above helps you with the migration, but again - we could've missed some edge cases. If so, please report via chat in [Koios Discussions channel](https://t.me/CardanoKoios) only. Please DO NOT make edits to the script content based on forum/alternate guide/channels, while done with best intentions - there have been solutions put online that modify files unnecessarily instead of correcting configs and disabling updates, such actions will only cause trouble for future updates. +Hope the guide above helps you with the migration, but again - we could've missed some edge cases. If so, please report via chat in [Koios Discussions channel](https://t.me/CardanoKoios) or open an issue on github. Please DO NOT make edits to the script content based on forum/alternate guide/channels, while done with best intentions - there have been solutions put online that modify files unnecessarily instead of correcting configs and disabling updates, such actions will only cause trouble for future updates. diff --git a/files/configs/guild/topology.json b/files/configs/guild/topology.json index 6905f143b..2bb9c973e 100644 --- a/files/configs/guild/topology.json +++ b/files/configs/guild/topology.json @@ -6,7 +6,7 @@ ], "advertise": false, "trustable": true, - "valency": 1 + "hotValency": 1 }, { "accessPoints": [ @@ -19,7 +19,7 @@ ], "advertise": false, "trustable": false, - "valency": 3, + "hotValency": 3, "warmValency": 5 } ], diff --git a/files/configs/mainnet/topology.json b/files/configs/mainnet/topology.json index 5fbe413c9..0a881ee27 100644 --- a/files/configs/mainnet/topology.json +++ b/files/configs/mainnet/topology.json @@ -21,15 +21,15 @@ ], "advertise": false, "trustable": true, - "valency": 2 + "hotValency": 2 }, { "accessPoints": [ {"address": "node-dus.poolunder.com", "port": 6900, "pool": "UNDR", "location": "EU/DE/Dusseldorf" }, {"address": "node-syd.poolunder.com", "port": 6900, "pool": "UNDR", "location": "OC/AU/Sydney" }, {"address": "194.36.145.157", "port": 6000, "pool": "RDLRT", "location": "EU/DE/Baden" }, - {"address": "152.53.18.60", "port": 6000, "pool": "RDLRT", "location": "NA/US/StLouis" }, - {"address": "148.72.153.168", "port": 16000, "pool": "AAA", "location": "US/StLouis" }, + {"address": "95.216.38.251", "port": 6000, "pool": "RDLRT", "location": "EU/FI/Helsinki" }, + {"address": "148.72.153.168", "port": 16000, "pool": "AAA", "location": "NA/US/StLouis" }, {"address": "78.47.99.41", "port": 6000, "pool": "AAA", "location": "EU/DE/Nuremberg" }, {"address": "relay1-pub.ahlnet.nu", "port": 2111, "pool": "AHL", "location": "EU/SE/Malmo" }, {"address": "relay2-pub.ahlnet.nu", "port": 2111, "pool": "AHL", "location": "EU/SE/Malmo" }, @@ -38,7 +38,7 @@ ], "advertise": false, "trustable": false, - "valency": 5, + "hotValency": 5, "warmValency": 10 } ], @@ -48,5 +48,5 @@ "advertise": false } ], - "useLedgerAfterSlot": 119160667 + "useLedgerAfterSlot": 128908821 } diff --git a/files/configs/preprod/topology.json b/files/configs/preprod/topology.json index ff12f6581..e96ced78d 100644 --- a/files/configs/preprod/topology.json +++ b/files/configs/preprod/topology.json @@ -13,7 +13,7 @@ ], "advertise": false, "trustable": true, - "valency": 2 + "hotValency": 2 }, { "accessPoints": [ @@ -24,7 +24,7 @@ ], "advertise": false, "trustable": false, - "valency": 2, + "hotValency": 2, "warmValency": 3 } ], @@ -34,5 +34,5 @@ "advertise": false } ], - "useLedgerAfterSlot": 55043150 + "useLedgerAfterSlot": 64454371 } \ No newline at end of file diff --git a/files/configs/preview/topology.json b/files/configs/preview/topology.json index b3717d82f..b26301bec 100644 --- a/files/configs/preview/topology.json +++ b/files/configs/preview/topology.json @@ -13,7 +13,7 @@ ], "advertise": false, "trustable": true, - "valency": 2 + "hotValency": 2 }, { "accessPoints": [ @@ -24,7 +24,7 @@ ], "advertise": false, "trustable": false, - "valency": 2, + "hotValency": 2, "warmValency": 3 } ], @@ -34,5 +34,5 @@ "advertise": false } ], - "useLedgerAfterSlot": 44070103 + "useLedgerAfterSlot": 53827185 } \ No newline at end of file diff --git a/files/configs/sanchonet/topology.json b/files/configs/sanchonet/topology.json index f57a90a83..f84ff6e8c 100644 --- a/files/configs/sanchonet/topology.json +++ b/files/configs/sanchonet/topology.json @@ -10,7 +10,7 @@ "accessPoints": [], "advertise": false, "trustable": false, - "valency": 1 + "hotValency": 1 } ], "publicRoots": [ @@ -19,5 +19,5 @@ "advertise": false } ], - "useLedgerAfterSlot": 21599922 + "useLedgerAfterSlot": 33695977 } \ No newline at end of file diff --git a/scripts/cnode-helper-scripts/cnode.sh b/scripts/cnode-helper-scripts/cnode.sh index 189dd21b1..19f179a1a 100755 --- a/scripts/cnode-helper-scripts/cnode.sh +++ b/scripts/cnode-helper-scripts/cnode.sh @@ -120,9 +120,10 @@ while getopts :ds opt; do esac done +[[ ${0} != '-bash' ]] && PARENT="$(dirname $0)" || PARENT="$(pwd)" # Check if env file is missing in current folder (no update checks as will mostly run as daemon), source env if present -[[ ! -f "$(dirname $0)"/env ]] && echo -e "\nCommon env file missing, please ensure latest guild-deploy.sh was run and this script is being run from ${CNODE_HOME}/scripts folder! \n" && exit 1 -. "$(dirname $0)"/env offline +[[ ! -f "${PARENT}"/env ]] && echo -e "\nCommon env file missing in \"${PARENT}\", please ensure latest guild-deploy.sh was run and this script is being run from ${CNODE_HOME}/scripts folder! \n" && exit 1 +. "${PARENT}"/env offline case $? in 1) echo -e "ERROR: Failed to load common env file\nPlease verify set values in 'User Variables' section in env file or log an issue on GitHub" && exit 1;; 2) clear ;; diff --git a/scripts/cnode-helper-scripts/guild-deploy.sh b/scripts/cnode-helper-scripts/guild-deploy.sh index 959bceb79..ef186744b 100755 --- a/scripts/cnode-helper-scripts/guild-deploy.sh +++ b/scripts/cnode-helper-scripts/guild-deploy.sh @@ -2,31 +2,31 @@ # shellcheck disable=SC2086,SC1090,SC2059,SC2016 # shellcheck source=/dev/null -unset CNODE_HOME - ########################################## # User Variables - Change as desired # # command line flags override set values # ########################################## -#G_ACCOUNT="cardano-community" # Override github GUILD account if you forked the project -#NETWORK='mainnet' # Connect to specified network instead of public network (Default: connect to public cardano network) -#WANT_BUILD_DEPS='Y' # Skip installing OS level dependencies (Default: will check and install any missing OS level prerequisites) -#FORCE_OVERWRITE='N' # Force overwrite of all files including normally saved user config sections in env, cnode.sh and gLiveView.sh - # topology.json, config.json and genesis files normally saved will also be overwritten -#LIBSODIUM_FORK='Y' # Use IOG fork of libsodium instead of official repositories - Recommended as per IOG instructions (Default: IOG fork) -#INSTALL_CNCLI='N' # Install/Upgrade and build CNCLI with RUST -#INSTALL_CWHCLI='N' # Install/Upgrade Vacuumlabs cardano-hw-cli for hardware wallet support -#INSTALL_OGMIOS='N' # Install Ogmios Server -#INSTALL_CSIGNER='N' # Install/Upgrade Cardano Signer -#CNODE_NAME='cnode' # Alternate name for top level folder, non alpha-numeric chars will be replaced with underscore (Default: cnode) -#CURL_TIMEOUT=60 # Maximum time in seconds that you allow the file download operation to take before aborting (Default: 60s) -#UPDATE_CHECK='Y' # Check if there is an updated version of guild-deploy.sh script to download -#SUDO='Y' # Used by docker builds to disable sudo, leave unchanged if unsure. -#SKIP_DBSYNC_DOWNLOAD='N' # When using -i d switch, used by docker builds or users who might not want to download dbsync binary +#G_ACCOUNT="cardano-community" # Override github GUILD account if you forked the project +#NETWORK='mainnet' # Connect to specified network instead of public network (Default: connect to public cardano network) +#WANT_BUILD_DEPS='Y' # Skip installing OS level dependencies (Default: will check and install any missing OS level prerequisites) +#FORCE_OVERWRITE='N' # Force overwrite of all config files (topology.json, config.json and genesis files) +#SCRIPTS_FORCE_OVERWRITE='N' # Force overwrite of all scripts (including normally saved user config sections in env, cnode.sh and gLiveView.sh) +#LIBSODIUM_FORK='Y' # Use IOG fork of libsodium instead of official repositories - Recommended as per IOG instructions (Default: IOG fork) +#INSTALL_CNCLI='N' # Install/Upgrade and build CNCLI with RUST +#INSTALL_CWHCLI='N' # Install/Upgrade Vacuumlabs cardano-hw-cli for hardware wallet support +#INSTALL_OGMIOS='N' # Install Ogmios Server +#INSTALL_CSIGNER='N' # Install/Upgrade Cardano Signer +#CNODE_NAME='cnode' # Alternate name for top level folder, non alpha-numeric chars will be replaced with underscore (Default: cnode) +#CURL_TIMEOUT=60 # Maximum time in seconds that you allow the file download operation to take before aborting (Default: 60s) +#UPDATE_CHECK='Y' # Check if there is an updated version of guild-deploy.sh script to download +#SUDO='Y' # Used by docker builds to disable sudo, leave unchanged if unsure. +#SKIP_DBSYNC_DOWNLOAD='N' # When using -i d switch, used by docker builds or users who might not want to download dbsync binary ###################################### # Do NOT modify code below # ###################################### +unset CNODE_HOME + PARENT="$(dirname $0)" #get_input() { @@ -61,7 +61,7 @@ versionCheck() { printf '%s\n%s' "${1//v/}" "${2//v/}" | sort -C -V; } #$1=avail usage() { cat <<-EOF >&2 - Usage: $(basename "$0") [-n ] [-p path] [-t ] [-b ] [-u] [-s [p][b][l][m][f][d][c][o][w][x]] + Usage: $(basename "$0") [-n ] [-p path] [-t ] [-b ] [-u] [-s [p][b][l][m][d][c][o][w][x][f][s]] Set up dependencies for building/using common tools across cardano ecosystem. The script will always update dynamic content from existing scripts retaining existing user variables @@ -75,12 +75,13 @@ usage() { b Install OS level dependencies for tools required while building cardano-node/cardano-db-sync components (Default: skip) l Build and Install libsodium fork from IO repositories (Default: skip) m Download latest (released) binaries for mithril-signer, mithril-client (Default: skip) - f Force overwrite entire content of scripts and config files (backups of existing ones will be created) (Default: skip) d Download latest (released) binaries for bech32, cardano-address, cardano-node, cardano-cli, cardano-db-sync and cardano-submit-api (Default: skip) - c Install/Upgrade CNCLI binary (Default: skip) - o Install/Upgrade Ogmios Server binary (Default: skip) - w Install/Upgrade Cardano Hardware CLI (Default: skip) - x Install/Upgrade Cardano Signer binary (Default: skip) + c Download latest (released) binaries for CNCLI (Default: skip) + o Download latest (released) binaries for Ogmios (Default: skip) + w Download latest (released) binaries for Cardano Hardware CLI (Default: skip) + x Download latest (released) binaries for Cardano Signer binary (Default: skip) + f Force overwrite config files (backups of existing ones will be created) (Default: skip) + s Force overwrite entire content [including user variables] of scripts (Default: skip) EOF exit 1 @@ -92,6 +93,7 @@ set_defaults() { [[ -z ${NETWORK} ]] && NETWORK='mainnet' [[ -z ${WANT_BUILD_DEPS} ]] && WANT_BUILD_DEPS='N' [[ -z ${FORCE_OVERWRITE} ]] && FORCE_OVERWRITE='N' + [[ -z ${SCRIPTS_FORCE_OVERWRITE} ]] && SCRIPTS_FORCE_OVERWRITE='N' [[ -z ${LIBSODIUM_FORK} ]] && LIBSODIUM_FORK='N' [[ -z ${INSTALL_MITHRIL} ]] && INSTALL_MITHRIL='N' [[ -z ${INSTALL_CNCLI} ]] && INSTALL_CNCLI='N' @@ -169,7 +171,7 @@ updateWithCustomConfig() { [[ $# -ne 2 ]] && subdir="cnode-helper-scripts" || subdir=$2 curl -s -f -m ${CURL_TIMEOUT} -o ${file}.tmp "${URL_RAW}/scripts/${subdir}/${file}" [[ ! -f ${file}.tmp ]] && err_exit "Failed to download '${file}' from GitHub" - if [[ -f ${file} && ${FORCE_OVERWRITE} != 'Y' ]]; then + if [[ -f ${file} && ${SCRIPTS_FORCE_OVERWRITE} != 'Y' ]]; then if grep '^# Do NOT modify' ${file}.tmp >/dev/null 2>&1; then TEMPL_CMD=$(awk '/^# Do NOT modify/,0' ${file}.tmp) STATIC_CMD=$(awk '/#!/{x=1}/^# Do NOT modify/{exit} x' ${file}) @@ -639,7 +641,7 @@ populate_cnode() { pushd "${CNODE_HOME}"/scripts >/dev/null || err_exit - [[ ${FORCE_OVERWRITE} = 'Y' ]] && echo -e "\nForced full upgrade! Please edit scripts/env, scripts/cnode.sh, scripts/dbsync.sh, scripts/submitapi.sh, scripts/ogmios.sh, scripts/gLiveView.sh and scripts/topologyUpdater.sh scripts/mithril-client.sh scripts/mithril-relay.sh scripts/mithril-signer.sh (alongwith files/topology.json, files/config.json, files/dbsync.json) as required!" + [[ ${SCRIPTS_FORCE_OVERWRITE} = 'Y' ]] && echo -e "\nForced full upgrade! Please edit scripts/env, scripts/cnode.sh, scripts/dbsync.sh, scripts/submitapi.sh, scripts/ogmios.sh, scripts/gLiveView.sh and scripts/topologyUpdater.sh scripts/mithril-client.sh scripts/mithril-relay.sh scripts/mithril-signer.sh (alongwith files/topology.json, files/config.json, files/dbsync.json) as required!" updateWithCustomConfig "blockPerf.sh" updateWithCustomConfig "cabal-build-all.sh" @@ -663,7 +665,7 @@ populate_cnode() { updateWithCustomConfig "mithril.library" find "${CNODE_HOME}/scripts" -name '*.sh' -exec chmod 755 {} \; 2>/dev/null - chmod -R 700 "${CNODE_HOME}"/priv 2>/dev/null + chmod 750 "${CNODE_HOME}"/priv 2>/dev/null } # Parse arguments supplied to script @@ -674,7 +676,8 @@ parse_args() { [[ "${S_ARGS}" =~ "b" ]] && INSTALL_OS_DEPS="Y" && WANT_BUILD_DEPS="Y" [[ "${S_ARGS}" =~ "l" ]] && INSTALL_OS_DEPS="Y" && LIBSODIUM_FORK="Y" [[ "${S_ARGS}" =~ "m" ]] && INSTALL_MITHRIL="Y" - [[ "${S_ARGS}" =~ "f" ]] && FORCE_OVERWRITE="Y" && POPULATE_CNODE="F" + [[ "${S_ARGS}" =~ "f" ]] && FORCE_OVERWRITE="Y" && POPULATE_CNODE="Y" + [[ "${S_ARGS}" =~ "s" ]] && SCRIPTS_FORCE_OVERWRITE="Y" && POPULATE_CNODE="Y" [[ "${S_ARGS}" =~ "d" ]] && INSTALL_CNODEBINS="Y" [[ "${S_ARGS}" =~ "c" ]] && INSTALL_CNCLI="Y" [[ "${S_ARGS}" =~ "o" ]] && INSTALL_OGMIOS="Y" @@ -697,7 +700,6 @@ main_flow() { [[ "${WANT_BUILD_DEPS}" == "Y" ]] && build_dependencies [[ "${LIBSODIUM_FORK}" == "Y" ]] && build_libsodium [[ "${INSTALL_MITHRIL}" == "Y" ]] && download_mithril - [[ "${FORCE_OVERWRITE}" == "Y" ]] && POPULATE_CNODE="F" && populate_cnode [[ "${POPULATE_CNODE}" == "Y" ]] && populate_cnode [[ "${INSTALL_CNODEBINS}" == "Y" ]] && download_cnodebins [[ "${INSTALL_CNCLI}" == "Y" ]] && download_cncli