diff --git a/ops/stage0-to-stage1.md b/ops/stage0-to-stage1.md index c76e615..89bf12f 100644 --- a/ops/stage0-to-stage1.md +++ b/ops/stage0-to-stage1.md @@ -93,7 +93,7 @@ Once all the participants have completed their onboarding, stage0 laconicd chain scp dev@:/srv/laconicd/stage1-deployment/data/laconicd-data/config/genesis.json ``` -* Now users can follow the steps to [Join as a validator on stage1](https://git.vdb.to/cerc-io/testnet-laconicd-stack/src/branch/main/testnet-onboarding-validator.md#join-as-a-validator-on-stage1) +* Now users can follow the steps to [Join as a validator on stage1](../testnet-onboarding-validator.md#join-as-a-validator-on-stage1) ## Bank Transfer diff --git a/ops/stage1-to-stage2.md b/ops/stage1-to-stage2.md index 0f64ce5..b2db30f 100644 --- a/ops/stage1-to-stage2.md +++ b/ops/stage1-to-stage2.md @@ -46,7 +46,7 @@ * Initialize stage2 chain: ```bash - DEPLOYMENT_DIR=$pwd + DEPLOYMENT_DIR=$(pwd) cd ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd @@ -94,7 +94,7 @@ scp dev@:/srv/laconicd/stage2-deployment/data/laconicd-data/config/genesis.json ``` -* Now users can follow the steps to [Upgrade to testnet stage2](https://git.vdb.to/cerc-io/testnet-laconicd-stack/src/branch/main/testnet-onboarding-validator.md#upgrade-to-testnet-stage2) +* Now users can follow the steps to [Upgrade to testnet stage2](../testnet-onboarding-validator.md#upgrade-to-testnet-stage2) ## Bank Transfer diff --git a/ops/stage2/upgrade-node-to-stage2.sh b/ops/stage2/upgrade-node-to-stage2.sh new file mode 100755 index 0000000..de334cf --- /dev/null +++ b/ops/stage2/upgrade-node-to-stage2.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# Exit on error +set -e +set -u + +NODE_HOME="$HOME/.laconicd" +stage2_genesis="$NODE_HOME/tmp-stage2/genesis.json" + +if [ ! -f ${stage2_genesis} ]; then + echo "stage2 genesis file not found, exiting..." + exit 1 +fi + +# Remove data but keep keys +laconicd cometbft unsafe-reset-all + +# Use provided genesis config +cp $stage2_genesis $NODE_HOME/config/genesis.json + +# Set chain id in config +chain_id=$(jq -r '.chain_id' $stage2_genesis) +laconicd config set client chain-id $chain_id --home $NODE_HOME + +echo "Node data reset and ready for stage2!" diff --git a/testnet-onboarding-validator.md b/testnet-onboarding-validator.md index 6f94e9c..c8b1fcb 100644 --- a/testnet-onboarding-validator.md +++ b/testnet-onboarding-validator.md @@ -280,6 +280,100 @@ laconic-so deployment --dir testnet-laconicd-deployment start sudo rm -r testnet-laconicd-deployment ``` +## Upgrade to testnet stage2 + +### Prerequisites + +* Testnet stage2 genesis file and peer node address + +* Mnemonic from the [wallet](https://wallet.laconic.com) + +* Have a testnet stage1 node running + +### Setup + +* Clone / pull the stack repo: + + ```bash + laconic-so fetch-stack git.vdb.to/cerc-io/testnet-laconicd-stack --pull + ``` + +* Clone / pull the required repositories: + + ```bash + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/testnet-laconicd setup-repositories --pull + + # If this throws an error as a result of being already checked out to a branch/tag in a repo, remove the repositories and re-run the command + ``` + +* Build the container images: + + ```bash + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/testnet-laconicd build-containers --force-rebuild + ``` + + This should create the following docker images locally with latest changes: + + * `cerc/laconicd` + +### Create a deployment + +* The existing deployment used for stage1 can be used for stage2 + +* Copy over the published testnet genesis file (`.json`) to data directory in deployment (`testnet-laconicd-deployment/data/laconicd-data/tmp-stage2`): + + ```bash + # In dir where stage1 deployment (`testnet-laconicd-deployment`) exists + TESTNET_DEPLOYMENT=$(pwd)/testnet-laconicd-deployment + + # Example + mkdir -p $TESTNET_DEPLOYMENT/data/laconicd-data/tmp-stage2 + cp genesis.json $TESTNET_DEPLOYMENT/data/laconicd-data/tmp-stage2/genesis.json + ``` + +* Run script to reset node data and upgrade for stage2: + + ```bash + cd ~/cerc/testnet-laconicd-stack + + docker run -it \ + -v $TESTNET_DEPLOYMENT/data/laconicd-data:/root/.laconicd \ + -v ./ops/stage2:/scripts \ + cerc/laconicd:local bash -c "/scripts/upgrade-node-to-stage2.sh" + + cd $TESTNET_DEPLOYMENT + ``` + +### Configuration + +* Inside the `testnet-laconicd-deployment` deployment directory, open `config.env` file and set following env variables: + + ```bash + CERC_CHAIN_ID=laconic_9000-2 + + # Comma separated list of nodes to keep persistent connections to + # Example: "node-1-id@laconicd.laconic.com:26656" + # Use the provided node id + CERC_PEERS="" + + # A custom human readable name for this node + CERC_MONIKER= + ``` + +### Start the deployment + +```bash +laconic-so deployment --dir testnet-laconicd-deployment start +``` + +See [Check status](#check-status) to follow sync status of your node + +See [Join as testnet validator](#join-as-testnet-validator) to join / rejoin as a validator using laconicd CLI + +### Clean up + +* Same as [Clean up](#clean-up) + ## Troubleshooting * If you face any issues in the onboarding app or the web-wallet, clear your browser cache and reload