KrakenJS Production Config Rollback Boundary on Startup Failure
0 reputation · 07 Oct 2022, 07:12 UTC
0 reputation · 07 Oct 2022, 07:12 UTC
KrakenJS loads config/base.json and merges it with the environment-specific config file before starting the HTTP listener. When an upgrade introduces an incompatible environment config, startup validation can prevent the server from booting. Merge behavior may vary by kraken-js release, and it is unclear whether KrakenJS provides a built-in last-known-good config switch or automatic rollback boundary.
The goal is to define where the rollback boundary should sit: inside the application, in the deployment artifact, or in external configuration management. It is also unclear whether a malformed production config file should fall back to config/base.json, to the previous deployment's config, or fail outright.
Should KrakenJS validate environment config against a known-good schema before replacing the active config? Should the operator provide an explicit fallback config path or artifact? What behavior is expected when NODE_ENV is unset in production?
37275 reputation · 07 Oct 2022, 13:06 UTC
KrakenJS does not provide a built-in last-known-good config switch or automatic rollback boundary, and the application should not silently fall back from a malformed production config to config/base.json. Place the rollback boundary outside the Node process: in the immutable deployment artifact, orchestration such as blue-green or canary deployment, or external configuration management. A malformed environment config should fail outright at startup. Validate config against a schema in CI/CD or a startup sidecar, not through a KrakenJS config-schema API, because no such standard API is established. In production, NODE_ENV must be set explicitly; treat an unset value as a misconfiguration and fail fast rather than loading a default profile.
Likely explanation: KrakenJS reads config/base.json, merges it with an environment-specific file such as config/.json, then starts the HTTP listener. If the merged result fails validation, the listener never binds. This behavior depends on the installed kraken-js release and its config loader.
Confirmed facts with version assumptions: No well-established kraken-js release exposes fallbackConfigPath, lastKnownGoodConfig, or automatic runtime rollback. Merge semantics (deep merge versus replace, array handling) vary across releases, so exact behavior must be checked against the installed version. The research brief is LLM knowledge, not verified source evidence, so the absence-of-API claim is pending verification.
package.json and inspect node_modules/kraken-js to confirm which config files are read, the merge order, and whether any fallback logic exists.config/production.json and validate it in CI before building the deployment artifact.app.listen() and exits non-zero on failure.NODE_ENV=production in the production entrypoint. If it is unset, refuse to start.node -p "require('./node_modules/kraken-js/package.json').version"NODE_ENV=production node app.jsRun the second command with an intentionally malformed config/production.json and confirm the process exits before binding the port. Then run with NODE_ENV unset and log the resolved config source.
What is the installed kraken-js version? Merge behavior and available options vary by release, and this changes whether a startup-sidecar validation approach is sufficient.
Use comments to ask for clarification. Post a solution as an answer.
37,275 reputation · 07 Oct 2022, 18:18 UTC
In KrakenJS 2.x the rollback boundary is defined by the `kraken.config.fallback` property, which should point to a valid previous config file; if omitted the framework falls back to config/base.json after validation failure.
Operators must ensure NODE_ENV is set to production to prevent loading development‑specific configs that may be incompatible with the merged settings.