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

[Feature request] Support multiple SPR records via environment variable #525

Open
veaceslavdoina opened this issue Aug 24, 2023 · 6 comments

Comments

@veaceslavdoina
Copy link
Contributor

Is your feature request related to a problem? Please describe.
We can't pass multiple SPR records via environment variable CODEX_BOOTSTRAP_NODE.

Describe the solution you'd like
We should be able to pass multiple SPR records via environment variable, because now we can pass just a single one

export CODEX_BOOTSTRAP_NODE=spr:xxx,spr:yyy

codex

Now we get an error

"error":"Incorrect base64 string"

Describe alternatives you've considered
As for now, we can pass multiple SPR records only using CLI options

codex --bootstrap-node=spr:xxx --bootstrap-node=spr:yyy

Additional context
Environment variables is a very useful way to pass configuration, especially when we are using containers.

@AuHau
Copy link
Member

AuHau commented Aug 24, 2023

This is blocked by the library's support: status-im/nim-confutils#87

@AuHau AuHau added the feature label Aug 24, 2023
@veaceslavdoina
Copy link
Contributor Author

In oauth2-proxy, they also add a trailing S - Environment variables

Screenshot 2023-09-22 at 14 57 05

@veaceslavdoina
Copy link
Contributor Author

An example from Geth - it is plural

    --bootnodes value                                                      ($GETH_BOOTNODES)
          Comma separated enode URLs for P2P discovery bootstrap

@veaceslavdoina
Copy link
Contributor Author

One more note about how Codex and Geth handle bootstrap env variable

  • With Geth we can set docker-compose.yaml and pass GETH_BOOTNODES variable, even if it is empty - Geth will ignore it and start normally.
  • Codex will fail to start when CODEX_BOOTSTRAP_NODE variable is empty.

This is important because docker compose does not provide dynamic elements configuration and a single way to pass bootstrap nodes dynamically would be to use command: ${COMMAND} and compute it dynamically and this adds unnecessary logic.

details

Empty value

Geth - Run successfully

docker run --rm -e "GETH_BOOTNODES=" ethereum/client-go:alltools-v1.13.5 geth --verbosity=5


INFO [12-10|17:08:30.461] Config environment variable found        envvar=GETH_BOOTNODES

Codex - Failed to start

docker run --rm -e "CODEX_BOOTSTRAP_NODE=" codexstorage/nim-codex:latest codex --log-level=debug


[Chronicles] Log message not delivered: [Chronicles] A writer was not configured for a dynamic log output device. Log message not delivered: WRN 2023-12-10 17:09:34.941+00:00 Invalid SignedPeerRecord uri               tid=1 uri=

[Chronicles] Log message not delivered: [Chronicles] A writer was not configured for a dynamic log output device. Log message not delivered: {"lvl":"WRN","ts":"2023-12-10 17:09:34.941+00:00","msg":"Invalid SignedPeerRecord uri","tid":1,"uri":""}

[Chronicles] Log message not delivered: [Chronicles] A writer was not configured for a dynamic log output device. Log message not delivered: WRN 2023-12-10 17:09:34.941+00:00 Invalid SignedPeerRecord uri               tid=1 uri=

Wrong value

Geth - Failed to start

docker run --rm -e "GETH_BOOTNODES=text" ethereum/client-go:alltools-v1.13.5 geth --verbosity=5

INFO [12-10|17:12:11.439] Config environment variable found        envvar=GETH_BOOTNODES
INFO [12-10|17:12:11.450] Starting Geth on Ethereum mainnet...
INFO [12-10|17:12:11.451] Bumping default cache on mainnet         provided=1024 updated=4096
CRIT [12-10|17:12:11.452] Bootstrap URL invalid                    enode=text err="missing 'enr:' prefix for base64-encoded record"

Codex - Failed to start

docker run --rm -e "CODEX_BOOTSTRAP_NODE=text" codexstorage/nim-codex:latest codex --log-level=debug


[Chronicles] Log message not delivered: [Chronicles] A writer was not configured for a dynamic log output device. Log message not delivered: WRN 2023-12-10 17:13:47.099+00:00 Invalid SignedPeerRecord uri               tid=1 uri=text

[Chronicles] Log message not delivered: [Chronicles] A writer was not configured for a dynamic log output device. Log message not delivered: {"lvl":"WRN","ts":"2023-12-10 17:13:47.099+00:00","msg":"Invalid SignedPeerRecord uri","tid":1,"uri":"text"}

[Chronicles] Log message not delivered: [Chronicles] A writer was not configured for a dynamic log output device. Log message not delivered: WRN 2023-12-10 17:13:47.099+00:00 Invalid SignedPeerRecord uri               tid=1 uri=text

@veaceslavdoina
Copy link
Contributor Author

Same issue is with CODEX_LISTEN_ADDRS / --listen-addrs

docker run --rm -e 'CODEX_LOG_LEVEL=trace' -e 'CODEX_LISTEN_ADDRS=/ip4/0.0.0.0/tcp/7777, /ip4/0.0.0.0/tcp/8888' codexstorage/nim-codex

docker run --rm codexstorage/nim-codex codex --log-level=trace --listen-addrs='/ip4/0.0.0.0/tcp/7777, /ip4/0.0.0.0/tcp/8888'
Screenshot 2024-02-23 at 20 24 37

@dryajov
Copy link
Contributor

dryajov commented Feb 23, 2024

this isn't how you pass multiple values to codex, you need to repeat the option as many times as required - --listen-addrs='/ip4/0.0.0.0/tcp/7777' --listen-addrs='/ip4/0.0.0.0/tcp/8888'

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

No branches or pull requests

4 participants