Skip to content

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

Closed
davion-knight wants to merge 1 commit into
JSONbored:mainfrom
davion-knight:feat-miner-compose
Closed

feat(miner-deployment): add docker-compose.miner.yml for AMS fleet mode#5266
davion-knight wants to merge 1 commit into
JSONbored:mainfrom
davion-knight:feat-miner-compose

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.

Contents

  • docker-compose.miner.yml — a miner service built from the Dockerfile (monorepo-root context), command: ["run"] (continuous worker), restart: unless-stopped, SQLite state on a named miner-data volume, and credentials via env_file (not inlined).
  • .gittensory-miner.env.example — env template with empty values (real values go in an uncommitted .gittensory-miner.env; nothing credential-like is committed).
  • DEPLOYMENT.md — a Docker Compose section: up usage + scaling. It documents --scale miner=N and the honest caveat that a shared miner-data volume corrupts the miner’s SQLite ledgers (not safe for concurrent access), with the per-worker isolation patterns: separate compose projects (-p miner-1 …) or distinct GITTENSORY_MINER_CONFIG_DIR mounts — and points at the k8s/ StatefulSet for built-in isolated scaling.

Validation

  • test/unit/miner-docker-compose.test.ts (4 tests): the service is built from the package Dockerfile with the named volume + unless-stopped restart, credentials come from an env file (no secret-named key assigned a value in the compose), and the env example ships only empty placeholders. The existing miner-deployment-doc.test.ts still passes (required DEPLOYMENT.md sections preserved).
  • YAML parses; tsc typecheck clean; prettier-clean; no hardcoded credentials. Static packaging only — no src/** logic, no runtime control-flow 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 12:38
@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.36%. Comparing base (738c8ca) to head (7ce82ec).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5266   +/-   ##
=======================================
  Coverage   94.36%   94.36%           
=======================================
  Files         474      474           
  Lines       40096    40096           
  Branches    14620    14620           
=======================================
  Hits        37836    37836           
  Misses       1585     1585           
  Partials      675      675           
Flag Coverage Δ
shard-1 46.25% <ø> (-0.15%) ⬇️
shard-2 34.75% <ø> (+0.01%) ⬆️
shard-3 32.06% <ø> (-0.05%) ⬇️
shard-4 31.83% <ø> (-0.20%) ⬇️
shard-5 33.54% <ø> (-0.16%) ⬇️
shard-6 45.08% <ø> (+0.30%) ⬆️

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 12:51:34 UTC

4 files · 1 AI reviewer · no blockers · readiness 100/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
Adds docker-compose.miner.yml plus an env-example template and DEPLOYMENT.md docs to run the miner as a long-lived worker instead of a hand-assembled docker run, closing #5177. The compose file, env template, and docs are internally consistent (build context ../.., correct Dockerfile path, env_file for credentials, named volume for SQLite state), and the added test asserts the structural contract rather than fabricating an unreachable scenario. The most notable detail is the honest documentation of the shared-volume `--scale` hazard for SQLite, with concrete isolation guidance (per-project `-p` namespacing or distinct GITTENSORY_MINER_CONFIG_DIR) rather than silently shipping a footgun.

Blockers

  • packages/gittensory-miner/docker-compose.miner.yml:36 hardcodes GITTENSORY_MINER_CONFIG_DIR in the compose environment, so an operator following packages/gittensory-miner/.gittensory-miner.env.example:11 to override that variable through the env file will be silently ignored by Compose's precedence rules; remove the hardcoded environment entry or change it to an interpolated default such as `GITTENSORY_MINER_CONFIG_DIR: ${GITTENSORY_MINER_CONFIG_DIR:-/data/miner}`.
Nits — 5 non-blocking
  • The compose file hardcodes `image: gittensory-miner:latest` alongside a `build` block; on a second `up` without `--build` Compose may reuse a stale local image with that tag if one already exists from an unrelated build — worth a one-line note or drop the explicit `image:` key so Compose derives a project-scoped default.
  • packages/gittensory-miner/docker-compose.miner.yml has no top-level `version:` key, which is fine for modern Compose but worth confirming the minimum supported Compose version is documented in DEPLOYMENT.md.
  • The test in test/unit/miner-docker-compose.test.ts checks that no key in the `environment` block matches TOKEN|API_KEY|SECRET|PASSWORD, but doesn't verify `env_file` itself isn't accidentally committed with real values — that's covered separately by .gitignore presumably, worth confirming it's ignored.
  • Consider adding `.gittensory-miner.env` to .gitignore (if not already) and asserting that in a test, since this PR's whole security premise rests on that file never being committed.
  • In DEPLOYMENT.md's scaling section, an explicit one-line example command for the `-p miner-1` pattern (already given) is good — could also mention `docker compose -p miner-1 down -v` for cleanup symmetry.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
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: 111 registered-repo PR(s), 82 merged, 2 issue(s).
Contributor context ✅ Confirmed Gittensor contributor davion-knight; Gittensor profile; 111 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).
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: 111 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

@JSONbored JSONbored left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Closing:

packages/gittensory-miner/docker-compose.miner.yml:36 hardcodes GITTENSORY_MINER_CONFIG_DIR in the compose environment, so an operator following packages/gittensory-miner/.gittensory-miner.env.example:11 to override that variable through the env file will be silently ignored by Compose's precedence rules; remove the hardcoded environment entry or change it to an interpolated default such as `GITTENSORY_MINER_CONFIG_DIR: ${GITTENSORY_MINER_CONFIG_DIR:-/data/miner}`.

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. manual-review Gittensor contributor context

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

2 participants