run-test-node.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/usr/bin/env bash
  2. set -e
  3. SCRIPT_PATH="$(dirname "${BASH_SOURCE[0]}")"
  4. cd $SCRIPT_PATH
  5. # Location that will be mounted as the /data volume in containers
  6. # This is how we access the initial members and balances files from
  7. # the containers and where generated chainspec files will be located.
  8. DATA_PATH=${DATA_PATH:=./data}
  9. # Initial account balance for Alice
  10. # Alice is the source of funds for all new accounts that are created in the tests.
  11. ALICE_INITIAL_BALANCE=100000000
  12. mkdir -p ${DATA_PATH}
  13. echo "{
  14. \"balances\":[
  15. [\"5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY\", ${ALICE_INITIAL_BALANCE}]
  16. ]
  17. }" > ${DATA_PATH}/initial-balances.json
  18. # Make Alice a member
  19. echo '
  20. [{
  21. "member_id": 0,
  22. "root_account": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
  23. "controller_account": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
  24. "handle":"alice_with_a_long_handle",
  25. "avatar_uri":"https://alice.com/avatar.png",
  26. "about":"Alice",
  27. "name": "Alice",
  28. "registered_at_time": 0
  29. },
  30. {
  31. "member_id": 1,
  32. "root_account": "5FUeDYFzvvizNhhHyidsuchG7jnToKj7zfimbWBpWKzT9Fqe",
  33. "controller_account": "5FUeDYFzvvizNhhHyidsuchG7jnToKj7zfimbWBpWKzT9Fqe",
  34. "handle":"bob_with_a_long_handle",
  35. "avatar_uri":"https://bob.com/avatar.png",
  36. "about":"Bob",
  37. "name": "Bob",
  38. "registered_at_time": 0
  39. }
  40. ]
  41. ' > ${DATA_PATH}/initial-members.json
  42. function cleanup() {
  43. rm -Rf ${DATA_PATH}/alice
  44. }
  45. trap cleanup EXIT
  46. # Create a chain spec file
  47. ../../target/release/chain-spec-builder new -a Alice \
  48. --chain-spec-path ${DATA_PATH}/chain-spec.json \
  49. --initial-balances-path ${DATA_PATH}/initial-balances.json \
  50. --initial-members-path ${DATA_PATH}/initial-members.json \
  51. --deployment dev \
  52. --sudo-account 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
  53. ../../target/release/joystream-node --base-path ${DATA_PATH}/alice \
  54. --validator --chain ${DATA_PATH}/chain-spec.json --alice --unsafe-ws-external --rpc-cors all