Skip to content

Commit

Permalink
update generate sh
Browse files Browse the repository at this point in the history
  • Loading branch information
wanwiset25 committed Dec 20, 2023
1 parent 8869924 commit 26d190b
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 12 deletions.
23 changes: 23 additions & 0 deletions subnet/deployment-generator/script/docker.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
CONFIG_PATH=~/subnet
#your current directory


#genesis config
NETWORK_NAME=localsubnet
NUM_MACHINE=1
NUM_SUBNET=3
MAIN_IP=192.168.1.1

#parentchain config
PARENTCHAIN=devnet
PARENTCHAIN_WALLET_PK=0x1111111111111111111111111111111111111111111111111111111111111111

# OS=mac

#docker image versions, default to stable
# VERSION_SUBNET
# VERSION_BOOTNODE
# VERSION_OBSERVER
# VERSION_RELAYER
# VERSION_STATS
# VERSION_FRONTEND
40 changes: 28 additions & 12 deletions subnet/deployment-generator/script/generate.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
#!/bin/bash
VERSION_GENERATOR="generator-csc"
VERSION_CSC="latest"
VERSION_SUBNET="featur-puppeth-generator"
docker pull xinfinorg/subnet-generator:$VERSION_GENERATOR
docker pull xinfinorg/csc:$VERSION_CSC
docker pull xinfinorg/xdcsubnets:$VERSION_SUBNET
VERSION_CSC="add-docker"
VERSION_SUBNET="feature-puppeth-docker-2"
echo 'checking docker images'
if [[ -z "$(docker images -q xinfinorg/subnet-generator:$VERSION_GENERATOR)" ]]; then # || echo "doesn't exist"
docker pull xinfinorg/subnet-generator:$VERSION_GENERATOR
fi
if [[ -z "$(docker images -q xinfinorg/csc:$VERSION_CSC)" ]]; then # || echo "doesn't exist"
docker pull xinfinorg/csc:$VERSION_CSC
fi
if [[ -z "$(docker images -q xinfinorg/xdcsubnets:$VERSION_SUBNET)" ]]; then # || echo "doesn't exist"
docker pull xinfinorg/xdcsubnets:$VERSION_SUBNET
fi

echo ''
echo 'generating configs'
current_dir="$(cd "$(dirname "$0")" && pwd)"
mkdir -p generated
docker run --env-file docker.env -v $current_dir/generated:/app/generated xinfinorg/subnet-generator:$VERSION_GENERATOR || gen_success=false
if [[ $gen_success == false ]]; then
echo 'configs generation failed'
exit 1
fi

docker run --env-file docker.env -v $(pwd)/generated:/app/generated xinfinorg/subnet-generator:$VERSION_GENERATOR && cd generated
echo 'generating genesis.json'
docker run -v $current_dir/generated/:/app/generated/ --entrypoint 'bash' xinfinorg/xdcsubnets:$VERSION_SUBNET /work/puppeth.sh || pup_success=false
if [[ $pup_success == false ]]; then
echo 'genesis.json generation failed'
exit 1
fi

# cd ..
# docker run --env-file generated/common.env \
# -v $(pwd)/generated/:/app/generated/ \
# --network host \
# --entrypoint 'bash' xinfinorg/subnet-generator:v0.1.6 ./deploy_csc.sh
# cd generated
echo 'subnet generation successful'

0 comments on commit 26d190b

Please sign in to comment.