Stack module
Layer 6. Services. Services
The stack package is the stack axis. The running unit is the deployment.
Source: modules/stack/.
At a glance
Section titled “At a glance”| CLI | None |
| Subcommands | 0 |
| HTTP endpoints | see the route reference |
| Events emitted | see the event reference |
| Error codes | see the error code reference |
| Service classes | Service |
| Cross-module deps | app, node |
Source layout
Section titled “Source layout”modules/stack/├── errors.go├── events.go├── router.go├── service.go├── models.go└── commands/HTTP API
Section titled “HTTP API”Routes are listed in the generated route reference; request/response notes live in the API reference.
Events emitted
Section titled “Events emitted”Event codes, durability class, and payload shapes are listed in the generated event reference.
Errors
Section titled “Errors”Typed errors are catalogued in the error code reference with HTTP statuses and message templates.
Responsibilities
Section titled “Responsibilities”The stack package is the stack axis. The running unit is the deployment.
The module starts, stops, restarts, and execs that deployment. It
owns the four lifecycle verbs that do not change the on-disk definition:
startbrings services up through the node runtime and emitsA200100STKSTRon success,V500100STRFALon failure.stop: graceful shutdown, emitsA200101STKSTP/V500101STPFAL.restart: stop then start, emitsA200102STKRST/V500102RSTFAL.exec: run a command inside a running service container, emitsA200103STKEXC/V500103EXCFAL.
All four are surfaced through Service in service.go
and exposed on both the CLI (shc start|stop|restart|exec) and the
HTTP API (/api/method/shc.stack.*).
What the stack module does not own: deciding what a deployment
contains, or rendering it (that is app; the leader renders once),
running backups or restore (that is backup), or
running scheduled tasks (that is job). This module is a
controller over a deployment’s runtime operations.
The service resolves the deployment’s owning node before execution. Local
operations use the runtime executor; remote ones go through the internal
API’s /internal/stacks/... routes. Operator start and stop requests also
write the scheduler’s desired state (running or stopped).