Skip to content

chore: add Cloud Agent development environment - #4

Open
donny-devops wants to merge 2 commits into
mainfrom
gitgangster/cloud-agent-env-23ac
Open

donny-devops wants to merge 2 commits into
mainfrom
gitgangster/cloud-agent-env-23ac

Conversation

@donny-devops

@donny-devops donny-devops commented Sep 10, 2026

Copy link
Copy Markdown
Owner

What & why

This repo is a collection of Docker Compose stacks, so a usable Cloud Agent environment needs Docker-in-Docker plus the tooling CI relies on. This PR adds a repository-managed environment under .cursor/ that provisions Docker Engine + Compose, runs the Docker daemon on every boot, installs the YAML linter used by CI, and seeds per-stack .env files.

Changes

  • .cursor/environment.json — repo-managed environment (user: ubuntu, install, start). A committed environment.json is the highest-precedence environment source, so merging this makes every future Cloud Agent on the repo pick it up automatically.
  • .cursor/install.sh — idempotent bootstrap: installs Docker Engine + Compose plugin (Docker apt repo), switches to iptables-legacy (needed for bridge networking in the nested VM), adds the agent user to the docker group, installs yamllint, and seeds homelab-dashboard/.env and monitoring-analytics/.env from their .env.example files (never overwriting an existing .env).
  • .cursor/start.sh — per-boot startup: enables shared mount propagation (mount --make-rshared /, required by node-exporter's rslave bind mount) and runs dockerd (with the fuse-overlayfs storage driver) in the foreground so the platform supervises it for the agent's lifetime.

Docker installation lives in install (one-time, captured into the environment snapshot); daemon startup is per-boot in start. The stacks are intentionally not auto-started — the two stacks both bind port 3000, so a developer brings up one stack at a time with docker compose up.

How to use

# dockerd is already running (start.sh) once the agent boots
cd monitoring-analytics && docker compose up -d   # Prometheus/Grafana/Alertmanager/Loki/…
# or
cd homelab-dashboard && docker compose up -d       # Traefik/Homepage/Portainer/Uptime Kuma/…

Validation

  • yamllint (CI config) passes on all YAML; docker compose config --quiet passes for both stacks.
  • monitoring-analytics brought up: Prometheus actively scrapes prometheus, node-exporter, and cadvisor (all up=1); Alertmanager healthy and firing rules; live PromQL returns data.
  • homelab-dashboard brought up: Traefik, Homepage, Portainer, and Uptime Kuma all serve HTTP.
  • install.sh run twice (idempotent). start.sh foreground design verified: launched detached (as the platform does on boot), dockerd persists after the launcher exits and runs containers.
  • Draft environment build of this branch succeeded, and two fresh Cloud Agents booted from it confirmed Docker 29.8.0 / Compose v5.5.1 / yamllint 1.38.0, seeded .env files, valid compose config, hello-world, and Prometheus scraping targets up.

Follow-ups for full fidelity (optional services)

These need external access not in the egress allowlist / secrets and are not required for the core environment:

  • Grafana (monitoring-analytics) installs its configured plugins from grafana.com on startup — add grafana.com to the egress allowlist.
  • Heimdall (homelab-dashboard) image is pulled from lscr.io — add lscr.io to the egress allowlist.
  • Watchtower (homelab-dashboard) is configured for Slack notifications — set a valid SLACK_WEBHOOK_URL.

Separately, two pre-existing stack issues (independent of this environment) are worth a follow-up: the loki healthcheck uses wget, which is not present in the loki image (so promtail's depends_on: service_healthy never unblocks), and jaeger cannot create its badger dirs in the root-owned named volume because it runs as a non-root user.

Open in Web Open in Cursor 

Adds .cursor/environment.json plus idempotent install/start scripts that provision Docker Engine + Compose, start dockerd (fuse-overlayfs) per boot, enable shared mount propagation for node-exporter, install yamllint, and seed per-stack .env files.

Co-authored-by: Adonis Jimenez <donny-devops@users.noreply.github.com>
@ecc-tools

ecc-tools Bot commented Sep 10, 2026

Copy link
Copy Markdown

ECC Tools / Security Evidence

Commit: 894e48cec0f3dc23c3c679ea6f3c8217c7fc19de

Security evidence gate passed (success)

No security-sensitive scanner-evidence gap detected.

Mode: enforce

Scanned 3 changed file(s). No missing scanner-evidence signal was detected.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@ecc-tools

ecc-tools Bot commented Sep 10, 2026

Copy link
Copy Markdown

ECC Tools / PR Risk Taxonomy

Commit: 894e48cec0f3dc23c3c679ea6f3c8217c7fc19de

PR taxonomy clear (success)

Scanned 3 changed file(s). No taxonomy bucket signals were detected.

Scanned 3 changed file(s).

No PR taxonomy bucket signals were detected.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@ecc-tools

ecc-tools Bot commented Sep 10, 2026

Copy link
Copy Markdown

ECC Tools / Reference Set Readiness

Commit: 894e48cec0f3dc23c3c679ea6f3c8217c7fc19de

Reference set readiness gaps detected (neutral)

Reference evidence present for 0/7 areas (0%) across 3 changed file(s).

This check is based on files changed in this PR. Repository-level readiness is still reported by /ecc-tools analyze comments and generated manifests.

Area Status Evidence / Next Step
Deep analyzer corpus Missing Add analyzer fixture, golden, benchmark, or reference-set files that can catch analyzer regressions.
RAG/evaluator comparison Missing Add retrieval or evaluator reference-set comparison fixtures with expected ranking behavior.
PR salvage/review corpus Missing Add stale-PR, review-thread, reopen-flow, or salvage reference cases for queue cleanup automation.
Discussion triage corpus Missing Add public discussion triage fixtures, golden cases, or reference sets for informational, answered, and no-response classifications.
Harness compatibility Missing Add cross-harness, adapter-compliance, or harness-audit evidence for Claude, Codex, OpenCode, Zed, dmux, and agent surfaces.
Security evidence Missing Attach security evidence such as SBOMs, SARIF, audit reports, or AgentShield evidence packs.
CI failure-mode evidence Missing Add captured CI failure logs, dry-run fixtures, or troubleshooting docs for common workflow failure modes.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@ecc-tools

ecc-tools Bot commented Sep 10, 2026

Copy link
Copy Markdown

ECC Tools / Hosted Promotion Readiness

Commit: 894e48cec0f3dc23c3c679ea6f3c8217c7fc19de

Hosted promotion readiness passed (success)

No hosted promotion evidence gaps detected across 3 changed file(s); 0 corpus scenarios had matching evidence.

This check compares PR file changes against the evaluator/RAG promotion corpus in src/analyzers/fixtures/evaluator-rag-corpus.ts.
Hosted output scoring inspected 0 completed cached hosted job results.

No evaluator corpus scenarios matched this PR.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@amazon-q-developer amazon-q-developer 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.

Summary

This PR adds a Cloud Agent development environment with Docker-in-Docker support. The implementation is mostly solid, but there are three critical security and logic issues that must be addressed before merge:

Critical Issues:

  1. Security: GPG key download lacks fingerprint verification (install.sh:10-11)
  2. Security: yamllint installed without version pinning (install.sh:32)
  3. Logic Error: dockerd startup timeout detection is broken (start.sh:13-18)

All three issues have commit-able fixes provided. Please apply the suggested changes to ensure secure and reliable environment provisioning.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

Comment thread .cursor/install.sh
sudo usermod -aG docker "$(id -un)" || true

# ── CI tooling: yamllint ───────────────────────────────────────
python3 -m pip install --user --quiet --upgrade yamllint

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛑 Security Vulnerability: Installing yamllint without version pinning allows arbitrary code execution if the package is compromised between releases.1

Pin to a specific version to ensure reproducible and auditable builds.

Suggested change
python3 -m pip install --user --quiet --upgrade yamllint
python3 -m pip install --user --quiet yamllint==3.0.0

Footnotes

  1. CWE-494: Download of Code Without Integrity Check - https://cwe.mitre.org/data/definitions/494.html

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Micro-Learning Topic: Download of Code Without Integrity Check (CWE 494)

Matched on "CWE-494"

What is this? (2min video)

The product downloads source code or an executable from a remote location and executes the code without sufficiently verifying the origin and integrity of the code.

Try a challenge in Secure Code Warrior

Comment thread .cursor/start.sh Outdated
Comment on lines +13 to +18
for _ in $(seq 1 30); do
if sudo docker info >/dev/null 2>&1; then
break
fi
sleep 1
done

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛑 Logic Error: The timeout check after the wait loop never triggers because the loop doesn't track whether it exhausted all iterations. If dockerd fails to start within 30 seconds, the script silently continues to line 21 where the check will catch it, but this creates a race condition if dockerd becomes ready between line 18 and line 21.

Add explicit timeout detection within the loop.

Suggested change
for _ in $(seq 1 30); do
if sudo docker info >/dev/null 2>&1; then
break
fi
sleep 1
done
timeout=30
for i in $(seq 1 "$timeout"); do
if sudo docker info >/dev/null 2>&1; then
break
fi
if [ "$i" -eq "$timeout" ]; then
echo "dockerd failed to start within ${timeout}s; see /var/log/dockerd.log" >&2
exit 1
fi
sleep 1
done

Comment thread .cursor/install.sh
Comment on lines +10 to +11
curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
| sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛑 Security Vulnerability: The GPG key download lacks checksum verification, allowing potential MITM attacks to inject malicious keys that could authenticate compromised Docker packages.1

Verify the GPG key fingerprint after download to ensure authenticity.

Suggested change
curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
| sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
curl -fsSL \
| sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
# Verify the key fingerprint (Docker's official fingerprint)
if ! sudo gpg --no-default-keyring --keyring /etc/apt/keyrings/docker.gpg --list-keys | grep -q "9DC858229FC7DD38854AE2D88D81803C0EBFCD88"; then
echo "ERROR: Docker GPG key fingerprint verification failed" >&2
sudo rm -f /etc/apt/keyrings/docker.gpg
exit 1
fi

Footnotes

  1. CWE-494: Download of Code Without Integrity Check - https://cwe.mitre.org/data/definitions/494.html

…s it

A backgrounded dockerd launched from start and then abandoned can be reaped once the start command returns, leaving new agents without a running daemon. Foreground the daemon (exec) so it stays attached for the agent lifetime.

Co-authored-by: Adonis Jimenez <donny-devops@users.noreply.github.com>
@ecc-tools

ecc-tools Bot commented Sep 10, 2026

Copy link
Copy Markdown

ECC Tools / Security Evidence

Commit: e0cdce7c6b113616d3509222602a28fb5061cd5a

Security evidence gate passed (success)

No security-sensitive scanner-evidence gap detected.

Mode: enforce

Scanned 3 changed file(s). No missing scanner-evidence signal was detected.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@ecc-tools

ecc-tools Bot commented Sep 10, 2026

Copy link
Copy Markdown

ECC Tools / PR Risk Taxonomy

Commit: e0cdce7c6b113616d3509222602a28fb5061cd5a

PR taxonomy clear (success)

Scanned 3 changed file(s). No taxonomy bucket signals were detected.

Scanned 3 changed file(s).

No PR taxonomy bucket signals were detected.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@ecc-tools

ecc-tools Bot commented Sep 10, 2026

Copy link
Copy Markdown

ECC Tools / Reference Set Readiness

Commit: e0cdce7c6b113616d3509222602a28fb5061cd5a

Reference set readiness gaps detected (neutral)

Reference evidence present for 0/7 areas (0%) across 3 changed file(s).

This check is based on files changed in this PR. Repository-level readiness is still reported by /ecc-tools analyze comments and generated manifests.

Area Status Evidence / Next Step
Deep analyzer corpus Missing Add analyzer fixture, golden, benchmark, or reference-set files that can catch analyzer regressions.
RAG/evaluator comparison Missing Add retrieval or evaluator reference-set comparison fixtures with expected ranking behavior.
PR salvage/review corpus Missing Add stale-PR, review-thread, reopen-flow, or salvage reference cases for queue cleanup automation.
Discussion triage corpus Missing Add public discussion triage fixtures, golden cases, or reference sets for informational, answered, and no-response classifications.
Harness compatibility Missing Add cross-harness, adapter-compliance, or harness-audit evidence for Claude, Codex, OpenCode, Zed, dmux, and agent surfaces.
Security evidence Missing Attach security evidence such as SBOMs, SARIF, audit reports, or AgentShield evidence packs.
CI failure-mode evidence Missing Add captured CI failure logs, dry-run fixtures, or troubleshooting docs for common workflow failure modes.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@ecc-tools

ecc-tools Bot commented Sep 10, 2026

Copy link
Copy Markdown

ECC Tools / Hosted Promotion Readiness

Commit: e0cdce7c6b113616d3509222602a28fb5061cd5a

Hosted promotion readiness passed (success)

No hosted promotion evidence gaps detected across 3 changed file(s); 0 corpus scenarios had matching evidence.

This check compares PR file changes against the evaluator/RAG promotion corpus in src/analyzers/fixtures/evaluator-rag-corpus.ts.
Hosted output scoring inspected 0 completed cached hosted job results.

No evaluator corpus scenarios matched this PR.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@donny-devops
donny-devops marked this pull request as ready for review September 10, 2026 21:07
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.

2 participants