hazo_env 0.12.1 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGE_LOG.md CHANGED
@@ -1,5 +1,173 @@
1
1
  # hazo_env — Change Log
2
2
 
3
+ ## 0.14.1 — 2026-11-23
4
+
5
+ Fix: `resolvePeerDir()` no longer requires the current directory's basename
6
+ to end in `-blue`/`-green`. When no color suffix is found, it reads the
7
+ optional `configSuffix` parameter (populated from the INI's `dir_suffix`)
8
+ to compute the peer as `<basename>-<opposite>` — e.g. `~/kinstripe` with
9
+ `dir_suffix = blue` peers with `~/kinstripe-green`. This eliminates the
10
+ previously-"unavoidable" directory rename during the blue-green migration.
11
+
12
+ - **`resolvePeerDir()`** (`src/deploy/peer.ts`): new optional third
13
+ parameter `configSuffix?: string`.
14
+ - **`runBuild()`** (`src/deploy/build.ts`): passes `config.dir_suffix` on
15
+ the no-state fallback path.
16
+ - **`runInit()`** (`src/deploy/init.ts`): passes `config.dir_suffix`.
17
+
18
+ ## 0.14.0 — 2026-11-09
19
+
20
+ New: `resolveConnectConfig()` (`src/resolve/connect.ts`) and `doctor()`'s
21
+ live-probe path now support a third `[db.<env>]` `type`: `pg` — a direct
22
+ Postgres connection via `hazo_connect`'s `pg` dialect (`PgAdapter`), as
23
+ opposed to `postgrest`, which fronts Postgres through a PostgREST HTTP
24
+ layer. Found while migrating the blogsketch platform app onto hazo_env:
25
+ its prod DB is plain Postgres via `pg` (not PostgREST) specifically because
26
+ only the `pg`/`PgAdapter` dialect exposes a real `.raw()` escape hatch,
27
+ which both hazo_blog's native-tsvector full-text search and hazo_jobs' own
28
+ `SELECT ... FOR UPDATE SKIP LOCKED` job-claim queries depend on — and
29
+ `resolveConnectConfig()` had no type value for that at all, a real gap,
30
+ not a style choice.
31
+
32
+ - **`DbEnvConfig` (`src/types/index.ts`)**: `type` gains `'pg'`; new
33
+ optional `pg?: { connectionString: string; ssl?: boolean | 'require' }`
34
+ field, mirroring the existing `sqlite`/`postgrest` shapes.
35
+ - **`resolveConnectConfig()`**: new `type = pg` branch. Reads
36
+ `connection_string` (through the same `${VAR}` placeholder substitution
37
+ as every other secret-shaped ini value) and optional `ssl` (`require` or
38
+ `false`; omitted means "let hazo_connect/PgAdapter use its own default,
39
+ which is no TLS"). Throws `HAZO_ENV_CONFIG_MISSING_DB_CONNECTION_STRING`
40
+ when `connection_string` is absent, and `HAZO_ENV_CONFIG_UNKNOWN_SSL_VALUE`
41
+ for any `ssl` value other than `require`/`false` — same "fail at
42
+ config-resolve time with a named error" precedent as the existing sqlite
43
+ `driver` validation. The final unknown-type error message now lists
44
+ `sqlite`, `postgrest`, and `pg`.
45
+ - **`doctor()`'s `--probe` path (`src/doctor.ts`)**: a `pg`-typed env is now
46
+ probed the same way a `sqlite`-typed one is — `createHazoConnect({ type:
47
+ 'pg', connectionString, ssl })` then `SELECT 1` via `rawQuery()` — behind
48
+ the same existing prod-without-`--all` refusal guard. PostgREST envs are
49
+ still not probed (no behavior change there).
50
+ - `config/hazo_env_config.ini.sample` and `README.md`'s config reference
51
+ gain a commented `pg` example / the updated type list.
52
+ - Added `resolveConnectConfig — pg shape` tests in `__tests__/resolver.test.ts`
53
+ (resolve, missing-driver-default, missing `connection_string`, bad `ssl`
54
+ value).
55
+
56
+ No changes to the `postgrest`/`sqlite` branches — purely additive, hence a
57
+ minor bump.
58
+
59
+ ## 0.13.1 — 2026-11-09
60
+
61
+ Fix: `startNamedPm2Process` (`src/deploy/pm2-start.ts`) hard-coded the
62
+ ecosystem file lookup to the literal name `ecosystem.config.js`. 0.13.0's own
63
+ multi-app/sidecar support was built explicitly for kinstripe's
64
+ `ecosystem.config.cjs` (see that release's own changelog entry and
65
+ `sidecar.ts`'s header, both of which name it) — but the lookup itself was
66
+ never updated, so every `startNamedPm2Process` call (`deploy build`'s
67
+ staging start, `deploy switch`/`rollback`'s promotion, and
68
+ `syncSidecar`'s recreate path) against a `.cjs`-named app would throw `No
69
+ ecosystem.config.js found` even though a perfectly valid ecosystem file
70
+ existed one extension over. Found while wiring kinstripe's own
71
+ `config/hazo_env_config.ini` `[deploy]` section onto 0.13.0 — a real
72
+ blocker for the exact app this feature was built for.
73
+
74
+ - New `ECOSYSTEM_CONFIG_FILENAMES` list + `resolveEcosystemConfigPath(dir)`
75
+ helper in `pm2-start.ts`: tries `ecosystem.config.cjs` first, then
76
+ `ecosystem.config.js`, returning the first that exists; throws a clear
77
+ error naming both candidates when neither is found. `.cjs` is checked
78
+ first since that's the extension a `"type": "module"` package (kinstripe's
79
+ own `package.json`) must use to keep an `module.exports = {...}` file
80
+ parsed as CommonJS rather than failing as ESM.
81
+ - No behavior change for single-`.js` consumers (gotimer, blogsketch) —
82
+ `.js` is still found exactly as before when no `.cjs` sibling exists.
83
+ - Added regression tests in `__tests__/deploy-pm2-start.test.ts` and
84
+ `__tests__/deploy-sidecar.test.ts` pinning `.cjs`-only resolution and
85
+ `.cjs`-over-`.js` precedence when both exist.
86
+
87
+ ## 0.13.0 — 2026-11-09
88
+
89
+ New: multi-app ecosystem file support for `hazo-env deploy`, driven by two
90
+ real consuming apps — kinstripe's `ecosystem.config.cjs` and this monorepo's
91
+ own blogsketch `ecosystem.config.js` — each of which declares one critical
92
+ web app (cluster mode) PLUS one or more non-web sidecar processes (a
93
+ cron/scheduler/jobs worker in both apps' cases; kinstripe's also runs a
94
+ websocket server and a PDF-render pool) in the SAME ecosystem file. Until
95
+ now, `startNamedPm2Process` (`src/deploy/pm2-start.ts`) hard-threw on any
96
+ ecosystem file with more than one `apps` entry — a real blocker for both
97
+ apps' migration onto this module.
98
+
99
+ - **`startNamedPm2Process` (`src/deploy/pm2-start.ts`)**: `StartNamedPm2ProcessOptions`
100
+ gains an optional `selectAppName?: string`. When given, the template app is
101
+ picked from `ecosystem.apps.find(a => a.name === selectAppName)` instead of
102
+ assuming/requiring a single-app file, throwing a clear error if nothing
103
+ matches. When omitted, behavior is byte-for-byte unchanged — still throws
104
+ if `apps.length !== 1` — so `build.ts`/`switch.ts`/`rollback.ts`, none of
105
+ which pass it, see no behavior change. `port` is now also optional: when
106
+ omitted, NO `PORT` key is injected into either `env` or `env_production` on
107
+ the cloned app config at all, leaving whatever the template already sets
108
+ (or doesn't) completely untouched — sidecars (a cron/jobs worker, say)
109
+ typically don't listen on a port the way the web app does.
110
+
111
+ - **New `src/deploy/sidecar.ts`**: a parallel, independent primitive for
112
+ non-web-facing pm2 processes that move with whichever directory is
113
+ currently live but are NEVER themselves blue-green-swapped — no
114
+ live/standby pair, no state-file tracking, no `-staging` clone, no health
115
+ check. Duplicating a scheduler/jobs-worker into a standby dir the way the
116
+ web app is duplicated would double-claim and double-execute background
117
+ jobs against the same shared production DB, a real correctness bug, not
118
+ just wasted work — this module exists specifically to prevent that.
119
+ Exports `syncSidecar(runner, { dir, name })`, which NEVER throws (every
120
+ failure path returns `{ action: 'failed', warning: <message> }` instead,
121
+ since a sidecar problem must never abort the caller's web-app promotion):
122
+ if the named pm2 process is found, online, and its `pm_cwd` already
123
+ matches `dir`, it's reloaded in place (`pm2 reload <name> --update-env`);
124
+ otherwise (not found, not online, pointing at the OTHER — just-demoted —
125
+ dir, or a failed reload) it's tolerant-deleted and freshly started against
126
+ `dir` via `startNamedPm2Process`'s new `selectAppName` option, with no
127
+ `port`. `syncSidecars(runner, dir, sidecarNames)` maps this over a list.
128
+ Also exports `findPm2ProcessByName`, matching by exact registered pm2
129
+ name rather than by cwd (unlike `status.ts`'s `findPm2ProcessForDir`) —
130
+ right after a switch, a sidecar is still registered against the
131
+ just-demoted dir, so cwd-matching would miss it entirely.
132
+
133
+ - **`DeployConfig` (`src/deploy/types.ts`) / `[deploy]` resolver
134
+ (`src/resolve/deploy.ts`)**: new `sidecar_apps: string[]` field — other pm2
135
+ app names in the same ecosystem file that move with the live dir but are
136
+ never blue-green-swapped themselves. Parsed from a new comma-separated INI
137
+ key, `sidecar_apps = name1, name2`; trimmed, empty entries dropped;
138
+ defaults to `[]` when absent.
139
+
140
+ - **`deploy switch` / `deploy rollback` (`src/deploy/switch.ts` /
141
+ `src/deploy/rollback.ts`)**: after the existing `pm2 save` step, both now
142
+ call `syncSidecars(runner, <the dir that just became live>,
143
+ config.sidecar_apps)` unconditionally, adding `sidecars:
144
+ SidecarSyncResult[]` to `RunSwitchResult`/`RunRollbackResult`. A sidecar
145
+ failure is reported in this array, never thrown — it cannot affect
146
+ `runSwitch`/`runRollback`'s own success/throw behavior, since by this
147
+ point the web app's own promotion has already succeeded.
148
+
149
+ - **`deploy status` (`src/deploy/status.ts`)**: `DeployStatusResult` gains
150
+ `sidecars: Array<{ name, running, pid?, pm2Status?, pm_cwd?, stale }>`,
151
+ populated by looking up each `config.sidecar_apps` name by pm2 process name
152
+ (not by cwd) in the already-fetched process list. `stale: true` means the
153
+ process was found but its `pm_cwd` does NOT match the current live dir — a
154
+ signal the sidecar hasn't been synced onto the current live dir yet.
155
+ Always `[]` when no state file exists yet (same guard as `live`/`standby`).
156
+
157
+ - **CLI (`src/cli.ts`)**: `deploy status` prints each sidecar's running/stale
158
+ state after the live/standby lines; `deploy switch`/`deploy rollback`
159
+ print each sidecar's name/action/detail after their existing per-result
160
+ output — a `failed` sidecar prints a yellow `⚠` warning line but never
161
+ aborts or changes the process exit code, which is controlled solely by the
162
+ web-app promotion's own result.
163
+
164
+ - `config/hazo_env_config.ini.sample` documents the new `sidecar_apps` key
165
+ under `[deploy]`.
166
+
167
+ Backward compatible: every change here is additive. `sidecar_apps` defaults
168
+ to `[]`, which makes `syncSidecars` a no-op (no extra pm2 commands issued at
169
+ all) — existing single-app deployments (gotimer) see zero behavior change.
170
+
3
171
  ## 0.12.1 — 2026-11-07
4
172
 
5
173
  Fix: `deploy build` health check now retries on connection-refused. `checkHealth`
package/README.md CHANGED
@@ -201,7 +201,7 @@ See `config/hazo_env_config.ini.sample` for the full annotated template.
201
201
  Key sections:
202
202
  - `[env]` — `pattern` (comma-separated env names), `app` (app identifier)
203
203
  - `[data]` — `root` (data_root; default `app_data`)
204
- - `[db.<env>]` — `type` (`sqlite` | `postgrest`), `database_path` / `base_url` / `api_key`
204
+ - `[db.<env>]` — `type` (`sqlite` | `postgrest` | `pg`), `database_path` / `base_url` + `api_key` / `connection_string` + `ssl`
205
205
  - `[host.<env>]` — `location` (`local` | `remote`)
206
206
 
207
207
  Secret placeholders use `${ENV_VAR_NAME}` syntax — hazo_env substitutes them from `.env.local` at runtime.
@@ -64,6 +64,19 @@ type = postgrest
64
64
  base_url = ${POSTGREST_PROD_URL}
65
65
  api_key = ${POSTGREST_API_KEY}
66
66
 
67
+ ; Alternative to [db.prod] above: a direct Postgres connection via
68
+ ; hazo_connect's `pg` dialect (PgAdapter), instead of fronting Postgres
69
+ ; through PostgREST. Pick this when the app needs `pg`'s `.raw()` escape
70
+ ; hatch (native-tsvector full-text search, `SELECT ... FOR UPDATE SKIP
71
+ ; LOCKED` job-claim queries, ...) — postgrest/supabase adapters have no
72
+ ; `raw()` at all.
73
+ ; [db.prod]
74
+ ; type = pg
75
+ ; connection_string = ${DATABASE_URL}
76
+ ; ; Optional. "require" for a remote/managed Postgres over TLS. Omit (or
77
+ ; ; "false") for a same-host loopback connection with no TLS.
78
+ ; ssl = require
79
+
67
80
  [host.dev]
68
81
  ; Hint about where the dev environment runs (local/remote)
69
82
  location = local
@@ -183,3 +196,9 @@ build_cmd = npm run build
183
196
  ; order after the unsuffixed post_switch_cmd. Omit entirely to run none.
184
197
  ; post_switch_cmd = npm run indexnow
185
198
  ; post_switch_cmd_2 = bash scripts/cf-purge.sh
199
+
200
+ ; Other pm2 app names in this SAME ecosystem file that move with the live dir
201
+ ; but are never blue-green-swapped themselves (a cron/scheduler/jobs worker,
202
+ ; websocket server, PDF-render pool, ...) — see src/deploy/sidecar.ts.
203
+ ; Comma-separated. Default: none.
204
+ ; sidecar_apps = myapp-scheduler, myapp-pdf-pool
package/dist/cli.js CHANGED
@@ -223,6 +223,12 @@ function formatDirStatus(info) {
223
223
  const indicator = info.running ? pc.green(`✓ running (pid ${info.pid})`) : pc.dim('✗ not running');
224
224
  return ` ${pc.bold(info.role.padEnd(8))} ${info.dir} ${pc.dim(`port ${info.port}`)} ${indicator}`;
225
225
  }
226
+ /** Sidecars have no port (see sidecar.ts) — a short variant of formatDirStatus, flagging staleness instead. */
227
+ function formatSidecarStatus(info) {
228
+ const indicator = info.running ? pc.green(`✓ running (pid ${info.pid})`) : pc.dim('✗ not running');
229
+ const staleNote = info.stale ? ` ${pc.yellow('⚠ stale: pm_cwd mismatch')}` : '';
230
+ return ` ${pc.bold('sidecar'.padEnd(8))} ${info.name} ${indicator}${staleNote}`;
231
+ }
226
232
  async function runDeployStatus() {
227
233
  const { resolveDeployConfig } = await import('./resolve/deploy.js');
228
234
  const { runStatus } = await import('./deploy/status.js');
@@ -238,6 +244,9 @@ async function runDeployStatus() {
238
244
  console.log(formatDirStatus(result.live));
239
245
  if (result.standby)
240
246
  console.log(formatDirStatus(result.standby));
247
+ for (const sidecar of result.sidecars) {
248
+ console.log(formatSidecarStatus(sidecar));
249
+ }
241
250
  console.log('');
242
251
  console.log(` last switch: ${result.lastSwitch ?? pc.dim('(none)')}`);
243
252
  console.log(` last build: ${result.lastBuild ?? pc.dim('(none)')}${result.lastBuildStatus ? ` ${result.lastBuildStatus === 'success' ? pc.green(result.lastBuildStatus) : pc.red(result.lastBuildStatus)}` : ''}`);
@@ -441,6 +450,16 @@ async function runDeploySwitch() {
441
450
  console.log(` ${pc.green('Switch complete.')} live: ${pc.bold(result.newLiveDir)} (port ${result.prodPort})`);
442
451
  console.log(` standby: ${result.newStandbyDir}`);
443
452
  console.log('');
453
+ if (result.sidecars.length) {
454
+ console.log(` sidecars:`);
455
+ for (const sidecar of result.sidecars) {
456
+ const icon = sidecar.action === 'failed' ? pc.yellow('⚠') : pc.green('✓');
457
+ console.log(` ${icon} ${sidecar.name} ${sidecar.action} ${pc.dim(sidecar.detail)}`);
458
+ if (sidecar.warning)
459
+ console.log(` ${pc.dim(sidecar.warning)}`);
460
+ }
461
+ console.log('');
462
+ }
444
463
  }
445
464
  catch (e) {
446
465
  if (e instanceof SwitchAbortError) {
@@ -472,6 +491,16 @@ async function runDeployRollback() {
472
491
  console.log(` ${pc.green('rolled back')} to ${pc.bold(result.restoredLiveDir)}, running on port ${result.prodPort}.`);
473
492
  console.log(` standby: ${result.newStandbyDir}`);
474
493
  console.log('');
494
+ if (result.sidecars.length) {
495
+ console.log(` sidecars:`);
496
+ for (const sidecar of result.sidecars) {
497
+ const icon = sidecar.action === 'failed' ? pc.yellow('⚠') : pc.green('✓');
498
+ console.log(` ${icon} ${sidecar.name} ${sidecar.action} ${pc.dim(sidecar.detail)}`);
499
+ if (sidecar.warning)
500
+ console.log(` ${pc.dim(sidecar.warning)}`);
501
+ }
502
+ console.log('');
503
+ }
475
504
  }
476
505
  catch (e) {
477
506
  if (e instanceof RollbackAbortError) {
@@ -3,6 +3,7 @@ export * from './state.js';
3
3
  export * from './runner.js';
4
4
  export * from './peer.js';
5
5
  export * from './pm2-start.js';
6
+ export * from './sidecar.js';
6
7
  export * from './clean.js';
7
8
  export * from './status.js';
8
9
  export * from './init.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/deploy/index.ts"],"names":[],"mappings":"AAUA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/deploy/index.ts"],"names":[],"mappings":"AAUA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
@@ -13,6 +13,7 @@ export * from './state.js';
13
13
  export * from './runner.js';
14
14
  export * from './peer.js';
15
15
  export * from './pm2-start.js';
16
+ export * from './sidecar.js';
16
17
  export * from './clean.js';
17
18
  export * from './status.js';
18
19
  export * from './init.js';
@@ -4,31 +4,31 @@ export interface StartNamedPm2ProcessOptions {
4
4
  dir: string;
5
5
  /** PM2 process name to start the app under — must not collide with an existing registration. */
6
6
  name: string;
7
- /** Port to run the app on, merged into the cloned app config's env. */
8
- port: number;
7
+ /**
8
+ * Port to run the app on, merged into the cloned app config's env and
9
+ * env_production. Optional, added for sidecar.ts's benefit: a sidecar
10
+ * process (e.g. a cron/jobs worker) typically doesn't listen on a port at
11
+ * all, unlike the web app this helper was originally built for. When
12
+ * omitted, NO `PORT` override is injected into either block — whatever
13
+ * the template app's own ecosystem.config.js entry already sets (or
14
+ * doesn't) for `PORT` is carried over completely unchanged. Existing
15
+ * callers (build.ts, switch.ts, rollback.ts) all pass a port and are
16
+ * unaffected.
17
+ */
18
+ port?: number;
19
+ /**
20
+ * Added for multi-app ecosystem files (kinstripe's and blogsketch's own
21
+ * ecosystem.config.js/.cjs each declare one critical web app plus one or
22
+ * more sidecar processes — a cron/jobs worker, and in kinstripe's case
23
+ * also a websocket server and a PDF-render pool — in the SAME file). When
24
+ * set, the template app is selected from `ecosystem.apps` by exact `name`
25
+ * match instead of assuming/requiring a single-app file; throws a clear
26
+ * error if no entry has this name. Omitting this option keeps today's
27
+ * exact single-app behavior unchanged (see the guard below) — none of
28
+ * this module's existing callers pass it.
29
+ */
30
+ selectAppName?: string;
9
31
  }
10
- /**
11
- * Start `opts.dir`'s app under PM2 as `opts.name`, running on `opts.port`,
12
- * with `cwd` set to `opts.dir`.
13
- *
14
- * Assumes a single-app ecosystem file (one entry in `apps`) — this
15
- * project's existing convention (see gotimer's own ecosystem.config.js) and
16
- * explicitly in scope per the deploy-module spec, which excludes
17
- * multi-instance/cluster mode; no evidence of a multi-app ecosystem file
18
- * was found anywhere in this monorepo while building this helper. Throws if
19
- * `apps` is empty or has more than one entry, rather than silently guessing
20
- * which one to use.
21
- *
22
- * `PORT` is merged into BOTH `env` and `env_production` on the cloned
23
- * config, since gotimer's own ecosystem.config.js (the one concrete example
24
- * in this monorepo) puts the app's runtime env — PORT included — under
25
- * `env_production` rather than the bare `env` block; setting both makes this
26
- * helper work regardless of which block the target app's `--env` flag
27
- * actually resolves against, without having to inspect the file at the call
28
- * site. Every other key the template app sets (script, args, instances,
29
- * exec_mode, etc.) is carried over unchanged — only name/cwd/env are
30
- * overridden.
31
- */
32
32
  export declare function startNamedPm2Process(runner: CommandRunner, opts: StartNamedPm2ProcessOptions): void;
33
33
  /** True if a non-zero pm2 result looks like "process or namespace <name> not found" rather than a real failure. */
34
34
  export declare function isPm2ProcessNotFound(result: CommandResult): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"pm2-start.d.ts","sourceRoot":"","sources":["../../src/deploy/pm2-start.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAe/D,MAAM,WAAW,2BAA2B;IAC1C,yEAAyE;IACzE,GAAG,EAAE,MAAM,CAAC;IACZ,gGAAgG;IAChG,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;CACd;AAeD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,2BAA2B,GAAG,IAAI,CAkEnG;AAeD,mHAA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B,GAAG,IAAI,CA+EnG;AAeD,mHAAmH;AACnH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAEnE;AAED,MAAM,WAAW,sBAAsB;IACrC,uEAAuE;IACvE,OAAO,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,8GAA8G;IAC9G,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mGAAmG;IACnG,OAAO,EAAE,MAAM,CAAC;IAChB,qJAAqJ;IACrJ,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,8HAA8H;IAC9H,cAAc,EAAE,OAAO,CAAC;IACxB;;;;;;;;;;OAUG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,gJAAgJ;AAChJ,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,sBAAsB,GAAG,qBAAqB,CA4D1G"}
@@ -46,46 +46,94 @@ const require = createRequire(import.meta.url);
46
46
  * Start `opts.dir`'s app under PM2 as `opts.name`, running on `opts.port`,
47
47
  * with `cwd` set to `opts.dir`.
48
48
  *
49
- * Assumes a single-app ecosystem file (one entry in `apps`) — this
50
- * project's existing convention (see gotimer's own ecosystem.config.js) and
51
- * explicitly in scope per the deploy-module spec, which excludes
52
- * multi-instance/cluster mode; no evidence of a multi-app ecosystem file
53
- * was found anywhere in this monorepo while building this helper. Throws if
54
- * `apps` is empty or has more than one entry, rather than silently guessing
55
- * which one to use.
49
+ * Template selection: when `opts.selectAppName` is omitted, this assumes a
50
+ * single-app ecosystem file (one entry in `apps`) — this project's existing
51
+ * convention (see gotimer's own ecosystem.config.js) and explicitly in scope
52
+ * per the deploy-module spec, which excludes multi-instance/cluster mode;
53
+ * no evidence of a multi-app ecosystem file was found anywhere in this
54
+ * monorepo while building this helper. Throws if `apps` is empty or has
55
+ * more than one entry, rather than silently guessing which one to use. When
56
+ * `opts.selectAppName` IS given (added for kinstripe's and blogsketch's own
57
+ * multi-app ecosystem files — see `StartNamedPm2ProcessOptions`), the
58
+ * template is instead the `apps` entry whose `name` matches it exactly,
59
+ * regardless of how many other entries the file declares; throws a clear
60
+ * error if none matches.
56
61
  *
57
62
  * `PORT` is merged into BOTH `env` and `env_production` on the cloned
58
- * config, since gotimer's own ecosystem.config.js (the one concrete example
59
- * in this monorepo) puts the app's runtime env — PORT included — under
60
- * `env_production` rather than the bare `env` block; setting both makes this
61
- * helper work regardless of which block the target app's `--env` flag
62
- * actually resolves against, without having to inspect the file at the call
63
- * site. Every other key the template app sets (script, args, instances,
64
- * exec_mode, etc.) is carried over unchanged — only name/cwd/env are
65
- * overridden.
63
+ * config when `opts.port` is given, since gotimer's own ecosystem.config.js
64
+ * (the one concrete example in this monorepo) puts the app's runtime env —
65
+ * PORT included — under `env_production` rather than the bare `env` block;
66
+ * setting both makes this helper work regardless of which block the target
67
+ * app's `--env` flag actually resolves against, without having to inspect
68
+ * the file at the call site. When `opts.port` is omitted (sidecars — see
69
+ * `StartNamedPm2ProcessOptions.port`), neither block is touched for `PORT`
70
+ * at all. Every other key the template app sets (script, args, instances,
71
+ * exec_mode, etc.) is carried over unchanged — only name/cwd/(optionally)
72
+ * env are overridden.
66
73
  */
67
- export function startNamedPm2Process(runner, opts) {
68
- const ecosystemPath = path.join(opts.dir, 'ecosystem.config.js');
69
- if (!fs.existsSync(ecosystemPath)) {
70
- throw new Error(`No ecosystem.config.js found at ${ecosystemPath}.`);
74
+ /**
75
+ * Candidate ecosystem-config filenames, in lookup-preference order. `.cjs`
76
+ * comes first: both real multi-app consumers this helper's `selectAppName`
77
+ * option was built for (kinstripe) use `ecosystem.config.cjs` — a plain
78
+ * `.js` file would be interpreted as ESM and fail the `module.exports =`
79
+ * CommonJS pattern every ecosystem file in this monorepo (and kinstripe's)
80
+ * actually uses, under a package with `"type": "module"` (exactly
81
+ * kinstripe's own package.json) — so apps that need the explicit `.cjs`
82
+ * extension to stay CommonJS are the common case this list exists to serve,
83
+ * not an edge case. `.js` is still checked second for existing single-app
84
+ * consumers (e.g. gotimer/blogsketch) that don't set `"type": "module"` and
85
+ * have always used the plain `.js` name.
86
+ */
87
+ const ECOSYSTEM_CONFIG_FILENAMES = ['ecosystem.config.cjs', 'ecosystem.config.js'];
88
+ /**
89
+ * Resolve `dir`'s ecosystem config file, trying each of
90
+ * `ECOSYSTEM_CONFIG_FILENAMES` in order and returning the first that exists.
91
+ * Throws a clear error listing every candidate name when none is found,
92
+ * rather than hard-coding a single extension (the previous behavior, which
93
+ * silently broke any `.cjs`-named consumer with "No ecosystem.config.js
94
+ * found" even though one existed under a different, equally valid name).
95
+ */
96
+ function resolveEcosystemConfigPath(dir) {
97
+ for (const filename of ECOSYSTEM_CONFIG_FILENAMES) {
98
+ const candidate = path.join(dir, filename);
99
+ if (fs.existsSync(candidate))
100
+ return candidate;
71
101
  }
102
+ throw new Error(`No ecosystem config found at ${dir} (tried: ${ECOSYSTEM_CONFIG_FILENAMES.join(', ')}).`);
103
+ }
104
+ export function startNamedPm2Process(runner, opts) {
105
+ const ecosystemPath = resolveEcosystemConfigPath(opts.dir);
72
106
  const ecosystem = require(ecosystemPath);
73
107
  if (!Array.isArray(ecosystem.apps) || ecosystem.apps.length === 0) {
74
108
  throw new Error(`${ecosystemPath} has no "apps" entries — cannot start a named pm2 process from it.`);
75
109
  }
76
- if (ecosystem.apps.length > 1) {
77
- throw new Error(`${ecosystemPath} declares ${ecosystem.apps.length} apps — startNamedPm2Process only supports a ` +
78
- `single-app ecosystem file (multi-instance/cluster mode is out of scope for this deploy module).`);
110
+ let template;
111
+ if (opts.selectAppName !== undefined) {
112
+ const match = ecosystem.apps.find((a) => a.name === opts.selectAppName);
113
+ if (!match) {
114
+ const declaredNames = ecosystem.apps.map((a) => a.name ?? '(unnamed)').join(', ');
115
+ throw new Error(`${ecosystemPath} has no "apps" entry named "${opts.selectAppName}" (declared names: ${declaredNames}) — ` +
116
+ `cannot start a named pm2 process from it.`);
117
+ }
118
+ template = match;
119
+ }
120
+ else {
121
+ if (ecosystem.apps.length > 1) {
122
+ throw new Error(`${ecosystemPath} declares ${ecosystem.apps.length} apps — startNamedPm2Process only supports a ` +
123
+ `single-app ecosystem file (multi-instance/cluster mode is out of scope for this deploy module).`);
124
+ }
125
+ template = ecosystem.apps[0];
79
126
  }
80
- const template = ecosystem.apps[0];
81
- const portStr = String(opts.port);
82
127
  const namedApp = {
83
128
  ...template,
84
129
  name: opts.name,
85
130
  cwd: opts.dir,
86
- env: { ...(template.env ?? {}), PORT: portStr },
87
- env_production: { ...(template.env_production ?? {}), PORT: portStr },
88
131
  };
132
+ if (opts.port !== undefined) {
133
+ const portStr = String(opts.port);
134
+ namedApp.env = { ...(template.env ?? {}), PORT: portStr };
135
+ namedApp.env_production = { ...(template.env_production ?? {}), PORT: portStr };
136
+ }
89
137
  // Written to os.tmpdir(), not opts.dir: opts.dir's own ecosystem.config.js
90
138
  // may be tracked/gitignored in ways that make a sibling temp file there
91
139
  // awkward (and a fresh clone's dir is exactly the case build.ts's db-setup
@@ -1,3 +1,4 @@
1
+ import { type SidecarSyncResult } from './sidecar.js';
1
2
  import type { CommandRunner, DeployConfig, DeployState } from './types.js';
2
3
  export interface RunRollbackResult {
3
4
  restoredLiveDir: string;
@@ -8,6 +9,12 @@ export interface RunRollbackResult {
8
9
  stagingDeleteWarning?: string;
9
10
  /** Set when `pm2 save` failed after a successful rollback (non-fatal — the rollback itself already succeeded). */
10
11
  pm2SaveWarning?: string;
12
+ /**
13
+ * Reload-or-recreate results for `config.sidecar_apps` (see sidecar.ts),
14
+ * run unconditionally after the web-app restore above has already
15
+ * succeeded. A sidecar failure is reported here, never thrown.
16
+ */
17
+ sidecars: SidecarSyncResult[];
11
18
  }
12
19
  /** Thrown when there's nothing to roll back, or a fatal step fails. */
13
20
  export declare class RollbackAbortError extends Error {
@@ -1 +1 @@
1
- {"version":3,"file":"rollback.d.ts","sourceRoot":"","sources":["../../src/deploy/rollback.ts"],"names":[],"mappings":"AAkFA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE3E,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,WAAW,CAAC;IACnB,6GAA6G;IAC7G,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,kHAAkH;IAClH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,uEAAuE;AACvE,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,OAAO,EAAE,MAAM;CAI5B;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,GAAG,iBAAiB,CAoH1F"}
1
+ {"version":3,"file":"rollback.d.ts","sourceRoot":"","sources":["../../src/deploy/rollback.ts"],"names":[],"mappings":"AAkFA,OAAO,EAAgB,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE3E,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,WAAW,CAAC;IACnB,6GAA6G;IAC7G,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,kHAAkH;IAClH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,QAAQ,EAAE,iBAAiB,EAAE,CAAC;CAC/B;AAED,uEAAuE;AACvE,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,OAAO,EAAE,MAAM;CAI5B;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,GAAG,iBAAiB,CA0H1F"}
@@ -79,6 +79,7 @@
79
79
  import path from 'node:path';
80
80
  import { readState, updateState } from './state.js';
81
81
  import { promoteDirFresh, PromoteDirFreshError } from './pm2-start.js';
82
+ import { syncSidecars } from './sidecar.js';
82
83
  /** Thrown when there's nothing to roll back, or a fatal step fails. */
83
84
  export class RollbackAbortError extends Error {
84
85
  constructor(message) {
@@ -185,6 +186,10 @@ export function runRollback(config, runner) {
185
186
  `a server reboot's "pm2 resurrect" may restore the OLD pm2 process list even though this rollback ` +
186
187
  `succeeded. Run "pm2 save" manually.`
187
188
  : undefined;
189
+ // Sidecar sync: runs unconditionally after the web app's own restore has
190
+ // already succeeded — see switch.ts's identical wiring/rationale.
191
+ // `restoreDir` is the NEW live dir at this point in the function.
192
+ const sidecars = syncSidecars(runner, restoreDir, config.sidecar_apps);
188
193
  return {
189
194
  restoredLiveDir: restoreDir,
190
195
  newStandbyDir: currentLiveDir,
@@ -192,5 +197,6 @@ export function runRollback(config, runner) {
192
197
  state: newState,
193
198
  stagingDeleteWarning,
194
199
  pm2SaveWarning,
200
+ sidecars,
195
201
  };
196
202
  }
@@ -0,0 +1,74 @@
1
+ import type { CommandRunner } from './types.js';
2
+ interface Pm2ProcessEnv {
3
+ status?: string;
4
+ pm_cwd?: string;
5
+ }
6
+ interface Pm2Process {
7
+ pid?: number;
8
+ name?: string;
9
+ pm2_env?: Pm2ProcessEnv;
10
+ }
11
+ /**
12
+ * Find the PM2 process registered under the EXACT name `name` — unlike
13
+ * status.ts's `findPm2ProcessForDir`, which matches by `pm2_env.pm_cwd`.
14
+ * A sidecar's registered name is stable across every switch/rollback cycle
15
+ * (there is no `-staging` clone for a sidecar), so matching by name is the
16
+ * correct, cwd-independent way to find "the one registration for this
17
+ * sidecar, wherever it currently points".
18
+ */
19
+ export declare function findPm2ProcessByName(processes: Pm2Process[], name: string): Pm2Process | undefined;
20
+ /** Outcome of a single `syncSidecar` call. */
21
+ export interface SidecarSyncResult {
22
+ /** The sidecar's pm2 process name (same as the `name` passed in). */
23
+ name: string;
24
+ /**
25
+ * 'reloaded' — it was already online against the right dir; reloaded in place.
26
+ * 'recreated' — it was missing, offline, or pointing at the wrong (demoted) dir; deleted and freshly started.
27
+ * 'failed' — the recreate path itself failed; see `warning` for the caught error's message.
28
+ */
29
+ action: 'reloaded' | 'recreated' | 'failed';
30
+ /** Human-readable description of what happened, for CLI/log output. */
31
+ detail: string;
32
+ /** Set only when `action === 'failed'`: the caught error's message. */
33
+ warning?: string;
34
+ }
35
+ /**
36
+ * Reload-or-recreate ONE sidecar so it ends up running against `opts.dir`
37
+ * (the directory that just became live). NEVER throws — every failure path
38
+ * returns `action: 'failed'` instead, since a sidecar problem must never
39
+ * abort the caller's web-app promotion (see switch.ts's/rollback.ts's own
40
+ * wiring, which calls this unconditionally AFTER the web app's own
41
+ * promotion has already succeeded).
42
+ *
43
+ * Logic:
44
+ * - Query `pm2 jlist` and find the process registered under `opts.name`.
45
+ * - If it's found, `pm2_env.status === 'online'`, AND its `pm_cwd`
46
+ * resolves to `opts.dir`: reload it in place (`pm2 reload <name>
47
+ * --update-env`, tolerant of failure — a failed reload falls through to
48
+ * the recreate path below rather than being silently swallowed; only a
49
+ * reload command that itself exits 0 is reported as `'reloaded'`).
50
+ * - Otherwise (not found, not online, or `pm_cwd` points at the OTHER
51
+ * dir — i.e. it's still running against the directory that was just
52
+ * demoted, or the reload above failed): tolerant-delete any existing
53
+ * `opts.name` registration (ignoring "not found", exactly like
54
+ * pm2-start.ts's own `promoteDirFresh`), then fresh-start it against
55
+ * `opts.dir` via the shared `startNamedPm2Process` primitive — selecting
56
+ * the matching entry out of the (typically multi-app) ecosystem file by
57
+ * name (`selectAppName: opts.name`), and omitting `port` entirely, since
58
+ * a sidecar (cron/jobs worker, websocket server, PDF-render pool, ...)
59
+ * doesn't listen on a port the way the web app does.
60
+ */
61
+ export declare function syncSidecar(runner: CommandRunner, opts: {
62
+ dir: string;
63
+ name: string;
64
+ }): SidecarSyncResult;
65
+ /**
66
+ * Sync every sidecar in `sidecarNames` onto `dir` (the directory that just
67
+ * became live). Simple sequential loop — these are cheap, cwd-only pm2
68
+ * operations, no need for anything fancier (parallelism, batching, ...).
69
+ * Each entry is independent: one sidecar's `'failed'` result never stops
70
+ * the rest from being attempted.
71
+ */
72
+ export declare function syncSidecars(runner: CommandRunner, dir: string, sidecarNames: string[]): SidecarSyncResult[];
73
+ export {};
74
+ //# sourceMappingURL=sidecar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sidecar.d.ts","sourceRoot":"","sources":["../../src/deploy/sidecar.ts"],"names":[],"mappings":"AA2CA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,UAAU,aAAa;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,UAAU;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAqBD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAElG;AAED,8CAA8C;AAC9C,MAAM,WAAW,iBAAiB;IAChC,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,MAAM,EAAE,UAAU,GAAG,WAAW,GAAG,QAAQ,CAAC;IAC5C,uEAAuE;IACvE,MAAM,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,iBAAiB,CAiDzG;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAE5G"}
@@ -0,0 +1,156 @@
1
+ // hazo_env/src/deploy/sidecar.ts — reload-or-recreate a non-web-facing PM2
2
+ // process that moves with whichever directory is currently live, but is
3
+ // NEVER itself blue-green-swapped.
4
+ //
5
+ // Why this exists: two real consuming apps (kinstripe's own
6
+ // ecosystem.config.cjs, and this monorepo's own ecosystem.config.js for
7
+ // blogsketch) each declare one critical web app (cluster mode, blue-green
8
+ // swapped via switch.ts/rollback.ts's promoteDirFresh) PLUS one or more
9
+ // sidecar processes in the SAME ecosystem file — a cron/scheduler/jobs
10
+ // worker in both apps' cases, and in kinstripe's case also a websocket
11
+ // server and a PDF-render pool. A sidecar must NEVER be duplicated into a
12
+ // standby dir the way the web app is: duplicating a scheduler/jobs-worker
13
+ // would double-claim and double-execute background jobs against the same
14
+ // shared production DB — a real correctness bug, not just wasted work.
15
+ // Instead, a sidecar has exactly ONE registration at a time, and after
16
+ // every switch/rollback it simply needs to end up pointing at whichever
17
+ // directory just became live.
18
+ //
19
+ // This is a parallel, independent primitive to the live/standby pair
20
+ // state.ts tracks: no live/standby distinction, no state-file tracking, no
21
+ // `-staging` clone, no health check (sidecars aren't web-facing, so there's
22
+ // nothing HTTP-reachable to health-check). The contract is purely
23
+ // "reload-in-place if it's already healthy against the right dir, otherwise
24
+ // tolerant-delete and fresh-start it there" — see `syncSidecar` below.
25
+ //
26
+ // Deliberately does not reuse status.ts's `findPm2ProcessForDir`: that
27
+ // function matches by `pm2_env.pm_cwd`, which is exactly wrong here — right
28
+ // after a switch, the OLD (now-demoted) dir's cwd is still what's actually
29
+ // registered, and matching by cwd would just find "the sidecar, still
30
+ // pointing at the wrong dir" instead of "the sidecar, by its stable
31
+ // name". Sidecars are looked up by their exact registered pm2 `name`
32
+ // instead (see `findPm2ProcessByName`), which is stable across every
33
+ // switch/rollback cycle (unlike the web app's own single `<app_name>`
34
+ // registration, a sidecar's name never changes — there's no
35
+ // `<name>-staging` clone, ever).
36
+ //
37
+ // status.ts's `Pm2Process`/`Pm2ProcessEnv` types and its `queryPm2Processes`
38
+ // jlist-parsing helper are not exported from that module, so this file
39
+ // redefines a minimal, structurally-compatible subset here rather than
40
+ // reaching into status.ts's internals.
41
+ import path from 'node:path';
42
+ import { startNamedPm2Process, isPm2ProcessNotFound } from './pm2-start.js';
43
+ /**
44
+ * Query `pm2 jlist` and parse the JSON process list. Mirrors status.ts's
45
+ * own `queryPm2Processes`, minus its `warnings` accumulator — a jlist
46
+ * failure here is not surfaced as a separate warning; it's indistinguishable
47
+ * from "the sidecar isn't registered yet", which `syncSidecar` already
48
+ * handles correctly by falling through to the recreate path. Returns an
49
+ * empty list (never throws) on any failure to read/parse pm2's output.
50
+ */
51
+ function queryPm2Processes(runner) {
52
+ const result = runner.spawn('pm2 jlist');
53
+ if (result.code !== 0)
54
+ return [];
55
+ try {
56
+ const parsed = JSON.parse(result.stdout);
57
+ return Array.isArray(parsed) ? parsed : [];
58
+ }
59
+ catch {
60
+ return [];
61
+ }
62
+ }
63
+ /**
64
+ * Find the PM2 process registered under the EXACT name `name` — unlike
65
+ * status.ts's `findPm2ProcessForDir`, which matches by `pm2_env.pm_cwd`.
66
+ * A sidecar's registered name is stable across every switch/rollback cycle
67
+ * (there is no `-staging` clone for a sidecar), so matching by name is the
68
+ * correct, cwd-independent way to find "the one registration for this
69
+ * sidecar, wherever it currently points".
70
+ */
71
+ export function findPm2ProcessByName(processes, name) {
72
+ return processes.find((p) => p.name === name);
73
+ }
74
+ /**
75
+ * Reload-or-recreate ONE sidecar so it ends up running against `opts.dir`
76
+ * (the directory that just became live). NEVER throws — every failure path
77
+ * returns `action: 'failed'` instead, since a sidecar problem must never
78
+ * abort the caller's web-app promotion (see switch.ts's/rollback.ts's own
79
+ * wiring, which calls this unconditionally AFTER the web app's own
80
+ * promotion has already succeeded).
81
+ *
82
+ * Logic:
83
+ * - Query `pm2 jlist` and find the process registered under `opts.name`.
84
+ * - If it's found, `pm2_env.status === 'online'`, AND its `pm_cwd`
85
+ * resolves to `opts.dir`: reload it in place (`pm2 reload <name>
86
+ * --update-env`, tolerant of failure — a failed reload falls through to
87
+ * the recreate path below rather than being silently swallowed; only a
88
+ * reload command that itself exits 0 is reported as `'reloaded'`).
89
+ * - Otherwise (not found, not online, or `pm_cwd` points at the OTHER
90
+ * dir — i.e. it's still running against the directory that was just
91
+ * demoted, or the reload above failed): tolerant-delete any existing
92
+ * `opts.name` registration (ignoring "not found", exactly like
93
+ * pm2-start.ts's own `promoteDirFresh`), then fresh-start it against
94
+ * `opts.dir` via the shared `startNamedPm2Process` primitive — selecting
95
+ * the matching entry out of the (typically multi-app) ecosystem file by
96
+ * name (`selectAppName: opts.name`), and omitting `port` entirely, since
97
+ * a sidecar (cron/jobs worker, websocket server, PDF-render pool, ...)
98
+ * doesn't listen on a port the way the web app does.
99
+ */
100
+ export function syncSidecar(runner, opts) {
101
+ try {
102
+ const processes = queryPm2Processes(runner);
103
+ const proc = findPm2ProcessByName(processes, opts.name);
104
+ const targetDir = path.resolve(opts.dir);
105
+ const cwdMatchesTarget = proc?.pm2_env?.pm_cwd !== undefined && path.resolve(proc.pm2_env.pm_cwd) === targetDir;
106
+ if (proc && proc.pm2_env?.status === 'online' && cwdMatchesTarget) {
107
+ const reloadResult = runner.spawn(`pm2 reload ${opts.name} --update-env`);
108
+ if (reloadResult.code === 0) {
109
+ return {
110
+ name: opts.name,
111
+ action: 'reloaded',
112
+ detail: `"${opts.name}" was already online against ${opts.dir}; reloaded with --update-env.`,
113
+ };
114
+ }
115
+ // Reload command itself failed (non-zero exit) — fall through to the
116
+ // recreate path below instead of reporting failure outright; a
117
+ // reload failure doesn't necessarily mean the recreate path will also
118
+ // fail (e.g. a transient pm2 daemon hiccup).
119
+ }
120
+ // Recreate path: not found, not online, pointing at the OTHER
121
+ // (just-demoted) dir, or a failed reload above. Tolerant-delete
122
+ // whatever's currently registered under `opts.name` first — mirrors
123
+ // promoteDirFresh's own "pm2 delete, not stop" reasoning (pm2-start.ts's
124
+ // header): a stale registration pointing at the wrong dir must be fully
125
+ // deregistered before starting fresh, or pm2 would just restart IT in
126
+ // place instead of recomputing `cwd`/`pm_cwd` against `opts.dir`.
127
+ const deleteResult = runner.spawn(`pm2 delete ${opts.name}`);
128
+ const wasRegistered = deleteResult.code === 0 || !isPm2ProcessNotFound(deleteResult);
129
+ startNamedPm2Process(runner, { dir: opts.dir, name: opts.name, selectAppName: opts.name });
130
+ return {
131
+ name: opts.name,
132
+ action: 'recreated',
133
+ detail: wasRegistered
134
+ ? `"${opts.name}" was stale (not online, or pointing at a different dir); deleted and recreated against ${opts.dir}.`
135
+ : `"${opts.name}" was not registered; created fresh against ${opts.dir}.`,
136
+ };
137
+ }
138
+ catch (e) {
139
+ return {
140
+ name: opts.name,
141
+ action: 'failed',
142
+ detail: `Failed to sync sidecar "${opts.name}" against ${opts.dir}.`,
143
+ warning: e instanceof Error ? e.message : String(e),
144
+ };
145
+ }
146
+ }
147
+ /**
148
+ * Sync every sidecar in `sidecarNames` onto `dir` (the directory that just
149
+ * became live). Simple sequential loop — these are cheap, cwd-only pm2
150
+ * operations, no need for anything fancier (parallelism, batching, ...).
151
+ * Each entry is independent: one sidecar's `'failed'` result never stops
152
+ * the rest from being attempted.
153
+ */
154
+ export function syncSidecars(runner, dir, sidecarNames) {
155
+ return sidecarNames.map((name) => syncSidecar(runner, { dir, name }));
156
+ }
@@ -22,6 +22,24 @@ export interface DeployStatusResult {
22
22
  lastSwitch?: string;
23
23
  lastBuild?: string;
24
24
  lastBuildStatus?: 'success' | 'failed';
25
+ /**
26
+ * Status of each `config.sidecar_apps` entry (see sidecar.ts) — looked up
27
+ * by exact pm2 process NAME, not by cwd (unlike `live`/`standby` above),
28
+ * since a sidecar's registration is never swapped the way the web app's
29
+ * is. `stale: true` means the process was found but its `pm_cwd` does NOT
30
+ * match the current `live.dir` — i.e. it hasn't been synced onto the
31
+ * current live dir yet, a signal something's wrong (normally `deploy
32
+ * switch`/`deploy rollback`'s own `syncSidecars` call keeps this in
33
+ * sync). Always `[]` when `!stateFound` (same guard as `live`/`standby`).
34
+ */
35
+ sidecars: Array<{
36
+ name: string;
37
+ running: boolean;
38
+ pid?: number;
39
+ pm2Status?: string;
40
+ pm_cwd?: string;
41
+ stale: boolean;
42
+ }>;
25
43
  /** Non-fatal problems encountered while gathering status (pm2 unavailable, unparsable df output, ...). */
26
44
  warnings: string[];
27
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/deploy/status.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAe,MAAM,YAAY,CAAC;AAE3E,+DAA+D;AAC/D,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,qEAAqE;IACrE,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAA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return processes.find((p) => p.pm2_env?.pm_cwd && path.resolve(p.pm2_env.pm_cwd) === target);
44
44
  }
45
+ /**
46
+ * Find the PM2 process registered under the EXACT name `name` — mirrors
47
+ * `findPm2ProcessForDir`'s shape, but matches by pm2 process `name` rather
48
+ * than `pm_cwd`. Used for `config.sidecar_apps` entries (see sidecar.ts):
49
+ * unlike the web app's own single `<app_name>` registration (which gets
50
+ * fully deleted/recreated on every switch, always under the SAME name),
51
+ * each sidecar is looked up by its stable, never-renamed pm2 name — cwd
52
+ * matching would miss it entirely right after a switch, while it's still
53
+ * registered against the dir that was just demoted.
54
+ */
55
+ function findPm2ProcessByName(processes, name) {
56
+ return processes.find((p) => p.name === name);
57
+ }
45
58
  function dirStatus(role, dir, port, processes) {
46
59
  const proc = findPm2ProcessForDir(processes, dir);
47
60
  const status = proc?.pm2_env?.status;
@@ -162,9 +175,24 @@ export function runStatus(config, runner, opts = {}) {
162
175
  memoryFreeMb,
163
176
  minMemoryMb: config.min_memory_mb,
164
177
  memoryLow,
178
+ sidecars: [],
165
179
  warnings,
166
180
  };
167
181
  }
182
+ const liveDirResolved = path.resolve(state.live_dir);
183
+ const sidecars = config.sidecar_apps.map((name) => {
184
+ const proc = findPm2ProcessByName(processes, name);
185
+ const status = proc?.pm2_env?.status;
186
+ const pmCwd = proc?.pm2_env?.pm_cwd;
187
+ return {
188
+ name,
189
+ running: status === 'online',
190
+ pid: proc?.pid,
191
+ pm2Status: status,
192
+ pm_cwd: pmCwd,
193
+ stale: !!proc && (pmCwd === undefined || path.resolve(pmCwd) !== liveDirResolved),
194
+ };
195
+ });
168
196
  return {
169
197
  appName: config.app_name,
170
198
  stateFound: true,
@@ -177,6 +205,7 @@ export function runStatus(config, runner, opts = {}) {
177
205
  lastSwitch: state.last_switch,
178
206
  lastBuild: state.last_build,
179
207
  lastBuildStatus: state.last_build_status,
208
+ sidecars,
180
209
  warnings,
181
210
  };
182
211
  }
@@ -1,3 +1,4 @@
1
+ import { type SidecarSyncResult } from './sidecar.js';
1
2
  import type { CommandRunner, DeployConfig, DeployState } from './types.js';
2
3
  export interface PostSwitchHookResult {
3
4
  cmd: string;
@@ -18,6 +19,14 @@ export interface RunSwitchResult {
18
19
  pm2SaveWarning?: string;
19
20
  postSwitchHooks: PostSwitchHookResult[];
20
21
  state: DeployState;
22
+ /**
23
+ * Reload-or-recreate results for `config.sidecar_apps` (see sidecar.ts),
24
+ * run unconditionally after the web-app promotion above has already
25
+ * succeeded. A sidecar failure is reported here, never thrown — it must
26
+ * never cause `runSwitch` itself to report failure (the web app has
27
+ * already been promoted by this point).
28
+ */
29
+ sidecars: SidecarSyncResult[];
21
30
  }
22
31
  /** Thrown when there's nothing to switch (no state file yet) or a fatal step fails. */
23
32
  export declare class SwitchAbortError extends Error {
@@ -1 +1 @@
1
- {"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../src/deploy/switch.ts"],"names":[],"mappings":"AA8DA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE3E,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,qGAAqG;IACrG,cAAc,EAAE,OAAO,CAAC;IACxB,2FAA2F;IAC3F,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,8GAA8G;IAC9G,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,oBAAoB,EAAE,CAAC;IACxC,KAAK,EAAE,WAAW,CAAC;CACpB;AAED,uFAAuF;AACvF,qBAAa,gBAAiB,SAAQ,KAAK;gB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ACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,GAAE,gBAAqB,GAAG,eAAe,CAkInH"}
@@ -59,6 +59,7 @@
59
59
  import path from 'node:path';
60
60
  import { readState, updateState } from './state.js';
61
61
  import { promoteDirFresh, PromoteDirFreshError } from './pm2-start.js';
62
+ import { syncSidecars } from './sidecar.js';
62
63
  /** Thrown when there's nothing to switch (no state file yet) or a fatal step fails. */
63
64
  export class SwitchAbortError extends Error {
64
65
  constructor(message) {
@@ -168,6 +169,12 @@ export function runSwitch(config, runner, opts = {}) {
168
169
  `a server reboot's "pm2 resurrect" may restore the OLD pm2 process list even though this switch ` +
169
170
  `succeeded. Run "pm2 save" manually.`
170
171
  : undefined;
172
+ // Sidecar sync: runs unconditionally after the web app's own promotion
173
+ // has already succeeded (see sidecar.ts's header for why sidecars are
174
+ // never blue-green-swapped the same way). `oldStandbyDir` is the NEW live
175
+ // dir at this point in the function. Never allowed to affect runSwitch's
176
+ // own success/throw behavior — syncSidecars() itself never throws.
177
+ const sidecars = syncSidecars(runner, oldStandbyDir, config.sidecar_apps);
171
178
  return {
172
179
  previousLiveDir: oldLiveDir,
173
180
  newLiveDir: oldStandbyDir,
@@ -179,5 +186,6 @@ export function runSwitch(config, runner, opts = {}) {
179
186
  pm2SaveWarning,
180
187
  postSwitchHooks,
181
188
  state: newState,
189
+ sidecars,
182
190
  };
183
191
  }
@@ -34,6 +34,12 @@ export interface DeployConfig {
34
34
  migrate_cmd?: string;
35
35
  /** Shell commands run after a successful switch (indexnow, CDN purge, ...). May be empty. */
36
36
  post_switch_cmds: string[];
37
+ /**
38
+ * Other pm2 app names in the same ecosystem file that move with the live
39
+ * dir but are never blue-green-swapped themselves — see sidecar.ts.
40
+ * Default: []
41
+ */
42
+ sidecar_apps: string[];
37
43
  }
38
44
  /** Result of a single command execution. */
39
45
  export interface CommandResult {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot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3B,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;GASG"}
@@ -1 +1 @@
1
- {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../src/doctor.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,OAAO,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,kEAAkE;IAClE,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAMD;;;GAGG;AACH,wBAAsB,MAAM,CAAC,IAAI,GAAE,aAAkB,GAAG,OAAO,CAAC,YAAY,CAAC,CAoS5E"}
1
+ {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../src/doctor.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,OAAO,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,kEAAkE;IAClE,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAMD;;;GAGG;AACH,wBAAsB,MAAM,CAAC,IAAI,GAAE,aAAkB,GAAG,OAAO,CAAC,YAAY,CAAC,CAoT5E"}
package/dist/doctor.js CHANGED
@@ -128,7 +128,7 @@ export async function doctor(opts = {}) {
128
128
  catch {
129
129
  continue; // already reported as error above
130
130
  }
131
- if (cfg.type === 'sqlite' && cfg.sqlite) {
131
+ if ((cfg.type === 'sqlite' && cfg.sqlite) || (cfg.type === 'pg' && cfg.pg)) {
132
132
  // `createHazoConnect` only exists on hazo_connect's `/server` subpath (the main
133
133
  // `.` export doesn't re-export it) — see hazo_connect/dist/server/index.d.ts.
134
134
  const hazoConnect = await optional_import('hazo_connect/server');
@@ -139,7 +139,7 @@ export async function doctor(opts = {}) {
139
139
  detail: 'install hazo_connect to enable probing',
140
140
  });
141
141
  }
142
- else {
142
+ else if (cfg.type === 'sqlite' && cfg.sqlite) {
143
143
  try {
144
144
  const conn = hazoConnect.createHazoConnect({ type: 'sqlite', sqlite: cfg.sqlite });
145
145
  // The adapter's raw-SQL method is `rawQuery`, not `query` (see
@@ -155,6 +155,24 @@ export async function doctor(opts = {}) {
155
155
  });
156
156
  }
157
157
  }
158
+ else if (cfg.type === 'pg' && cfg.pg) {
159
+ try {
160
+ const conn = hazoConnect.createHazoConnect({
161
+ type: 'pg',
162
+ connectionString: cfg.pg.connectionString,
163
+ ssl: cfg.pg.ssl ?? false,
164
+ });
165
+ await conn.rawQuery('SELECT 1');
166
+ checks.push({ label: `DB probe [db.${env}]`, status: 'ok', detail: 'pg connection OK' });
167
+ }
168
+ catch (e) {
169
+ checks.push({
170
+ label: `DB probe [db.${env}]`,
171
+ status: 'error',
172
+ detail: e instanceof Error ? e.message : String(e),
173
+ });
174
+ }
175
+ }
158
176
  }
159
177
  }
160
178
  }
@@ -1 +1 @@
1
- {"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../src/resolve/connect.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAmB5E;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,GAAE,qBAA0B,GAAG,WAAW,CA4ElF"}
1
+ {"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../src/resolve/connect.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAmB5E;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,GAAE,qBAA0B,GAAG,WAAW,CA+GlF"}
@@ -91,9 +91,44 @@ export function resolveConnectConfig(opts = {}) {
91
91
  const api_key = substitutePlaceholders(rawKey, extraVars);
92
92
  return { type: 'postgrest', postgrest: { base_url, api_key } };
93
93
  }
94
+ if (type === 'pg') {
95
+ const rawConnectionString = section['connection_string'];
96
+ if (!rawConnectionString) {
97
+ throw new HazoConfigError({
98
+ code: 'HAZO_ENV_CONFIG_MISSING_DB_CONNECTION_STRING',
99
+ pkg: 'hazo_env',
100
+ message: `[db.${targetEnv}] is type=pg but has no connection_string.`,
101
+ });
102
+ }
103
+ const connectionString = substitutePlaceholders(rawConnectionString, extraVars);
104
+ // Optional `ssl = require` in [db.<env>] — passed straight through to
105
+ // hazo_connect's pg config. Validated here (not left for hazo_connect to
106
+ // reject) for the same reason the sqlite `driver` key is validated above:
107
+ // a typo fails at config-resolve time with a hazo_env error that names
108
+ // the bad value.
109
+ const rawSsl = section['ssl'];
110
+ let ssl;
111
+ if (rawSsl === undefined) {
112
+ ssl = undefined;
113
+ }
114
+ else if (rawSsl === 'require') {
115
+ ssl = 'require';
116
+ }
117
+ else if (rawSsl === 'false') {
118
+ ssl = false;
119
+ }
120
+ else {
121
+ throw new HazoConfigError({
122
+ code: 'HAZO_ENV_CONFIG_UNKNOWN_SSL_VALUE',
123
+ pkg: 'hazo_env',
124
+ message: `[db.${targetEnv}] has unknown ssl "${rawSsl}". Expected "require" or "false".`,
125
+ });
126
+ }
127
+ return { type: 'pg', pg: ssl === undefined ? { connectionString } : { connectionString, ssl } };
128
+ }
94
129
  throw new HazoConfigError({
95
130
  code: 'HAZO_ENV_CONFIG_UNKNOWN_DB_TYPE',
96
131
  pkg: 'hazo_env',
97
- message: `[db.${targetEnv}] has unknown type "${type}". Expected "sqlite" or "postgrest".`,
132
+ message: `[db.${targetEnv}] has unknown type "${type}". Expected "sqlite", "postgrest", or "pg".`,
98
133
  });
99
134
  }
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/resolve/deploy.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAgFvD;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,YAAY,CAuDlD"}
1
+ {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/resolve/deploy.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAiGvD;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,YAAY,CAwDlD"}
@@ -81,6 +81,23 @@ function collectPostSwitchCmds(section) {
81
81
  }
82
82
  return cmds;
83
83
  }
84
+ /**
85
+ * Parses `sidecar_apps` (comma-separated pm2 app names, e.g.
86
+ * `sidecar_apps = kinstripe-scheduler, kinstripe-pdf-pool`) into a trimmed,
87
+ * empty-entry-free array. Unlike `post_switch_cmd`'s numbered-key
88
+ * collection, this is a single comma-separated value, not a numbered
89
+ * sequence — a plain split/trim/filter. Absent key -> [] (same default as
90
+ * every other list-shaped [deploy] field).
91
+ */
92
+ function collectSidecarApps(section) {
93
+ const raw = section['sidecar_apps'];
94
+ if (typeof raw !== 'string')
95
+ return [];
96
+ return raw
97
+ .split(',')
98
+ .map((s) => s.trim())
99
+ .filter((s) => s.length > 0);
100
+ }
84
101
  const VALID_DB_STRATEGIES = new Set(['auto', 'copy', 'shared']);
85
102
  /**
86
103
  * Resolve the `[deploy]` section of hazo_env_config.ini into a typed
@@ -136,5 +153,6 @@ export function resolveDeployConfig() {
136
153
  pre_build_cmd: section['pre_build_cmd'] ?? DEFAULTS.pre_build_cmd,
137
154
  migrate_cmd: section['migrate_cmd'] ?? DEFAULTS.migrate_cmd,
138
155
  post_switch_cmds: collectPostSwitchCmds(section),
156
+ sidecar_apps: collectSidecarApps(section),
139
157
  };
140
158
  }
@@ -10,7 +10,7 @@ export type EnvRoleMap = Record<string, HazoEnvRole>;
10
10
  export type HostHint = 'local' | 'remote' | 'unknown';
11
11
  /** DB configuration for a single environment (from [db.<env>] in INI) */
12
12
  export interface DbEnvConfig {
13
- type: 'sqlite' | 'postgrest';
13
+ type: 'sqlite' | 'postgrest' | 'pg';
14
14
  sqlite?: {
15
15
  database_path: string;
16
16
  /** Which SQLite engine hazo_connect should use. Defaults to 'sql.js' when
@@ -28,6 +28,17 @@ export interface DbEnvConfig {
28
28
  base_url: string;
29
29
  api_key: string;
30
30
  };
31
+ /** Direct Postgres connection (hazo_connect's `pg` dialect — `PgAdapter`,
32
+ * the only dialect exposing a real `.raw()` escape hatch, e.g. for
33
+ * native-tsvector full-text search or `SELECT ... FOR UPDATE SKIP LOCKED`
34
+ * job-claim queries). Distinct from `postgrest`, which fronts Postgres
35
+ * through a PostgREST HTTP layer with no `.raw()` at all. */
36
+ pg?: {
37
+ connectionString: string;
38
+ /** 'require' for TLS (remote/managed Postgres); false (default) for a
39
+ * same-host loopback connection with no TLS. */
40
+ ssl?: boolean | 'require';
41
+ };
31
42
  }
32
43
  /** Files configuration returned by resolveFilesConfig */
33
44
  export interface FilesEnvConfig {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAEA,sDAAsD;AACtD,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;AAEnE,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,8BAA8B;AAC9B,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,OAAO,CAAC;IACb,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,UAAU,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB;AAED,uCAAuC;AACvC,MAAM,WAAW,qBAAqB;IACpC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hazo_env",
3
- "version": "0.12.1",
3
+ "version": "0.14.1",
4
4
  "description": "Canonical environment resolver — typed env names, per-env DB/file/secret config, doctor and CLI for hazo apps",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -91,8 +91,8 @@
91
91
  "@types/react": "^19.0.0",
92
92
  "@types/react-dom": "^19.0.0",
93
93
  "hazo_core": "^2.5.0",
94
- "hazo_config": "^2.7.2",
95
- "hazo_connect": "^4.3.5",
94
+ "hazo_config": "^2.9.2",
95
+ "hazo_connect": "^4.6.1",
96
96
  "hazo_files": "^3.7.0",
97
97
  "next": "^16.0.10",
98
98
  "react": "^19.0.0",