Repository navigation
fix(install): Windows re-runs work again; organiser setup needs only Docker - #12
Conversation
…Docker (#11) - install.ps1: keep --force-recreate an array (@(if ...)) so a re-run no longer hands Docker "- - f o r c e ..." ("no such service: -"); the removed-laptop check after it now surfaces, and ends "has been stopped", not "nothing changed" - install.ps1: exit 1 on every failure (run as a file or a one-off -Command); pasted into an open window it sets $LASTEXITCODE instead of closing it - install.ps1 / install.sh: ask for and check the name and the join code's format before the 2 GB image download - tests/unit/test_install_ps1.py: runs the installer in real pwsh with a docker stub that records the exact argv and rejects unknown services like Compose - provision.py: one hospital is enough when join codes add the rest; documented running it inside the published image, and the plain docker compose command next to make hub - Join codes page: copy buttons for the code and both install commands - Node image workflow: check the manifest's architectures with jq (the JSON is pretty-printed, so the grep never matched) - README: kit hospitals show their container's facts on Nodes (known limit)
…y docstring example
Live verification of
|
| Scenario | Result |
|---|---|
docker run --rm -v "${PWD}:/src" -w /src …:v1.1.0 python scripts/provision.py --zip --peers "hospital-a=<ip>:8001" --directory "<ip>:8100", one hospital |
✅ exit 0. Wrote kits/directory and kits/hospital-a (plus zips). |
Hub without make: docker compose --project-directory . --env-file kits/directory/hub.env -f deploy/hub.yml up -d --wait |
✅ all 4 services healthy |
Own hospital without make: docker compose --project-directory kits/hospital-a -f kits/hospital-a/deploy/node.yml up -d |
✅ registered, epoch 1 |
| Join codes page in Chrome: Copy the code and Copy the Windows command | ✅ The button changes to "Copied". The Windows clipboard held exactly the code, then the one-line command with the hub address. |
Friend's installer on PS 5.1
| Scenario | Result |
|---|---|
| Name given, no code | ✅ No join code given. Exit 1 in 1 s, before the download, no folder left. |
Malformed code ABCD-1234 |
✅ That is not a join code…. Exit 1, before the download. |
| 1-character name | ✅ …must be 2 to 60 characters. Exit 1, before the download. |
Taken name (hospital a, unattended) |
✅ That name is taken, exit 1. The code wasn't spent: it enrolled a hospital later (last row). |
First install, name typed at the prompt (first X, then a real name), code from env |
✅ X was rejected and the second line was used. Enrolled Riverside Clinic, Done, exit 0. |
| Re-run on the enrolled laptop (the #11 bug) | ✅ keeping its keys → container recreated → Done, exit 0 |
Paste into an open window (powershell with no -File/-Command), failing run |
✅ The window stays open: STILL OPEN; LASTEXITCODE=1 |
The same failure as powershell -Command "irm … | iex; 'AFTER'" |
✅ Exit 1; AFTER isn't printed |
| Organiser Remove, then the friend re-runs | ✅ The organiser removed this laptop… + This laptop's hospital has been stopped; nothing else was changed. Exit 1, container gone. |
Recovery: delete MedChain, the unspent code, the same name |
✅ Enrolled riverside-clinic-38bf, Done. The next run completed with missing: []. |
Training with the organiser plus the friend completed with missing: [], before the Remove and again after the recovery.
Must do: merging alone doesn't reach friends
Every friend-facing reference still points at the v1.1.0 tag and image:
- the dashboard default
INSTALLER_VERSION(dashboard/server/index.js:29,deploy/hub.yml:114); $InstallerVersion = "1.1.0"ininstall.ps1andINSTALLER_VERSION=1.1.0ininstall.sh, which also pick the image tag;IMAGE_VERSIONdefaults inhub.yml,node.ymland the.envexamples;- the URLs in the docs.
So after merging, the Join codes page still hands out the old, broken install.ps1. To fix it:
- Bump all of these to a new version (e.g.
v1.1.1). - Merge.
- Push the tag, so the image workflow publishes
medchain-node:v1.1.1and the raw URL exists.
Should fix: a laptop enrolled with an older hub is told "Done"
What happened: my first runs here found a MedChain folder left over from a previous hub at the same address, which the organiser had since re-provisioned with a new CA. The installer said already enrolled… keeping its keys → waited 60 s → it has not reached the hub yet; it keeps trying by itself → Done with exit 0.
What the node actually logs, forever:
directory registration failed (https://100.109.218.85:8100/register unreachable (ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate signature failure)); retrying in 15s
Why it matters: this happens whenever an organiser rebuilds the hub (new kits, or down -v) and friends re-run the command.
Suggested fix: have the node report registration: refused (or a new wrong_network) when the directory's certificate doesn't verify against the enrolled CA. The installer would then say: "This laptop was enrolled with a different hub: delete the folder …, ask for a new join code". Separately, the node's own log line should say "certificate mismatch", not "unreachable".
Nits
- README: the new "On Linux, add
--user …" sentence runs straight into the old "The command writeskits/hospital-a/…" text with no paragraph break, so they render as one paragraph (around line 618). - Two Docker-only sections: this PR and docs(readme): Windows step by step with only Docker and Tailscale #13 (the Windows README section) both add Docker-only organiser steps. Once this is merged and a fixed tag is out, docs(readme): Windows step by step with only Docker and Tailscale #13's "Known issue" block and its "list a placeholder second hospital" advice become obsolete. I'll update docs(readme): Windows step by step with only Docker and Tailscale #13 to match once this is merged.
Not covered
install.shlive (no Mac here; its unit tests pass in CI).- Two physical machines.
- Typing the hidden join code into a real console window (the code came from
MEDCHAIN_JOIN_CODE; the name was typed at the prompt).
Verdict: the code changes work as described on real Windows 5.1. Approve once the version bump (must do) is done; the older-hub "Done" (should fix) can follow.
Intent
Following the merge of PR #10 (join-code onboarding) and the publish of the v1.1.0 image, a real tester ran the published package end to end on a genuinely clean Windows 11 laptop (only Docker Desktop and Tailscale installed beforehand) and filed GitHub issue #11 on this repository with the findings. The captain asked to have that issue checked and its real findings fixed, continuing the same effort to get the friend-onboarding flow actually working that produced PR #10. The issue reports that a first-time friend join works well, but re-running the install command on Windows - which the project's own documentation tells a friend to do after every reboot - always fails due to a real PowerShell bug, and that setting up the organiser's side cannot currently be done with only Docker installed, contrary to what the docs imply. It also reports several smaller real defects found during the same live test.
What issue #11 reports (the substance of the findings referred to above):
$recreate = if ($rerun) { @("--force-recreate") } else { @() }unwraps the one-element array into a string, and splatting it passes the flag to Docker one character at a time ("no such service: -"); the installer then shows misleading port advice. The tester verified$recreate = @(if ($rerun) { "--force-recreate" })fixes it. Because the "organiser removed this laptop" check runs after that docker compose up line, a removed friend on Windows saw the Docker error instead of the clear removal message. The PS7 test with a fake docker missed it because the fake did not check its arguments; the issue asks for a test that checks the arguments docker compose up actually receives on a re-run.python scripts/provision.py, but the organiser has no Python (running it viadocker run --rm -v "${PWD}:/src" -w /src ghcr.io/denimworld12/medchain-node:v1.1.0 python scripts/provision.py ...worked); provision.py refuses--peerswith only the organiser's own hospital ("needs at least two hospitals"), forcing a placeholder second hospital when everyone else will be added by join code;make hubdoes not exist on Windows, and the plaindocker compose --project-directory . --env-file kits/directory/hub.env -f deploy/hub.yml up -d --waitworked. Suggestions: document the docker run provision.py command (or ship it in the image), allow one hospital when join codes add the rest, show the plain docker compose hub command next to make hub.grep -q '"architecture":"arm64"'does not match how--format '{{json .Manifest.Manifests}}'prints the JSON.What Changed
deploy/install/install.ps1,install.sh): On Windows,--force-recreatenow stays an array (@(if ($rerun) { ... })). Before, PowerShell turned it into a string and splatted it to Docker one character at a time, so every re-run failed. Both installers now ask for and check the hospital name and join code before the 2 GB image download. That includes a format check for the 20-character code. When a removed laptop's node is stopped, the closing message now says so instead of "Nothing has been changed".install.ps1now reports failure: it exits 1 when run as a file or one-off command, and sets$LASTEXITCODE = 1when pasted into an open window. It also falls back cleanly whenGet-CimInstanceis unavailable. Newtests/unit/test_install_ps1.pyand extratest_install_sh.pycases cover this, including the argumentsdocker compose upreceives on a re-run.scripts/provision.py --peersnow accepts a single hospital, the organiser's own, because join codes add the rest. README anddocs/MULTI_LAPTOP.mdnow give thedocker run ... python scripts/provision.pycommand for organisers without Python. They also show the plaindocker composecommands next tomake hubandmake node, and explain why a hospital started from a kit shows the container's hostname and OS on the Nodes page.jqto confirm bothamd64andarm64are in the manifest. It used togrepfor compact JSON, which never matched the pretty-printed output, so the step failed.Risk Assessment
✅ Low: The fix round changed only docs (the README command is now on one line, and the provision.py docstring uses a double backslash and its prose is back in its own paragraph), and both changes are correct; the code changes reviewed in round 1 (install.ps1 array fix, exit codes, early checks of the name and join code, provision.py accepting one hospital, the jq manifest check, the Copy buttons) still look correct, and only a small README wording issue is left.
Testing
This host has no PowerShell, so I ran install.ps1 under PowerShell 7.4.6 in a local container, with docker and tailscale replaced by fakes that record their arguments. Those runs are not live, so the installer scenarios are marked untested. Under those fakes the target installer passed every check, and the base commit's installer reproduced issue #11 ("no such service: -", exit 0 on failures, "Nothing has been changed" after a removal). The install.sh and provision.py tests passed. The image workflow's new jq check, run live against the real published v1.1.0 manifest list, passes, and the old grep check fails on it. I did not drive the organiser's Docker-only setup (provisioning in the image, then the plain docker compose hub command) or the Join codes Copy buttons: the 2 GB v1.1.0 image download was stopped at its time limit before it finished. So there is no screenshot of the Copy button UI.
-d --force-recreateas separate whole arguments and the hospital starts ('Done')docker run ... medchain-node:v1.1.0 python scripts/provision.py --zip --peers <own hospital only> --directory ...and gets kits including kits/direc…docker compose --project-directory . --env-file kits/directory/hub.env -f deploy/hub.yml up -d --waitEvidence: install.ps1 tests on the target (real pwsh 7)
Evidence: Base commit's install.ps1 failing the same tests (issue #11 reproduced)
Evidence: Installer output and recorded docker calls: re-run, removed laptop, missing code, refused code
Evidence: install.sh and provision.py tests
Evidence: Image workflow check: old grep vs new jq on the real v1.1.0 manifest list
What was verified live vs. only reviewed
Live-verified
dockerstub that records the exact argv and rejects unknown services the way Docker Compose does (tests/unit/test_install_ps1.py). The base commit's installer reproduces the issue exactly: Docker gotup -d - - f o r c e - r e c r e a t e, saidno such service: -, and the script exited 0. With the fix it getsup -d --force-recreateand finishes with "Done". The same harness covers: a removed laptop's re-run shows the removal message, stops the node, exits 1, and no longer says "Nothing has been changed"; a missing or malformed join code or a bad name is refused beforedocker pull; every failure exits 1, includingpwsh -Command "... | iex"; and pasting into an open window (-NoExit) sets$LASTEXITCODE=1without closing it.jqcheck passes on the real published v1.1.0 and v1.0.0 manifest lists (amd64 + arm64) and fails on a one-architecture list. The oldgrepfailed because the JSON is pretty-printed ("architecture": "arm64", with a space).docker run --rm -v "${PWD}:/src" -w /src <image> python scripts/provision.py --zip --peers hospital-a=... --directory ...and it wrote the hospital kit, the directory kit withhub.env, and ahospitals.yamlholding one hospital. It used the localv1.0.0image, because the 2 GBv1.1.0download didn't finish in time. The script and code come from the mounted repo folder, so only the image's Python and libraries matter, and those requirements are the same.Only reviewed against the code (not driven here)
make: the documenteddocker compose --project-directory . --env-file kits/directory/hub.env -f deploy/hub.yml up -d --waitis exactly the commandmake hubruns (Makefilehub:target), and the issue reporter ran it successfully (healthy in 94 s). It wasn't started here because another hub was already running on this machine on the same ports.$PSCommandPath,-cmatch,[Environment]::GetCommandLineArgs(),Get-Command Get-CimInstanceas a guard).install.sh(macOS/Linux): the same checks now run before the download, covered bytests/unit/test_install_sh.pywith stubs (not live).The proof for anything left unverified here is the issue #11 reporter re-running on a real Windows 11 laptop.
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
README.md:615- The README says the 'Only Docker installed' provision command "works in PowerShell and in a Mac or Linux terminal", but the example breaks across lines with a trailing\, and PowerShell does not treat that as a line continuation. On the Windows organiser laptop this section is written for, line 1 runs the container with\as its command and fails, then line 2 runspython scripts/provision.py ...on the host, which has no Python. That is the same dead end issue v1.1.0: install.ps1 re-run always fails on Windows (--force-recreate splatted per character); organiser setup needs Python/make #11 reported. Fix: put the command on one line, as docs/MULTI_LAPTOP.md already does.scripts/provision.py:35- Two problems in the new docker-run example in the provision.py module docstring. First, the next paragraph was joined onto the code line (--directory ... Every link is HTTPS: each address goes into that hospital's), so the example and the prose are both garbled. Second, the docstring is not raw and uses a single\before the newline, which Python reads as a line continuation inside the string, so the rendered text loses the break. The earlier example uses\\for this reason. Fix: use\\and put the prose back in its own paragraph.README.md:791- The intent asks for issue v1.1.0: install.ps1 re-run always fails on Windows (--force-recreate splatted per character); organiser setup needs Python/make #11's real findings to be fixed, and lists this one: "a hospital started from a kit (the organiser's own) shows the container's hostname and Linux/WSL2 on the Nodes page instead of the laptop's details". The change does not fix it. It only adds a README note ("Another: a hospital started from a kit ... shows what its container sees, the container's hostname and the Docker VM's Linux"). Please confirm that documenting this as a known limit is acceptable for this change, or whether kit-started nodes should get the host's facts (for example MEDCHAIN_HOST_* filled in when the kit is started).🔧 Fix applied.
1 info still open:
README.md:618- Since the fix round, the sentence "The command writeskits/hospital-a/...kits/hospital-d/" comes right after the new docker example. That example passes only--peers hospital-a=..., so it writeskits/hospital-a/andkits/directory/and nothing for hospitals b to d. Someone reading top to bottom will expect four hospital kits. Fix: say "the commands above write one kit per hospital in--peers(kits/hospital-a/...)", or move the docker paragraph below this sentence.-d --force-recreateas separate whole arguments and the hospital starts ('Done'), A laptop the organiser removed re-runs the installer: it shows the removal message, stops the node, exits 1, and does not say 'Nothing has been changed', A friend runs the installer with no join code or a malformed code or name: it is refused before the 2 GB image is downloaded, with exit 1, Any installer failure exits non-zero, and a paste into an open window sets LASTEXITCODE instead of closing it, An organiser with only Docker runs the documenteddocker run ... medchain-node:v1.1.0 python scripts/provision.py --zip --peers <own hospital only> --directory ...and gets kits including kits/directory/hub.env, The organiser starts the hub without make, usingdocker compose --project-directory . --env-file kits/directory/hub.env -f deploy/hub.yml up -d --wait, On the dashboard's Join codes page the organiser presses Copy on the code and on the install commands and sees 'Copied'-d --force-recreateas separate whole arguments and the hospital starts ('Done')docker run ... medchain-node:v1.1.0 python scripts/provision.py --zip --peers <own hospital only> --directory ...and gets kits including kits/direc…docker compose --project-directory . --env-file kits/directory/hub.env -f deploy/hub.yml up -d --waitdocker run medchain-pwsh-test2 ... python3 -m pytest -v tests/unit/test_install_ps1.pyagainst the target install.ps1 (8 passed)Same pytest run with the base commit's install.ps1 swapped in (7 of 8 failed, including 'no such service: -' and exit code 0 on failures)Manual transcripts from real pwsh 7.4.6 with docker/tailscale stubs: enrolled re-run, removed-laptop re-run, missing join code, refused join codepython3 -m pytest -v tests/unit/test_install_sh.py tests/unit/test_provision.pyin a container (25 passed)docker buildx imagetools inspect ghcr.io/denimworld12/medchain-node:v1.1.0 --format '{{json .Manifest.Manifests}}'piped to the old grep check (exit 1) and the new jq check (true, exit 0), plus a negative jq run on an amd64-only list (false, exit 1)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.