Joystream Stats 1e81c42be3 use host pg service from docker containers (olympia) 2 anos atrás
..
codegen 1898705979 query node - graphql playground fix and query templates IV 2 anos atrás
mappings 0aacf87b2d Fix entries status updates after the judgement period 2 anos atrás
schemas 49d6a9c1ec Add `WorkSubmittedEvent.bounty` 2 anos atrás
.gitignore 8cd0d2d850 Merge branch 'giza_feature_NewContentFeaturesAndNFT' into olympia 2 anos atrás
CHANGELOG.md f4bc6875f1 Fix typos 2 anos atrás
README.md e4deee9576 Merge branch 'master' into olympia-update-from-master 2 anos atrás
build.sh ad83afe7fe query node - graphql playground fix and query templates 2 anos atrás
kill.sh 1e81c42be3 use host pg service from docker containers (olympia) 2 anos atrás
manifest.yml 1e81c42be3 use host pg service from docker containers (olympia) 2 anos atrás
package.json 42cf5603e8 query node - active video counters generalization 2 anos atrás
run-tests.sh 42cf5603e8 query node - active video counters generalization 2 anos atrás
start.sh 1e81c42be3 use host pg service from docker containers (olympia) 2 anos atrás

README.md

Query node

This is a query-node project generated by hydra-cli. Experiment by modifying schema.graphql and the mappings in the mappings folder, defined in manifest.yml.

For more information about Hydra see: https://dzhelezov.gitbook.io/hydra/

1. Building the node

Run

# Make sure these steps are executed first:
# yarn build:packages; # OR:
# yarn && yarn workspace @joystream/types build && yarn workspace @joystream/metadata-protobuf build
yarn workspace query-node-root build

This will generate event decorations for the mappings via hydra-typegen inside mappings/generated (based on the runtime metadata saved in ../chain-metadata.json) and a graphql-server along with the TypeORM models based on schema.graphql inside generated/graphql-server.

2. Building the mappings

In order to re-build the mappings only, without re-generating the graphql-server code and event decorations (in case there were no changes in the runtime and schema.graphql) you can also run:

yarn workspace query-node-mappings build

3. Initializing the database and starting the node

yarn workspace query-node-root start

This script script will:

  • Bring up joystream-node service (if not already started)
  • Bring up db service (query node is using a PostgreSQL database to store the data)
  • Configure the database (yarn workspace query-node config:dev)
  • Create the database and initialize schema (yarn workspace query-node-root db:prepare && yarn workspace query-node-root db:processor:migrate)
  • Start the GraphQL server service (docker-compose up -d graphql-server)
  • Start the Hydra Processor responsible for processing the runtime events and running the mappings' functions (docker-compose up -d processor)

4. Stopping the node and removing all associated containers

You can stop the query-node and remove all associated docker containers without affecting any other services by running:

yarn workspace query-node-root kill
  • Database connection settings: DB_NAME, DB_HOST, DB_PORT, DB_USER, DB_PASS
  • Chain RPC endpoint: WS_PROVIDER_ENDPOINT_URI
  • If non-standard types are being used by the Substrate runtime, map type definitions in the json format as an external volume

Follow the links for more information about the indexer service and indexer-api-gateway.

GraphQL Playground assets url

Query node's user interface, GraphQL Playground, is expecting to be served at /graphql. If you are serving the files on path like /query/server/graphql via some nginx proxy, aliasing, etc. you will need to provide the base url to query node server via GRAPHQL_PLAYGROUND_CDN environment variable.

# use the following when serving playground at `/query/server/graphql`
GRAPHQL_PLAYGROUND_CDN="query/server" yarn workspace query-node-root query-node:start:dev