Files
shopdb-flask/docs/deployment/PRODUCTION-READINESS.md
cproudlock f9d6b57f0f Move the documentation to the line that ships, and correct it against the code
The docs lived on one lineage and the fleet code on another. That is why six
pages described a shared fleet key as how an agent authenticates, why
COLLECTOR-AUTH had to warn that the per-PC credential code was not in the
repository it sat in, and why ADR-019 recorded a decision whose implementation
was somewhere else. Documentation that cannot see the code it documents goes
stale by construction, and no amount of editing fixes that.

So the corpus moves here: 84 files, 56 pages, 20 ADRs, the proposals, INDEX.md,
llms.txt and both gates. Filenames are unchanged, because a wiki page name is
derived from the filename and a rename breaks every link anybody saved.

THE POINT OF THE MOVE IS THE CORRECTION IT ENABLES. Every caveat that said "not
in this tree" was false the moment the files landed beside the code, so each was
rewritten from what is actually here:

- COLLECTOR-AUTH gained the real enroll request body, the two bounds on the
  unauthenticated route (per-IP rate limit, pending cap with stale rows dropped
  before a real PC is refused), and the rejected pending reason that binds to
  the endpoint identity rather than the nonce.
- ADR-019 now describes an implementation that is present, including its tests,
  and says plainly that what remains is the FLEET migration, not the code.
- proposals/device-identity claimed phase 1 was unbuilt. plugins/computers
  declares deviceid on the collector schema and prefers it over the older
  fallbacks. Corrected in the page, its summary and the index.

WINDOWS/IIS IS NOW DOCUMENTED AS THE LEGACY PATH, per the product decision, and
carefully: it is what production runs today. Every Windows page opens by saying
it is supported, not for a new site, and where a new site should go instead. No
procedure was cut - an operator on an IIS box at 2am needs these pages to work
exactly as well tomorrow. MIGRATE-TOPOLOGY stops being a footnote and becomes
the off-ramp, which is why it nearly doubled: what was there did not match how
the Docker stack really works here.

The Docker material that already lived on this line was kept and given
ownership rather than buried under the ported Windows-centric prose: DEPLOY now
describes the four services, the migrate service that runs the upgrade chain
before api starts, TLS terminated by nginx, and the plugin count corrected from
thirteen to seventeen - a number both lineages had wrong.

ROADMAP is rewritten from evidence rather than memory: what has shipped, read
out of the changelog, the ADRs and the manifests, and ahead of it exactly two
items - finalize a distributed release and polish the setup wizard.

PROJECT-MAP is generated and was stale; the GENERATOR was what was wrong.
--check passes now.

API-REFERENCE is retired to a pointer. /api/docs serves 573 operations with
derived auth, query parameters and harvested examples, and a hand-written page
competing with that is a liability. The file stays so its wiki page and its
inbound links survive.

AND THE MOVE TURNED ON A SCRUB THAT HAD NEVER RUN HERE. test_docs_publishable
keys on docs/*.md, which this line did not have, so it skipped - its own comment
predicted what would surface. Porting the corpus activated it and it found 48
lines that must not reach a published wiki: branch names abbreviating the site,
assistant-tooling paths, the site name in two deployment pages, and an employee
ID in a Windows path that the scrub does not even look for.
2026-09-19 09:10:15 -04:00

11 KiB

Production readiness assessment, 2026-09-07

This is a record, not guidance. Read it for WHY the deployment story needed work, not for what to do. Two things have moved since:

  • Its recommendation was reversed. It recommends Windows/IIS for the reference site and Docker only for new ones. The decision since is the other way round: Docker is the path for every site and Windows/IIS is the legacy topology that will be deprecated.
  • Its "critical path" became the roadmap. Pre-built images in a registry, one-command setup, automatic plugin registration and a simpler backup mode are now the distributed-release item on ROADMAP. Several of its gaps are already closed: the migrate service runs the schema, the plugin bootstrap and the seeders with no manual step, and docker-compose.prebuilt.yml removes npm from the image build.

Current pages: DEPLOY to stand a site up, DOCKER-PREBUILT-APPROACH to build it behind a proxy, ROADMAP for what is left.

Executive Summary

[CRITICAL] NOT PRODUCTION READY in current state without significant operational investment.

The Docker deployment requires extensive manual setup, multiple services, and assumes expertise with Docker Compose, restic backup systems, and Flask plugin architecture. This assessment documents current gaps and provides recommendations.

Current State: Deployment Complexity

What Works

[OK] Flask application code - Stable, tested, 17 plugins functional
[OK] Database schema - Migrations work, data model is sound
[OK] Frontend build - Vue 3 SPA compiles and serves correctly
[OK] Docker images - Build successfully (with caveats below)
[OK] Plugin architecture - Clean, documented, extensible

Critical Gaps

[FAIL] One-command deployment - Requires 7-10 manual steps
[FAIL] Corporate proxy handling - Zscaler cert extraction needed for npm
[FAIL] Backup system complexity - 3 containers + restic + scheduler
[FAIL] TLS certificate generation - Manual OpenSSL commands required
[FAIL] Plugin initialization - Must run apply-profile after first start
[FAIL] Password reset - No default admin password, requires manual SQL
[FAIL] Build time - 15+ minutes with corporate proxy
[FAIL] Documentation scattered - 3 different setup guides (Docker, Local, Backup)

Why Is This So Complex?

1. Corporate Network Reality

Problem: Behind Zscaler proxy, npm can't trust npm registry
Impact: Docker build fails without extracted corporate root CA
Workaround: PowerShell script to extract cert before building
Production Fix: Pre-build images in CI/CD with cert, publish to registry

2. Plugin Architecture Design

Problem: Plugin state in instance/plugins.json, not database
Impact: Importing prod database doesn't register plugins
Workaround: Manual flask plugin apply-profile after first start
Production Fix: Auto-detect installed plugins from schema on boot

3. Backup System Architecture

Problem: Designed for restic with 3-container orchestration
Impact: Requires backup-store + backup-watcher + backup containers
Workaround: All documented, but complex to deploy
Production Fix: Simpler mysqldump-only mode with direct file storage

4. Multi-Stage Docker Build

Problem: Frontend build needs Node 20, backend needs Python 3.14
Impact: Multi-stage build is slow, complex, hard to debug
Workaround: Build works, but takes 15 minutes
Production Fix: Pre-build frontend on CI, copy dist/ into Python-only image

Deployment Models (Ordered by Simplicity)

Option 1: IIS + Windows Services (SIMPLEST)

Best for: Single Windows server deployment
Complexity: Low
Maintenance: Medium

Setup:

  1. Install Python 3.13+
  2. Install MySQL (or use existing instance)
  3. Run installer (creates Windows service for Flask)
  4. Configure IIS reverse proxy
  5. Install plugins via UI

Pros:

  • Native Windows deployment
  • Familiar IIS management
  • No Docker complexity
  • Fast startup

Cons:

  • Windows-only
  • Manual updates
  • No containerization benefits

Production Ready: [WARN] YES (with installer improvements)

Best for: Sites with Docker but no build capability
Complexity: Low-Medium
Maintenance: Low

Setup:

  1. Pull pre-built image from registry
  2. Run docker-compose with .env file
  3. Access UI, enable plugins

Pros:

  • No build step
  • Fast deployment (2 minutes)
  • Consistent environment
  • Easy updates (pull new image)

Cons:

  • Requires Docker
  • Need image registry
  • Initial registry setup

Production Ready: [OK] YES (requires CI/CD setup)

Option 3: Docker Source Build (CURRENT)

Best for: Development, customization
Complexity: High
Maintenance: High

Setup:

  1. Extract Zscaler cert
  2. Generate TLS certs
  3. Build Docker images (15+ min)
  4. Configure .env with 15+ variables
  5. Start docker-compose
  6. Run migrations
  7. Install plugins
  8. Reset admin password
  9. Configure backup system
  10. Test everything

Pros:

  • Full source control
  • Customizable
  • No external dependencies

Cons:

  • Extremely complex
  • Long build times
  • Many failure points
  • Requires Docker expertise

Production Ready: [CRITICAL] NO (too complex for operations)

Option 4: Kubernetes (FUTURE)

Best for: Multi-site deployment, high availability
Complexity: Very High
Maintenance: Medium (with proper GitOps)

Status: Not implemented
Effort: 2-3 weeks of work

What Would Make This Production Ready?

Critical Path (Must Have)

  1. Pre-Built Images in Registry

    • Build images in CI/CD
    • Push to container registry
    • Sites just docker pull
    • Effort: 1 week
  2. One-Command Setup

    • ./deploy.sh does everything
    • No manual cert extraction
    • No manual plugin installation
    • Effort: 3 days
  3. Automated Plugin Detection

    • Scan database schema on boot
    • Auto-register plugins in JSON
    • No manual apply-profile
    • Effort: 2 days
  4. Simplified Backup (Option)

    • Simple mysqldump + tar mode
    • Single container, no restic
    • Good enough for 80% of sites
    • Effort: 1 week
  5. Windows Installer Improvements

    • One-click install
    • Includes Python runtime
    • Creates service automatically
    • Effort: 1 week

Nice to Have (Future)

  • Helm chart for Kubernetes
  • Monitoring/metrics built-in
  • Health check endpoints
  • Automated testing in CI
  • Rolling update strategy

Honest Recommendations

For the reference site

Recommended: Option 1 (IIS + Windows Services)

Reversed since. See the note at the top of this page.

Why (as argued at the time):

  • The site already had Windows infrastructure
  • Simpler to operate
  • Faster to deploy
  • The team knew IIS

Steps:

  1. Build Windows installer
  2. Deploy to Windows Server
  3. Configure IIS reverse proxy
  4. Import prod database
  5. Done

Timeline: 2-3 days including testing

For New Sites

Recommended: Option 2 (Docker Pre-Built Images)

Prerequisites:

  • Set up CI/CD to build images
  • Set up container registry (Docker Hub, Harbor, or AWS ECR)
  • Create deploy.sh script

Then sites can:

# 1. Copy .env.example to .env and edit
cp .env.example .env

# 2. Run deployment
./deploy.sh

# 3. Access UI
https://your-server:5001

Timeline for CI/CD setup: 1-2 weeks

For Current Docker Source Build

Status: Development/customization only, not for production

Use when:

  • Testing new features
  • Developing plugins
  • Debugging issues
  • Learning the system

Don't use when:

  • Deploying to operations
  • Training new ops staff
  • Time-sensitive deployments

Current Documentation Issues

Too Many Guides

  • LOCAL-DEV-SETUP.md - Windows development (port 3307, run_dev.py)
  • DOCKER-SETUP.md - Docker source build (complex, 15+ steps)
  • PRODUCTION-READINESS.md - This file (meta/assessment)
  • scripts/backup/README.md - Backup system (3 containers, restic)

Closed since: the first two were folded into DEVELOPMENT-SETUP and DEPLOY, and INDEX.md is now the single entry point this section asks for.

Problem: Which one do I follow?

Solution: Create decision tree:

  • Developer on Windows -> LOCAL-DEV-SETUP.md
  • Ops deploying to prod -> (DOESN'T EXIST YET - need simplified guide)
  • Custom development -> DOCKER-SETUP.md
  • Backup questions -> scripts/backup/README.md

Missing Guides

  • PRODUCTION-DEPLOY.md - Step-by-step for operations (IIS or Docker pull)
  • QUICK-START.md - 5-minute version for evaluation
  • TROUBLESHOOTING.md - Common issues, not scattered across files
  • UPGRADE-GUIDE.md - How to update between versions

What We Did Today (Honest Assessment)

[OK] Merged the upstream development branch down - 98 commits
[OK] Fixed local dev - run_dev.py works for Windows development
[OK] Documented Docker - Comprehensive but too complex
[OK] Added backup docs - System works but needs expertise
[WARN] Docker "production ready" - Technically works, operationally complex
[FAIL] Simple deployment - Still requires too many manual steps

Next Steps (Priority Order)

Immediate (This Week)

  1. Create QUICK-START.md

    • 5-minute eval version
    • Uses pre-built image (if available) OR local dev
    • Gets people to working system fast
  2. Test Windows Installer

    • Build the installer for the deployment branch
    • Deploy to test Windows Server
    • Document any issues
  3. Create deployment decision tree

    • Flowchart: what's my situation -> which method to use
    • Don't make users read 4 docs to figure out where to start

Short Term (Next Sprint)

  1. Set up CI/CD for image builds

    • GitHub Actions or Jenkins
    • Build on every push to the deployment branch
    • Push to internal registry
  2. Create deploy.sh script

    • One command: ./deploy.sh --env prod
    • Handles certs, plugins, migrations automatically
  3. Simplify backup system

    • Add "simple mode" - just mysqldump + tar
    • Keep restic for advanced sites
    • Document tradeoffs

Long Term (Next Month)

  1. Auto-plugin detection

    • Boot-time schema scan
    • No manual apply-profile
  2. Consolidate documentation

    • One entry point
    • Clear paths for each audience
    • Tested by someone who hasn't seen the system

Conclusion

Is ShopDB production-ready?

  • The code: Yes, it's solid
  • Docker source build deployment: No, too complex
  • Windows installer deployment: Yes, with improvements
  • Docker pre-built images deployment: Yes, but needs CI/CD setup

Bottom line: The application is mature. The deployment story needs work. Focus should shift from "making Docker work" to "making deployment simple."

Recommendation: Invest 2-3 weeks in deployment automation (CI/CD, pre-built images, deploy.sh) rather than continuing to document complex manual processes.