You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.5 KiB

  1. #! /bin/bash
  2. set -eu
  3. DOCKER_IMAGE=$1
  4. NETWORK_NAME=$2
  5. IPV=$3
  6. ID=$4
  7. APP_PROXY=$5
  8. set +u
  9. NODE_FLAGS=$6
  10. set -u
  11. if [[ "$IPV" == 6 ]]; then
  12. IP_SWITCH="--ip6"
  13. else
  14. IP_SWITCH="--ip"
  15. fi
  16. echo "starting tendermint peer ID=$ID"
  17. # start tendermint container on the network
  18. # NOTE: $NODE_FLAGS should be unescaped (no quotes). otherwise it will be
  19. # treated as one flag.
  20. # test/p2p/data/mach$((ID-1)) data is generated in test/docker/Dockerfile using
  21. # the tendermint testnet command.
  22. if [[ "$ID" == "x" ]]; then # Set "x" to "1" to print to console.
  23. docker run \
  24. --net="$NETWORK_NAME" \
  25. $IP_SWITCH=$(test/p2p/address.sh $IPV $ID) \
  26. --name "local_testnet_$ID" \
  27. --entrypoint tendermint \
  28. -e TMHOME="/go/src/github.com/tendermint/tendermint/test/p2p/data/mach$((ID-1))" \
  29. -e GOMAXPROCS=1 \
  30. --log-driver=syslog \
  31. --log-opt syslog-address=udp://127.0.0.1:5514 \
  32. --log-opt syslog-facility=daemon \
  33. --log-opt tag="{{.Name}}" \
  34. "$DOCKER_IMAGE" node $NODE_FLAGS --log_level=debug --proxy_app="$APP_PROXY" &
  35. else
  36. docker run -d \
  37. --net="$NETWORK_NAME" \
  38. $IP_SWITCH=$(test/p2p/address.sh $IPV $ID) \
  39. --name "local_testnet_$ID" \
  40. --entrypoint tendermint \
  41. -e TMHOME="/go/src/github.com/tendermint/tendermint/test/p2p/data/mach$((ID-1))" \
  42. -e GOMAXPROCS=1 \
  43. --log-driver=syslog \
  44. --log-opt syslog-address=udp://127.0.0.1:5514 \
  45. --log-opt syslog-facility=daemon \
  46. --log-opt tag="{{.Name}}" \
  47. "$DOCKER_IMAGE" node $NODE_FLAGS --log_level=debug --proxy_app="$APP_PROXY"
  48. fi