diff --git a/docs/quickstart/quickstart_chains/near_migration_from_thegraph.md b/docs/quickstart/quickstart_chains/near_migration_from_thegraph.md new file mode 100644 index 00000000000..509bf830164 --- /dev/null +++ b/docs/quickstart/quickstart_chains/near_migration_from_thegraph.md @@ -0,0 +1,272 @@ +# Migration guide for Near. + +## Goals + +Migrate [thegraph example](https://github.com/graphprotocol/graph-tooling/tree/main/examples/near-blocks) to subquery + + + +**Original code before porting ([link](https://github.com/web3cdnservices/subquery-near-migration-from-thegraph-example/tree/4a10de0b048f7f68fb4f84b6de8b79ac40a85c03)** + +**Modified code for subquery indexers ([Link](https://github.com/web3cdnservices/subquery-near-migration-from-thegraph-example)** + +____ + + + +## 1. Update docker-compose.yml + +Open `docker-compose.yml` and fully override with content below. This container will help to debug. No changes required. + +``` +version: "3" + +services: + postgres: + build: + context: . + dockerfile: ./docker/pg-Dockerfile + ports: + - 5432:5432 + volumes: + - .data/postgres:/var/lib/postgresql/data + environment: + POSTGRES_PASSWORD: postgres + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres"] + interval: 5s + timeout: 5s + retries: 5 + + subquery-node: + image: onfinality/subql-node-near:latest + depends_on: + "postgres": + condition: service_healthy + restart: always + environment: + DB_USER: postgres + DB_PASS: postgres + DB_DATABASE: postgres + DB_HOST: postgres + DB_PORT: 5432 + volumes: + - ./:/app + command: + - sh + - -f=/app + - --db-schema=app + - --disable-historical=false + - --batch-size=10 + healthcheck: + test: ["CMD", "curl", "-f", "http://subquery-node:3000/ready"] + interval: 3s + timeout: 5s + retries: 10 + + graphql-engine: + image: onfinality/subql-query:latest + ports: + - 3000:3000 + depends_on: + "postgres": + condition: service_healthy + "subquery-node": + condition: service_healthy + restart: always + environment: + DB_USER: postgres + DB_PASS: postgres + DB_DATABASE: postgres + DB_HOST: postgres + DB_PORT: 5432 + command: + - --name=app + - --playground + - --indexer=http://subquery-node:3000 +``` + +## 2. Add packages as compose requirements. + +**create & open file (load-extensions )** +``` +mkdir -p docker && nano docker/load-extensions.sh +``` +And paste content: + +``` +#!/bin/sh + +psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <