graphprotocol / graph-node

Graph Node indexes data from blockchains such as Ethereum and serves it over GraphQL
https://thegraph.com
Apache License 2.0
2.89k stars 962 forks source link

unable to run the project on aws ec2 #3051

Open tharinduk90 opened 2 years ago

tharinduk90 commented 2 years ago

Do you want to request a feature or report a bug? unable to run the project What is the current behavior? unable to run the project

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

i am trying to run the graph node , in aws ec2 (ubuntu 18.04.6 LTS 4 GB RAM, GNU/Linux 5.4.0-1060-aws x86_64 ) with aws rds postgres sql db (without using ssl/tls)

1) In ec2, install IPFS and run ipfs init followed by ipfs daemon.

Capture

2) Create PostgreSQL DB in aws rds 3) In ec2 , clone https://github.com/graphprotocol/graph-node did, cargo build 4) cargo run -p graph-node --release -- \ --postgres-url postgresql://SUPER_USER:SUPER_USER_PW@DBURL....rds.amazonaws.com:5432/graphdb \ --ethereum-rpc mainnet:https://mainnet.infura.io/v3/INFURA_ID --ipfs 127.0.0.1:5001

5) In ec2 , clone https://github.com/graphprotocol/example-subgraph , then did yarn yarn codegen yarn create-local yarn deploy-local

the i notice that in the db some tables has created.But as soon as i hit "yarn deploy-local", it give me error

✖ Failed to deploy to Graph node http://127.0.0.1:8020/: subgraph resolve error: resolve error: No IPFS clients were supplied to handle the call to object.stat. File: QmXfCx2FYrBhbm7WP8Mn5N error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Capture

and the logs from the graph-node says.

warning: graph-node (lib) generated 4 warnings Finished release [optimized] target(s) in 0.31s Running target/release/graph-node --postgres-url 'postgresql://postgres:abcd1234@database-2.cyf4genvizjn.us-east-1.rds.amazonaws.com:5432/graphdb' --ethereum-rpc 'mainnet:https://main9' Dec 10 11:22:43.942 INFO Graph Node version: v0.25.0 (4bdb0640b 2021-12-01) Dec 10 11:22:43.942 INFO Generating configuration from command line arguments Dec 10 11:22:43.942 INFO Starting up Dec 10 11:22:43.942 INFO Creating transport, capabilities: archive, traces, url: https://mainnet.infura.io/v3/6e7e3dc04b744e2f8ab3c4e965eb0839, provider: mainnet-rpc-0 Dec 10 11:22:44.025 INFO Connecting to Postgres, weight: 1, conn_pool_size: 10, url: postgresql://postgres:HIDDEN_PASSWORD@database-2.cyf4genvizjn.us-east-1.rds.amazonaws.com:5432/graphdb, Dec 10 11:22:44.026 INFO Pool successfully connected to Postgres, pool: main, shard: primary, component: Store Dec 10 11:22:44.081 INFO Setting up fdw, pool: main, shard: primary, component: ConnectionPool Dec 10 11:22:44.097 INFO Running migrations, pool: main, shard: primary, component: ConnectionPool Dec 10 11:22:44.103 INFO Migrations finished, pool: main, shard: primary, component: ConnectionPool Dec 10 11:22:44.103 INFO Mapping primary, pool: main, shard: primary, component: ConnectionPool Dec 10 11:22:44.135 INFO Connecting to Ethereum to get network identifier, capabilities: archive, traces, provider: mainnet-rpc-0 Dec 10 11:22:44.145 INFO Connected to Ethereum, capabilities: archive, traces, network_version: 1, provider: mainnet-rpc-0 Dec 10 11:22:44.151 INFO Creating LoadManager in disabled mode, component: LoadManager Dec 10 11:22:44.152 INFO Starting block ingestors with 1 chains [mainnet] Dec 10 11:22:44.152 INFO Starting block ingestor for network, network_name: mainnet Dec 10 11:22:44.152 INFO Starting job runner with 3 jobs, component: JobRunner Dec 10 11:22:44.155 INFO Starting JSON-RPC admin server at: http://localhost:8020, component: JsonRpcServer Dec 10 11:22:44.155 INFO Starting GraphQL HTTP server at: http://localhost:8000, component: GraphQLServer Dec 10 11:22:44.155 INFO Starting index node server at: http://localhost:8030, component: IndexNodeServer Dec 10 11:22:44.155 INFO Starting metrics server at: http://localhost:8040, component: MetricsServer Dec 10 11:22:44.155 INFO Started all assigned subgraphs, node_id: default, count: 0, component: SubgraphRegistrar Dec 10 11:22:44.156 INFO Starting GraphQL WebSocket server at: ws://localhost:8001, component: SubscriptionServer Dec 10 11:22:57.343 INFO Syncing 1 blocks from Ethereum., code: BlockIngestionStatus, blocks_needed: 1, blocks_behind: 1, latest_block_head: 13777094, current_block_head: 13777093, provider Dec 10 11:23:33.068 INFO Syncing 1 blocks from Ethereum., code: BlockIngestionStatus, blocks_needed: 1, blocks_behind: 1, latest_block_head: 13777095, current_block_head: 13777094, provider Dec 10 11:23:42.772 INFO Syncing 2 blocks from Ethereum., code: BlockIngestionStatus, blocks_needed: 2, blocks_behind: 2, latest_block_head: 13777097, current_block_head: 13777095, provider

Dec 10 11:24:00.514 INFO Syncing 1 blocks from Ethereum., code: BlockIngestionStatus, blocks_needed: 1, blocks_behind: 1, latest_block_head: 13777098, current_block_head: 13777097, provider Dec 10 11:24:02.056 INFO Received subgraph_deploy request, params: SubgraphDeployParams { name: SubgraphName("example"), ipfs_hash: DeploymentHash("QmXfCx2FYrBhbm7WP8Mn5N6ERbY3jfKVqjntZZYmyer Dec 10 11:24:02.056 ERRO subgraph_deploy failed, params: SubgraphDeployParams { name: SubgraphName("example"), ipfs_hash: DeploymentHash("QmXfCx2FYrBhbm7WP8Mn5N6ERbY3jfKVqjntZZYmyNhPRy"), n(No IPFS clients were supplied to handle the call to object.stat. File: QmXfCx2FYrBhbm7WP8Mn5N6ERbY3jfKVqjntZZYmyNhPRy)), component: JsonRpcServer Dec 10 11:24:28.220 INFO Syncing 1 blocks from Ethereum., code: BlockIngestionStatus, blocks_needed: 1, blocks_behind: 1, latest_block_head: 13777099, current_block_head: 13777098, provider: mainnet-rpc-0, component: BlockIngestor Dec 10 11:24:34.981 INFO Syncing 1 blocks from Ethereum., code: BlockIngestionStatus, blocks_needed: 1, blocks_behind: 1, latest_block_head: 13777100, current_block_head: 13777099, provider: mainnet-rpc-0, component: BlockIngestor Dec 10 11:24:54.956 INFO Syncing 1 blocks from Ethereum., code: BlockIngestionStatus, blocks_needed: 1, blocks_behind: 1, latest_block_head: 13777101, current_block_head: 13777100, provider: mainnet-rpc-0, component: BlockIngestor Dec 10 11:25:11.082 INFO Syncing 1 blocks from Ethereum., code: BlockIngestionStatus, blocks_needed: 1, blocks_behind: 1, latest_block_head: 13777102, current_block_head: 13777101, provider: mainnet-rpc-0, component: BlockIngestor Dec 10 11:25:19.226 INFO Syncing 1 blocks from Ethereum., code: BlockIngestionStatus, blocks_needed: 1, blocks_behind: 1, latest_block_head: 13777103, current_block_head: 13777102, provider: mainnet-rpc-0, component: BlockIngestor Dec 10 11:25:23.014 INFO Syncing 1 blocks from Ethereum., code: BlockIngestionStatus, blocks_needed: 1, blocks_behind: 1, latest_block_head: 13777104, current_block_head: 13777103, provider: mainnet-rpc-0, component: BlockIngestor Dec 10 11:25:38.103 INFO Syncing 1 blocks from Ethereum., code: BlockIngestionStatus, blocks_needed: 1, blocks_behind: 1, latest_block_head: 13777105, current_block_head: 13777104, provider: mainnet-rpc-0, component: BlockIngestor

Capture_2

6) for the testing i allowed all the inbound/outbound ports in aws ec2

What is the expected behavior?

should run without any issue.

Can some one help me on this matter ? I am unable to fix the issue and get it to run.

leoyvens commented 2 years ago

At glance can't provide much help other than it looks like an issue in the connection between graph node and the ipfs node.

tharinduk90 commented 2 years ago

@leoyvens thank you very much for the reply. The graph node communicate with ipfs via port 5001.Both are in the same ec2 and port 5001 is running.Is their can way i can trouble shoot the problem ?

ronidee commented 2 years ago

I'm getting the exact same error, using e2-micro (gcp), yet I'm running postgres locally (localhost:5432) and using the --ethereum-ws parameter.

The instance of the node had following to say about it (which is essentially the same as the result of yarn deploy-local): Note: my "deployment hash" happens to be the same as for OP. I didn't go through the source yet, probably that's intended, as we probably both used the example subgraph(?)

ERRO subgraph_deploy failed, params: SubgraphDeployParams { name: SubgraphName("example"), ipfs_hash: DeploymentHash("QmXfCx2FYrBhbm7WP8Mn5N6ERbY3jfKVqjntZZYmyNhPRy"), node_id: None }, error: ResolveError(ResolveError(No IPFS clients were supplied to handle the call to object.stat. File: QmXfCx2FYrBhbm7WP8Mn5N6ERbY3jfKVqjntZZYmyNhPRy)), component: JsonRpcServer.

Edit: what am I supposed to enter as the version label? I just left it blank or put v0.0.1 there

tharinduk90 commented 2 years ago

@ronidee. After the above issue, I tried with https://hub.docker.com/r/graphprotocol/graph-node. And it worked.

https://github.com/graphprotocol/graph-node/tree/master/docker

the only difference i did was , run the ipfs daemon with screen (https://linuxize.com/post/how-to-use-linux-screen/). (you can run it as a service).

After this i did not run the original code . But the docker works.Data saved in PostgreSQL.

I added a version number and keep on increasing with every deployment.

Since we use the same example- graph (same code) , it will generate same hash.

tharinduk90 commented 2 years ago

i checked, with the graph-node (not the docker) giving the same error, it is not working,

ERRO subgraph_deploy failed, params: SubgraphDeployParams { name: SubgraphName("example"), ipfs_hash: DeploymentHash("QmXfCx2FYrBhbm7WP8Mn5N6ERbY3jfKVqjntZZYmyNhPRy"), node_id: None }, error: ResolveError(ResolveError(No IPFS clients were supplied to handle the call to object.stat. File: QmXfCx2FYrBhbm7WP8Mn5N6ERbY3jfKVqjntZZYmyNhPRy)), component: JsonRpcServer

But the docker is working (https://hub.docker.com/r/graphprotocol/graph-node) .

Can some one help me one this ?

ronidee commented 2 years ago

@tharinduk90 did you build the docker image yourself or used the one you linked? I am having issues building it myself (the "extra step for linux users"). And how did you connect the graph-node inside the docker container to your local ethereum node?

If this is too off-topic I apologize. Please delete my comment then, I'll create a separate issue for it then.

tharinduk90 commented 2 years ago

I used the docker that has been published.Did not try to build the docker image.Fo ubuntu I did not able to run the project, the mentioned error occurs.

I connected the the graph-node inside the docker container to local(host) ipfs node like below, hope this will help.

sudo docker run -it --network="host" \ -e postgres_host=DATABASE_URL \ -e postgres_port=5432 \ -e postgres_user=POSTGRES_USER\ -e postgres_pass= POSTGRES_PW \ -e postgres_db=graph-node \ -e ipfs=http://127.0.0.1:5001 \ -e ethereum=mainnet:https://mainnet.infura.io/v3/INFURA_ID \ graphprotocol/graph-node:latest

http://127.0.0.1:5001 => this is running in host

https://docs.docker.com/network/host/

azf20 commented 2 years ago

hi @tharinduk90 - to confirm, the issue you are having is still when you yarn deploy-local? Does it work if you use

-e ipfs=http://host.docker.internal:5001
fergmolina commented 2 years ago

@tharinduk90 @ronidee hey guys, did you solve the issue? if so, can you tell us how? I'm having the same problem locally. Thanks!