ondratra f801dea4ea query node - .env file cleaning před 3 roky
..
generated f801dea4ea query node - .env file cleaning před 3 roky
mappings 71af8763ca Merge branch 'query_node_featured_video_update_fix' into query_node_sumer_features_lint před 3 roky
scripts f3a066535a Merge branch 'master' into sumer-new-substrate-update-apps před 3 roky
.gitignore 3ef0c05306 add missing export and files generated by warthog před 3 roky
README.md 27dfe5a50b query node - graphql playground settings + reenabling relation id fields před 3 roky
bootstrap.sh 12fb4bd0b5 query node - members and workers bootstrapping před 3 roky
build.sh c7caa0ecf8 query node - processor types link rework před 3 roky
manifest.yml 06009f6b80 query node - mappings for events emitted from 2 different extrinsics před 3 roky
package.json edc401c32b query node - lint command added to query node's package.json před 3 roky
run-tests.sh 7a3e697569 github workflow do not stop joystream-node when starting tests před 3 roky
schema.graphql 95bbe0e958 query node - predictable ids III před 3 roky

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.

1. Bootstrap

Run

yarn && yarn bootstrap

and generate the model files as defined in schema.graphql, create the database and run all the necessary migrations in one shot.

NB! Don't use in production, as it will delete all the existing records.

2. Generate Types for events and extrinsics

A separate tool Hydra Typegen can be used for generating Typescript classes for the event handlers (the mappings).
Run

yarn typegen

to run the typegen for events and extrinsics defined in manifest.yml (it fetches the metadata from an RPC endpoint and blockhash defined there).

3. Build Mappings

Mappings is a separated TypeScript module created in the mappings folder. The handlers exported by the module should match the ones defined in manifest.yml in the mappings section. Once the necessary files are generated, build it with

yarn mappings:build

4. Run the processor and the GraphQL server

Then run the processor:

yarn processor:start

Afterwards start the GraphQL server in a separate terminal (opens a GraphQL playground at localhost by default):

yarn query-node:start:dev

5. Locally hosted indexer

The Hydra Indexer endpoint used by Hydra processor is defined as environment variable INDEXER_ENDPOINT_URL sourced from .env. There are publicly available Hydra indexers for Polkadot and Subsocial. For other chains, a self-hosted indexer should be used.

The simplest way to run an indexer locally is to run docker-compose-indexer.yml with docker-compose. The following environment variables must be provided:

  • 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