Indexer Installation

This guide will walk you through setting up a self-hosted indexer API. before indexer service setup, user should have setup Endless fullnode and already connected to Endless network.

Please refer Sample configuration with index GRPC enabled

Pre-compile binary file with configuration

To run the indexer service we need to build configuration: config.toml. the content below for your reference:

stream_url="http://127.0.0.1:50051"
server="127.0.0.1:3000"
db_dir="endless_indexer_data"

Let’s go through some of these fields.

  • stream_url indexer service depends transaction sent by GRPC service.

    stream_url should points to endless-node GRPC endpoint, please refer Sample configuration with index GRPC enabled

  • server This is the URL service of endless-indexer. By default the value is 127.0.0.1:3000.

  • db_dir db_dir points to the directory where index service store db data. By default the value is endless_indexer_data

Run endless-index

Make sure the config.toml is located in the same directory as endless-index.

endless-index

All indexed data are saved under endless_indexer_data.

Prune endless_indexer_data and restart endless-index if user want to clear and rebuild the index from the scratch.

Docker

docker run command:

docker run -e APP_STREAM_URL=http://127.0.0.1:50051 -v $PWD/data:/app -p 3000:3000 endless-indexer

Here is a sample docker-compose.yaml to orchestrate endless-node and endless-indexer:

services:
  # Ensure that the default configuration file in `endless-node` has already been modified to enable index GRPC 
  # and point to the IP address and corresponding port of `endless-indexer`
  endless-node:
    image: endlesslab/endless-node:latest
    restart: unless-stopped

  endless-indexer:
    image: endlesslab/endless-indexer:latest
    depends_on:
      - endless-node
    environment: 
      - APP_STREAM_URL=http://127.0.0.1:50051
      - APP_SERVER=127.0.0.1:3000
      - APP_DB_DIR=/app/endless_indexer_data
    ports:
      - "3000:3000"
      - "50051:50051"
    volumes:
      - ./endless_indexer_data:/app/endless_indexer_data
    restart: unless-stopped

Endless-index API Doc

After ensure endless-index service is started, accessing http://localhost:3000/api/v2/spec will display the schema that conforms to the OpenAPI specification.

Last updated