Skip to content

feat(miner-deployment): add docker-compose.miner.yml for AMS fleet mode - #5299

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
davion-knight:feat-miner-compose-v2
Jul 12, 2026
Merged

feat(miner-deployment): add docker-compose.miner.yml for AMS fleet mode#5299
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
davion-knight:feat-miner-compose-v2

Conversation

@davion-knight

Copy link
Copy Markdown
Contributor

Adds packages/gittensory-miner/docker-compose.miner.yml so operators run the miner as a long-lived worker instead of a hand-assembled docker run (#5177). Built on the existing package Dockerfile.

Fixes vs the prior submission (#5266, closed on review)

  • Compose-precedence footgun (the closing defect): removed the hardcoded GITTENSORY_MINER_CONFIG_DIR from the compose environment block. Compose's environment silently overrides env_file, so advertising that var as an env-file override was a dead footgun. The state dir is now simply fixed at /data/miner (the Dockerfile default + the volume mount) and documented as such — no contradiction. Removed the matching line from .env.example.
  • Secret-file hygiene: added .gittensory-miner.env to .gitignore (keeping the committed .example), since the whole premise is that the filled-in file is never committed. Verified with git check-ignore.

Contents

  • docker-compose.miner.yml — a miner service built from the Dockerfile (monorepo-root context), command: ["run"], restart: unless-stopped, SQLite state on a named miner-data volume, credentials via env_file (nothing overridable pinned in environment).
  • .gittensory-miner.env.example — empty (scanner-safe) placeholders; .gitignore protects the real copy.
  • DEPLOYMENT.md — Docker Compose section: up usage + --scale with the honest SQLite-collision caveat and per-worker isolation patterns (separate compose projects / distinct config dirs; k8s StatefulSet for built-in isolation).

Validation

  • test/unit/miner-docker-compose.test.ts (5 tests): service built from the package Dockerfile + named volume + unless-stopped; credentials via env-file with a regression assertion that GITTENSORY_MINER_CONFIG_DIR is NOT pinned in environment (the closing defect); env example ships only empty placeholders; and .gitignore protects the real env file while keeping the example. The existing miner-deployment-doc.test.ts still passes.
  • YAML parses; tsc clean; prettier-clean; no hardcoded credentials. Static packaging only — no src/** logic touched.

Closes #5177

Add a compose file so operators run the miner as a long-lived worker instead of a
hand-assembled docker run (JSONbored#5177): a `miner` service built from the package Dockerfile,
`restart: unless-stopped`, SQLite state on a named `miner-data` volume, and credentials via
an env file (.gittensory-miner.env) rather than inlined — so tokens stay out of the compose
file and out of `docker inspect`. Documents `--scale miner=N` plus the honest caveat that a
shared volume corrupts the SQLite ledgers, with the per-worker isolation patterns (separate
compose projects or distinct config dirs; k8s StatefulSet for built-in isolation), in the
compose comments and DEPLOYMENT.md. Ships a scanner-safe .env.example (empty values) and a
validation test asserting the service contract + that no credential is hardcoded.

Closes JSONbored#5177
@davion-knight
davion-knight requested a review from JSONbored as a code owner July 12, 2026 13:17
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.37%. Comparing base (d56f4ec) to head (fc165a1).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5299   +/-   ##
=======================================
  Coverage   94.37%   94.37%           
=======================================
  Files         474      474           
  Lines       40128    40128           
  Branches    14631    14631           
=======================================
  Hits        37869    37869           
  Misses       1583     1583           
  Partials      676      676           
Flag Coverage Δ
shard-1 46.28% <ø> (-0.15%) ⬇️
shard-2 34.74% <ø> (+0.03%) ⬆️
shard-3 30.96% <ø> (-1.11%) ⬇️
shard-4 32.91% <ø> (+0.81%) ⬆️
shard-5 33.25% <ø> (-0.44%) ⬇️
shard-6 45.43% <ø> (+0.59%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 12, 2026
@loopover-orb

loopover-orb Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Tip

🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩

✅ Gittensory review result - approve/merge recommended

Review updated: 2026-07-12 13:24:55 UTC

5 files · 2 AI reviewers · no blockers · readiness 100/100 · CI green · unknown

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
Adds docker-compose.miner.yml plus an env-file example, .gitignore entries, and a structural test suite for a long-lived AMS fleet-mode miner worker, explicitly fixing the prior submission's environment/env_file precedence footgun by removing the hardcoded GITTENSORY_MINER_CONFIG_DIR override. The compose file, env example, gitignore, and tests are internally consistent, the state-dir fix is real (verified by the regression test asserting the var is absent from `environment`), and DEPLOYMENT.md is updated with matching usage and an honest SQLite multi-worker caveat. Diff is scoped tightly to the stated fleet-mode compose feature and closes #5177.

Nits — 5 non-blocking
  • docker-compose.miner.yml:22 hardcodes `image: gittensory-miner:latest` alongside a `build:` block — with multiple isolated compose projects (per the doc's own -p miner-1/-p miner-2 pattern) they'll all tag/reuse the same local image name unless each project builds and retags independently; worth a comment or `image: gittensory-miner:${TAG:-latest}` if that's a real concern for the documented scaling pattern.
  • test/unit/miner-docker-compose.test.ts:20-24 asserts `environment` doesn't contain secret-like keys via a `JSON.stringify` regex on `miner.environment ?? {}` — this passes trivially since the compose file never defines `environment` at all, so the test mostly just double-checks the YAML doesn't add one later rather than testing meaningful current behavior (still fine as a regression guard, but the coverage is thinner than the comment implies).
  • Consider documenting in DEPLOYMENT.md or the compose file comment what `image: gittensory-miner:latest` implies for the `-p miner-1`/`-p miner-2` isolated-worker pattern already documented, since each project would otherwise share/overwrite the same tag.
  • nit: packages/gittensory-miner/DEPLOYMENT.md:13 still says fleet mode scales horizontally by adding containers, but the new Compose section correctly says multiple containers sharing one volume will contend/corrupt, so change the table language to mention isolated state per worker.
  • nit: packages/gittensory-miner/DEPLOYMENT.md:62 still says launch additional containers with the same volume for parallel attempts, which contradicts the new SQLite collision caveat at packages/gittensory-miner/DEPLOYMENT.md:82; update that older bullet to require separate volumes/config dirs.
Signal Result Evidence
Code review ✅ No blockers 2 reviewers, synthesized
Linked issue ✅ Linked #5177
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 117 registered-repo PR(s), 85 merged, 2 issue(s).
Contributor context ✅ Confirmed Gittensor contributor davion-knight; Gittensor profile; 117 PR(s), 2 issue(s).
Gate result ✅ Passing No configured blocker found.
Improvement ⚠️ ℹ️ Insufficient signal risk: clean · value: insufficient-signal — Nothing measurable for the structural-improvement analyzers on this PR (e.g. no code files changed). LLM value judgment: moderate — The PR delivers a focused, tested operator-facing compose workflow that fixes a concrete precedence defect from the prior closed submission and is well-scoped to the linked issue #5177.
Review context
  • Author: davion-knight
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 117 PR(s), 2 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
[BETA] Chat with Gittensory

Ask Gittensory a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @gittensory ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @gittensory chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @gittensory mention with a real question is routed to the closest matching read-only command automatically -- no exact syntax required.

Full command reference: https://gittensory.aethereal.dev/docs/gittensory-commands

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Gittensory approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit df806cc into JSONbored:main Jul 12, 2026
17 checks passed
JSONbored added a commit that referenced this pull request Jul 28, 2026
…manifests

docker-compose.miner.yml and k8s/miner-deployment.yaml both invoked `run`
since their first commits (#5299, #5258) -- a subcommand the miner CLI has
never dispatched. A fleet worker built from either manifest sets up the
egress firewall, then immediately exits 1 with "Unknown command: run"
instead of ever mining. `loop` is the real continuous fleet-worker daemon.

Also extends the DEPLOYMENT.md docs-accuracy audit
(scripts/check-miner-deployment-docs.ts) to cross-check these container
manifests' commands against the CLI's registered-command table, the same
way it already does for markdown prose, so this drift class fails CI going
forward instead of only being caught by inspection.
JSONbored added a commit that referenced this pull request Jul 28, 2026
…manifests (#9524)

docker-compose.miner.yml and k8s/miner-deployment.yaml both invoked `run`
since their first commits (#5299, #5258) -- a subcommand the miner CLI has
never dispatched. A fleet worker built from either manifest sets up the
egress firewall, then immediately exits 1 with "Unknown command: run"
instead of ever mining. `loop` is the real continuous fleet-worker daemon.

Also extends the DEPLOYMENT.md docs-accuracy audit
(scripts/check-miner-deployment-docs.ts) to cross-check these container
manifests' commands against the CLI's registered-command table, the same
way it already does for markdown prose, so this drift class fails CI going
forward instead of only being caught by inspection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add docker-compose.miner.yml for AMS fleet mode with named services and restart policy

1 participant