Skip to content

fix(docker): make devnet cluster workflow reproducible - #827

Open
keanji-x wants to merge 5 commits into
Galxe:mainfrom
keanji-x:codex/fix-docker-cluster-renderer
Open

fix(docker): make devnet cluster workflow reproducible#827
keanji-x wants to merge 5 commits into
Galxe:mainfrom
keanji-x:codex/fix-docker-cluster-renderer

Conversation

@keanji-x

@keanji-x keanji-x commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • synchronize the Docker devnet renderer with the current shared validator/reth templates
  • fail fast on undefined envsubst variables and invalid rendered reth JSON
  • make entrypoint and generated devnet config permissions deterministic under restrictive umasks
  • document the host artifact prerequisites, required example TOMLs, host gravity_cli build, and local image repository override

Problem

A clean run of docker/gravity_node/README.md had five independent blockers:

  1. render-cluster-config.sh omitted current identity, discovery, validator-port, storage/log, and txpool template variables, producing malformed YAML and invalid JSON.
  2. Dockerfile used chmod +x for entrypoint.sh; under umask 077 the image contained root-owned mode 0711, which the non-root gravity user could not read, so containers exited 126.
  3. The renderer inherited umask 077 and produced mode 0700 directories / 0600 public configs that uid 10001 could not read through the bind mount.
  4. The README artifact step omitted the required host gravity_cli build and creation of genesis.toml / cluster.toml from their examples.
  5. The build tags gravity_node:, while the documented Compose command only set IMAGE_TAG and therefore tried to pull galxe/gravity_node:.

Independent clean-room validation

A context-free agent followed the README from a detached clean worktree and reproduced all five failures before applying the minimal fixes represented by this PR. It then:

  • completed the source Docker build with Rust 1.93 (Cargo release: 7m56s)
  • generated fresh identities, genesis, and waypoint from gravity_chain_core_contracts main
  • rendered and started a fresh 4-validator + 1-VFN Compose project
  • observed three RPC samples eight seconds apart:
    • 98/98/98/99/97
    • 130/130/131/131/130
    • 166/166/167/167/167
  • later observed 427/428/428/428/427
  • verified with gravity_cli: epoch 2, four ACTIVE validators, no pending validators, total voting power 8
  • verified all five containers were running as user gravity with restart_count=0

The final validation cluster remains running for inspection.

Local checks

  • bash -n docker/gravity_node/render-cluster-config.sh
  • git diff --check
  • rendered reth JSON parses with jq
  • cargo +nightly-2026-09-02 fmt --all -- --check

Nightly rustfmt compatibility

The repository uses a floating nightly formatter in CI. The current nightly wraps long comments in three Rust files already present on main, so commit edac653 applies exactly those mechanical comment-only changes. It contains no logic changes.

@keanji-x keanji-x changed the title fix(docker): restore devnet cluster config rendering fix(docker): make devnet cluster workflow reproducible Sep 2, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: edac653ce6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

# These disposable devnet configs are bind-mounted into a container running as
# uid 10001. Keep their existing documented world-readable behavior even when
# the caller has a restrictive umask; never use this renderer for mainnet keys.
umask 022

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Normalize copied artifact modes

When the documented workflow is run under a restrictive umask (for example, umask 077; make init && make genesis), genesis.json and waypoint.txt are created as mode 0600. Changing the renderer's umask does not widen those files because the later cp operations preserve their source mode; only identity.yaml is explicitly chmodded. Consequently, the bind-mounted artifacts remain unreadable by container uid 10001 and every node can fail during genesis/waypoint loading. This can be reproduced by checking the rendered files with stat; copy these artifacts with an explicit mode or chmod them after copying.

AGENTS.md reference: AGENTS.md:L8-L12

Useful? React with 👍 / 👎.

ByteYue
ByteYue previously approved these changes Sep 3, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cb9e5e891f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +72 to +73
test -f genesis.toml || cp genesis.toml.example genesis.toml
test -f cluster.toml || cp cluster.toml.example cluster.toml

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require default configs before rendering hard-coded ports

When the checkout already contains ignored, customized cluster/genesis.toml or cluster/cluster.toml files, these guards preserve them even though the next step calls render-cluster-config.sh, whose set_ports table and node IDs are fixed to the example defaults. For example, changing node1's genesis validator port to 7180 makes make genesis embed 7180 in on-chain discovery while the rendered validator still listens on 6180, so the documented Compose cluster cannot reach consensus. Either render from the selected TOMLs or reject/non-destructively isolate non-default files; this can be validated by changing one example port, running steps 1–3, and comparing the genesis endpoint with config/node1/validator.yaml.

AGENTS.md reference: AGENTS.md:L8-L8

Useful? React with 👍 / 👎.

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

Successfully merging this pull request may close these issues.

3 participants