Use template for setting config variables for faucet

This commit is contained in:
Adw8 2024-07-17 10:00:46 +05:30
parent b00dcb66c8
commit 951580888a
6 changed files with 35 additions and 17 deletions

View File

@ -4,7 +4,9 @@ Stacks to run a node for laconic testnet
- [testnet-laconicd stack documentation](stack-orchestrator/stacks/testnet-laconicd/README.md) - [testnet-laconicd stack documentation](stack-orchestrator/stacks/testnet-laconicd/README.md)
- [laconic-console stack documentation](stack-orchestrator/stacks/laconic-console/README.md) (to run laconic registry CLI and console standalone) - [laconic-console stack documentation](stack-orchestrator/stacks/laconic-console/README.md) (to run laconic registry CLI and console standalone)
- [laconic-faucet stack documentation](stack-orchestrator/stacks/laconic-faucet/README.md)
## Testnet onboarding demo ## Testnet onboarding demo
Follow steps in [testnet-onboarding-demo.md](./testnet-onboarding-demo.md) to run demo for onboarding testnet participants in laconicd chain Follow steps in [testnet-onboarding-demo.md](./testnet-onboarding-demo.md) to run demo for onboarding testnet participants in laconicd chain

View File

@ -5,9 +5,13 @@ services:
environment: environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG} CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
CERC_FAUCET_KEY: ${CERC_FAUCET_KEY} CERC_FAUCET_KEY: ${CERC_FAUCET_KEY}
CERC_RPC_ENDPOINT: ${CERC_RPC_ENDPOINT}
entrypoint: "bash" entrypoint: "bash"
command: "./start-faucet.sh" command: "./start-faucet.sh"
volumes: volumes:
- ../config/laconic-faucet/start-faucet.sh:/app/start-faucet.sh - ../config/laconic-faucet/start-faucet.sh:/app/start-faucet.sh
- ../config/laconic-faucet/config-template.toml:/app/environments/config-template.toml
ports: ports:
- "3000:3000" - "3000:3000"
extra_hosts:
- "host.docker.internal:host-gateway"

View File

@ -0,0 +1,11 @@
[upstream]
rpcEndpoint = "REPLACE_WITH_RPC_ENDPOINT"
chainId = "laconic_9000-1"
denom = "photon"
prefix = "laconic"
faucetKey = "REPLACE_WITH_CERC_FAUCET_KEY"
[server]
transferAmount = 1000000
dailyLimit = 3000000
dbDir = "db"

View File

@ -6,16 +6,24 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x set -x
fi fi
toml_file="./environments/local.toml" config_template=$(cat environments/config-template.toml)
local_config="./environments/local.toml"
# Set faucet key from env # Set faucet key from env
faucet_key=${CERC_FAUCET_KEY} faucet_key=${CERC_FAUCET_KEY}
echo "The faucet key is $faucet_key"
# Update the faucetKey in local.toml rpc_endpoint=${CERC_RPC_ENDPOINT}
sed -i "s/faucetKey = \"\"/faucetKey = \"$faucet_key\"/" "$toml_file" echo "The RPC endpoint is $rpc_endpoint"
echo "Updated faucetKey in local.toml"
FAUCET_CONFIG=$(echo "$config_template" | \
sed -E "s|REPLACE_WITH_CERC_FAUCET_KEY|${faucet_key}|; s|REPLACE_WITH_RPC_ENDPOINT|${rpc_endpoint}|")
echo "$FAUCET_CONFIG" > $local_config
echo "Updated config file"
echo "Config.toml:"
cat $local_config
# Start node-js server # Start node-js server
echo "Starting faucet..."
yarn start-faucet yarn start-faucet
echo "Started faucet"

View File

@ -2,4 +2,4 @@
# Build cerc/laconic-faucet # Build cerc/laconic-faucet
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
docker build -t cerc/laconic-faucet:local ${build_command_args} ${CERC_REPO_BASE_DIR}/laconic-faucet docker build -t cerc/laconic-faucet:local ${build_command_args} ${CERC_REPO_BASE_DIR}/laconic-testnet-faucet

View File

@ -17,10 +17,10 @@ Instructions for running the laconic faucet server
* Clone the stack repo: * Clone the stack repo:
```bash ```bash
laconic-so fetch-stack git.vdb.to/cerc-io/laconic-testnet-faucet laconic-so fetch-stack git.vdb.to/cerc-io/testnet-laconicd-stack
``` ```
* Clone the laconic-faucet: * Clone the laconic-faucet respository:
```bash ```bash
laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-faucet setup-repositories laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-faucet setup-repositories
@ -57,20 +57,13 @@ Instructions for running the laconic faucet server
laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-faucet deploy create --spec-file laconic-faucet-spec.yml --deployment-dir laconic-faucet-deployment laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-faucet deploy create --spec-file laconic-faucet-spec.yml --deployment-dir laconic-faucet-deployment
``` ```
<!-- * Copy over the published testnet genesis file (`.json`) to data directory in deployment (`testnet-laconicd-deployment/data/laconicd-data/tmp`):
```bash
# Example
mkdir -p testnet-laconicd-deployment/data/laconicd-data/tmp
cp genesis.json testnet-laconicd-deployment/data/laconicd-data/tmp/genesis.json
``` -->
## Configuration ## Configuration
* Inside the `laconic-faucet-deployment` deployment directory, open `config.env` file and set following env variables: * Inside the `laconic-faucet-deployment` deployment directory, open `config.env` file and set following env variables:
```bash ```bash
CERC_FAUCET_KEY= CERC_FAUCET_KEY=
CERC_RPC_ENDPOINT=
``` ```
## Start the deployment ## Start the deployment