3.1 KiB
3.1 KiB
Deployment / Trial Run
Public OA Boundary
Public OA is quasi-production. Deployments, remote config changes and live data operations require explicit approval and evidence.
Rules
- Use
SYNC_ENV=0 bash deploy/trialrun/deploy.shonly when deployment is approved; do not overwrite remote.env. - When
server/src/config.jsreads a new environment key, add the same key todeploy/trialrun/.env.examplebefore deployment;deploy/trialrun/deploy.shrunsnode deploy/trialrun/validate-env-contract.jsat step 0 and must fail if the example contract drifts. - After deployment, report commit hash,
/ready, public smoke results and whether the user can test. - Real business writes are manual unless an Issue explicitly authorizes a controlled test write.
- Do not execute real payments, import bank statements, connect payment providers or write ERP without a separate approved Issue.
Scenario: Deployment Env Contract
1. Scope / Trigger
- Trigger: any backend config, deployment compose, or trialrun env wiring change.
- Purpose: prevent deploy-time surprises where local code compiles but the deployment contract rejects the release or silently misses a runtime default.
2. Signatures
- Command:
node deploy/trialrun/validate-env-contract.js - Deployment entry:
SYNC_ENV=0 bash deploy/trialrun/deploy.sh - Contract sources:
server/src/config.jsdeploy/trialrun/.env.exampledeploy/trialrun/docker-compose.yml
3. Contracts
- Every
process.env.KEYorrequiredEnv("KEY")inserver/src/config.jsmust be present indeploy/trialrun/.env.example. server,worker, andinitservices must load./.envthroughenv_file.- Compose service-level
environmentoverrides are limited to the explicit allowlist invalidate-env-contract.js. SYNC_ENV=0is the default public deploy mode; it does not overwrite remote.env.
4. Validation & Error Matrix
- Missing key in
.env.example->validate-env-contract.jsexits non-zero. - Service omits
env_file: ./.env-> contract exits non-zero. - Unauthorized compose override -> contract exits non-zero.
- Remote
.envmissing -> deploy step 4 exits before migration.
5. Good/Base/Bad Cases
- Good: add
EMAIL_LOGIN_CODE_TTL_SECONDStoconfig.js, document it in.env.example, then run contract validation before deploy. - Base: code-only feature without env changes still runs the contract gate.
- Bad: add a config key only in
config.js; deploy fails at step 0.
6. Tests Required
- Always run
node deploy/trialrun/validate-env-contract.jsafter env-related changes and before public deployment. - For public deploys, also run or verify
/ready, runtime smoke, external deps smoke, public bundle copy scan, and live smoke when credentials exist.
7. Wrong vs Correct
Wrong
# Config key exists only in server/src/config.js.
SYNC_ENV=0 bash deploy/trialrun/deploy.sh
Correct
# Add the key to deploy/trialrun/.env.example first.
node deploy/trialrun/validate-env-contract.js
SYNC_ENV=0 bash deploy/trialrun/deploy.sh