|
| 1 | +# DocOps Box — Agent Handoff: Volumes Architecture Implemented |
| 2 | + |
| 3 | +**Date:** 2026-04-07 |
| 4 | +**From:** Tooling/script agent |
| 5 | +**To:** README/docs agent |
| 6 | +**Re:** Named-volume architecture decision is fully implemented |
| 7 | + |
| 8 | +--- |
| 9 | + |
| 10 | +## What Was Done |
| 11 | + |
| 12 | +All five files from the handoff plan are updated and shellcheck-clean. |
| 13 | + |
| 14 | +### `Dockerfile` |
| 15 | +- `VIRTUAL_ENV=/opt/venv` added to `ENV` block |
| 16 | +- `PATH` updated: `/opt/venv/bin:/usr/local/bundle/bin:$PATH` |
| 17 | +- `python3-venv` added to the Python apt install block |
| 18 | +- `mkdir -p` now creates `/opt/venv` and `$WORKDIR/node_modules` as volume mount points |
| 19 | +- `chown -R` covers `/opt/venv` (mount points must pre-exist and be owned by run user) |
| 20 | + |
| 21 | +### `entrypoint.sh` |
| 22 | +- Added `/opt/venv` to the recursive `chown` at startup |
| 23 | +- Added `chown` of `/workspace/node_modules` (named volume mount, not workspace bind) |
| 24 | +- Added lazy venv bootstrap: if `VIRTUAL_ENV` is set, `/opt/venv/bin/python` is absent, |
| 25 | + and `python3` exists → runs `python3 -m venv /opt/venv` as root then chowns it. |
| 26 | + Fires only on first container start after a fresh/reset volume; no-op thereafter. |
| 27 | + |
| 28 | +### `docopsbox.yml` |
| 29 | +Two new per-project named volumes: |
| 30 | +- `docops-{slug}-node` → mounted at `/workspace/node_modules` |
| 31 | +- `docops-{slug}-python` → mounted at `/opt/venv` |
| 32 | + |
| 33 | +Both are declared in the `volumes:` section with slug-interpolated names. |
| 34 | +Existing shared caches (`docops-npm-cache`, `docops-pip-cache`) are unchanged. |
| 35 | + |
| 36 | +### `.devcontainer/devcontainer.json` |
| 37 | +- `postCreateCommand` now also runs `pip install -r requirements.txt` (guarded: only |
| 38 | + if `requirements.txt` exists) |
| 39 | + |
| 40 | +### `docr` script |
| 41 | +- `cmd_reset`: `node_vol` and `python_vol` variables added; both are removed on plain |
| 42 | + `reset` and on `--full`. Help text updated accordingly. |
| 43 | +- `cmd_status`: now reports node and python volume state/size alongside bundle. |
| 44 | +- `cmd_list`: disposition labels improved — shared download caches labeled separately |
| 45 | + from per-project disposable volumes. |
| 46 | +- `cmd_help`: reset description updated to name gems/node/python. |
| 47 | + |
| 48 | +--- |
| 49 | + |
| 50 | +## Final Volume Architecture (Implemented) |
| 51 | + |
| 52 | +| Volume | Docker name | Mount point | Scope | |
| 53 | +|--------|-------------|-------------|-------| |
| 54 | +| Ruby gems | `docops-{slug}-bundle` | `/usr/local/bundle` | Per-project | |
| 55 | +| Node modules | `docops-{slug}-node` | `/workspace/node_modules` | Per-project | |
| 56 | +| Python venv | `docops-{slug}-python` | `/opt/venv` | Per-project | |
| 57 | +| npm download cache | `docops-npm-cache` | `/npm-cache` | Shared | |
| 58 | +| pip download cache | `docops-pip-cache` | `/pip-cache` | Shared | |
| 59 | +| Shell history | `docops-shell-history` | `/commandhistory` | Shared | |
| 60 | + |
| 61 | +--- |
| 62 | + |
| 63 | +## README Updates Needed (Your Side) |
| 64 | + |
| 65 | +The Volume Lifecycle section and related prose need to reflect: |
| 66 | + |
| 67 | +1. **Volume table**: Add Node modules and Python venv rows (see table above) |
| 68 | +2. **"What Just Happened?" bullet list** (after `docr init`/`docr run`): mention that |
| 69 | + node_modules and the Python venv are now in named volumes, not in the workspace |
| 70 | +3. **`docr reset` docs**: say "dependency caches (gems, node modules, Python venv)" |
| 71 | + rather than just "gem cache" |
| 72 | +4. **Why named volumes for Node/Python** (a brief explainer, or a sidebar): Linux |
| 73 | + binaries in node_modules are useless on macOS/Windows host; Python venv uses |
| 74 | + symlinks that break on the host filesystem. Named volumes keep them inside Docker |
| 75 | + where they work correctly and persist across restarts. |
| 76 | +5. **`VIRTUAL_ENV` / Python**: users can `pip install` normally inside the container; |
| 77 | + no `--user` or `--break-system-packages` flags needed. The venv is at `/opt/venv`. |
| 78 | + |
| 79 | +The `uninstall` subcommand was also added since the last handoff — you may want a |
| 80 | +one-liner in the command reference: removes installed binary and backup data dir. |
0 commit comments