46: Make it possible to launch fixturenet with or without the statediff DB. (#59)
* 46: Make it possible to launch fixturenet with or without the statediff DB. * Require the hostname as well.
This commit is contained in:
parent
bd9aaebe3d
commit
32edd7aea7
@ -31,7 +31,7 @@ services:
|
|||||||
fixturenet-eth-geth-2:
|
fixturenet-eth-geth-2:
|
||||||
hostname: fixturenet-eth-geth-2
|
hostname: fixturenet-eth-geth-2
|
||||||
environment:
|
environment:
|
||||||
CERC_RUN_STATEDIFF: "true"
|
CERC_RUN_STATEDIFF: "detect"
|
||||||
CERC_STATEDIFF_DB_NODE_ID: 2
|
CERC_STATEDIFF_DB_NODE_ID: 2
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "nc", "-v", "localhost", "8545"]
|
test: ["CMD", "nc", "-v", "localhost", "8545"]
|
||||||
@ -43,7 +43,6 @@ services:
|
|||||||
- ../config/fixturenet-eth/fixturenet-eth.env
|
- ../config/fixturenet-eth/fixturenet-eth.env
|
||||||
image: cerc/fixturenet-eth-geth:local
|
image: cerc/fixturenet-eth-geth:local
|
||||||
depends_on:
|
depends_on:
|
||||||
- migrations
|
|
||||||
- fixturenet-eth-bootnode-geth
|
- fixturenet-eth-bootnode-geth
|
||||||
|
|
||||||
fixturenet-eth-bootnode-lighthouse:
|
fixturenet-eth-bootnode-lighthouse:
|
||||||
|
@ -17,3 +17,4 @@ CERC_STATEDIFF_DB_PORT=5432
|
|||||||
CERC_STATEDIFF_DB_NAME="cerc_testing"
|
CERC_STATEDIFF_DB_NAME="cerc_testing"
|
||||||
CERC_STATEDIFF_DB_USER="vdbm"
|
CERC_STATEDIFF_DB_USER="vdbm"
|
||||||
CERC_STATEDIFF_DB_PASSWORD="password"
|
CERC_STATEDIFF_DB_PASSWORD="password"
|
||||||
|
CERC_STATEDIFF_DB_GOOSE_MIN_VER=23
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
FROM skylenet/ethereum-genesis-generator@sha256:210353ce7c898686bc5092f16c61220a76d357f51eff9c451e9ad1b9ad03d4d3 AS ethgen
|
FROM skylenet/ethereum-genesis-generator@sha256:210353ce7c898686bc5092f16c61220a76d357f51eff9c451e9ad1b9ad03d4d3 AS ethgen
|
||||||
|
|
||||||
FROM cerc/go-ethereum:local
|
FROM cerc/go-ethereum:local
|
||||||
RUN apk add --no-cache python3 python3-dev py3-pip curl wget jq build-base gettext libintl openssl bash
|
RUN apk add --no-cache python3 python3-dev py3-pip curl wget jq build-base gettext libintl openssl bash bind-tools postgresql-client
|
||||||
|
|
||||||
COPY --from=ethgen /usr/local/bin/eth2-testnet-genesis /usr/local/bin/eth2-testnet-genesis
|
COPY --from=ethgen /usr/local/bin/eth2-testnet-genesis /usr/local/bin/eth2-testnet-genesis
|
||||||
COPY --from=ethgen /usr/local/bin/eth2-val-tools /usr/local/bin/eth2-val-tools
|
COPY --from=ethgen /usr/local/bin/eth2-val-tools /usr/local/bin/eth2-val-tools
|
||||||
|
@ -22,8 +22,33 @@ else
|
|||||||
|
|
||||||
echo -n "$JWT" > /opt/testnet/build/el/jwtsecret
|
echo -n "$JWT" > /opt/testnet/build/el/jwtsecret
|
||||||
|
|
||||||
|
if [ "$CERC_RUN_STATEDIFF" == "detect" ] && [ -n "$CERC_STATEDIFF_DB_HOST" ]; then
|
||||||
|
if [ -n "$(dig $CERC_STATEDIFF_DB_HOST +short)" ]; then
|
||||||
|
echo "Statediff DB at $CERC_STATEDIFF_DB_HOST"
|
||||||
|
CERC_RUN_STATEDIFF="true"
|
||||||
|
else
|
||||||
|
echo "No statediff DB available."
|
||||||
|
CERC_RUN_STATEDIFF="false"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
STATEDIFF_OPTS=""
|
STATEDIFF_OPTS=""
|
||||||
if [ "$CERC_RUN_STATEDIFF" == "true" ]; then
|
if [ "$CERC_RUN_STATEDIFF" == "true" ]; then
|
||||||
|
ready=0
|
||||||
|
while [ $ready -eq 0 ]; do
|
||||||
|
echo "Waiting for statediff DB..."
|
||||||
|
sleep 1
|
||||||
|
export PGPASSWORD="$CERC_STATEDIFF_DB_PASSWORD"
|
||||||
|
result=$(psql -h "$CERC_STATEDIFF_DB_HOST" \
|
||||||
|
-p "$CERC_STATEDIFF_DB_PORT" \
|
||||||
|
-U "$CERC_STATEDIFF_DB_USER" \
|
||||||
|
-d "$CERC_STATEDIFF_DB_NAME" \
|
||||||
|
-t -c 'select max(version_id) from goose_db_version;' 2>/dev/null | awk '{ print $1 }')
|
||||||
|
if [ -n "$result" ] && [ $result -ge $CERC_STATEDIFF_DB_GOOSE_MIN_VER ]; then
|
||||||
|
echo "DB ready..."
|
||||||
|
ready=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
STATEDIFF_OPTS="--statediff=true \
|
STATEDIFF_OPTS="--statediff=true \
|
||||||
--statediff.db.host=$CERC_STATEDIFF_DB_HOST \
|
--statediff.db.host=$CERC_STATEDIFF_DB_HOST \
|
||||||
--statediff.db.name=$CERC_STATEDIFF_DB_NAME \
|
--statediff.db.name=$CERC_STATEDIFF_DB_NAME \
|
||||||
|
Loading…
Reference in New Issue
Block a user