The scanner has been reporting the same count for weeks, which is what a rule that only prints becomes. It now FAILS the build, and it looks where the leaks actually were: PowerShell, the installer, the seeds, generated JSON, the frontend - case-insensitively, across plugins, shopdb, scripts, deploy, tools. A line that is deliberate declares itself with an ADR-015-OK marker and a reason, so the claim is visible in review instead of tolerated in silence. What it found, fixed here: - The shadow client wrote one site's ShopDB URL into HKLM whenever the registry disagreed. At the site it was written for that reads as healing drift; anywhere else it overwrites the site's own address on every enforce cycle, and the site cannot win because the cycle repeats. The bay's value now wins, an explicit -BaseUrl seeds it, and with neither there is nothing honest to write, so it says so and skips. - The kiosk dispatcher fell back to one plant's host when HKLM was unset, so a kiosk elsewhere quietly opened a server it has no business reaching. The fallback is now this site's site_base_url, baked in at seed time, and the dispatcher refuses rather than guessing when neither is set. Its legacy shortcut matcher derives the host from that URL instead of naming one. - The OpenAPI generator hardcoded a production hostname into every spec it generated, which then published to a public wiki. The relative mount is the only server it can honestly name; a site passes its own by environment. - Placeholders and examples in the UI and the client help offered real internal subnets and a real production URL. They now use documentation ranges. Both publication gates - the export scrub and the docs publishability test - carry the site patterns, which neither did. One plant's hostname, FQDN and internal networks are out of the documentation and the generated specs. Comments naming the reference site are reworded rather than deleted: the reasoning is worth keeping, the plant name is not what makes it true.
7.9 KiB
Production pilot runbook (West Jefferson)
Goal: stand up a real shopdb-flask instance loaded with WJ's classic-ASP data,
run it in parallel with the classic app for a validation window, then cut
over. This runbook adds the legacy-data import + verification + cutover on top of
the generic stand-up in DEPLOY.md. Read that first; this only
calls out the pilot-specific steps.
Related: IMPORT-ADOPTION.md (import model),
IMPORT-API.md (the contract), BACKUP-RESTORE.md,
scripts/site_imports/wjf/ (the loader).
0. Pre-flight checklist
- Host provisioned (Docker + compose, or a VM with Python 3 + MySQL 8).
- Three current classic dumps in hand:
shopdb(main),cmmc_usb,wjf_employees. Take fresh dumps at import time - the classic app is live. - Target MySQL 8, utf8mb4 (charset is contract, ADR-004). Old MySQL <5.7
needs
innodb_large_prefix=ON+ Barracuda. - Decide the pilot URL (e.g.
shopdb-pilot.example.net) - separate from the classic app; do not reuse its hostname yet. - Confirm the import decisions still hold (see the loader README / the import plan): assetnumber fallback + skip-dups, metrology routing, cmmc-only USB, warranties = Dell, occurrences parked.
1. Stand up the pilot instance
Follow DEPLOY.md steps 1-6 against a NEW empty database (name it clearly, e.g.
shopdb_flask_pilot):
flask db upgrade
flask plugin upgrade-all # applies every plugin's chain
flask seed permissions
flask seed settings
flask seed reference-data # seeds communicationtypes (IP) + the rest
Enable every bundled plugin the site tracks - including usb, which ships disabled. A plugin's routes only register when it is enabled at app start, and the importer needs them:
for p in computers employees machines measuringtools network notifications \
printers slides usb warranty knowledgebase geenforce; do
flask plugin enable "$p"
done
Do not run the setup wizard yet - the import fills the data the wizard would otherwise ask you to seed.
2. Load the classic data
The loader (scripts/site_imports/wjf/) reads the classic dumps and drives the
import API. It is site glue, not product code.
-
Load the three dumps into scratch source DBs the loader can read (strip the
CREATE DATABASE/USElines so they land under scratch names, no clobber):for pair in "shopdb_src:shopdb_dump.sql" "cmmc_usb_src:cmmc_usb_dump.sql" \ "wjf_employees_src:wjf_employees_dump.sql"; do db="${pair%%:*}"; f="${pair##*:}" mysql -h HOST -u root -p -e "CREATE DATABASE $db CHARACTER SET utf8mb4;" sed -E '/^CREATE DATABASE/d; /^USE `/d' "$f" | mysql -h HOST -u root -p "$db" done -
Point the loader at the PILOT database and run all stages:
DATABASE_URL='mysql+pymysql://USER:PW@HOST:3306/shopdb_flask_pilot?charset=utf8mb4' \ venv/bin/python -m scripts.site_imports.wjf.runThe 16 stages run in order (reference -> catalog -> assets hub -> locations -> printers -> dependents -> relationships -> subnets -> usb -> verify). It is idempotent - a crashed run resumes from
idmap.json. -
Reclassify servers into network devices. The classic DB stored servers as PCs, so the import lands them as
computerassets. Re-point them in place:DATABASE_URL=... venv/bin/python scripts/reclassify_servers_to_network.py # dry run, prints matches DATABASE_URL=... venv/bin/python scripts/reclassify_servers_to_network.py --commit # apply # match on an exact computer type instead of the SVR- name prefix: ... --type "Server" --commitThe assetid does not change: communications, relationships, map position, and audit history carry over. Only the extension row is swapped (computers -> networkdevices) and the asset type flipped; reclassified devices get the
Servernetworkdevicetype. Run the dry run, eyeball the list, then commit. Re-running is safe (already-moved assets no longer match).
Expected magnitude (from the WJ dumps used in development - your fresh dumps will differ slightly):
| entity | count |
|---|---|
| assets [*] | ~983 (computer ~663, machine ~76, network ~58, measuring-tool ~136, printer ~50) |
| locations | ~24 |
| employees | ~415 |
| installs | ~850 |
| primary IPs | ~461 |
| warranties | ~464 |
| notifications | ~261 |
| knowledge base | ~341 |
| relationships | ~93 |
| subnets | ~37 |
| USB devices / events | ~18 / ~232 |
[*] Counts taken AFTER scripts/reclassify_servers_to_network.py --commit.
Servers imported as computers are re-pointed to network devices, so the computer
count drops and network rises by the same amount versus a raw import.
PLACEHOLDER - re-measure before publishing. The computer/network split shown in the assets row above still reflects a RAW import (pre-reclassify). Re-run the counts on the current prodscratch AFTER the reclassify step above and drop in the actual numbers; do not carry these development figures forward as if they already account for the reclassify.
The verify stage prints a source-vs-target row-count audit; the gaps are the
documented skips (inactive rows, duplicate machinenumbers, LocationOnly, the
9999 placeholder).
3. Verify the import
- Read the
verifystage output - source vs target counts line up modulo the documented skips. - Create the admin:
flask seed admin --username ... --email ...(password printed once). Mark setup done so the app does not force the wizard: setsetup_complete=truein settings (or click through the wizard, skipping the seed steps). - UI spot-check (log in): Computers list paginates the full fleet; the Shop Floor Map plots assets, color-coded by type (positions came from mapleft/maptop); open a PC detail (installs), a printer (IP + share), an application (installed-on list), a KB article; check the employee directory; check a couple of asset relationships.
- Branding: upload the site logo + floor-plan blueprint under Settings, set
facility name (Settings drive these per
CONFIG.md). - Photos are deferred - employees show initials until a photo batch is run.
4. Parallel-run window
- Keep the classic app authoritative during the window. The pilot is read-mostly for validation; do not dual-write.
- Have a few real users (IT + a floor lead) work the pilot and log gaps.
- Re-import is cheap: fix a loader mapping, drop + rebuild the pilot DB, re-run. Nothing you do to the pilot touches classic.
- Point the collector (GE-Enforce fleet ingest) at the pilot in parallel to
confirm live PC check-ins land (see
COLLECTOR-INTEGRATION.md), using a scoped service token.
5. Cutover
When the window is clean:
- Freeze classic writes (announce a short read-only window).
- Take final fresh dumps; re-run the loader into a clean pilot DB so the cutover data is current.
- Verify counts + a fast UI spot-check.
- Repoint the production hostname/DNS (or the reverse proxy) at the pilot.
- Retire the classic app to read-only standby (do not delete - keep it as the rollback for the agreed period).
6. Rollback
- Pre-cutover: trivially point back at classic (it never stopped being authoritative).
- Post-cutover, within the standby window: repoint DNS/proxy back at classic; investigate; re-cut when fixed. Because the loader is deterministic and the classic DB is untouched, a re-run reproduces the flask DB exactly.
7. Post-cutover
- Backups on a schedule (
BACKUP-RESTORE.md) - mysqldump + theinstance/dir (uploaded logos, floor plans, tokens). - Run the employee-photo batch.
- GE-Enforce: publish manifests + cut the fleet over to the flask endpoints
when ready (
GE-ENFORCE-DEPLOY.md) - independent of this pilot. - Schedule the deferred data (occurrences, full communications fidelity) only if a real need appears.