Fixes the 'no GitHub credentials' deadlock observed in the first
NAS-Docker batch run (2 May 2026): scrum4me-mcp's `wait_for_job`
expects a local clone at `~/Projects/<repo-name>` (convention-fallback
in resolveRepoRoot) but the container had no credentials and no clone.
Agent asked the user how to proceed; turn closed without claim.
Changes:
- `.env.example`: GH_TOKEN (fine-grained PAT, repo+PR scope) and
GH_PRECLONE_REPOS (comma-separated owner/name list, default covers
Scrum4Me + scrum4me-mcp).
- `bin/repo-bootstrap.sh` (new): runs as agent-user; configures git
credential-helper with HTTPS oauth2 token, then clones-or-fetches
each entry in GH_PRECLONE_REPOS into ~/Projects/<name>. Idempotent.
- `bin/entrypoint.sh`: hooks repo-bootstrap before run-agent.sh.
- `Dockerfile`:
- installs `gh` CLI (used for auto_pr `gh pr create`; reads GH_TOKEN
from env directly).
- pre-creates `~agent/Projects` and `~agent/.scrum4me-agent-worktrees`
so directory-ownership is right from the first boot.
- `README.md`: 'Repo bootstrap (clone-on-start)' section + GH_TOKEN
step in the deploy checklist; corrects the obsolete 'no push
credentials' note (agent now pushes feature-branches, gh creates PRs).
Same token covers clone, push and PR-creation — one secret to rotate.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
97 lines
3.9 KiB
Text
97 lines
3.9 KiB
Text
# ============================================================
|
|
# scrum4me-agent-runner — environment configuratie
|
|
# ============================================================
|
|
# Kopieer naar .env en vul in. Houd .env buiten git (zie .gitignore).
|
|
# Permissies: chmod 600 .env
|
|
|
|
# ----- Claude Code authenticatie ----------------------------
|
|
# Genereer op je werkstation met: `claude setup-token`
|
|
# Output is een sk-ant-oat01-... token; geldig 1 jaar; gebruikt
|
|
# je Pro/Max subscription quota in plaats van per-token billing.
|
|
#
|
|
# Alternatief: ANTHROPIC_API_KEY (sk-ant-api03-...) voor pay-per-use
|
|
# via console.anthropic.com. Niet beide tegelijk zetten.
|
|
CLAUDE_CODE_OAUTH_TOKEN=sk-ant-oat01-vervang-mij
|
|
# ANTHROPIC_API_KEY=
|
|
|
|
# ----- Scrum4Me API token -----------------------------------
|
|
# Bearer-token van de DEDICATED agent-user (niet je persoonlijke
|
|
# account). Aanmaken: log in als de agent-user → /settings/tokens
|
|
# → label "NAS-runner". Token wordt eenmalig getoond.
|
|
#
|
|
# Als deze ge-revoked wordt: rebuild + redeploy (zie README).
|
|
SCRUM4ME_TOKEN=vervang-mij
|
|
|
|
# ----- GitHub credentials -----------------------------------
|
|
# Personal Access Token (fine-grained) met:
|
|
# - Repository access op madhura68/Scrum4Me + madhura68/scrum4me-mcp
|
|
# - Permissions: Contents (read/write), Pull requests (read/write),
|
|
# Metadata (read)
|
|
#
|
|
# Gebruikt voor:
|
|
# 1. Pre-clone van de repos in /home/agent/Projects/<name>/ bij
|
|
# container-start (entrypoint.sh)
|
|
# 2. `git push` van agent feature-branches via HTTPS
|
|
# 3. `gh pr create` (auto_pr=true) — gh CLI leest GH_TOKEN uit env
|
|
#
|
|
# Genereer op github.com → Settings → Developer settings →
|
|
# Personal access tokens → Fine-grained tokens.
|
|
GH_TOKEN=ghp_vervang-mij
|
|
|
|
# Lijst (komma-gescheiden) van repos om vooraf te clonen naar
|
|
# ~agent/Projects/<name>. resolveRepoRoot in scrum4me-mcp valt
|
|
# automatisch terug op die conventie. Voeg meer toe als je nieuwe
|
|
# producten/repos toevoegt aan Scrum4Me.
|
|
GH_PRECLONE_REPOS=madhura68/Scrum4Me,madhura68/scrum4me-mcp
|
|
|
|
# ----- Scrum4Me database ------------------------------------
|
|
# Beide URLs uit het Neon-dashboard. DATABASE_URL is pooled,
|
|
# DIRECT_URL is unpooled — scrum4me-mcp gebruikt DATABASE_URL
|
|
# voor reads/writes; DIRECT_URL is alleen nodig als je de mcp
|
|
# uitbreidt met LISTEN/NOTIFY (op dit moment niet).
|
|
DATABASE_URL=postgresql://user:pass@host/dbname?sslmode=require
|
|
DIRECT_URL=postgresql://user:pass@host/dbname?sslmode=require
|
|
|
|
# ----- Scrum4Me API host ------------------------------------
|
|
# Voor token-validatie via /api/health en /api/products
|
|
# voorafgaand aan het starten van de daemon-loop. Gebruik je
|
|
# productie-URL.
|
|
SCRUM4ME_BASE_URL=https://scrum4me.example.com
|
|
|
|
# ----- Scrum4Me MCP versie ----------------------------------
|
|
# Pin een specifieke commit-sha of tag van scrum4me-mcp.
|
|
# `main` werkt voor ontwikkeling; in productie altijd vastpinnen.
|
|
MCP_GIT_REF=main
|
|
|
|
# Idem voor Claude Code zelf. `latest` of een specifieke versie.
|
|
CLAUDE_CODE_VERSION=latest
|
|
|
|
# ----- NAS paths --------------------------------------------
|
|
# Basis-share waaronder cache/, logs/ en state/ vallen.
|
|
# Pas aan als je een andere share-naam gebruikt op QNAP.
|
|
NAS_BASE=/share/Agent
|
|
|
|
# UID/GID matchen met de share-eigenaar op QNAP (admin = 1000
|
|
# bij standaard QTS-installatie).
|
|
AGENT_UID=1000
|
|
AGENT_GID=1000
|
|
|
|
# ----- Health endpoint --------------------------------------
|
|
# Externe poort op de NAS waarop /health bereikbaar is.
|
|
# Wijzig als 8080 al in gebruik is door iets anders op QTS.
|
|
AGENT_HEALTH_PORT_HOST=8080
|
|
|
|
# ----- Daemon-loop tuning -----------------------------------
|
|
# Maximum opeenvolgende mislukte batches voordat de container
|
|
# zichzelf "unhealthy" markeert.
|
|
AGENT_MAX_FAILURES=5
|
|
|
|
# Backoff in seconden: start, factor, max
|
|
AGENT_BACKOFF_START=5
|
|
AGENT_BACKOFF_FACTOR=2
|
|
AGENT_BACKOFF_MAX=300
|
|
|
|
# Hoeveel uur logs bewaren voor we comprimeren (gzip).
|
|
AGENT_LOG_GZIP_AFTER_HOURS=24
|
|
# Hoeveel dagen ge-gzipte logs bewaren voor we ze verwijderen.
|
|
AGENT_LOG_DELETE_AFTER_DAYS=30
|