Had to change docker go-ipfs version down to v0.4.21
?
https://github.com/ipfs/go-ipfs
ssh -L 127.0.0.1:8020:127.0.0.1:8020 patrick@<IP>
http post localhost:8020 jsonrpc="2.0" id="1" method="subgraph_create" params:='{"name": "rtoken-project/rdai"}'
# id: a6cfb81317e96b821b0f8f40dafc7334
http post localhost:8020 jsonrpc="2.0" id="1" method="subgraph_deploy" params:='{"name": "rtoken-project/rdai", "ipfs_hash": "QmcfFeCEJx2gzfxS82JhdbumsiF7bNXBmr75MptbdEGNxx", "node_id":"indexer_2_untracked"}'
# timeout error??
docker exec <docker-id> ipfs get QmcfFeCEJx2gzfxS82JhdbumsiF7bNXBmr75MptbdEGNxx
docker exec graph_ipfs.1.8ubex0jv2vbyzclytb317pupb ipfs get QmcfFeCEJx2gzfxS82JhdbumsiF7bNXBmr75MptbdEGNxx
# Takes a long time to find it
Create another graph-node
with separate db user/password and database. Add labels to expose 8000
on private.indexer.pioneergraph.com
. You should be sure to use auth.
Keep in mind that traefik middleware BasicAuth
, all dollar signs in the hash need to be doubled for escaping read more
echo $(openssl passwd -apr1 password) | sed -e s/\\$/\\$\\$/g
Add another user to the database
docker exec -ti <docker-postgres-id> bash
psql -U indexer
CREATE DATABASE indexer_private;
CREATE ROLE indexer_private WITH PASSWORD '<password>' CREATEDB SUPERUSER LOGIN;
# exit and try with new user
psql -U indexer_private
CREATE DATABASE "graph-node-private";
yarn create-local
yarn deploy-local
# QmcZKCf2KEoujqZErX8uUrBs6ntyqjVVN4oRZocDK7yMK6
Now test it out
https://private.indexer.pioneergraph.com/subgraphs/id/QmcZKCf2KEoujqZErX8uUrBs6ntyqjVVN4oRZocDK7yMK6 https://private.indexer.pioneergraph.com/subgraphs/name/rtoken-project/rdai/graphql
If using graph-cli
then turn off https-redirect
, and don't use http
"deploy-local": "graph deploy --node http://user:[email protected]/admin --ipfs http://user:[email protected] rtoken-project/rdai",
http post 127.0.0.1:8020 jsonrpc="2.0" id="1" method="subgraph_reassign" params:='{"ipfs_hash": "QmcZKCf2KEoujqZErX8uUrBs6ntyqjVVN4oRZocDK7yMK6", "node_id": "indexer_2_untracked"}'
http post localhost:8020 jsonrpc="2.0" id="1" method="subgraph_create" params:='{"name": "rtoken-monorepo/rdai"}'
"create-local": "graph create --node http://user:[email protected]/admin rtoken-project/rdai",
"remove-local": "graph remove --node http://user:[email protected]/admin rtoken-project/rdai",
"deploy-local": "graph deploy --node http://user:[email protected]/admin --ipfs http://user:[email protected] rtoken-project/rdai",
DOCS
In this example we will use the subgraph rtoken-project/rdai
to demonstrate how you would deploy your own subgraph to your indexer.
First install graph-cli
, download the desired subgraph repo, and make any changes to the subgraph.yaml
# Install the graph-cli
npm i -g @graphprotocol/graph-cli
# Use any existing subgraph
git clone https://github.com/Jannis/gravity-subgraph.git && cd gravity-subgraph
Now we are ready to push our subgraph to our indexer.
In package.json
, add the following scripts (don't forget to add a comma in the line above)
"create-indexer": "graph create jannis/gravity --node http://127.0.0.1:8020",
"deploy-indexer": "graph deploy jannis/gravity --debug --ipfs https://testnet.thegraph.com/ipfs/ --node http://127.0.0.1:8020"
Now generate the files, and deploy
yarn
yarn codegen
yarn create-indexer
yarn deploy-indexer
If successful, you will see Deployed to http://127.0.0.1:8000/subgraphs/name/jannis/gravity/graphql
. Check that your subgraph is syncing using docker logs, as mentioned above, and happy querying!
size is 172GB
SELECT
pg_size_pretty (
pg_database_size ('graph-node-private')
);