Rebrand NetAnalyzer -> StoreHealthAnalyzer and consolidate the store
reporting surface into a single `st [number]` command with focused
sub-modes.
Commands
- st [number] - general info (SIW + brands + Meraki net link)
- st [number] network - switches, APs, store server
- st [number] pos - registers, payment terminals, customer display
- st [number] ios - MDM-tracked iOS hardware
- st [number] phone - wired 78xx + DECT basestations/handsets with
registration state, extensions and main DID
- st [number] av - Atlas AMPs + MDM-tracked Apple TVs, video
walls, music players, LED displays
- Removed `analyze` in favor of the unified `st` surface
Integrations
- integrations/webex: Service App OAuth with rotating refresh tokens,
seed + cleanup scripts, tokens/ storage (git-ignored)
- integrations/atlas: Xyte client + cached device discovery keyed on
zero-padded 6-digit store numbers, cold-cache failure -> unavailable
banner instead of a misleading empty result
- services/webexPhone, services/webexService, services/avService: shape
raw upstream data into the report layer's contract
- utils/merakiMatcher: FQDN hostname extraction so payment terminals
match Meraki descriptions; case-insensitive lookup
- utils/chunkReport: split long markdown replies at 7000-char boundaries
Reliability / ops
- server.js: awaited framework.stop() + 8s hard-kill timer so nodemon /
Docker restarts don't leak WDM device registrations ("excessive device
registrations")
- nodemon.json: SIGINT so the graceful path always runs
- scripts/cleanupWebexDevices.js: one-shot WDM cleanup utility
- Group-space routing: hears() regexes tolerate the leading @BotName
prefix Webex prepends to mentions
- Replaced HTML-unsafe <number> placeholders with [number] in all help
strings
Remote agent containerization
- docker/remote-agent/: multi-stage node:22-alpine image, non-root user,
tini for signal handling, minimal deps (ws/axios/dotenv)
- docker/remote-agent/package.sh: docker buildx build defaulting to
linux/amd64 (with override), saves image + assembles deploy/ + writes
SHA256 + zips for offline transfer
- docker/remote-agent/deploy/: runtime docker-compose.yml, install.sh
with platform sanity check, remote-host README
- .dockerignore + .gitignore updates for build artifacts and dist bundles
- npm run agent:package convenience script
Cleanup
- Dropped storeHealth.js / HealthReport.js and their tests/mocks in favor
of the shared storeDetail pipeline
- Store model handles null SIW records gracefully; toSummary always
ends with a newline so the Meraki link sits on its own line
Tests
- 144 tests across 14 suites passing; new coverage for atlasClient,
atlasDevices, avService, avCategory classification, webexPhone,
webexServiceAppAuth, storeDetail integration, siw, chunkReport and
the updated meraki matcher
Co-authored-by: Cursor <cursoragent@cursor.com>
66 lines
2.8 KiB
Docker
66 lines
2.8 KiB
Docker
# syntax=docker/dockerfile:1.7
|
|
|
|
# ============================================================================
|
|
# StoreHealthAnalyzer — Remote Agent
|
|
# ----------------------------------------------------------------------------
|
|
# The remote agent is a tiny WebSocket client that proxies HTTP requests
|
|
# (SIW / MDM / anything else the main bot needs from an internal network)
|
|
# back to the main StoreHealthAnalyzer server. It ships as a standalone
|
|
# container so it can run inside the segmented network where SIW/MDM live.
|
|
#
|
|
# Build context is the REPOSITORY ROOT so we can pull in `remoteAgent.js`
|
|
# from the source tree. Everything else (bot framework, express, config/,
|
|
# services/) is intentionally excluded — the agent doesn't need any of it.
|
|
#
|
|
# Build:
|
|
# docker build -f docker/remote-agent/Dockerfile -t sha-remote-agent:latest .
|
|
#
|
|
# Run:
|
|
# docker run --rm -it \
|
|
# --env-file docker/remote-agent/.env \
|
|
# --name sha-remote-agent \
|
|
# sha-remote-agent:latest
|
|
# ============================================================================
|
|
|
|
# ---- Stage 1: dependencies ------------------------------------------------
|
|
FROM node:22-alpine AS deps
|
|
|
|
WORKDIR /app
|
|
|
|
# Only copy the minimal package manifest (ws + axios + dotenv). Using
|
|
# `npm install --omit=dev` because this package.json intentionally has no
|
|
# lockfile — the three-dep footprint is small and stable enough that the
|
|
# extra file adds more maintenance than reproducibility.
|
|
COPY docker/remote-agent/package.json ./package.json
|
|
RUN npm install --omit=dev --no-audit --no-fund && npm cache clean --force
|
|
|
|
# ---- Stage 2: runtime -----------------------------------------------------
|
|
FROM node:22-alpine AS runtime
|
|
|
|
# tini is a tiny init that reaps zombies and forwards signals correctly, so
|
|
# `docker stop` reaches Node's SIGTERM handler for a clean websocket close.
|
|
RUN apk add --no-cache tini
|
|
|
|
# The `node` user ships preconfigured in the official image (uid 1000).
|
|
# Running unprivileged is a sane default for a container that just makes
|
|
# outbound HTTP calls.
|
|
WORKDIR /app
|
|
USER node
|
|
|
|
# Bring in the pre-installed node_modules from the deps stage, then the
|
|
# single application file. Both are owned by `node` so they can be read at
|
|
# runtime without extra chmod steps.
|
|
COPY --chown=node:node --from=deps /app/node_modules ./node_modules
|
|
COPY --chown=node:node docker/remote-agent/package.json ./package.json
|
|
COPY --chown=node:node remoteAgent.js ./remoteAgent.js
|
|
|
|
ENV NODE_ENV=production
|
|
|
|
# Documented, not enforced — the agent is a WebSocket CLIENT, so it doesn't
|
|
# listen on any port. Leaving this uncommented would be misleading, so we
|
|
# just skip EXPOSE entirely.
|
|
|
|
# tini as PID 1 → signals reach node → agent's SIGTERM/SIGINT handler runs
|
|
# → websocket closes cleanly → process exits 0.
|
|
ENTRYPOINT ["/sbin/tini", "--"]
|
|
CMD ["node", "remoteAgent.js"]
|