hashgraph / hedera-mirror-node-explorer

Hedera Mirror Node Explorer for the Hedera Hashgraph DLT.
Apache License 2.0
15 stars 12 forks source link

Be able to change the port that the Explorer listens on. #229

Closed reselbob closed 1 year ago

reselbob commented 2 years ago

Problem

Help, please, I can't locate the instructions for changing the port that the Hedera Node Explorer listens on.

It seems by default the port is 9090, but the machine I want to run the Explorer on already dedicates port 9090 to CoPilot.

How do I change the port for the Hedera Node Explorer, for example to 9050?

I can't seem to locate the information in the readme of for this repo.

Solution

N/A

Alternatives

N/A

svienot commented 2 years ago

You may launch the Explorer using npm run serve:prod, which will use port 38920 by default -- which you can change by editing the corresponding scripts target in the package.json file, located at the root of the repository. If you want to run in Docker, you can change the port 9090 into something else by editing the docker-compose.yml file.

nathanklick commented 2 years ago

Hi @reselbob, Are you using the npm run serve command to run your application?

If you are using the npm run serve command then you override the port as follows:

npm run serve -- --port 9050

Please let us know if the above addressed your issue or if you need any further assistance.

reselbob commented 2 years ago

WOW!!! Thanks for the fast reply. Your suggestions work.

I have a follow up question. I am trying to bind the Explorer to a local node I've setup using this code:

https://github.com/hashgraph/hedera-mirror-node

I altered the .env for the Explorer like so:

### The name of the product as shown in the footer tagline
VUE_APP_PRODUCT_NAME="Hedera Mirror Node Explorer"

### The prefix used in the document title
VUE_APP_DOCUMENT_TITLE_PREFIX="Hedera"

### The URL to which a click on the bottom-right sponsor logo will navigate
# VUE_APP_SPONSOR_URL="<URL of sponsor>"

### The URL of the 'Terms of Use' page
# VUE_APP_TERMS_OF_USE_URL="<URL>"

### The HTML content of the disclaimer notice displayed on the Rewards Estimator
# VUE_APP_ESTIMATOR_NOTICE='<HTML content>'

### The HTML content of the disclaimer popup dialog displayed by the Wallet Chooser
# VUE_APP_WALLET_CHOOSER_DISCLAIMER_POPUP='<HTML content>'

### When set to 'true', this variable will enable the 'Staking' page
VUE_APP_ENABLE_STAKING=false

### When set to 'true', this variable will enable the 'Blocks' page
VUE_APP_ENABLE_BLOCKS=true

### When set, these variables will cause the insertion of a custom menu item
### in the network selector pull-down menu of the TopNavBar
VUE_APP_LOCAL_MIRROR_NODE_MENU_NAME=LocalNode
VUE_APP_LOCAL_MIRROR_NODE_URL=http://localhost:5551/

I am using http://localhost:5551/ because that is the server address is use when accessing the API, like so:

curl localhost:5551/api/v1/transactions

Yet, no data is showing up in the Explorer under LocalNode, even when I create an account against that node. I fear I am doing something very wrong. Can you help me see the error of my ways @nathanklick @svienot ?

If not, I understand completely.

svienot commented 1 year ago

I assume that when you query your mirror-node REST API with curl, this actually returns data? To make sure the explorer set-up works, you can try to point to a public mirror node and check you get data. For instance with:

VUE_APP_LOCAL_MIRROR_NODE_URL=https://previewnet.mirrornode.hedera.com

If this works, then would you mind sending what your browser console shows when you try to access your local mirror node?

reselbob commented 1 year ago

Yes, @svienot I am getting data when I run curl localhost:5551/api/v1/transactions :

[{"account":"0.0.2","amount":-1,"is_approval":false},{"account":"0.0.55","amount":1,"is_approval":false}],"valid_duration_seconds":"120","valid_start_timestamp":"1663357397.092158473"},{"bytes":null,"charged_tx_fee":0,"consensus_timestamp":"1663357404.372987812","entity_id":null,"max_fee":"10000","memo_base64":"MTY2MzM1NzQwNDM2OSBNb25pdG9yIHBpbmdlciBvbiBmNzE2NTc2NDU0ZWY=","name":"CRYPTOTRANSFER","node":"0.0.3","nonce":0,"parent_consensus_timestamp":null,"result":"SUCCESS","scheduled":false,"transaction_hash":"08Hm4qWLvWDFe6bF/PPeHu5ffudzkyZUsF3bh5eE9xBRaaJegiVr/8g2ppXX3NMJ","transaction_id":"0.0.2-1663357395-864163174","transfers":[{"account":"0.0.2","amount":-1,"is_approval":false},{"account":"0.0.55","amount":1,"is_approval":false}],"valid_duration_seconds":"120","valid_start_timestamp":"1663357395.864163174"},{"bytes":null,"charged_tx_fee":0,"consensus_timestamp":"1663357403.420798245","entity_id":null,"max_fee":"10000","memo_base64":"MTY2MzM1NzQwMzM2OSBNb25pdG9yIHBpbmdlciBvbiBmNzE2NTc2NDU0ZWY=","name":"CRYPTOTRANSFER","node":"0.0.3","nonce":0,"parent_consensus_timestamp":null,"result":"SUCCESS","scheduled":false,"transaction_hash":"4E0x3XiHaEuAQgoOemR87s6vDRjQHCsGUi8VlCjWNfiiqVa6hLzpkHPQXuYFKmPY","transaction_id":"0.0.2-1663357390-624140591","transfers":[{"account":"0.0.2","amount":-1,"is_approval":false},{"account":"0.0.55","amount":1,"is_approval":false}],"valid_duration_seconds":"120","valid_start_timestamp":"1663357390.624140591"},{"bytes":null,"charged_tx_fee":0,"consensus_timestamp":"1663357402.418270366","entity_id":null,"max_fee":"10000","memo_base64":"MTY2MzM1NzQwMjM2OSBNb25pdG9yIHBpbmdlciBvbiBmNzE2NTc2NDU0ZWY=","name":"CRYPTOTRANSFER","node":"0.0.3","nonce":0,"parent_consensus_timestamp"

Wiring LocalNode into VUE_APP_LOCAL_MIRROR_NODE_URL=https://previewnet.mirrornode.hedera.com does indeed show data.

Here are some screen shot of LocalNode configured for VUE_APP_LOCAL_MIRROR_NODE_URL=http://localhost:5551/

Screen Shot 2022-09-16 at 12 54 03 PM

Screen Shot 2022-09-16 at 12 53 47 PM

ericleponner commented 1 year ago

Open developer panel of your navigator, goto console tab and look if there is any error details.

reselbob commented 1 year ago

Help @ericleponner I am not sure what you mean by "developer panel of your navigator". Are you talking about the Hashgraph Explorer or Developer console in Chrome? or something else?

Also @ericleponner Thank you for taking the time out of your day to help me out.

svienot commented 1 year ago

Yes, we meant open the Chrome Developer console to see potential errors output there.

reselbob commented 1 year ago

BTW @ericleponner I am getting a connection refused error from the browser, like so:

Let me check if I have the port open on the server.

Screen Shot 2022-09-16 at 3 17 31 PM

reselbob commented 1 year ago

But, when I use a browser on the server where the local node is running, I do see data for LocalNode.

reselbob commented 1 year ago

I opened port 5551 on the server, but I still get the ERROR_CONNECTION_REFUSED. But, when I run the Explorer from the actual server, I get data, as expected. I wonder, is there something I need to configure with the Local Node Server? Or the Explorer server? Again, thank you all so much for all the help you are giving me.

svienot commented 1 year ago

I am closing this issue since the configuration where a local instance of the explorer running in Docker connects to a local instance of the mirror-node running in Docker works just fine -- following the READMEs of both projects.