@caelo-cms/provisioning 0.11.19 → 0.11.20
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/dist/agent-db.js +32 -0
- package/dist/aws-task-roles.d.ts +11 -0
- package/dist/aws-task-roles.d.ts.map +1 -1
- package/dist/aws-task-roles.js +19 -0
- package/dist/aws-task-roles.js.map +1 -1
- package/dist/azure-secrets.d.ts +22 -0
- package/dist/azure-secrets.d.ts.map +1 -0
- package/dist/azure-secrets.js +14 -0
- package/dist/azure-secrets.js.map +1 -0
- package/dist/caddy.d.ts +7 -0
- package/dist/caddy.d.ts.map +1 -1
- package/dist/caddy.js +22 -1
- package/dist/caddy.js.map +1 -1
- package/dist/cli.js +3 -0
- package/dist/cli.js.map +1 -1
- package/dist/gateway-armor.d.ts +24 -0
- package/dist/gateway-armor.d.ts.map +1 -0
- package/dist/gateway-armor.js +118 -0
- package/dist/gateway-armor.js.map +1 -0
- package/dist/gateway-edge.d.ts +128 -0
- package/dist/gateway-edge.d.ts.map +1 -0
- package/dist/gateway-edge.js +211 -0
- package/dist/gateway-edge.js.map +1 -0
- package/dist/infra-contract.d.ts +1 -1
- package/dist/infra-contract.d.ts.map +1 -1
- package/dist/infra-contract.js +21 -1
- package/dist/infra-contract.js.map +1 -1
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +8 -1
- package/dist/lifecycle.js.map +1 -1
- package/dist/pool-budget-stack.d.ts +22 -0
- package/dist/pool-budget-stack.d.ts.map +1 -1
- package/dist/pool-budget-stack.js +22 -1
- package/dist/pool-budget-stack.js.map +1 -1
- package/dist/public-service-shape.d.ts +45 -0
- package/dist/public-service-shape.d.ts.map +1 -0
- package/dist/public-service-shape.js +90 -0
- package/dist/public-service-shape.js.map +1 -0
- package/dist/remote-mcp-edge.d.ts +1 -1
- package/dist/remote-mcp-edge.js +1 -1
- package/dist/remote-mcp.d.ts.map +1 -1
- package/dist/remote-mcp.js +12 -2
- package/dist/remote-mcp.js.map +1 -1
- package/dist/serverless-backend.d.ts +27 -0
- package/dist/serverless-backend.d.ts.map +1 -0
- package/dist/serverless-backend.js +30 -0
- package/dist/serverless-backend.js.map +1 -0
- package/dist/stack-contract.d.ts +6 -0
- package/dist/stack-contract.d.ts.map +1 -1
- package/dist/stack-contract.js +24 -0
- package/dist/stack-contract.js.map +1 -1
- package/dist/stack-converge.d.ts +13 -0
- package/dist/stack-converge.d.ts.map +1 -1
- package/dist/stack-converge.js +27 -0
- package/dist/stack-converge.js.map +1 -1
- package/dist/staging-gateway-setup.d.ts +5 -0
- package/dist/staging-gateway-setup.d.ts.map +1 -1
- package/dist/staging-gateway-setup.js +60 -19
- package/dist/staging-gateway-setup.js.map +1 -1
- package/dist/upgrade/app-roll.d.ts +5 -1
- package/dist/upgrade/app-roll.d.ts.map +1 -1
- package/dist/upgrade/app-roll.js +20 -3
- package/dist/upgrade/app-roll.js.map +1 -1
- package/dist/upgrade/converge.d.ts.map +1 -1
- package/dist/upgrade/converge.js +27 -4
- package/dist/upgrade/converge.js.map +1 -1
- package/dist/upgrade/health.d.ts +13 -3
- package/dist/upgrade/health.d.ts.map +1 -1
- package/dist/upgrade/health.js +24 -7
- package/dist/upgrade/health.js.map +1 -1
- package/dist/upgrade/load-balancer-get.d.ts +17 -0
- package/dist/upgrade/load-balancer-get.d.ts.map +1 -0
- package/dist/upgrade/load-balancer-get.js +38 -0
- package/dist/upgrade/load-balancer-get.js.map +1 -0
- package/dist/upgrader-gcp.d.ts.map +1 -1
- package/dist/upgrader-gcp.js +8 -1
- package/dist/upgrader-gcp.js.map +1 -1
- package/dist/wizards/gcp-cost.d.ts +9 -0
- package/dist/wizards/gcp-cost.d.ts.map +1 -1
- package/dist/wizards/gcp-cost.js +69 -34
- package/dist/wizards/gcp-cost.js.map +1 -1
- package/package.json +2 -2
- package/src/aws-task-roles.ts +22 -0
- package/src/azure-secrets.ts +38 -0
- package/src/caddy.test.ts +19 -2
- package/src/caddy.ts +23 -0
- package/src/cli.ts +5 -0
- package/src/gateway-armor.ts +135 -0
- package/src/gateway-bootstrap.test.ts +1 -0
- package/src/gateway-edge.test.ts +262 -0
- package/src/gateway-edge.ts +256 -0
- package/src/gateway-env-isolation.test.ts +45 -6
- package/src/infra-contract.test.ts +5 -3
- package/src/infra-contract.ts +21 -1
- package/src/lifecycle.ts +8 -1
- package/src/pool-budget-stack.ts +25 -0
- package/src/pool-budget-stacks.test.ts +31 -0
- package/src/public-service-shape.test.ts +166 -0
- package/src/public-service-shape.ts +131 -0
- package/src/remote-mcp-edge.ts +1 -1
- package/src/remote-mcp.test.ts +38 -1
- package/src/remote-mcp.ts +25 -3
- package/src/serverless-backend.ts +47 -0
- package/src/stack-contract.test.ts +13 -0
- package/src/stack-contract.ts +25 -0
- package/src/stack-converge.test.ts +28 -1
- package/src/stack-converge.ts +30 -0
- package/src/staging-gateway-setup.test.ts +55 -3
- package/src/staging-gateway-setup.ts +79 -27
- package/src/upgrade/app-roll.ts +27 -3
- package/src/upgrade/converge.ts +33 -4
- package/src/upgrade/health.test.ts +88 -13
- package/src/upgrade/health.ts +32 -7
- package/src/upgrade/load-balancer-get.ts +64 -0
- package/src/upgrade/upgrade.test.ts +96 -3
- package/src/upgrader-gcp.ts +8 -1
- package/src/wizards/gcp-cost.ts +78 -35
- package/stacks/aws/index.ts +24 -22
- package/stacks/azure/index.ts +152 -64
- package/stacks/gcp/index.ts +35 -47
- package/stacks/gcp-firebase/index.ts +25 -13
package/dist/wizards/gcp-cost.js
CHANGED
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
* floor cost (idle + scale-to-zero traffic). Real usage adds egress
|
|
10
10
|
* + AI calls + storage growth on top.
|
|
11
11
|
*/
|
|
12
|
-
import {
|
|
12
|
+
import { GATEWAY_ARMOR_BILLED_RULES } from "../gateway-edge.js";
|
|
13
|
+
import { ADMIN_MEMORY_DEFAULT, memoryQuantityMiB, parseSchedulerIntervalMinutes, RUNTIME_SECRETS, SERVICE_CPU_IDLE, } from "../stack-contract.js";
|
|
13
14
|
/**
|
|
14
15
|
* #1140 — Workflows steps one scheduler tick costs (scheduler-setup.ts
|
|
15
16
|
* schedulerWorkflowSource): the claims `assign`, the signJwt call (a Google
|
|
@@ -69,6 +70,24 @@ export function alwaysOnAdminInstanceUsd(gib) {
|
|
|
69
70
|
const perSecond = CLOUD_RUN_INSTANCE_PRICE.vcpuSecond + gib * CLOUD_RUN_INSTANCE_PRICE.gibSecond;
|
|
70
71
|
return Math.round(perSecond * MONTH_SECONDS);
|
|
71
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Cloud Armor Standard list prices, USD a month (cloud.google.com/armor/pricing,
|
|
75
|
+
* checked 2026-11-02): $0.006849315 per policy-hour and $0.001369863 per
|
|
76
|
+
* rule-hour, rounded; plus $0.75 per million requests on a global policy.
|
|
77
|
+
*/
|
|
78
|
+
export const CLOUD_ARMOR_POLICY_USD = 5;
|
|
79
|
+
export const CLOUD_ARMOR_RULE_USD = 1;
|
|
80
|
+
/**
|
|
81
|
+
* Secret Manager: $0.06 per active secret version a month, the first 6 per
|
|
82
|
+
* billing account free (cloud.google.com/secret-manager/pricing); access
|
|
83
|
+
* operations are cents at Caelo's volume.
|
|
84
|
+
*/
|
|
85
|
+
const SECRET_VERSION_USD = 0.06;
|
|
86
|
+
const SECRET_FREE_VERSIONS = 6;
|
|
87
|
+
/** What `count` secrets with one active version each cost a month. */
|
|
88
|
+
export function secretManagerMonthlyUsd(count) {
|
|
89
|
+
return Math.round(Math.max(0, count - SECRET_FREE_VERSIONS) * SECRET_VERSION_USD * 100) / 100;
|
|
90
|
+
}
|
|
72
91
|
/** The region the price table's list rates are for. */
|
|
73
92
|
const PRICED_REGION = "europe-west1";
|
|
74
93
|
const SQL_TIER_USD = {
|
|
@@ -143,6 +162,15 @@ export function estimateGcpCost(inputs) {
|
|
|
143
162
|
? "scale-to-zero; ~$1/mo light traffic"
|
|
144
163
|
: `${inputs.gatewayMinInstances} min-instance${inputs.gatewayMinInstances > 1 ? "s" : ""}`,
|
|
145
164
|
},
|
|
165
|
+
{
|
|
166
|
+
// #1330 — the staging gateway serves the staged site behind the
|
|
167
|
+
// staging gate. Like every public service it is always provisioned at
|
|
168
|
+
// zero minimum instances with request-based CPU (E14 a of #763), and
|
|
169
|
+
// answers a fixed 404 while no staging host is set.
|
|
170
|
+
name: "Cloud Run staging gateway",
|
|
171
|
+
monthlyUsd: 0,
|
|
172
|
+
notes: "scale-to-zero, request-based CPU; only the team's visits to staging wake it, mostly in the free tier",
|
|
173
|
+
},
|
|
146
174
|
{
|
|
147
175
|
// #1328 — remote MCP's sign-in service, its own service on every
|
|
148
176
|
// install (E14 a of #763): always provisioned, zero minimum instances,
|
|
@@ -151,17 +179,17 @@ export function estimateGcpCost(inputs) {
|
|
|
151
179
|
monthlyUsd: 0,
|
|
152
180
|
notes: "scale-to-zero, request-based CPU; only external AI apps' sign-in and MCP calls wake it, mostly in the free tier",
|
|
153
181
|
},
|
|
154
|
-
//
|
|
155
|
-
// gcp
|
|
156
|
-
// edge
|
|
157
|
-
//
|
|
158
|
-
//
|
|
182
|
+
// Only the gcp variant has a load balancer, Cloud CDN and Cloud Armor.
|
|
183
|
+
// gcp-firebase has none of them (E3 of #763): Firebase Hosting is the
|
|
184
|
+
// edge with its own CDN, the admin is gated by IAP on Cloud Run, and the
|
|
185
|
+
// public services protect themselves without a WAF
|
|
186
|
+
// (docs/dev/gateway-hardening.md).
|
|
159
187
|
...(provider === "gcp"
|
|
160
188
|
? [
|
|
161
189
|
{
|
|
162
190
|
name: "Load balancer + managed SSL cert",
|
|
163
191
|
monthlyUsd: 18,
|
|
164
|
-
notes: "Global LB base fee +
|
|
192
|
+
notes: "Global LB base fee (up to 5 forwarding rules) + certificates (free) — flat; the staging host's route and certificate (#1330) add nothing",
|
|
165
193
|
},
|
|
166
194
|
{
|
|
167
195
|
name: "Cloud CDN cache",
|
|
@@ -169,49 +197,56 @@ export function estimateGcpCost(inputs) {
|
|
|
169
197
|
notes: "Free egress at edge cache hits",
|
|
170
198
|
},
|
|
171
199
|
{
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
200
|
+
// #1339 — the gateway's policy (src/gateway-edge.ts): its rules
|
|
201
|
+
// plus the default rule, each billed; the staging gateway's
|
|
202
|
+
// backend shares it. Prices: CLOUD_ARMOR_POLICY_USD above.
|
|
203
|
+
name: "Cloud Armor policy (gateway + staging gateway)",
|
|
204
|
+
monthlyUsd: CLOUD_ARMOR_POLICY_USD +
|
|
205
|
+
GATEWAY_ARMOR_BILLED_RULES * CLOUD_ARMOR_RULE_USD +
|
|
206
|
+
(inputs.wafAdaptiveProtection ? 5 : 0),
|
|
207
|
+
notes: `policy ($${CLOUD_ARMOR_POLICY_USD}) with ${GATEWAY_ARMOR_BILLED_RULES} rules ($${GATEWAY_ARMOR_BILLED_RULES * CLOUD_ARMOR_RULE_USD}): per-IP bans on credential operations and the visitor API, a captcha throttle, OWASP sqli/xss at sensitivity 1${inputs.wafAdaptiveProtection ? "; adaptive protection (ML-based bot mitigation) +$5" : ""}; an extra layer, the gateways rate-limit themselves; requests ~$0`,
|
|
177
208
|
},
|
|
178
209
|
{
|
|
179
210
|
// #1328 — the MCP-Auth-Proxy's own backend (serverless NEG +
|
|
180
211
|
// backend service, no extra LB fee: same URL map) with its own
|
|
181
212
|
// Cloud Armor policy carrying the remote-MCP throttle
|
|
182
|
-
// (src/remote-mcp-edge.ts) and the default rule.
|
|
183
|
-
// Standard: $0.006849315/policy-hour (~$5/mo) and
|
|
184
|
-
// $0.001369863/rule-hour (~$1/mo), plus $0.75 per million
|
|
185
|
-
// requests on a global policy — cloud.google.com/armor/pricing,
|
|
186
|
-
// checked 2026-11-02.
|
|
213
|
+
// (src/remote-mcp-edge.ts) and the default rule.
|
|
187
214
|
name: "MCP-Auth-Proxy backend + Cloud Armor policy",
|
|
188
|
-
monthlyUsd:
|
|
215
|
+
monthlyUsd: CLOUD_ARMOR_POLICY_USD + 2 * CLOUD_ARMOR_RULE_USD,
|
|
189
216
|
notes: "own policy ($5) with 2 rules ($2): per-IP throttle for remote MCP clients; requests ~$0",
|
|
190
217
|
},
|
|
218
|
+
{
|
|
219
|
+
name: "Cloud Storage (static + media + staging)",
|
|
220
|
+
monthlyUsd: 1,
|
|
221
|
+
notes: "~5 GB storage + low egress; the staging bucket holds two complete builds (#1330 A/B slots); growth roughly $0.02/GB",
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
name: "BigQuery edge log sink",
|
|
225
|
+
monthlyUsd: 0,
|
|
226
|
+
notes: "Free tier — pay only on >1 TB/mo query",
|
|
227
|
+
},
|
|
191
228
|
]
|
|
192
229
|
: [
|
|
193
230
|
{
|
|
194
|
-
name: "Firebase Hosting",
|
|
231
|
+
name: "Firebase Hosting (live + staging site)",
|
|
232
|
+
monthlyUsd: 0,
|
|
233
|
+
notes: "Free tier: 10 GB storage + 360 MB/day egress; the staging site (#1330) only rewrites to the staging gateway and stores nothing",
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
name: "Cloud Storage (media + staging)",
|
|
237
|
+
monthlyUsd: 1,
|
|
238
|
+
notes: "~5 GB storage + low egress; static lives on Firebase; the private staging bucket holds two complete builds (#1330 A/B slots); growth roughly $0.02/GB",
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
name: "Cloud Logging (service logs, the edge log sink)",
|
|
195
242
|
monthlyUsd: 0,
|
|
196
|
-
notes: "Free tier:
|
|
243
|
+
notes: "Free tier: the first 50 GiB of logs a month",
|
|
197
244
|
},
|
|
198
245
|
]),
|
|
199
|
-
{
|
|
200
|
-
name: provider === "gcp"
|
|
201
|
-
? "Cloud Storage (static + media)"
|
|
202
|
-
: "Cloud Storage (media only — static lives on Firebase)",
|
|
203
|
-
monthlyUsd: 1,
|
|
204
|
-
notes: "~5 GB storage + low egress; growth roughly $0.02/GB",
|
|
205
|
-
},
|
|
206
246
|
{
|
|
207
247
|
name: "Secret Manager (runtime secrets)",
|
|
208
|
-
monthlyUsd:
|
|
209
|
-
notes:
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
name: "BigQuery edge log sink",
|
|
213
|
-
monthlyUsd: 0,
|
|
214
|
-
notes: "Free tier — pay only on >1 TB/mo query",
|
|
248
|
+
monthlyUsd: secretManagerMonthlyUsd(RUNTIME_SECRETS.length),
|
|
249
|
+
notes: `${RUNTIME_SECRETS.length} secrets, one active version each: 6 free, then $${SECRET_VERSION_USD} each (the database logins of the admin and both gateways, the Google sign-in client, the remote-MCP seal key, the staging gate key and three internal keys; the staging database shares the Cloud SQL instance at no extra cost)`,
|
|
215
250
|
},
|
|
216
251
|
{
|
|
217
252
|
name: "Install state (ops bucket + Cloud KMS key)",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gcp-cost.js","sourceRoot":"","sources":["../../src/wizards/gcp-cost.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC;;;;;;;;;GASG;AAEH,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,6BAA6B,EAC7B,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAkC9B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAW,CAAC;AAE1E;;;GAGG;AACH,MAAM,eAAe,GAAG;IACtB,eAAe,EAAE,IAAI;IACrB,eAAe,EAAE,KAAK;IACtB,YAAY,EAAE,KAAK;IACnB,YAAY,EAAE,KAAK;CACX,CAAC;AAEX,wFAAwF;AACxF,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAe;IACrD,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,6BAA6B,CAAC,OAAO,CAAC,CAAC,CAAC;IACjF,MAAM,QAA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ChB,KAAK,EACH,+FAA+F;SAClG;QACD;YACE,IAAI,EAAE,wDAAwD;YAC9D,UAAU,EAAE,CAAC;YACb,KAAK,EACH,0HAA0H;SAC7H;QACD;YACE,IAAI,EAAE,sDAAsD,gBAAgB,OAAO;YACnF,UAAU,EAAE,uBAAuB,CAAC,gBAAgB,CAAC;YACrD,KAAK,EAAE,oBAAoB,oBAAoB,CAAC,QAAQ,GAAG,oBAAoB,CAAC,QAAQ,4EAA4E,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,gBAAgB,CAAC,kEAAkE;SACnR;KACF,CAAC;IAEF,uEAAuE;IACvE,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;IACzF,MAAM,UAAU,GACd,MAAM,CAAC,MAAM,KAAK,aAAa;QAC7B,CAAC,CAAC,WAAW,MAAM,CAAC,MAAM,wBAAwB;QAClD,CAAC,CAAC,WAAW,MAAM,CAAC,MAAM,6CAA6C,aAAa,gBAAgB,MAAM,CAAC,MAAM,mBAAmB,CAAC;IACzI,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;AACzC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@caelo-cms/provisioning",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.20",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"description": "Pulumi-driven provisioning for Caelo CMS — `bunx @caelo-cms/provisioning --provider <self-hosted|gcp|aws|azure>` brings up a TLS-served install with Postgres + storage + secrets manager + the admin + the API gateway.",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"prepublishOnly": "tsc -b --force && bun build ../platform-updater/src/agent-db.ts --target=bun --outfile=dist/agent-db.js && tsc --project stacks/gcp/tsconfig.json && tsc --project stacks/gcp-firebase/tsconfig.json"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@caelo-cms/shared": "^0.11.
|
|
43
|
+
"@caelo-cms/shared": "^0.11.20",
|
|
44
44
|
"@clack/prompts": "1.8.1",
|
|
45
45
|
"@pulumi/command": "^1",
|
|
46
46
|
"@pulumi/gcp": "^10",
|
package/src/aws-task-roles.ts
CHANGED
|
@@ -42,6 +42,28 @@ export const AWS_SERVICE_SECRETS: Readonly<Record<AwsTaskService, readonly AwsSe
|
|
|
42
42
|
"mcp-auth-proxy": [],
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* #1339 (epic #763 L5) — the database password env vars each task
|
|
47
|
+
* definition sets as ECS `secrets` (Secrets Manager references), and the
|
|
48
|
+
* secret each comes from. The URLs carry no password (shared
|
|
49
|
+
* database-url.ts: `<NAME>_URL` + `<NAME>_PASSWORD`). Every secret named
|
|
50
|
+
* here is one the service may read ({@link AWS_SERVICE_SECRETS}, asserted by
|
|
51
|
+
* a test). ECS resolves `secrets` with the task's execution role, so the
|
|
52
|
+
* task definitions of #749 get one execution role per service, scoped like
|
|
53
|
+
* its task role.
|
|
54
|
+
*/
|
|
55
|
+
export const AWS_SERVICE_DATABASE_PASSWORDS: Readonly<
|
|
56
|
+
Record<AwsTaskService, Readonly<Record<string, AwsSecret>>>
|
|
57
|
+
> = {
|
|
58
|
+
admin: {
|
|
59
|
+
ADMIN_DATABASE_PASSWORD: "postgres-password",
|
|
60
|
+
PUBLIC_ADMIN_DATABASE_PASSWORD: "postgres-password",
|
|
61
|
+
PUBLIC_STAGING_ADMIN_DATABASE_PASSWORD: "postgres-password",
|
|
62
|
+
},
|
|
63
|
+
gateway: { PUBLIC_DATABASE_PASSWORD: "public-role-password" },
|
|
64
|
+
"mcp-auth-proxy": {},
|
|
65
|
+
};
|
|
66
|
+
|
|
45
67
|
/**
|
|
46
68
|
* The IAM policy document letting a task role read exactly `secretArns`.
|
|
47
69
|
*
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* #1339 (epic #763 L5) — which Key Vault secret each Azure Container App
|
|
5
|
+
* reads as which database password env var. The database URLs carry no
|
|
6
|
+
* password (shared database-url.ts: `<NAME>_URL` + `<NAME>_PASSWORD`); the
|
|
7
|
+
* password is a Key Vault reference on the app, read through a
|
|
8
|
+
* user-assigned identity that holds "Key Vault Secrets User" on exactly the
|
|
9
|
+
* secrets listed here. Mirrors the GCP services' Secret Manager env
|
|
10
|
+
* (stack-contract.ts `SERVICE_SECRET_ENV`) and the AWS task roles
|
|
11
|
+
* (aws-task-roles.ts). Kept apart from the Pulumi program so the
|
|
12
|
+
* provisioning tests can assert it.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/** The Key Vault secrets holding a database password (`caelo<env>-<name>`). */
|
|
16
|
+
export type AzureDatabaseSecret = "pg-password" | "public-role-password";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* An identity that reads secrets: `admin` for the admin-side apps (admin,
|
|
20
|
+
* orchestrator, runner), `gateway` for the API gateway. The MCP-Auth-Proxy
|
|
21
|
+
* reads none (#1328).
|
|
22
|
+
*/
|
|
23
|
+
export type AzureSecretReader = "admin" | "gateway";
|
|
24
|
+
|
|
25
|
+
/** Each reader's password env vars and the secret each comes from. */
|
|
26
|
+
export const AZURE_SERVICE_DATABASE_SECRETS: Readonly<
|
|
27
|
+
Record<AzureSecretReader, Readonly<Record<string, AzureDatabaseSecret>>>
|
|
28
|
+
> = {
|
|
29
|
+
admin: {
|
|
30
|
+
ADMIN_DATABASE_PASSWORD: "pg-password",
|
|
31
|
+
PUBLIC_ADMIN_DATABASE_PASSWORD: "pg-password",
|
|
32
|
+
PUBLIC_STAGING_ADMIN_DATABASE_PASSWORD: "pg-password",
|
|
33
|
+
},
|
|
34
|
+
// CLAUDE.md §2: public_role on cms_public is the gateway's one login.
|
|
35
|
+
gateway: {
|
|
36
|
+
PUBLIC_DATABASE_PASSWORD: "public-role-password",
|
|
37
|
+
},
|
|
38
|
+
};
|
package/src/caddy.test.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MPL-2.0
|
|
2
2
|
|
|
3
3
|
import { describe, expect, it } from "bun:test";
|
|
4
|
+
import { HARD_MAX_BODY_BYTES } from "@caelo-cms/shared";
|
|
4
5
|
import {
|
|
6
|
+
CADDY_GATEWAY_MAX_BODY_BYTES,
|
|
5
7
|
type CaddyfileSpec,
|
|
6
8
|
caddyTokenProblem,
|
|
7
9
|
generateCaddyfile,
|
|
@@ -96,14 +98,29 @@ describe("Caddyfile upstreams (#707)", () => {
|
|
|
96
98
|
expect(out).not.toContain("localhost");
|
|
97
99
|
expect(out).not.toContain("127.0.0.1");
|
|
98
100
|
expect(block(out, "admin.example.com")).toContain("reverse_proxy caelo-admin:5173");
|
|
99
|
-
expect(block(out, "example.com")).
|
|
100
|
-
|
|
101
|
+
expect(block(out, "example.com")).toMatch(
|
|
102
|
+
/handle \/api\/\* \{\n(?:.*\n)*? {4}reverse_proxy caelo-gateway:8090\n/,
|
|
101
103
|
);
|
|
102
104
|
// #1330 — the staging host goes to the staging gateway, every path.
|
|
103
105
|
expect(block(out, "staging.example.com")).toContain("reverse_proxy caelo-staging-gateway:8091");
|
|
104
106
|
expect(block(out, "staging.example.com")).not.toContain("caelo-gateway:8090");
|
|
105
107
|
});
|
|
106
108
|
|
|
109
|
+
it("caps request bodies bound for a gateway at the gateways' hard ceiling (#1339)", () => {
|
|
110
|
+
const cap = `request_body {\n max_size ${HARD_MAX_BODY_BYTES}\n }`;
|
|
111
|
+
expect(CADDY_GATEWAY_MAX_BODY_BYTES).toBe(HARD_MAX_BODY_BYTES);
|
|
112
|
+
// Inside the /api/* handler of the public vhost, before the proxy.
|
|
113
|
+
expect(block(out, "example.com")).toContain(
|
|
114
|
+
`handle /api/* {\n request_body {\n max_size ${HARD_MAX_BODY_BYTES}\n }\n reverse_proxy caelo-gateway:8090\n`,
|
|
115
|
+
);
|
|
116
|
+
// Every path of the staging vhost goes to the staging gateway.
|
|
117
|
+
expect(block(out, "staging.example.com")).toContain(
|
|
118
|
+
`${cap}\n reverse_proxy caelo-staging-gateway:8091`,
|
|
119
|
+
);
|
|
120
|
+
// The admin's own uploads are not the gateways' to cap.
|
|
121
|
+
expect(block(out, "admin.example.com")).not.toContain("request_body");
|
|
122
|
+
});
|
|
123
|
+
|
|
107
124
|
it("does not route /admin/* on the public site (the admin routes from / on its own host)", () => {
|
|
108
125
|
expect(block(out, "example.com")).not.toContain("/admin");
|
|
109
126
|
});
|
package/src/caddy.ts
CHANGED
|
@@ -30,6 +30,14 @@
|
|
|
30
30
|
* run in CI) — issue #566 shipped a `try_files` nested inside
|
|
31
31
|
* `file_server { }`, which Caddy 2.11 refuses, so no vhost came up.
|
|
32
32
|
*
|
|
33
|
+
* Request bodies bound for a gateway (`/api/*` on public vhosts, every path
|
|
34
|
+
* on staging vhosts) are capped at {@link CADDY_GATEWAY_MAX_BODY_BYTES}
|
|
35
|
+
* (#1339). Caddy does no rate limiting: stock Caddy has no `rate_limit`
|
|
36
|
+
* directive (it needs a custom build with a third-party module), so the
|
|
37
|
+
* gateways' own per-client and per-operation limits are the rate limit on
|
|
38
|
+
* self-hosted, where Caddy hands them the real client address (one trusted
|
|
39
|
+
* hop) — the same layers that carry the WAF-less gcp-firebase setup (E3).
|
|
40
|
+
*
|
|
33
41
|
* Staging vhosts force `X-Robots-Tag: noindex`. Caddy serves no staging
|
|
34
42
|
* file itself (#1330): the staging gateway mounts the staged builds
|
|
35
43
|
* read-only, and Caddy has no other path to them, so nothing reaches a
|
|
@@ -69,11 +77,20 @@
|
|
|
69
77
|
import {
|
|
70
78
|
CONTENT_HASHED_PATH_PATTERN,
|
|
71
79
|
caddyRedirectsImport,
|
|
80
|
+
HARD_MAX_BODY_BYTES,
|
|
72
81
|
IMMUTABLE_CACHE_CONTROL,
|
|
73
82
|
NOSNIFF,
|
|
74
83
|
SVG_DOCUMENT_CSP,
|
|
75
84
|
} from "@caelo-cms/shared";
|
|
76
85
|
|
|
86
|
+
/**
|
|
87
|
+
* #1339 (epic #763 L5) — the largest request body Caddy passes to a
|
|
88
|
+
* gateway: the gateways' own hard ceiling ({@link HARD_MAX_BODY_BYTES}), so
|
|
89
|
+
* a larger body is refused at the edge (413) before it is streamed into the
|
|
90
|
+
* Compose network. The gateways keep their own, smaller per-route caps.
|
|
91
|
+
*/
|
|
92
|
+
export const CADDY_GATEWAY_MAX_BODY_BYTES = HARD_MAX_BODY_BYTES;
|
|
93
|
+
|
|
77
94
|
export interface CaddyDomainSpec {
|
|
78
95
|
readonly hostname: string;
|
|
79
96
|
/**
|
|
@@ -249,6 +266,9 @@ function vhost(d: CaddyDomainSpec, spec: CaddyfileSpec): string {
|
|
|
249
266
|
header X-Content-Type-Options "${NOSNIFF}"
|
|
250
267
|
@svg path *.svg
|
|
251
268
|
header @svg Content-Security-Policy "${SVG_DOCUMENT_CSP}"
|
|
269
|
+
request_body {
|
|
270
|
+
max_size ${CADDY_GATEWAY_MAX_BODY_BYTES}
|
|
271
|
+
}
|
|
252
272
|
reverse_proxy ${spec.stagingGatewayUpstream}
|
|
253
273
|
}
|
|
254
274
|
`;
|
|
@@ -272,6 +292,9 @@ function vhost(d: CaddyDomainSpec, spec: CaddyfileSpec): string {
|
|
|
272
292
|
@svg path *.svg
|
|
273
293
|
header @svg Content-Security-Policy "${SVG_DOCUMENT_CSP}"
|
|
274
294
|
handle /api/* {
|
|
295
|
+
request_body {
|
|
296
|
+
max_size ${CADDY_GATEWAY_MAX_BODY_BYTES}
|
|
297
|
+
}
|
|
275
298
|
reverse_proxy ${spec.gatewayUpstream}
|
|
276
299
|
}
|
|
277
300
|
handle {
|
package/src/cli.ts
CHANGED
|
@@ -1654,6 +1654,11 @@ async function serveStagingHost(
|
|
|
1654
1654
|
.join("\n")}`,
|
|
1655
1655
|
);
|
|
1656
1656
|
}
|
|
1657
|
+
if (edge.domainMappingKept) {
|
|
1658
|
+
console.log(
|
|
1659
|
+
`${host} still points at its old Cloud Run route, which stays until those records are set; the next upgrade removes it.`,
|
|
1660
|
+
);
|
|
1661
|
+
}
|
|
1657
1662
|
console.log(
|
|
1658
1663
|
`Protected staging site: https://${host}/ (its certificate is issued once the records resolve)`,
|
|
1659
1664
|
);
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* #1339 — bring the visitor gateway's Cloud Armor policy on an existing
|
|
5
|
+
* `gcp` install to the rules of gateway-edge.ts (infrastructure contract
|
|
6
|
+
* 21). The stack declares the same rules for new installs; the converge
|
|
7
|
+
* runs this, because the in-cloud upgrader holds no compute rights.
|
|
8
|
+
*
|
|
9
|
+
* No step leaves the policy with less protection than before:
|
|
10
|
+
* - a rule at a spec priority that differs is updated in place (one
|
|
11
|
+
* write: it is the old rule or the new one, never none);
|
|
12
|
+
* - a missing rule is created;
|
|
13
|
+
* - only once every rule is in place is the old catch-all ban at priority
|
|
14
|
+
* 1000 ({@link LEGACY_GENERAL_BAN}) deleted, and only when it is exactly
|
|
15
|
+
* that rule. A failure before that leaves it in force.
|
|
16
|
+
* Rules at other priorities are the Owner's own and stay.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import {
|
|
20
|
+
GATEWAY_ARMOR_RULES,
|
|
21
|
+
gatewayArmorRuleFlags,
|
|
22
|
+
isGatewayArmorRule,
|
|
23
|
+
isLegacyGeneralBan,
|
|
24
|
+
LEGACY_GENERAL_BAN,
|
|
25
|
+
type LiveGatewayArmorRule,
|
|
26
|
+
} from "./gateway-edge.js";
|
|
27
|
+
import { gcloud as defaultGcloud } from "./gcloud.js";
|
|
28
|
+
import type { GcloudRunner } from "./gcloud-retry.js";
|
|
29
|
+
import { gcpNamePrefix } from "./gcp-names.js";
|
|
30
|
+
|
|
31
|
+
/** What {@link ensureGatewayArmorRules} did, or why it could not. */
|
|
32
|
+
export type GatewayArmorResult =
|
|
33
|
+
| { readonly ok: true; readonly policy: string; readonly done: readonly string[] }
|
|
34
|
+
| { readonly ok: false; readonly error: string; readonly done: readonly string[] };
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Apply {@link GATEWAY_ARMOR_RULES} to the gateway's `<prefix>-waf*` policy.
|
|
38
|
+
*
|
|
39
|
+
* @param target the install's project and environment
|
|
40
|
+
* @returns the lines it changed (empty when every rule was already in place)
|
|
41
|
+
*/
|
|
42
|
+
export async function ensureGatewayArmorRules(
|
|
43
|
+
target: { readonly projectId: string; readonly env: string },
|
|
44
|
+
deps: { run?: GcloudRunner } = {},
|
|
45
|
+
): Promise<GatewayArmorResult> {
|
|
46
|
+
const run = deps.run ?? defaultGcloud;
|
|
47
|
+
const project = `--project=${target.projectId}`;
|
|
48
|
+
const done: string[] = [];
|
|
49
|
+
const prefix = `${gcpNamePrefix(target.env)}-waf`;
|
|
50
|
+
const list = await run([
|
|
51
|
+
"compute",
|
|
52
|
+
"security-policies",
|
|
53
|
+
"list",
|
|
54
|
+
project,
|
|
55
|
+
`--filter=name~^${prefix}`,
|
|
56
|
+
"--format=value(name)",
|
|
57
|
+
]);
|
|
58
|
+
if (!list.ok) return { ok: false, error: `list security policies: ${list.stderr.trim()}`, done };
|
|
59
|
+
const names = list.stdout
|
|
60
|
+
.split("\n")
|
|
61
|
+
.map((l) => l.trim())
|
|
62
|
+
.filter(Boolean);
|
|
63
|
+
// Pulumi names the policy `<prefix>-waf-<suffix>`; the MCP-Auth-Proxy's is `<prefix>-mcp-auth-proxy-armor`.
|
|
64
|
+
if (names.length !== 1) {
|
|
65
|
+
return {
|
|
66
|
+
ok: false,
|
|
67
|
+
error: `expected exactly one ${prefix}* Cloud Armor policy, found ${names.length}`,
|
|
68
|
+
done,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const policy = names[0] as string;
|
|
72
|
+
const describe = await run([
|
|
73
|
+
"compute",
|
|
74
|
+
"security-policies",
|
|
75
|
+
"describe",
|
|
76
|
+
policy,
|
|
77
|
+
project,
|
|
78
|
+
"--format=json",
|
|
79
|
+
]);
|
|
80
|
+
if (!describe.ok) {
|
|
81
|
+
return { ok: false, error: `describe ${policy}: ${describe.stderr.trim()}`, done };
|
|
82
|
+
}
|
|
83
|
+
let live: LiveGatewayArmorRule[];
|
|
84
|
+
try {
|
|
85
|
+
live = ((JSON.parse(describe.stdout) as { rules?: LiveGatewayArmorRule[] }).rules ??
|
|
86
|
+
[]) as LiveGatewayArmorRule[];
|
|
87
|
+
} catch {
|
|
88
|
+
return { ok: false, error: `describe ${policy}: output is not JSON`, done };
|
|
89
|
+
}
|
|
90
|
+
const rules = ["compute", "security-policies", "rules"];
|
|
91
|
+
for (const spec of GATEWAY_ARMOR_RULES) {
|
|
92
|
+
const existing = live.find((r) => r.priority === spec.priority);
|
|
93
|
+
if (existing && isGatewayArmorRule(existing, spec)) continue;
|
|
94
|
+
const verb = existing ? "update" : "create";
|
|
95
|
+
const r = await run([
|
|
96
|
+
...rules,
|
|
97
|
+
verb,
|
|
98
|
+
String(spec.priority),
|
|
99
|
+
`--security-policy=${policy}`,
|
|
100
|
+
project,
|
|
101
|
+
...gatewayArmorRuleFlags(spec),
|
|
102
|
+
"--quiet",
|
|
103
|
+
]);
|
|
104
|
+
if (!r.ok) {
|
|
105
|
+
return {
|
|
106
|
+
ok: false,
|
|
107
|
+
error: `${verb} rule ${spec.priority} on ${policy}: ${r.stderr.trim()}`,
|
|
108
|
+
done,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
done.push(`${existing ? "updated" : "created"} rule ${spec.priority}: ${spec.description}`);
|
|
112
|
+
}
|
|
113
|
+
const legacy = live.find((r) => r.priority === LEGACY_GENERAL_BAN.priority);
|
|
114
|
+
if (legacy && isLegacyGeneralBan(legacy)) {
|
|
115
|
+
const r = await run([
|
|
116
|
+
...rules,
|
|
117
|
+
"delete",
|
|
118
|
+
String(LEGACY_GENERAL_BAN.priority),
|
|
119
|
+
`--security-policy=${policy}`,
|
|
120
|
+
project,
|
|
121
|
+
"--quiet",
|
|
122
|
+
]);
|
|
123
|
+
if (!r.ok) {
|
|
124
|
+
return {
|
|
125
|
+
ok: false,
|
|
126
|
+
error: `delete the old catch-all ban ${LEGACY_GENERAL_BAN.priority} on ${policy}: ${r.stderr.trim()}`,
|
|
127
|
+
done,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
done.push(
|
|
131
|
+
`removed rule ${LEGACY_GENERAL_BAN.priority}: the old ban on every path (it banned staging reviewers)`,
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
return { ok: true, policy, done };
|
|
135
|
+
}
|
|
@@ -279,6 +279,7 @@ describe("gcp stack — the first up declares no gateway (Pulumi mocks)", () =>
|
|
|
279
279
|
// map goes with it, because the stack ignores its path rules after creation.
|
|
280
280
|
const GATEWAY_CHAIN = [
|
|
281
281
|
`${SERVICE}::caelo-production-gateway`,
|
|
282
|
+
"gcp:cloudrunv2/serviceIamMember:ServiceIamMember::caelo-production-data-gateway-public-invoker",
|
|
282
283
|
"gcp:compute/regionNetworkEndpointGroup:RegionNetworkEndpointGroup::caelo-production-gateway-neg",
|
|
283
284
|
"gcp:compute/backendService:BackendService::caelo-production-gateway-backend",
|
|
284
285
|
"gcp:compute/uRLMap:URLMap::caelo-production-url-map",
|