start.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. ## Query Node Infrastructure
  20. # Initialize a new database for the query node infrastructure
  21. docker-compose up -d db
  22. # Override DB_HOST for db setup
  23. export DB_HOST=localhost
  24. # Make sure we use dev config for db migrations (prevents "Cannot create database..." and some other errors)
  25. yarn workspace query-node config:dev
  26. # Migrate the databases
  27. yarn workspace query-node-root db:prepare
  28. yarn workspace query-node-root db:migrate
  29. # Set DB_HOST back to docker-service one
  30. export DB_HOST=db
  31. # Start processor and graphql server
  32. docker-compose up -d processor
  33. docker-compose up -d graphql-server
  34. ## Storage Infrastructure
  35. docker-compose run -d --name colossus --entrypoint sh colossus -c "yarn storage-node dev:init --apiUrl ${WS_PROVIDER_ENDPOINT_URI} && \
  36. yarn storage-node server --queryNodeHost ${QUERY_NODE_HOST} --port ${COLOSSUS_PORT} \
  37. --uploads /data --worker ${WORKER_ID} --apiUrl ${WS_PROVIDER_ENDPOINT_URI} --sync --syncInterval=1 \
  38. --keyFile=${ACCOUNT_KEYFILE} --elasticSearchHost=${ELASTIC_SEARCH_HOST}"
  39. docker-compose up -d distributor-node
  40. # Create a new content directory lead
  41. yarn workspace api-scripts initialize-content-lead
  42. # Set sudo as the membership screening authority
  43. yarn workspace api-scripts set-sudo-as-screening-auth
  44. docker-compose up -d pioneer
  45. echo "use Ctrl+C to shutdown the development network."
  46. while true; do
  47. read
  48. done