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

bug: registry assets fail to load in prod build #121

Closed
conorsch opened this issue Oct 31, 2024 · 2 comments · Fixed by #125
Closed

bug: registry assets fail to load in prod build #121

conorsch opened this issue Oct 31, 2024 · 2 comments · Fixed by #125

Comments

@conorsch
Copy link
Contributor

conorsch commented Oct 31, 2024

Spent some time debugging a disparity between the deployed testnet-facing instance (https://dex-explorer.testnet.plinfra.net) and the local dev env. That investigation resulted in #120, which is good progress, but we're still not quite there: the v2 version now deployed doesn't load asset info correctly.

When running the prod build, I see in the browser network console a 404 when accessing this URL: https://raw.githubusercontent.com/prax-wallet/registry/main/registry/chains/.json That's obviously a concatenation error where the env var PENUMBRA_CHAIN_ID=penumbra-testnet-phobos-2 did not get interpolated into the string. It's definitely set, though, and the pnpm dev environment loads it just fine. Why isn't the chain id loading in the prod build?

Previously we were using the bundled version of the assets (#57 (comment)), but I believe recent work on the v2 interface moved that to remote fetching.

@grod220
Copy link
Contributor

grod220 commented Nov 1, 2024

Some ideas, but happy to pair on this though!

Wonder if we need to read from the build args and insert as env vars in the containerfile:

ARG PENUMBRA_GRPC_ENDPOINT
ENV PENUMBRA_GRPC_ENDPOINT=${PENUMBRA_GRPC_ENDPOINT}

Do we need to pass in secrets within the deploy action?

Another idea entirely is to write a env.production file with all the secrets (docs). Frontenders are using env.development locally and nextjs automatically loads the variables.

@conorsch
Copy link
Contributor Author

conorsch commented Nov 1, 2024

Ah, are you suggesting that the the code has regressed and we lost the ability to configure the asset registry info at runtime? In #73 we discussed the requirement to support multiple chains via our published image:

We currently build a container image, ghcr.io/penumbra-zone/dex-explorer, to make it easy for anyone to run a dex-explorer. There are currently multiple deployments, tracking different chains, based on this image. We must update the application config such that the same built artifact, i.e. the container, can be used to run against multiple chains.

For example, RC runs an instance and they need to be able to configure the correct chain info.

Do we need to pass in secrets within the deploy action?

No, we don't: the environment variables are provided to the container at runtime, via configuration management software that isn't visible in this repo. I've confirmed that the PENUMBRA_GRPC_ENDPOINT var is available inside the container context:

/app $ printenv | grep ^PENUMBRA_GRPC_ENDPOINT
PENUMBRA_GRPC_ENDPOINT=https://testnet.plinfra.net

Indeed, all the necessary env vars are available and correct:

/app $ printenv | grep ^PENUMBRA_ | cut -d= -f1 | sort
PENUMBRA_CHAIN_ID
PENUMBRA_CUILOA_URL
PENUMBRA_GRPC_ENDPOINT
PENUMBRA_INDEXER_CA_CERT
PENUMBRA_INDEXER_ENDPOINT

So I don't think the problem is that the env vars are absent, I think the problem is that the pnpm run build process is (again) generating code that does not accept runtime configuration for the chain id. We need to fix that behavior, so that the app remains configurable. We'd initially addressed that behavior in #80, but due to recent code churn, compounded by the fact that the testnet deployment wasn't working well (#120), it's likely we broke that behavior without noticing the implications.

What do you think, @grod220? Can we support the runtime config setup again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants