diff options
author | Wei-Ning Huang <w@dexon.org> | 2018-07-20 09:52:52 +0800 |
---|---|---|
committer | missionliao <38416648+missionliao@users.noreply.github.com> | 2018-07-20 09:52:52 +0800 |
commit | dfa19fc2b4e38097334f4a30e159f9bcd92909c0 (patch) | |
tree | 718524746a0871a07a4a68dea43481e6ac841b39 /simulation/kubernetes/run_simulation.sh | |
parent | 46a84bff9ac419853550f7c17b13fb8633e507c9 (diff) | |
download | dexon-consensus-dfa19fc2b4e38097334f4a30e159f9bcd92909c0.tar dexon-consensus-dfa19fc2b4e38097334f4a30e159f9bcd92909c0.tar.gz dexon-consensus-dfa19fc2b4e38097334f4a30e159f9bcd92909c0.tar.bz2 dexon-consensus-dfa19fc2b4e38097334f4a30e159f9bcd92909c0.tar.lz dexon-consensus-dfa19fc2b4e38097334f4a30e159f9bcd92909c0.tar.xz dexon-consensus-dfa19fc2b4e38097334f4a30e159f9bcd92909c0.tar.zst dexon-consensus-dfa19fc2b4e38097334f4a30e159f9bcd92909c0.zip |
Implement simulation on a real network (#5)
simulation: implement simulation on a real network
Diffstat (limited to 'simulation/kubernetes/run_simulation.sh')
-rwxr-xr-x | simulation/kubernetes/run_simulation.sh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/simulation/kubernetes/run_simulation.sh b/simulation/kubernetes/run_simulation.sh new file mode 100755 index 0000000..88f9eee --- /dev/null +++ b/simulation/kubernetes/run_simulation.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +IMAGE_TAG=asia.gcr.io/cobinhood/dexcon-simulation:latest + + +build_binary() { + make DOCKER=true -C ../.. + cp -r ../../build . +} + +build_docker_image() { + docker build -t ${IMAGE_TAG} . + docker push ${IMAGE_TAG} +} + +start_simulation() { + kubectl delete deployment --all --force --grace-period=0 + sleep 10 + + kubectl apply -f peer-server.yaml + sleep 10 + kubectl apply -f validator.yaml +} + +main() { + local num_validators=$1 + + if [ "$num_validators" == "" ]; then + num_validators=7 + fi + + # Render configuration files. + sed "s/{{numValidators}}/$num_validators/" validator.yaml.in > validator.yaml + sed "s/{{numValidators}}/$num_validators/" config.toml.in > config.toml + + build_binary + build_docker_image + start_simulation +} + +main $* |