Router Operator

Guide for Deploying Connext Subgraphs from P2P

Learn more about deploying a Connext Subgraph

jazkamer

Author

The Connext Academy’s router operators team from p2p.org created this guide on deploying subgraphs.

Before you start

If you are using hetzner, gcp, aws you need to use server profile for your ipfs node. More info can be found here

Also you can save a lot of disk space by disabling the block_hash for graph-node:
GRAPH_ETHEREUM_CLEANUP_BLOCKS: 'true'

It can lead to an increasing number of total rpc requests.

System requirements

RAM CPU DISK
16GB or more 8 vcore At least 10G for each subgraph with GRAPH_ETHEREUM_CLEANUP_BLOCKS set to true

Also you need to have an archive RPC node for each chain.

How to deploy self-hosted subgraph

As an example subgraph we will deploy matic subgraph on ubuntu 20.0.4

  1. Install all needed packages:
Copy to Clipboard
  1. Copy graph repo:
Copy to Clipboard
  1. Change rpc-provider url in docker-compose:
Copy to Clipboard
  1. Change port mappings for graph-node to localhost
Copy to Clipboard
  1. Clone connext repo

Be sure that you are using graph version 0.21.1 (Because current subgraphs use api version 0.0.4)

  1. Compile subgraph (config are stored in ./configs directory)
Copy to Clipboard
  1. Create subgraph and deploy it (make sure that graph docker-compose is up and running)
  1. Check subgraph
  1. Wait for subgraph to get synced
  1. You can setup nginx in front of graph-node, or change port mappings and open node to the world
  1. Add self-hosted subgraph for the router by providing config param subgraph in the chainConfig section

Monitoring

You can use this exporter to monitor your subgraphs. Also you can find alerts in this repo too.