ocean-subgraph/docker
Matthias Kretschmann f1a8269036
Activate dependabot, build tweaks, green CI (#6)
* activate dependabot

* package updates

* move auto-generated typings, adapt .gitignore

* lint fix

* eslint config tweaks, turn off eqeqeq rule

* kick out Travis, switch to GitHub Actions

* Update the readme file.

* Add totalOceanLiquidity and fix TVL calculation

* add logs to track pool shares.

* lockedValue fix

* update variable names

* Feature/devel instructions (#19)

* improve developer docs

* fix readme

Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>

* update gitignore

Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>

* .env, and infura key

Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>

Co-authored-by: mihaisc <mihai.scarlat@smartcontrol.ro>

* merged/dependabot-tvl-fix (#21)

* Update the readme file.

* Add totalOceanLiquidity and fix TVL calculation

* add logs to track pool shares.

* update variable names

* fix error after merge

Co-authored-by: ssallam <travis@travis-ci.org>

* use const

Co-authored-by: ssallam <travis@travis-ci.org>
Co-authored-by: Alex Coseru <alex.coseru@gmail.com>
Co-authored-by: mihaisc <mihai.scarlat@smartcontrol.ro>
Co-authored-by: Samer <36411297+ssallam@users.noreply.github.com>
2021-02-09 11:13:31 +01:00
..
bin Activate dependabot, build tweaks, green CI (#6) 2021-02-09 11:13:31 +01:00
hooks Activate dependabot, build tweaks, green CI (#6) 2021-02-09 11:13:31 +01:00
.env.example Activate dependabot, build tweaks, green CI (#6) 2021-02-09 11:13:31 +01:00
docker-compose.yml Activate dependabot, build tweaks, green CI (#6) 2021-02-09 11:13:31 +01:00
README.md Activate dependabot, build tweaks, green CI (#6) 2021-02-09 11:13:31 +01:00
setup.sh Activate dependabot, build tweaks, green CI (#6) 2021-02-09 11:13:31 +01:00
start Activate dependabot, build tweaks, green CI (#6) 2021-02-09 11:13:31 +01:00
wait_for Activate dependabot, build tweaks, green CI (#6) 2021-02-09 11:13:31 +01:00

Graph Node Docker Image

Preconfigured Docker image for running a Graph Node.

Usage

docker run -it \
  -e postgres_host=<HOST> \
  -e postgres_port=<PORT> \
  -e postgres_user=<USER> \
  -e postgres_pass=<PASSWORD> \
  -e postgres_db=<DBNAME> \
  -e ipfs=<HOST>:<PORT> \
  -e ethereum=<NETWORK_NAME>:<ETHEREUM_RPC_URL> \
  graphprotocol/graph-node:latest

Example usage

docker run -it \
  -e postgres_host=host.docker.internal \
  -e postgres_port=5432 \
  -e postgres_user=graph-node \
  -e postgres_pass=oh-hello \
  -e postgres_db=graph-node \
  -e ipfs=host.docker.internal:5001 \
  -e ethereum=mainnet:http://localhost:8545/ \
  graphprotocol/graph-node:latest

Docker Compose

The Docker Compose setup requires an Ethereum network name and node to connect to. By default, it will use mainnet:http://host.docker.internal:8545 in order to connect to an Ethereum node running on your host machine. You can replace this with anything else in docker-compose.yaml.

Note for Linux users: On Linux, host.docker.internal is not currently supported. Instead, you will have to replace it with the IP address of your Docker host (from the perspective of the Graph Node container). To do this, run:

CONTAINER_ID=$(docker container ls | grep graph-node | cut -d' ' -f1)
docker exec $CONTAINER_ID /bin/bash -c 'apt install -y iproute2 && ip route' | awk '/^default via /{print $3}'

This will print the host's IP address. Then, put it into docker-compose.yml:

sed -i -e 's/host.docker.internal/<IP ADDRESS>/g' docker-compose.yml

After you have set up an Ethereum node—e.g. Ganache or Parity—simply clone this repository and run

docker-compose up

This will start IPFS, Postgres and Graph Node in Docker and create persistent data directories for IPFS and Postgres in ./data/ipfs and ./data/postgres. You can access these via:

  • Graph Node:
    • GraphiQL: http://localhost:8000/
    • HTTP: http://localhost:8000/subgraphs/name/<subgraph-name>
    • WebSockets: ws://localhost:8001/subgraphs/name/<subgraph-name>
    • Admin: http://localhost:8020/
  • IPFS:
    • 127.0.0.1:5001 or /ip4/127.0.0.1/tcp/5001
  • Postgres:
    • postgresql://graph-node:let-me-in@localhost:5432/graph-node

Once this is up and running, you can use graph-cli to create and deploy your subgraph to the running Graph Node.