Update script to setup and run a node
This commit is contained in:
parent
3bee6e4941
commit
7adddacc72
@ -16,8 +16,6 @@ services:
|
||||
- "26657"
|
||||
- "26656"
|
||||
- "9473"
|
||||
- "8545"
|
||||
- "8546"
|
||||
- "9090"
|
||||
- "9091"
|
||||
- "1317"
|
||||
|
@ -3,9 +3,45 @@ if [[ -n "$CERC_SCRIPT_DEBUG" ]]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
# TODO: pass from the caller
|
||||
# TODO: Read from env
|
||||
MONIKER=MyNode
|
||||
CHAIN_ID=laconic_9000-1
|
||||
GENESIS_FILE_URL="/root/.laconicd/config/genesis.json"
|
||||
PEERS=""
|
||||
LOGLEVEL="info"
|
||||
|
||||
# TODO: Get genesis file using CURL
|
||||
if [ -z "$PEERS" ]; then
|
||||
echo "Persistent peers not provided, exiting..."
|
||||
exit 1
|
||||
else
|
||||
echo "Using persistent peers $PEERS"
|
||||
fi
|
||||
|
||||
laconicd start --gql-playground --gql-server --log_level $LOGLEVEL
|
||||
echo "Env:"
|
||||
echo "Moniker: $MONIKER"
|
||||
echo "Chain Id: $CHAIN_ID"
|
||||
echo "Genesis file: $GENESIS_FILE_URL"
|
||||
echo "Persistent peers: $PEERS"
|
||||
|
||||
NODE_HOME=/root/.laconicd
|
||||
|
||||
# Set chain id in config
|
||||
laconicd config set client chain-id $CHAIN_ID --home $NODE_HOME
|
||||
|
||||
# Check if node data dir already exists
|
||||
if [ -z "$(ls -A "$NODE_HOME/data")" ]; then
|
||||
# Init node
|
||||
echo "Initializing a new laconicd node with moniker $MONIKER and chain id $CHAIN_ID"
|
||||
laconicd init $MONIKER --chain-id=$CHAIN_ID --home $NODE_HOME
|
||||
|
||||
# Fetch genesis config
|
||||
echo "Fetching genesis file from $GENESIS_FILE_URL"
|
||||
curl -o $NODE_HOME/config/genesis.json $GENESIS_FILE_URL
|
||||
else
|
||||
echo "Node data dir $NODE_HOME/data already exists, skipping initialization..."
|
||||
fi
|
||||
|
||||
# Update config with persistent peers
|
||||
sed -i "s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/g" $NODE_HOME/config/config.toml
|
||||
|
||||
laconicd start --gql-playground --gql-server --log_level $LOGLEVEL --home $NODE_HOME
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Build cerc/laconicd
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
docker build -t cerc/laconic2d:local ${build_command_args} ${CERC_REPO_BASE_DIR}/laconic2d
|
||||
|
@ -10,31 +10,33 @@ Minimum hardware requirements:
|
||||
|
||||
## Clone the stack repo
|
||||
|
||||
```
|
||||
$ laconic-so fetch-stack git.vdb.to/cerc-io/testnet-laconicd-stack
|
||||
```bash
|
||||
laconic-so fetch-stack git.vdb.to/cerc-io/testnet-laconicd-stack
|
||||
```
|
||||
|
||||
## Clone required repositories
|
||||
|
||||
```
|
||||
$ laconic-so --stack ~/cerc/testnet-laconicd-stack/stacks/laconicd-full-node setup-repositories
|
||||
```bash
|
||||
laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconicd-full-node setup-repositories
|
||||
```
|
||||
|
||||
## Build the fixturenet-eth containers
|
||||
|
||||
```
|
||||
$ laconic-so --stack ~/cerc/testnet-laconicd-stack/stacks/laconicd-full-node build-containers
|
||||
```bash
|
||||
laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconicd-full-node build-containers
|
||||
```
|
||||
|
||||
This should create several container images in the local image registry:
|
||||
|
||||
* cerc/laconicd
|
||||
*
|
||||
* cerc/laconic2d
|
||||
* cerc/laconic-registry-cli
|
||||
* cerc/webapp-base
|
||||
* cerc/laconic-console-host
|
||||
|
||||
## Deploy the stack
|
||||
|
||||
```
|
||||
$ laconic-so --stack ~/cerc/testnet-laconicd-stack/stacks/laconicd-full-node deploy up
|
||||
```bash
|
||||
laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconicd-full-node deploy up
|
||||
```
|
||||
|
||||
## Check status
|
||||
@ -43,14 +45,16 @@ $ laconic-so --stack ~/cerc/testnet-laconicd-stack/stacks/laconicd-full-node dep
|
||||
|
||||
## Join as testnet validator
|
||||
|
||||
<!-- TODO -->
|
||||
<!-- TODO import a funded account / create an account and get it funded -->
|
||||
|
||||
<!-- TODO create a validator-->
|
||||
|
||||
## Clean up
|
||||
|
||||
Stop all services running in the background:
|
||||
|
||||
```bash
|
||||
$ laconic-so --stack ~/cerc/testnet-laconicd-stack/stacks/laconicd-full-node deploy down
|
||||
laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconicd-full-node deploy down
|
||||
```
|
||||
|
||||
Clear volumes created by this stack:
|
||||
|
Loading…
Reference in New Issue
Block a user