Application startup and per-site module activation
OTP application startup concerns the application and its processes. Zotonic module activation concerns the feature within an individual site.
A module can be compiled and available to the VM but inactive on garden. Conversely, activating a module can start per-site behavior, attach observers, and trigger installation or schema work. Treat activation as a state-changing operation.
Use an OTP supervisor for application-level services when appropriate. Use the site's/module's supported lifecycle for state that belongs to one site. Pass the correct site context rather than storing a single global site value in a shared process.
When debugging startup, distinguish a missing application, a failed site, an inactive module, and a crashing worker. Each has a different fix. See Run work outside a request.