Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable to run Local network with a consensus node and mirror node #1

Merged
merged 47 commits into from
Mar 2, 2022

Conversation

Neeharika-Sompalli
Copy link
Contributor

@Neeharika-Sompalli Neeharika-Sompalli commented Feb 24, 2022

Closes hashgraph/hedera-services#2893

  1. Combined the services and mirror node docker compose files to a single docker-compose.yml file
  2. Created compose-network folder to have all static files needed to start Local node
  3. Created network-logs folder to have all the logs generated from the run
  4. Removed submodules

The following tests are run:

  1. REST API queries for http://localhost:5551/api/v1/accounts?order=desc, http://localhost:5551/api/v1/transactions, http://localhost:5551/api/v1/balances?order=desc

  2. MINIO UI shows the recordStreams and accountBalances at http://localhost:9001/buckets/hedera-streams/

  3. GRPC tested with grpcurl -plaintext -d '{"file_id": {"fileNum": 102}, "limit": 0}' localhost:5600 com.hedera.mirror.api.proto.NetworkService/getNodes and streaming live messages when subscribed for topic
    image
    image

  4. Web3 tested with newman run hedera-mirror-web3/postman.json --env-var baseUrl=http://localhost:8545 and all tests passed
    image

README.md Outdated Show resolved Hide resolved
@Neeharika-Sompalli Neeharika-Sompalli changed the title Enable to run Local node with a consensus node and Mirror node Enable to run Local network with a consensus node and mirror node Feb 24, 2022
Comment on lines 12 to 23
db:
host: 127.0.0.1
loadBalance: true
name: mirror_node
owner: ${hedera.mirror.importer.db.username}
ownerPassword: ${hedera.mirror.importer.db.password}
password: mirror_node_pass
port: 5432
restPassword: mirror_api_pass
restUsername: mirror_api
schema: public
username: mirror_node

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section can be removed as it is the application defaults.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed. Thanks

.gitignore Outdated
Comment on lines 2 to 3
network-logs/node/*.log

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should ignore log files generated anywhere.

Suggested change
network-logs/node/logs/*.log
network-logs/node/*.log
*.log

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Modified

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't check in the .idea folder and add it to gitignore. Especially since this isn't a real project that needs anything more than a simple text editor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed .idea folder

mem_limit: 512m
memswap_limit: 512m
depends_on:
network-node:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't depend upon network-node. Should depend upon importer instead since he creates the schema.

Suggested change
network-node:
importer:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

depend on network-node is intentionally added to make sure consensus node is started first , before any mirror node components, to resolve some error. Modified to depend on importer , will re-test multiple times to see if no issues occur.

Comment on lines 282 to 283
volumes:
- ./compose-network/mirror-node/application.yml:/usr/etc/hedera-mirror-web3/application.yml

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks to be unneeded right now along with SPRING_CONFIG_ADDITIONAL_LOCATION.

Suggested change
volumes:
- ./compose-network/mirror-node/application.yml:/usr/etc/hedera-mirror-web3/application.yml

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it ! Was added from mirror-node project. Removed.

mem_limit: 512m
memswap_limit: 512m
depends_on:
network-node:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
network-node:
importer:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned before modified. But will re-test multiple times

mem_limit: 768m
memswap_limit: 768m
depends_on:
network-node:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depends on minio, not node

Suggested change
network-node:
minio:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here. Modified

REST_PASSWORD: mirror_api_pass
ROSETTA_PASSWORD: mirror_rosetta_pass
networks:
- mirror-node-bridge
Copy link

@steven-sheehy steven-sheehy Feb 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure your intent for the mirror-node-bridge network, but right now it encompasses the uploaders, minio and all mirror node components. I think we should separate that more and have a mirror-node network that contains db, importer, grpc, rest and web3. Then importer only could also be on a network that is common with minio.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two networks are added since network-node-potgres and db to not interfere with each other as both are on same port.
@steven-sheehy Do you mean to add third mirror-node network for clarity?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Neeharika-Sompalli Steven is suggesting adding a third network (eg: uploader-bridge) that includes minio, the uploaders and the mirror node importer. The mirror node importer would wind up being a member of two networks so it could access the PostgreSQL database.

Therefore, the importer would have a network section that looks something like this:

networks:
   - mirror-node-bridge
   - uploader-bridge

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What Nathan said, although disagree upon the naming:

networks:
  - mirror-node
  - cloud-storage

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -0,0 +1 @@
{"version":"1","format":"fs","id":"b43d434a-ae8b-4ed4-a7a6-0d80eda86ee8","fs":{"version":"2"}}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to check in a logs or data folder? This seems like an anti-pattern and makes it easy to check in files we should not that might contain sensitive information. It should just be created by whichever component that needs it and gitignored.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The minio-server/data folder is added to create hedera-streams bucket when the server starts. When tried using mb to create bucket, faced few issues.
Do you think it should not be done this way ?

Agreed, will add this folder to gitignore

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should auto-create the bucket, but the network-logs folder doesn't need to be checked in to do this. I think minio will auto create buckets for any folder under /data. So you just need to modify the entrypoint/command to create the dir if it doesn't exist. There's a number of solutions here. Something like this:

    entrypoint: sh
    command: -c 'mkdir -p /data/hedera-streams && /usr/bin/minio server /data'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed as Steven suggested using the command
command: -c 'mkdir -p /data/hedera-streams && minio server /data --console-address ":9001"'

README.md Outdated
@@ -1,15 +1,18 @@
# How to run a a mirror node with a local services code
# How to run a LocalNode with a mirror node and consensus node

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# How to run a LocalNode with a mirror node and consensus node
# How to run a local node with a mirror node and consensus node

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link

@steven-sheehy steven-sheehy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Nice work!

@Neeharika-Sompalli Neeharika-Sompalli changed the base branch from master to main March 2, 2022 20:31
@Neeharika-Sompalli Neeharika-Sompalli merged commit 6de4da6 into main Mar 2, 2022
@Neeharika-Sompalli Neeharika-Sompalli deleted the test-local-node branch March 2, 2022 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable developers to run Local node
4 participants