/indexer-coordinator

Coordinator service for indexers managing projects and connecting with Subquery Network

Primary LanguageTypeScriptApache License 2.0Apache-2.0

INDEXER COORDINATOR

Start with Docker

Start all the services: db service coordinator service and proxy service together with docker compose command.

Run Docker Compose

1

Indexer Management with Admin App

For the default configuration, open the indexer admin app with http://localhost:8000

2

Start With CLI

Install

npm install -g @subql/indexer-coordinator@0.1.1-10

Start Coordinator Service

Start a Postgres DB

Need to start a postgres DB server before run the coordinator service. The following is an example to start a service with docker:

# Install and start the db server
docker run --name "coordinator-server" -e POSTGRES_PASSWORD="postgres" \
    -e PGPASSWORD="postgres" \
    -p 5432:5432 \
    -d postgres

# Create db
docker exec -i "coordinator-server" psql -U postgres -c "create database \"coordinator\""

Run the Coordinator Command

  1. Show all the parameters
# Run the `help` command line
subql-coordinator -help

# All the parameters
Indexer Coordinator
  --network      Network type for the service
            [string] [choices: "local", "testnet", "mainnet"] [default: "local"]
  --ws-endpoint  Specify wss endpoint for this network       [string] [required]
  --port         Port the service will listen on        [number] [default: 8000]

Postgres
  --postgres-host      Postgres host                         [string] [required]
  --postgres-port      Postgres port                    [number] [default: 5432]
  --postgres-username  Postgres username          [string] [default: "postgres"]
  --postgres-password  Postgres password          [string] [default: "postgres"]
  --postgres-database  Postgres database name                [string] [required]

Options:
  --version  Show version number                                       [boolean]
  ---help
  1. Start coordinator service
subql-coordinator --network testnet \
    --ws-endpoint 'https://moonbeam-alpha.api.onfinality.io/public' \
    --postgres-host localhost \
    --postgres-database coordinator \
    --postgres-port 5432 \
    --port 8000
  1. Open Indexer Admin Dapp

Open the indexer-admin app with http://localhost:8000. The domain and port depends on the deployment.

Development

Run the following command to build the local image for the coordinator updates

  • docker-compose -f docker-compose-dev.yml up running the postgres and redis

  • Add coordinator_db to network hosts. open /etc/hosts, add 127.0.0.1 coordinator_db_dev

  • Start services in development:

    • indexer-admin: yarn start
    • indexer-coordinator: yarn start
    • indexer-proxy: cargo run