Skip to content

Instantly share code, notes, and snippets.

@dalechyn
Created May 17, 2024 18:43
Show Gist options
  • Save dalechyn/ba8ff2f8a3079556c8edf9cf0fee21d8 to your computer and use it in GitHub Desktop.
Save dalechyn/ba8ff2f8a3079556c8edf9cf0fee21d8 to your computer and use it in GitHub Desktop.
running-dockerized-subgraph.md

This readme describes how to run Abstract API via docker and how to pass custom network configurations.

Firstly, prepare a set of the networks you're planning to pass to the API instance. Such should conform the schema {[chainId]:{ rpc: string; versionControl: string }}.

In chainId parameter you must specify the chain id which will hold the following properties:

In rpc parameter you must specify network RPC URL. In versionControl parameter you must specify the address of Version Control contract deployed in that network.

I.e: { "phoenix-1": {"rpc":"https://rpc-proxy.abstract-os.workers.dev/phoenix-1/rpc","versionControl":"terra1hstp8gfjlg2reet90mgada3h8n9jf2d7tnd9r554h0d0q95lgq5q2fhp8v"}}

As you have it, you should pass it as an env argument to the docker instance, which you will run as follows:

docker run abstractsdk/subgraph:0.19 -e NETWORK_CONFIGURATION_MAP=<prepared_json> -p 4001:4001

So that the final example of running the API with the previously stated network configuration would look like this:

docker run abstractsdk/subgraph:0.19 -e NETWORK_CONFIGURATION_MAP='{"phoenix-1":{"rpc":"https://rpc-proxy.abstract-os.workers.dev/phoenix-1/rpc","versionControl":"terra1hstp8gfjlg2reet90mgada3h8n9jf2d7tnd9r554h0d0q95lgq5q2fhp8v"}}' -p 4001:4001

The API will be served and exposed via port 4001 and would be accessible at http://localhost:4001.

Happy hacking!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment