iotaledger / one-click-tangle

"One Click Tangle" intends to make lives easier to IOTA adopters by providing pre-configured scripts and recipes that allow to deploy IOTA Networks and Nodes "in one click".
MIT License
55 stars 36 forks source link

IOTA Explorer failure for private Tangle #86

Closed akov800 closed 1 year ago

akov800 commented 1 year ago

I am deploying a private chrysalis-based Tangle using the provided scripts. All of the main Docker containers are built and started properly: coo, node1, spammer and node-autopeering. However, when trying to install the IOTA Explorer, although the explorer-webapp container is up and running, the explorer-api fails. I receive the error "Network is not one of the valid network types" corresponding to the following lines of the explorer code:

https://github.com/iotaledger/explorer/blob/94a5bc12f33995b3cca4942d183ce1c63877b20b/api/src/services/networkService.ts#L83-L86

I found out that the network type ("tangle") configuration provided in the private-network.json config file does not correspond to any of the network types defined in the explorer's scripts, since "tangle" is not one of the available options. https://github.com/iotaledger/one-click-tangle/blob/e9cceb4f5c08a55b63dd82c7d27652bd15a7e36c/explorer/config/private-network.json#L1-L14

https://github.com/iotaledger/explorer/blob/94a5bc12f33995b3cca4942d183ce1c63877b20b/api/src/models/db/networkType.ts#L1-L18

First, I tried to fix this by modifying the explorer's script and adding a new network type called "tangle" so it matches to the one given in the configuration. Also, another workaround is to change the type in the private-network.json config file. I tried with the "mainnet" option and this way I finally managed to deploy the explorer-api container. However, when accessing the explorer web at http://localhost:8082 nothing was displayed, receiving the error shown in the next image where there seems to be a syntax error while executing the env.js script.

Explorer_Failure

Here come my questions: First, which of the available network types (defined in the explorer's script) is the most suitable for the deployed private Tangle? And second, any idea on how to solve the error occured while displaying the explorer graphical interface?

Technical notes: Ubuntu version: 20.04 Docker version: 23.01 Docker-compose version: 1.25.0

Thank you in advance!

jmcanterafonseca-iota commented 1 year ago

can you try with network: "custom" ?

akov800 commented 1 year ago

can you try with network: "custom" ?

I already tried this option, but I still get the same syntax error while rendering the explorer web app.

msarcev commented 1 year ago

Add a file named env.js in the client/public folder with this content

window.env = {
    API_ENDPOINT: 'http://localhost:4000/'
};

In there specify the URI of the Explorer-api (by default it should be as above). I'm sorry for this, i think we are missing this step in the setup docs. 😅

msarcev commented 1 year ago

Also, as you already noticed, the value for network in a network config cannot be "tangle" or anything that is not one of the defined values. I would suggest "mainnet" if you are using it for a Chrysalis network, or "custom" for a Stardust one.

akov800 commented 1 year ago

I have just applied the changes you suggested and it worked perfecly.

Thank you so much!