English
Ops Panel: Architecture
The Ops Panel is a deployment and operations console for a single machine: you operate in a browser, and it executes Docker and file operations on the host. This page covers its component boundaries, where state lives, and a few design choices related to reliability.
Control Plane and Managed Plane
| Layer | What it is | Key point |
|---|---|---|
| Panel process | Single Go binary, frontend embedded with go:embed | The panel runs no containers itself; it only orchestrates Docker on the host |
| Base environment stack | PostgreSQL, Redis, Artemis | Strong random passwords generated; one-click password change synced to consumers |
| Business application stack | Main app, channel sub-apps, admin / merchant / H5 | Image builds and per-service deployment both live in this stack |
| Gateway stack | Standalone nginx | Origin always 80; HTTPS is terminated by an outer CDN / gateway, which then goes back to origin |
| State file | installer-state.json (0644, atomic writes) | .env and compose are rendered from it; there is no second copy of the truth |
Boundaries of the Three Compose Stacks
Three stacks instead of one big compose, because their lifecycles differ: the base environment lives as long as the machine, the business stack is rebuilt on every release, and the gateway is only adjusted when domains or certificates change. Split this way, rebuilding business containers never touches database volumes, and gateway changes never restart business services.
Stacks connect through Docker networks and container names (the business stack reaches postgresql / redis / artemis; the gateway upstream points at backend:9999), so do not rename services casually.
State and Drift
The panel honors exactly one source of truth for state: installer-state.json in the working directory.
- Saving configuration only updates the state file; it does not take effect immediately;
- Deployment renders
.envanddocker-compose.ymlfrom the state, then runs pull / up; - When configuration changed but was not redeployed, the page flags it as drift and offers two actions: "Redeploy" or "Apply Configuration";
- When containers are running but a snapshot is missing, startup fills the snapshot from the current state automatically, so the panel never diverges from reality.
The payoff is that the panel can restart without losing configuration; the cost is that configuration and runtime state may briefly disagree — do not ignore drift warnings.
Tasks and Logs
Installing Docker, pulling source, building images, and deploying services are long tasks; all use one asynchronous task model:
- Tasks run with a single concurrency on the server; state is persisted, so refreshing the page resumes the view;
- Progress is streamed over SSE and also written to the panel's own log (size-based rotation);
- Tasks can be cancelled, and history has a cap so it does not grow without bound.
Container logs are read separately from docker logs tails, polled by the frontend, and kept apart from task logs.
Why a Single Binary
- The deployment target is a bare machine; the panel must not depend on Node, Java, or a database on the host;
- With the frontend embedded, an upgrade only replaces one file (panel self-upgrade uses the same path);
- The panel carries no business traffic; if it goes down, payments are unaffected, and access and accounts can still be recovered via the TUI and command line.
Design Constraints
| Constraint | Reason |
|---|---|
| Requires root / sudo; optional systemd service | It operates Docker, writes /opt/daxpay, and changes system services |
| Origin listens on 80 only, no direct HTTPS | Certificates and CDNs differ per customer; outer termination is more stable |
| Empty password = generate randomly and write back; the API only reports whether one is set | Keeps passwords out of pages and logs |
| All write operations are audited (SQLite) | Deployment and password changes must be traceable |
| No changes to business configuration | Business runtime parameters are managed by the main app; the panel only injects and restarts |