0

I have a subgraph that is running on a EC2 Instance and I want to be able to re-compile it, re-generate it and re-deploy it every time a configuration changes. When I say configuration, I refer to the smart contracts I want to track events for.

The commands I have to run are the following:

npx graph-compiler --config configs/config.json --include node_modules/@openzeppelin/subgraphs/src/datasources --export-schema --export-subgraph

graph create generated/sample --node http://127.0.0.1:8020

graph deploy --ipfs http://localhost:5001 --node http://localhost:8020 generated/sample ./generated/sample.subgraph.yaml

Does anybody have done this before and can provide an example of some scripts I can run to achieve this?

1 Answer 1

0

These are the scripts I finally created to achieve this:

compile.sh

#!/bin/bash

if [ $# -eq 0 ];
then
  echo "$0: Missing arguments"
  exit 1
elif [ $# -gt 2 ];
then
  echo "$0: Too many arguments: $@"
  exit 1
else
  npx graph-compiler --config $1 --include node_modules/@openzeppelin/subgraphs/src/datasourc>
fi

create.sh

#!/bin/bash

graph create generated/sample --node http://127.0.0.1:8020

deploy.sh

#!/bin/bash

graph deploy --ipfs http://localhost:5001 --node http://localhost:8020 generated/sample ./gen>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.