start.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/usr/bin/env bash
  2. set -e
  3. # Run a complete joystream development network on your machine using docker.
  4. # Make sure to run build-docker-images.sh prior to running this script to use
  5. # the local build.
  6. set -a
  7. . .env
  8. set +a
  9. # Clean start!
  10. docker-compose down -v
  11. function down()
  12. {
  13. # Stop containers and clear volumes
  14. docker-compose down -v
  15. }
  16. trap down EXIT
  17. # Run a local development chain
  18. docker-compose up -d joystream-node
  19. WS_PROVIDER_ENDPOINT_URI=ws://localhost:9944 SKIP_MOCK_CONTENT=true \
  20. ./tests/network-tests/run-test-scenario.sh setup-new-chain
  21. # Set sudo as the membership screening authority
  22. yarn workspace api-scripts set-sudo-as-screening-auth
  23. ## Query Node Infrastructure
  24. # Initialize a new database for the query node infrastructure
  25. docker-compose up -d db
  26. # Override DB_HOST for db setup
  27. # Make sure we use dev config for db migrations (prevents "Cannot create database..." and some other errors)
  28. export DB_HOST=localhost
  29. yarn workspace query-node config:dev
  30. # Migrate the databases
  31. yarn workspace query-node-root db:prepare
  32. yarn workspace query-node-root db:migrate
  33. # Set DB_HOST back to docker-service one
  34. export DB_HOST=db
  35. # Start processor and graphql server
  36. docker-compose up -d processor
  37. docker-compose up -d graphql-server
  38. ## Storage Infrastructure
  39. docker-compose run -d --name colossus-1 --entrypoint sh colossus-1 -c "\
  40. yarn storage-node server --queryNodeHost ${GRAPHQL_SERVER_HOST}:${GRAPHQL_SERVER_PORT} \
  41. --port ${COLOSSUS_CONTAINER_PORT} \
  42. --uploads /data --worker 0 \
  43. --accountUri=//testing//worker//Storage//0 \
  44. --apiUrl ${WS_PROVIDER_ENDPOINT_URI} \
  45. --sync --syncInterval=1 \
  46. --elasticSearchHost=${ELASTIC_SEARCH_HOST}"
  47. docker-compose up -d distributor-1
  48. docker-compose up -d pioneer
  49. echo "use Ctrl+C to shutdown the development network."
  50. while true; do
  51. read
  52. done