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

Can't use Railway private networking between ENSNode and ENSRainbow service #218

Open
tk-o opened this issue Feb 11, 2025 · 6 comments
Open
Labels
ensnode ENSNode related ensrainbow ENSRainbow related

Comments

@tk-o
Copy link
Contributor

tk-o commented Feb 11, 2025

Setting ENSRAINBOW_URL env var for ENSNode deployment to http://${{ENSRainbow.RAILWAY_PRIVATE_DOMAIN}} results in connections errors, for example:

TypeError: fetch failed
    at Module.labelByHash (/app/apps/ensnode/src/lib/graphnode-helpers.ts:29:24)
    at /app/apps/ensnode/src/handlers/Registry.ts:133:31
  27 |  **/
  28 | export async function labelByHash(labelhash: Labelhash): Promise<string | null> {
> 29 |   const healResponse = await ensRainbowApiClient.heal(labelhash);
     |                        ^
  30 |
  31 |   if (healResponse.status === StatusCode.Success) {
  32 |     // original label found for the labelhash
caused by: Error: connect ECONNREFUSED fd12:11c:7a35:0:8000:4:d9f1:6886:80
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1610:16)

However, setting the same ENSRAINBOW_URL env var to https://${{ENSRainbow.RAILWAY_PUBLIC_DOMAIN}} allows network communication. It happens through a public network, so adds lots of connection overhead.

That's why we need to make the private connection to work.

@tk-o tk-o added ensnode ENSNode related ensrainbow ENSRainbow related labels Feb 11, 2025
@tk-o tk-o added this to ENSNode Feb 11, 2025
@lightwalker-eth
Copy link
Member

@tk-o Would it help if we used these? https://docs.railway.com/guides/variables

@BanaSeba
Copy link
Collaborator

@tk-o I was able to use a private endpoint in the beta environment. We should double-check whether it's still an issue

@tk-o
Copy link
Contributor Author

tk-o commented Feb 21, 2025

@BanaSeba and I caught up and figured why my previous attempt to connect ENSNode and ENSRainbow over private network did not work.

Railway networking

Railway Private Domain (RAILWAY_PRIVATE_DOMAIN) is an IPv6 address, followed by port number, for example:

fd12:11c:7a35:0:8000:4:d9f1:6886:80

Railway Public Domain (RAILWAY_PUBLIC_DOMAIN) is... well a public domain, for example:

api.ensrainbow.io

and it can be mapped to any internal service port, for example map 80 to 8080:

Image

ENSRainbow ports

ENSRainbow runs on Railway infrastructure, which sets deployment port to 8080 by default. Connection attempts over port 80 get refused

Error: connect ECONNREFUSED fd12:11c:7a35:0:8000:4:d9f1:6886:80

On the other hand, the public URL reference worked as the public domain that ENSRainbow service uses is mapped from external port 80 to internal port 8080.

@tk-o
Copy link
Contributor Author

tk-o commented Feb 21, 2025

We could fix the issue with the following steps:

  1. Set an explicit port number for ENSRainbow runtime by setting the ENSRAINBOW_INTERNAL_PORT env var in Shared Variables panel
    Image

  2. Use the ENSRAINBOW_INTERNAL_PORT reference and set the PORT env var for ENSRailway service.
    Image

  3. Use the ENSRAINBOW_INTERNAL_PORT reference and set the ENSRAINBOW_URL env var for ENSNode Alpha/Subgraph services.
    Image

@tk-o
Copy link
Contributor Author

tk-o commented Feb 21, 2025

@BanaSeba plans to test the recommended solution out on the beta environment.

Rolling out any updates to alpha environment requires approval from @lightwalker-eth.

@tk-o tk-o moved this to Todo in ENSNode Feb 21, 2025
@tk-o
Copy link
Contributor Author

tk-o commented Feb 21, 2025

Solving this issue should improve I/O time needed for communication between ENSNode and ENSRainbow services.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ensnode ENSNode related ensrainbow ENSRainbow related
Projects
Status: Todo
Development

No branches or pull requests

3 participants