---
phase: 11-real-world-rollout-feedback
plan: 01
type: execute
wave: 1
depends_on: []
files_modified:
  - .planning/phases/11-real-world-rollout-feedback/deploy/DEPLOYMENT.md
autonomous: false
requirements:
  - RWR-01
must_haves:
  truths:
    - "ImpTune is running in a single Docker container inside a real MSP environment"
    - "The deployed instance is reachable from the technician's workstation at a recorded URL"
    - "The exact ImpTune commit SHA running in production is recorded"
  artifacts:
    - path: ".planning/phases/11-real-world-rollout-feedback/deploy/DEPLOYMENT.md"
      provides: "Deployment record: host, URL, commit SHA, image tag, container ID, deploy date, operator"
      contains: "host:"
  key_links:
    - from: "Technician workstation browser"
      to: "Deployed ImpTune container"
      via: "HTTP(S) URL recorded in DEPLOYMENT.md"
      pattern: "url:.*http"
---

<objective>
Deploy the current ImpTune build as a single Docker container inside a real MSP environment and record the deployment facts (host, URL, commit, image tag) so downstream plans and reviewers can locate the running instance.

Purpose: RWR-01 requires ImpTune to actually be running somewhere real — not on localhost — before any real package can be pushed. This plan is the "get it on a real host" step.

Output: A deployed, reachable ImpTune container plus `.planning/phases/11-real-world-rollout-feedback/deploy/DEPLOYMENT.md` recording where it lives.
</objective>

<execution_context>
@C:/Users/SebastienQUEROL/.claude/get-shit-done/workflows/execute-plan.md
@C:/Users/SebastienQUEROL/.claude/get-shit-done/templates/summary.md
</execution_context>

<context>
@.planning/PROJECT.md
@.planning/STATE.md
@.planning/ROADMAP.md
@.planning/REQUIREMENTS.md
@.planning/phases/10-real-world-runtime-validation/RUNTIME-VALIDATION.md
</context>

<tasks>

<task type="auto">
  <name>Task 1: Scaffold DEPLOYMENT.md and lock build metadata</name>
  <files>.planning/phases/11-real-world-rollout-feedback/deploy/DEPLOYMENT.md</files>
  <action>
    Create `.planning/phases/11-real-world-rollout-feedback/deploy/DEPLOYMENT.md` with the following sections (leave values blank for fields that only the human deploy step can fill; pre-fill the ones the agent can determine now):

    - Title: `# ImpTune v1.1 Rollout Deployment Record`
    - Build metadata (pre-fill now from the working tree):
      - `commit_sha:` — run `git rev-parse HEAD` and paste the full SHA
      - `commit_date:` — run `git show -s --format=%ci HEAD`
      - `branch:` — run `git rev-parse --abbrev-ref HEAD`
      - `dirty:` — yes/no from `git status --porcelain` (non-empty = yes)
    - Docker image (leave blank for the human to fill during deploy):
      - `image_tag:` (e.g. `imptune:v1.1-rollout`)
      - `image_digest:` (from `docker images --digests` after build)
    - Deployment target (leave blank for the human):
      - `msp_name:`
      - `host:` (hostname or IP of the Docker host inside the MSP env)
      - `url:` (full URL the technician will open — http(s)://host:port)
      - `deployed_by:`
      - `deployed_at:` (ISO8601)
      - `container_id:`
    - Notes section (free text, optional)

    Also pre-fill a short "How this was deployed" checklist placeholder with the three steps the human will perform in Task 2: build image, transfer/pull on MSP host, `docker run` with persistent volume for `imptune.db` + `uploads/`.

    Do NOT attempt to `docker build` or `docker run` in this task — this task is metadata scaffolding only.
  </action>
  <verify>
    <automated>test -f .planning/phases/11-real-world-rollout-feedback/deploy/DEPLOYMENT.md && grep -q "commit_sha:" .planning/phases/11-real-world-rollout-feedback/deploy/DEPLOYMENT.md && grep -q "^commit_sha: [0-9a-f]" .planning/phases/11-real-world-rollout-feedback/deploy/DEPLOYMENT.md</automated>
  </verify>
  <done>DEPLOYMENT.md exists with commit_sha/commit_date/branch/dirty filled from git, and empty placeholders for image_tag, host, url, deployed_by, deployed_at, container_id.</done>
</task>

<task type="checkpoint:human-action" gate="blocking">
  <name>Task 2: Human — build, ship, and run the container in the real MSP environment</name>
  <files>(human-driven — no files written directly by agent; updates DEPLOYMENT.md / ROLLOUT-RUN.md / v1.1-rollout.md as specified in the action)</files>
  <action>
    CHECKPOINT — human action required. Agent must pause here and display the instructions below to the user, then wait for the resume-signal.

    Built so far: DEPLOYMENT.md scaffold from Task 1 with commit SHA locked.

    Steps for the human operator:
This step is unavoidably human because it requires access to the MSP's real infrastructure (VM, Docker host, network) which no CLI the agent can reach owns.

    Steps for the human operator:

    1. On a workstation with Docker:
       - `docker build -t imptune:v1.1-rollout .` (from repo root)
       - `docker images --digests imptune:v1.1-rollout` — copy the digest
    2. Transfer image to MSP host (choose one):
       - `docker save imptune:v1.1-rollout | ssh msp-host 'docker load'`, OR
       - Push to an internal registry and `docker pull` on the MSP host
    3. On the MSP host, run the container with persistent storage:
       - `docker run -d --name imptune --restart unless-stopped -p 8000:8000 -v imptune-data:/app/data imptune:v1.1-rollout`
       - (Adjust port / volume path to match the repo's actual Dockerfile — confirm by reading `Dockerfile` + `imptune/config.py` before running.)
    4. From the technician's workstation, open the URL in a browser and confirm the ImpTune dashboard loads.
    5. Fill DEPLOYMENT.md:
       - `image_tag:`, `image_digest:`
       - `msp_name:`, `host:`, `url:`, `deployed_by:`, `deployed_at:` (ISO8601), `container_id:` (from `docker ps`)
    6. Commit DEPLOYMENT.md.

    Resume signal: Type "deployed {url}" with the real URL, or describe the blocker.
  </action>
  <verify>
    <automated>MISSING — checkpoint is human-gated; verification is operator attestation captured via the resume-signal. Agent should confirm the referenced artifact file was updated (e.g. grep for the newly-filled field in the target doc) before accepting the resume signal.</automated>
  </verify>
  <done>Human operator has performed the steps above, updated the referenced artifact, and replied with the resume signal.</done>
</task>

<task type="checkpoint:human-verify" gate="blocking">
  <name>Task 3: Verify deployment record is complete and instance is reachable</name>
  <files>(human-driven — no files written directly by agent; updates DEPLOYMENT.md / ROLLOUT-RUN.md / v1.1-rollout.md as specified in the action)</files>
  <action>
    CHECKPOINT — human action required. Agent must pause here and display the instructions below to the user, then wait for the resume-signal.

    Built so far: Deployed ImpTune container + filled DEPLOYMENT.md.

    Steps for the human operator:
1. Open `.planning/phases/11-real-world-rollout-feedback/deploy/DEPLOYMENT.md` — confirm no placeholder fields are still blank among: image_tag, image_digest, msp_name, host, url, deployed_by, deployed_at, container_id.
    2. From any machine with access, open the recorded `url:` in a browser — ImpTune dashboard must load.
    3. On the MSP host, run `docker ps --filter name=imptune --format '{{.Status}}'` — status must be `Up`.
    4. Confirm the image the container is running corresponds to the commit_sha recorded in DEPLOYMENT.md (spot-check: container's `/app` should match, or rely on image_digest match).

    Resume signal: Type "verified" or list the gaps.
  </action>
  <verify>
    <automated>MISSING — checkpoint is human-gated; verification is operator attestation captured via the resume-signal. Agent should confirm the referenced artifact file was updated (e.g. grep for the newly-filled field in the target doc) before accepting the resume signal.</automated>
  </verify>
  <done>Human operator has performed the steps above, updated the referenced artifact, and replied with the resume signal.</done>
</task>

</tasks>

<verification>
- DEPLOYMENT.md exists and has all 8 required fields populated (commit_sha, image_tag, image_digest, msp_name, host, url, deployed_by, deployed_at, container_id)
- The deployed URL returns the ImpTune dashboard in a browser
- `docker ps` on the MSP host shows the container as `Up`
</verification>

<success_criteria>
ImpTune is running in a single Docker container on a real MSP host, reachable at a recorded URL, and DEPLOYMENT.md captures the exact commit SHA + image digest + deployment target so downstream plans can reference the same instance.
</success_criteria>

<output>
After completion, create `.planning/phases/11-real-world-rollout-feedback/11-01-deploy-container-to-msp-SUMMARY.md`
</output>
