From 90bf55d1eb3d75d2cebd6f2cd4534ad7d98c584c Mon Sep 17 00:00:00 2001 From: Gabriel Montes Date: Wed, 6 Nov 2024 11:04:01 -0500 Subject: [PATCH 1/3] docker: use env vars for network/node in compose file By setting `NETWORK_NAME` and `ETHEREUM_RPC_URL` environment variables in reading those in the `docker-compose.yaml` file, customization will not require modifying the file. --- docker/README.md | 3 ++- docker/docker-compose.yml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docker/README.md b/docker/README.md index af95f4bbd52..1bdc39ef613 100644 --- a/docker/README.md +++ b/docker/README.md @@ -35,7 +35,8 @@ docker run -it \ 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`. +You can replace this with anything else in `docker-compose.yaml` or set the +environment variables `NETWORK_NAME` and `ETHEREUM_RPC_URL`. After you have set up an Ethereum node—e.g. Ganache or Parity—simply clone this repository and run diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index c78c2eb2194..36e8beba7b3 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -19,7 +19,7 @@ services: postgres_pass: let-me-in postgres_db: graph-node ipfs: 'ipfs:5001' - ethereum: 'mainnet:http://host.docker.internal:8545' + ethereum: ${NETWORK_NAME:-mainnet}:${ETHEREUM_RPC_URL:-http://host.docker.internal:8545} GRAPH_LOG: info ipfs: image: ipfs/kubo:v0.17.0 From 2496d27eae1f47751c9db475056376cea2354e85 Mon Sep 17 00:00:00 2001 From: Gabriel Montes Date: Wed, 6 Nov 2024 13:37:15 -0500 Subject: [PATCH 2/3] docker: allow setting PG user/pass with env vars The Docker compose file has hardcoded values for the Postgres user and password. This change allows setting other more secure values when starting up the processes. --- docker/docker-compose.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 36e8beba7b3..d2ba6cff338 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -15,8 +15,8 @@ services: - host.docker.internal:host-gateway environment: postgres_host: postgres - postgres_user: graph-node - postgres_pass: let-me-in + postgres_user: ${POSTGRES_USER:-graph-node} + postgres_pass: ${POSTGRESS_PASSWORD:-let-me-in} postgres_db: graph-node ipfs: 'ipfs:5001' ethereum: ${NETWORK_NAME:-mainnet}:${ETHEREUM_RPC_URL:-http://host.docker.internal:8545} @@ -38,8 +38,8 @@ services: "-cmax_connections=200" ] environment: - POSTGRES_USER: graph-node - POSTGRES_PASSWORD: let-me-in + POSTGRES_USER: ${POSTGRES_USER:-graph-node} + POSTGRES_PASSWORD: ${POSTGRESS_PASSWORD:-let-me-in} POSTGRES_DB: graph-node # FIXME: remove this env. var. which we shouldn't need. Introduced by # , maybe as a From 5ed77919b600d0d00580c14567f6e05cfa207297 Mon Sep 17 00:00:00 2001 From: Gabriel Montes Date: Wed, 6 Nov 2024 18:06:01 -0500 Subject: [PATCH 3/3] docker: remove ports not needed to be exposed --- docker/docker-compose.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index d2ba6cff338..1ec9bfd0adc 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -6,8 +6,6 @@ services: - '8000:8000' - '8001:8001' - '8020:8020' - - '8030:8030' - - '8040:8040' depends_on: - ipfs - postgres @@ -29,8 +27,6 @@ services: - ./data/ipfs:/data/ipfs:Z postgres: image: postgres - ports: - - '5432:5432' command: [ "postgres",