Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,47 @@ spec:
command:
- bash
- '-c'
- /scripts/create-genesis.sh
- >-
VAL_INDEX=${HOSTNAME##*-}

echo "Validator Index: $VAL_INDEX"


cp $CHAIN_DIR/cosmovisor/genesis/bin/$CHAIN_BIN /usr/bin


if [ -f $CHAIN_DIR/config/genesis.json ]; then
echo "Genesis file exists, exiting init container"
exit 0
fi


echo "Running setup genesis script..."

bash -e /scripts/create-genesis.sh

bash -e /scripts/update-genesis.sh


echo "Create node id json file"

NODE_ID=$($CHAIN_BIN tendermint show-node-id)

echo '{"node_id":"'$NODE_ID'"}' > $CHAIN_DIR/config/node_id.json


echo "Create consensus key json file"

$CHAIN_BIN tendermint show-validator >
$CHAIN_DIR/config/consensus_key.json

cat $CHAIN_DIR/config/consensus_key.json


echo "Add custom accounts and balances"

CHAIN_GENESIS_CMD=$($CHAIN_BIN 2>&1 | grep -q "genesis-related
subcommands" && echo "genesis" || echo "")
resources:
limits:
cpu: '2'
Expand Down Expand Up @@ -164,7 +204,15 @@ spec:
command:
- bash
- '-c'
- /scripts/update-config.sh
- |-
VAL_INDEX=${HOSTNAME##*-}
echo "Validator Index: $VAL_INDEX"

cp $CHAIN_DIR/cosmovisor/genesis/bin/$CHAIN_BIN /usr/bin

echo "Running setup config script..."

bash -e /scripts/update-config.sh
resources:
limits:
cpu: '2'
Expand Down Expand Up @@ -221,19 +269,21 @@ spec:
value: 'true'
- name: SLOGFILE
value: slog.slog
- name: DAEMON_NAME
value: persistenceCore
- name: DAEMON_HOME
value: /root/.persistenceCore
command:
- bash
- '-c'
- >-
- |-
#!/bin/bash

set -euo pipefail

START_ARGS=""

echo "Starting persistenceCore validator..."

exec persistenceCore start --home /root/.persistenceCore
--log_level info
/usr/bin/cosmovisor start $START_ARGS
resources:
limits:
cpu: '2'
Expand Down Expand Up @@ -301,31 +351,66 @@ spec:
- mountPath: /configs
name: addresses
- name: faucet
image: busybox:1.34.1
image: ghcr.io/cosmology-tech/starship/runner:latest
imagePullPolicy: IfNotPresent
env:
- name: FAUCET_CONCURRENCY
value: '5'
- name: FAUCET_PORT
- name: FAUCET_HTTP_PORT
value: '8000'
- name: FAUCET_CHAIN_BINARY
value: persistenceCore
- name: FAUCET_CHAIN_ID
value: core-1
- name: FAUCET_CHAIN_DENOM
value: uxprt
- name: FAUCET_CHAIN_PREFIX
value: persistence
- name: FAUCET_AMOUNT_SEND
value: '10000000'
- name: FAUCET_AMOUNT_STAKE
value: '10000000'
- name: FAUCET_RPC_ENDPOINT
value: http://localhost:26657
- name: FAUCET_REST_ENDPOINT
value: http://localhost:1317
- name: COINS
value: 100000000000000uxprt
command:
- sh
- bash
- '-c'
- /faucet/faucet
- >-
CREDIT_COINS=""

FEES=""

for coin in ${COINS//,/ }

do
amt="${coin//[!0-9]/}"
denom="${coin//[0-9]/}"

# Calculate the order of magnitude
if [ ${#amt} -gt 18 ]; then
creditAmt=$(echo $amt | sed -e "s/000000$//")
feesAmt=$(echo $amt | sed -e "s/0000000000000$//")
else
creditAmt=$(echo $amt | sed -e "s/0000$//")
feesAmt=$(echo $amt | sed -e "s/00000000$//")
fi

if [[ $CREDIT_COINS == "" ]]
then
CREDIT_COINS="$creditAmt$denom"
FEES="$feesAmt$denom"
else
CREDIT_COINS="${CREDIT_COINS},$creditAmt$denom"
fi
done


export FAUCET_MNEMONIC=$(jq -r ".faucet[0].mnemonic"
/configs/keys.json)


export | grep "FAUCET"


until bash -e /scripts/chain-rpc-ready.sh http://localhost:26657;
do
sleep 10
done


/faucet/faucet --credit-coins="$CREDIT_COINS" --chain-fees="$FEES"
resources:
limits:
cpu: '0.1'
Expand All @@ -338,6 +423,14 @@ spec:
name: addresses
- mountPath: /faucet
name: faucet
- mountPath: /scripts
name: scripts
readinessProbe:
httpGet:
path: /status
port: '8000'
initialDelaySeconds: 30
periodSeconds: 10
volumes:
- name: node
emptyDir: {}
Expand All @@ -347,3 +440,5 @@ spec:
- name: scripts
configMap:
name: setup-scripts-core-1
- name: faucet
emptyDir: {}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ metadata:
app.kubernetes.io/name: persistencecore
app.kubernetes.io/part-of: core-1
app.kubernetes.io/role: setup-scripts
starship.io/chain-name: persistencecore
starship.io/chain-id: core-1
data:
create-genesis.sh: >
#!/bin/bash
Expand Down
Loading
Loading