@caelo-cms/provisioning 0.11.19 → 0.11.21
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/admin-internal-google.d.ts +13 -1
- package/dist/admin-internal-google.d.ts.map +1 -1
- package/dist/admin-internal-google.js +47 -0
- package/dist/admin-internal-google.js.map +1 -1
- package/dist/agent/command.d.ts +1 -1
- 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-routing.d.ts.map +1 -1
- package/dist/cli-routing.js +2 -2
- package/dist/cli-routing.js.map +1 -1
- package/dist/cli.js +8 -0
- package/dist/cli.js.map +1 -1
- package/dist/converge-checkpoint.d.ts +6 -0
- package/dist/converge-checkpoint.d.ts.map +1 -1
- package/dist/dns/manual.d.ts +5 -1
- package/dist/dns/manual.d.ts.map +1 -1
- package/dist/dns/manual.js +2 -1
- package/dist/dns/manual.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/install-job-runner.d.ts.map +1 -1
- package/dist/install-job-runner.js +4 -3
- package/dist/install-job-runner.js.map +1 -1
- package/dist/install-job.d.ts +25 -1
- package/dist/install-job.d.ts.map +1 -1
- package/dist/install-job.js +72 -3
- package/dist/install-job.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/operator-access.d.ts +7 -2
- package/dist/operator-access.d.ts.map +1 -1
- package/dist/operator-access.js +37 -6
- package/dist/operator-access.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/project-status.d.ts +95 -0
- package/dist/project-status.d.ts.map +1 -0
- package/dist/project-status.js +213 -0
- package/dist/project-status.js.map +1 -0
- 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/state-attach.d.ts +17 -0
- package/dist/state-attach.d.ts.map +1 -1
- package/dist/state-attach.js +27 -9
- package/dist/state-attach.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/dist/wizards/gcp-install-job.d.ts +27 -4
- package/dist/wizards/gcp-install-job.d.ts.map +1 -1
- package/dist/wizards/gcp-install-job.js +62 -32
- package/dist/wizards/gcp-install-job.js.map +1 -1
- package/dist/wizards/gcp.d.ts +3 -0
- package/dist/wizards/gcp.d.ts.map +1 -1
- package/dist/wizards/gcp.js +10 -4
- package/dist/wizards/gcp.js.map +1 -1
- package/package.json +2 -2
- package/src/admin-internal-google.ts +48 -0
- 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-routing.ts +3 -2
- package/src/cli.ts +10 -0
- package/src/dns/manual.ts +4 -1
- 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/install-job-runner.ts +4 -2
- package/src/install-job.ts +86 -4
- package/src/lifecycle.ts +8 -1
- package/src/operator-access.test.ts +43 -0
- package/src/operator-access.ts +38 -6
- package/src/pool-budget-stack.ts +25 -0
- package/src/pool-budget-stacks.test.ts +31 -0
- package/src/project-status.test.ts +462 -0
- package/src/project-status.ts +306 -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/state-attach.ts +46 -16
- 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/src/wizards/gcp-install-job.ts +91 -46
- package/src/wizards/gcp.ts +14 -7
- 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/src/upgrader-gcp.ts
CHANGED
|
@@ -42,6 +42,7 @@ import {
|
|
|
42
42
|
} from "./upgrade/gcp-lookup.js";
|
|
43
43
|
import { createIapHealthProbe } from "./upgrade/health.js";
|
|
44
44
|
import { createReleaseImageForms } from "./upgrade/image-forms.js";
|
|
45
|
+
import { httpsLoadBalancerGet } from "./upgrade/load-balancer-get.js";
|
|
45
46
|
import { type IamTester, restIamTester } from "./upgrader-iam-preflight.js";
|
|
46
47
|
import type { UpdateQueue, UpgraderJobDeps } from "./upgrader-job.js";
|
|
47
48
|
import type { JobLog } from "./upgrader-reporter.js";
|
|
@@ -152,7 +153,13 @@ export async function healthProbeFor(
|
|
|
152
153
|
gatewayServiceUrl: urls.gateway as string,
|
|
153
154
|
mcpAuthProxyServiceUrl: urls["mcp-auth-proxy"] as string,
|
|
154
155
|
},
|
|
155
|
-
{
|
|
156
|
+
{
|
|
157
|
+
run,
|
|
158
|
+
http,
|
|
159
|
+
loadBalancerGet: httpsLoadBalancerGet,
|
|
160
|
+
sleep: realSleep,
|
|
161
|
+
accessJustChanged: context.accessJustChanged,
|
|
162
|
+
},
|
|
156
163
|
),
|
|
157
164
|
};
|
|
158
165
|
}
|
package/src/wizards/gcp-cost.ts
CHANGED
|
@@ -11,10 +11,12 @@
|
|
|
11
11
|
* + AI calls + storage growth on top.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
+
import { GATEWAY_ARMOR_BILLED_RULES } from "../gateway-edge.js";
|
|
14
15
|
import {
|
|
15
16
|
ADMIN_MEMORY_DEFAULT,
|
|
16
17
|
memoryQuantityMiB,
|
|
17
18
|
parseSchedulerIntervalMinutes,
|
|
19
|
+
RUNTIME_SECRETS,
|
|
18
20
|
SERVICE_CPU_IDLE,
|
|
19
21
|
} from "../stack-contract.js";
|
|
20
22
|
|
|
@@ -124,6 +126,27 @@ export function alwaysOnAdminInstanceUsd(gib: number): number {
|
|
|
124
126
|
return Math.round(perSecond * MONTH_SECONDS);
|
|
125
127
|
}
|
|
126
128
|
|
|
129
|
+
/**
|
|
130
|
+
* Cloud Armor Standard list prices, USD a month (cloud.google.com/armor/pricing,
|
|
131
|
+
* checked 2026-11-02): $0.006849315 per policy-hour and $0.001369863 per
|
|
132
|
+
* rule-hour, rounded; plus $0.75 per million requests on a global policy.
|
|
133
|
+
*/
|
|
134
|
+
export const CLOUD_ARMOR_POLICY_USD = 5;
|
|
135
|
+
export const CLOUD_ARMOR_RULE_USD = 1;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Secret Manager: $0.06 per active secret version a month, the first 6 per
|
|
139
|
+
* billing account free (cloud.google.com/secret-manager/pricing); access
|
|
140
|
+
* operations are cents at Caelo's volume.
|
|
141
|
+
*/
|
|
142
|
+
const SECRET_VERSION_USD = 0.06;
|
|
143
|
+
const SECRET_FREE_VERSIONS = 6;
|
|
144
|
+
|
|
145
|
+
/** What `count` secrets with one active version each cost a month. */
|
|
146
|
+
export function secretManagerMonthlyUsd(count: number): number {
|
|
147
|
+
return Math.round(Math.max(0, count - SECRET_FREE_VERSIONS) * SECRET_VERSION_USD * 100) / 100;
|
|
148
|
+
}
|
|
149
|
+
|
|
127
150
|
/** The region the price table's list rates are for. */
|
|
128
151
|
const PRICED_REGION = "europe-west1";
|
|
129
152
|
|
|
@@ -210,6 +233,16 @@ export function estimateGcpCost(inputs: CostEstimateInputs): {
|
|
|
210
233
|
? "scale-to-zero; ~$1/mo light traffic"
|
|
211
234
|
: `${inputs.gatewayMinInstances} min-instance${inputs.gatewayMinInstances > 1 ? "s" : ""}`,
|
|
212
235
|
},
|
|
236
|
+
{
|
|
237
|
+
// #1330 — the staging gateway serves the staged site behind the
|
|
238
|
+
// staging gate. Like every public service it is always provisioned at
|
|
239
|
+
// zero minimum instances with request-based CPU (E14 a of #763), and
|
|
240
|
+
// answers a fixed 404 while no staging host is set.
|
|
241
|
+
name: "Cloud Run staging gateway",
|
|
242
|
+
monthlyUsd: 0,
|
|
243
|
+
notes:
|
|
244
|
+
"scale-to-zero, request-based CPU; only the team's visits to staging wake it, mostly in the free tier",
|
|
245
|
+
},
|
|
213
246
|
{
|
|
214
247
|
// #1328 — remote MCP's sign-in service, its own service on every
|
|
215
248
|
// install (E14 a of #763): always provisioned, zero minimum instances,
|
|
@@ -219,17 +252,18 @@ export function estimateGcpCost(inputs: CostEstimateInputs): {
|
|
|
219
252
|
notes:
|
|
220
253
|
"scale-to-zero, request-based CPU; only external AI apps' sign-in and MCP calls wake it, mostly in the free tier",
|
|
221
254
|
},
|
|
222
|
-
//
|
|
223
|
-
// gcp
|
|
224
|
-
// edge
|
|
225
|
-
//
|
|
226
|
-
//
|
|
255
|
+
// Only the gcp variant has a load balancer, Cloud CDN and Cloud Armor.
|
|
256
|
+
// gcp-firebase has none of them (E3 of #763): Firebase Hosting is the
|
|
257
|
+
// edge with its own CDN, the admin is gated by IAP on Cloud Run, and the
|
|
258
|
+
// public services protect themselves without a WAF
|
|
259
|
+
// (docs/dev/gateway-hardening.md).
|
|
227
260
|
...(provider === "gcp"
|
|
228
261
|
? ([
|
|
229
262
|
{
|
|
230
263
|
name: "Load balancer + managed SSL cert",
|
|
231
264
|
monthlyUsd: 18,
|
|
232
|
-
notes:
|
|
265
|
+
notes:
|
|
266
|
+
"Global LB base fee (up to 5 forwarding rules) + certificates (free) — flat; the staging host's route and certificate (#1330) add nothing",
|
|
233
267
|
},
|
|
234
268
|
{
|
|
235
269
|
name: "Cloud CDN cache",
|
|
@@ -237,52 +271,61 @@ export function estimateGcpCost(inputs: CostEstimateInputs): {
|
|
|
237
271
|
notes: "Free egress at edge cache hits",
|
|
238
272
|
},
|
|
239
273
|
{
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
274
|
+
// #1339 — the gateway's policy (src/gateway-edge.ts): its rules
|
|
275
|
+
// plus the default rule, each billed; the staging gateway's
|
|
276
|
+
// backend shares it. Prices: CLOUD_ARMOR_POLICY_USD above.
|
|
277
|
+
name: "Cloud Armor policy (gateway + staging gateway)",
|
|
278
|
+
monthlyUsd:
|
|
279
|
+
CLOUD_ARMOR_POLICY_USD +
|
|
280
|
+
GATEWAY_ARMOR_BILLED_RULES * CLOUD_ARMOR_RULE_USD +
|
|
281
|
+
(inputs.wafAdaptiveProtection ? 5 : 0),
|
|
282
|
+
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`,
|
|
245
283
|
},
|
|
246
284
|
{
|
|
247
285
|
// #1328 — the MCP-Auth-Proxy's own backend (serverless NEG +
|
|
248
286
|
// backend service, no extra LB fee: same URL map) with its own
|
|
249
287
|
// Cloud Armor policy carrying the remote-MCP throttle
|
|
250
|
-
// (src/remote-mcp-edge.ts) and the default rule.
|
|
251
|
-
// Standard: $0.006849315/policy-hour (~$5/mo) and
|
|
252
|
-
// $0.001369863/rule-hour (~$1/mo), plus $0.75 per million
|
|
253
|
-
// requests on a global policy — cloud.google.com/armor/pricing,
|
|
254
|
-
// checked 2026-11-02.
|
|
288
|
+
// (src/remote-mcp-edge.ts) and the default rule.
|
|
255
289
|
name: "MCP-Auth-Proxy backend + Cloud Armor policy",
|
|
256
|
-
monthlyUsd:
|
|
290
|
+
monthlyUsd: CLOUD_ARMOR_POLICY_USD + 2 * CLOUD_ARMOR_RULE_USD,
|
|
257
291
|
notes:
|
|
258
292
|
"own policy ($5) with 2 rules ($2): per-IP throttle for remote MCP clients; requests ~$0",
|
|
259
293
|
},
|
|
294
|
+
{
|
|
295
|
+
name: "Cloud Storage (static + media + staging)",
|
|
296
|
+
monthlyUsd: 1,
|
|
297
|
+
notes:
|
|
298
|
+
"~5 GB storage + low egress; the staging bucket holds two complete builds (#1330 A/B slots); growth roughly $0.02/GB",
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
name: "BigQuery edge log sink",
|
|
302
|
+
monthlyUsd: 0,
|
|
303
|
+
notes: "Free tier — pay only on >1 TB/mo query",
|
|
304
|
+
},
|
|
260
305
|
] satisfies CostLine[])
|
|
261
306
|
: ([
|
|
262
307
|
{
|
|
263
|
-
name: "Firebase Hosting",
|
|
308
|
+
name: "Firebase Hosting (live + staging site)",
|
|
264
309
|
monthlyUsd: 0,
|
|
265
|
-
notes:
|
|
310
|
+
notes:
|
|
311
|
+
"Free tier: 10 GB storage + 360 MB/day egress; the staging site (#1330) only rewrites to the staging gateway and stores nothing",
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
name: "Cloud Storage (media + staging)",
|
|
315
|
+
monthlyUsd: 1,
|
|
316
|
+
notes:
|
|
317
|
+
"~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",
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
name: "Cloud Logging (service logs, the edge log sink)",
|
|
321
|
+
monthlyUsd: 0,
|
|
322
|
+
notes: "Free tier: the first 50 GiB of logs a month",
|
|
266
323
|
},
|
|
267
324
|
] satisfies CostLine[])),
|
|
268
|
-
{
|
|
269
|
-
name:
|
|
270
|
-
provider === "gcp"
|
|
271
|
-
? "Cloud Storage (static + media)"
|
|
272
|
-
: "Cloud Storage (media only — static lives on Firebase)",
|
|
273
|
-
monthlyUsd: 1,
|
|
274
|
-
notes: "~5 GB storage + low egress; growth roughly $0.02/GB",
|
|
275
|
-
},
|
|
276
325
|
{
|
|
277
326
|
name: "Secret Manager (runtime secrets)",
|
|
278
|
-
monthlyUsd:
|
|
279
|
-
notes:
|
|
280
|
-
"6 active versions free, then ~$0.06 each; the Google sign-in client (#914), the remote-MCP seal key (#806) and the staging database login's password (#1329; the staging database itself shares the Cloud SQL instance at no extra cost)",
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
name: "BigQuery edge log sink",
|
|
284
|
-
monthlyUsd: 0,
|
|
285
|
-
notes: "Free tier — pay only on >1 TB/mo query",
|
|
327
|
+
monthlyUsd: secretManagerMonthlyUsd(RUNTIME_SECRETS.length),
|
|
328
|
+
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)`,
|
|
286
329
|
},
|
|
287
330
|
{
|
|
288
331
|
name: "Install state (ops bucket + Cloud KMS key)",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
import { CAELO_VERSION } from "@caelo-cms/shared";
|
|
14
14
|
import { cancel, confirm, isCancel, log, note } from "@clack/prompts";
|
|
15
15
|
import { bold, cyan, dim, green, red, yellow } from "kleur/colors";
|
|
16
|
-
import { formatDnsRecordGroups, groupDnsRecords
|
|
16
|
+
import { formatDnsRecordGroups, groupDnsRecords } from "../dns/groups.js";
|
|
17
17
|
import { activeAccount, gcloud } from "../gcloud.js";
|
|
18
18
|
import type { GcloudRunner, Sleep } from "../gcloud-retry.js";
|
|
19
19
|
import { realSleep } from "../gcloud-retry.js";
|
|
@@ -30,7 +30,9 @@ import {
|
|
|
30
30
|
opsImageRef,
|
|
31
31
|
readExecutionLogs,
|
|
32
32
|
readInstallJobStatus,
|
|
33
|
+
readRecordedStackOutputs,
|
|
33
34
|
readSetupLink,
|
|
35
|
+
recordedDnsRecords,
|
|
34
36
|
startInstallJob,
|
|
35
37
|
storeInstallSecretValue,
|
|
36
38
|
} from "../install-job.js";
|
|
@@ -178,20 +180,35 @@ function logsHint(projectId: string, region: string): string {
|
|
|
178
180
|
return `gcloud run jobs executions list --job=${INSTALL_JOB_NAME} --region=${region} --project=${projectId}`;
|
|
179
181
|
}
|
|
180
182
|
|
|
181
|
-
/**
|
|
182
|
-
|
|
183
|
+
/**
|
|
184
|
+
* What the terminal says before it hands the install to the job (#822): the
|
|
185
|
+
* tab may close, and the one command that shows where the install stands
|
|
186
|
+
* from any terminal.
|
|
187
|
+
*/
|
|
188
|
+
export function handoffLines(projectId: string): string[] {
|
|
189
|
+
return [
|
|
190
|
+
bold(yellow("You may close this tab now.")),
|
|
191
|
+
"The install keeps running in your Google Cloud project. To see where it stands",
|
|
192
|
+
"(phase, DNS records, admin URL, Owner setup link), run this in any terminal",
|
|
193
|
+
"signed in to gcloud:",
|
|
194
|
+
"",
|
|
195
|
+
` ${bold(cyan(selfCommand("status", "--project", projectId)))}`,
|
|
196
|
+
];
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/** Print {@link handoffLines}, highlighted. */
|
|
200
|
+
function announceHandoff(projectId: string): void {
|
|
201
|
+
note(handoffLines(projectId).join("\n"), "The install runs on its own from here");
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** Name the job being followed; exit 130 on Ctrl-C with the way back. */
|
|
205
|
+
function announceFollowing(projectId: string, execution: string): void {
|
|
183
206
|
log.info(
|
|
184
|
-
|
|
185
|
-
`The install runs in your project as Cloud Run job ${bold(INSTALL_JOB_NAME)} (execution ${dim(execution)}).`,
|
|
186
|
-
dim(
|
|
187
|
-
"Closing this tab, Ctrl-C or Cloud Shell's idle timeout does not stop it. To follow it again, re-open the",
|
|
188
|
-
),
|
|
189
|
-
dim(`"Open in Cloud Shell" link (or re-run the same command) and pick project ${projectId}.`),
|
|
190
|
-
].join("\n"),
|
|
207
|
+
`The install runs in your project as Cloud Run job ${bold(INSTALL_JOB_NAME)} (execution ${dim(execution)}).`,
|
|
191
208
|
);
|
|
192
209
|
process.once("SIGINT", () => {
|
|
193
210
|
process.stdout.write(
|
|
194
|
-
`\nStopped following. The install keeps running in ${projectId};
|
|
211
|
+
`\nStopped following. The install keeps running in ${projectId}; to see where it stands: ${selfCommand("status", "--project", projectId)}\n`,
|
|
195
212
|
);
|
|
196
213
|
process.exit(130);
|
|
197
214
|
});
|
|
@@ -201,7 +218,7 @@ function announceDetachable(projectId: string, execution: string): void {
|
|
|
201
218
|
async function followToTheEnd(meta: InstallMetadata, execution: string): Promise<void> {
|
|
202
219
|
const projectId = meta.projectId ?? "";
|
|
203
220
|
const region = meta.region ?? "";
|
|
204
|
-
|
|
221
|
+
announceFollowing(projectId, execution);
|
|
205
222
|
const outcome = await tailInstallJob({ projectId, region, execution });
|
|
206
223
|
if (outcome.kind === "succeeded") {
|
|
207
224
|
await showResult(meta);
|
|
@@ -234,21 +251,7 @@ async function showResult(meta: InstallMetadata): Promise<void> {
|
|
|
234
251
|
// The records from the stack's outputs, as the pulumi-up step recorded
|
|
235
252
|
// them — not from the log, which a re-run after the install no longer shows.
|
|
236
253
|
// Uncached: this process may hold progress.json from before the job ran.
|
|
237
|
-
const
|
|
238
|
-
opsBucketName(projectId),
|
|
239
|
-
installRoot(meta.installId),
|
|
240
|
-
realSyncGcloud,
|
|
241
|
-
).peek("progress.json");
|
|
242
|
-
const progress = progressText
|
|
243
|
-
? (JSON.parse(progressText) as { steps?: Record<string, unknown> })
|
|
244
|
-
: {};
|
|
245
|
-
const pulumiUp = progress.steps?.[`pulumi-up-${projectId}`] as
|
|
246
|
-
| { outputs?: Record<string, unknown> }
|
|
247
|
-
| undefined;
|
|
248
|
-
const outputs = pulumiUp?.outputs ?? {};
|
|
249
|
-
const records = Array.isArray(outputs.dnsRecordsRequiredOut)
|
|
250
|
-
? (outputs.dnsRecordsRequiredOut as InstallDnsRecord[])
|
|
251
|
-
: [];
|
|
254
|
+
const records = recordedDnsRecords(readRecordedStackOutputs(projectId, realSyncGcloud));
|
|
252
255
|
const dnsLines =
|
|
253
256
|
records.length > 0
|
|
254
257
|
? [
|
|
@@ -295,6 +298,7 @@ export async function launchInstallJob(opts: {
|
|
|
295
298
|
if (!meta) throw new Error(`No install.json for install '${installId}'.`);
|
|
296
299
|
const decision = await decide(gcloud, realSyncGcloud, { projectId, region });
|
|
297
300
|
if (decision.kind === "attach") {
|
|
301
|
+
announceHandoff(projectId);
|
|
298
302
|
await followToTheEnd(meta, decision.status.execution);
|
|
299
303
|
return;
|
|
300
304
|
}
|
|
@@ -345,8 +349,10 @@ export async function launchInstallJob(opts: {
|
|
|
345
349
|
const now = await decide(gcloud, realSyncGcloud, { projectId, region });
|
|
346
350
|
if (now.kind !== "start") {
|
|
347
351
|
release();
|
|
348
|
-
if (now.kind === "attach")
|
|
349
|
-
|
|
352
|
+
if (now.kind === "attach") {
|
|
353
|
+
announceHandoff(projectId);
|
|
354
|
+
await followToTheEnd(meta, now.status.execution);
|
|
355
|
+
} else await showResult(meta);
|
|
350
356
|
return;
|
|
351
357
|
}
|
|
352
358
|
// Automatic DNS in the job (dns/cloudflare.ts) when this shell has a
|
|
@@ -369,6 +375,7 @@ export async function launchInstallJob(opts: {
|
|
|
369
375
|
`DNS: the job sets the records through Cloudflare (token stored in Secret Manager as ${INSTALL_CLOUDFLARE_TOKEN_SECRET}).`,
|
|
370
376
|
);
|
|
371
377
|
}
|
|
378
|
+
announceHandoff(projectId);
|
|
372
379
|
const started = await startInstallJob(gcloud, {
|
|
373
380
|
projectId,
|
|
374
381
|
region,
|
|
@@ -460,6 +467,7 @@ export async function prepareJobModeInstall(opts: {
|
|
|
460
467
|
if (!meta.region) return { kind: "existing", meta };
|
|
461
468
|
const decision = await decide(gcloud, realSyncGcloud, { projectId, region: meta.region });
|
|
462
469
|
if (decision.kind === "attach") {
|
|
470
|
+
announceHandoff(projectId);
|
|
463
471
|
await followToTheEnd(meta, decision.status.execution);
|
|
464
472
|
return { kind: "handled" };
|
|
465
473
|
}
|
|
@@ -470,37 +478,74 @@ export async function prepareJobModeInstall(opts: {
|
|
|
470
478
|
return { kind: "existing", meta };
|
|
471
479
|
}
|
|
472
480
|
|
|
481
|
+
/** The command that follows or resumes the install in `meta`'s project, on any machine. */
|
|
482
|
+
export function installerCommand(meta: Pick<InstallMetadata, "provider" | "projectId">): string {
|
|
483
|
+
return selfCommand(
|
|
484
|
+
"--provider",
|
|
485
|
+
meta.provider,
|
|
486
|
+
"--install-job",
|
|
487
|
+
"--project-id",
|
|
488
|
+
meta.projectId ?? "<gcp-project-id>",
|
|
489
|
+
);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/** How the install job stands: what the bucket records and what that means. */
|
|
493
|
+
export interface InstallJobView {
|
|
494
|
+
readonly status: InstallJobStatus;
|
|
495
|
+
readonly decision: InstallJobDecision;
|
|
496
|
+
}
|
|
497
|
+
|
|
473
498
|
/**
|
|
474
|
-
*
|
|
475
|
-
*
|
|
476
|
-
*
|
|
499
|
+
* What the bucket records about the install job and, for a run that claims
|
|
500
|
+
* to be running, whether its execution still is. Null when the install
|
|
501
|
+
* never used the job.
|
|
477
502
|
*/
|
|
478
|
-
export async function
|
|
479
|
-
meta: InstallMetadata,
|
|
480
|
-
deps: { run: GcloudRunner; syncRun: SyncGcloud }
|
|
481
|
-
): Promise<
|
|
482
|
-
if (!meta.projectId || !meta.region) return
|
|
503
|
+
export async function readInstallJobView(
|
|
504
|
+
meta: Pick<InstallMetadata, "projectId" | "region">,
|
|
505
|
+
deps: { run: GcloudRunner; syncRun: SyncGcloud },
|
|
506
|
+
): Promise<InstallJobView | null> {
|
|
507
|
+
if (!meta.projectId || !meta.region) return null;
|
|
483
508
|
const status = readInstallJobStatus(opsBucketName(meta.projectId), deps.syncRun);
|
|
484
|
-
if (!status) return
|
|
485
|
-
const
|
|
486
|
-
status,
|
|
509
|
+
if (!status) return null;
|
|
510
|
+
const live =
|
|
487
511
|
status.state === "running"
|
|
488
512
|
? await describeExecution(deps.run, {
|
|
489
513
|
projectId: meta.projectId,
|
|
490
514
|
region: meta.region,
|
|
491
515
|
execution: status.execution,
|
|
492
516
|
})
|
|
493
|
-
: null
|
|
494
|
-
);
|
|
495
|
-
|
|
496
|
-
|
|
517
|
+
: null;
|
|
518
|
+
return { status, decision: decideInstallJob(status, live) };
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
/** {@link InstallJobView} as `status` prints it, with the command that goes on from there. */
|
|
522
|
+
export function installJobViewLines(
|
|
523
|
+
view: InstallJobView,
|
|
524
|
+
meta: Pick<InstallMetadata, "provider" | "projectId">,
|
|
525
|
+
): string[] {
|
|
526
|
+
const { status, decision } = view;
|
|
527
|
+
const lines = [
|
|
528
|
+
`Install job: ${status.state} — ${status.phase} ${dim(`(v${status.caeloVersion}, execution ${status.execution}, updated ${status.updatedAt})`)}`,
|
|
529
|
+
];
|
|
497
530
|
if (status.detail) lines.push(` ${status.detail}`);
|
|
498
531
|
if (decision.kind === "attach") {
|
|
499
|
-
lines.push(` Follow it:
|
|
532
|
+
lines.push(` Follow it live: ${installerCommand(meta)}`);
|
|
500
533
|
} else if (decision.kind === "start") {
|
|
501
534
|
lines.push(
|
|
502
|
-
` Not finished (${decision.why}).
|
|
535
|
+
` Not finished (${decision.why}). Resume it where this run stopped: ${installerCommand(meta)}`,
|
|
503
536
|
);
|
|
504
537
|
}
|
|
505
538
|
return lines;
|
|
506
539
|
}
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* `status`'s view of the install job as text. Empty when the install never
|
|
543
|
+
* used the job.
|
|
544
|
+
*/
|
|
545
|
+
export async function installJobStatusLines(
|
|
546
|
+
meta: InstallMetadata,
|
|
547
|
+
deps: { run: GcloudRunner; syncRun: SyncGcloud } = { run: gcloud, syncRun: realSyncGcloud },
|
|
548
|
+
): Promise<string[]> {
|
|
549
|
+
const view = await readInstallJobView(meta, deps);
|
|
550
|
+
return view ? installJobViewLines(view, meta) : [];
|
|
551
|
+
}
|
package/src/wizards/gcp.ts
CHANGED
|
@@ -80,12 +80,7 @@ import {
|
|
|
80
80
|
upgraderServiceAccountEmail,
|
|
81
81
|
} from "../gcp-names.js";
|
|
82
82
|
import { INFRA_CONTRACT_VERSION } from "../infra-contract.js";
|
|
83
|
-
import {
|
|
84
|
-
INSTALL_JOB_NAME,
|
|
85
|
-
INSTALL_JOB_ROLES,
|
|
86
|
-
INSTALL_SETUP_LINK_SECRET,
|
|
87
|
-
storeSetupLink,
|
|
88
|
-
} from "../install-job.js";
|
|
83
|
+
import { INSTALL_JOB_NAME, INSTALL_JOB_ROLES, storeSetupLink } from "../install-job.js";
|
|
89
84
|
import {
|
|
90
85
|
adoptStateBackend,
|
|
91
86
|
ensureInstallDir,
|
|
@@ -349,6 +344,8 @@ export interface GcpConvergeOpts {
|
|
|
349
344
|
readonly setupLink: "print" | "secret";
|
|
350
345
|
/** Called as each step starts — the install job records it in the bucket. */
|
|
351
346
|
readonly onPhase?: (phase: string, detail?: string) => void;
|
|
347
|
+
/** Called with DNS records the stack's outputs don't carry (the staging host's, #822). */
|
|
348
|
+
readonly onDnsRecords?: (records: InstallDnsRecord[]) => void;
|
|
352
349
|
}
|
|
353
350
|
|
|
354
351
|
/**
|
|
@@ -578,6 +575,7 @@ export async function runGcpConverge(opts: GcpConvergeOpts): Promise<void> {
|
|
|
578
575
|
domain,
|
|
579
576
|
installStagingHost(meta),
|
|
580
577
|
imageDigests,
|
|
578
|
+
opts.onDnsRecords ?? (() => {}),
|
|
581
579
|
);
|
|
582
580
|
|
|
583
581
|
// === 11.3. The quality-audit job: parallel Lighthouse runs (#875) ===
|
|
@@ -1610,6 +1608,7 @@ async function stepStagingGateway(
|
|
|
1610
1608
|
domain: string,
|
|
1611
1609
|
stagingHost: string,
|
|
1612
1610
|
imageDigests: ImageDigests,
|
|
1611
|
+
onDnsRecords: (records: InstallDnsRecord[]) => void,
|
|
1613
1612
|
): Promise<boolean> {
|
|
1614
1613
|
const s = spinner();
|
|
1615
1614
|
s.start(`Setting up the staging gateway behind the staging gate (${stagingHost})...`);
|
|
@@ -1634,6 +1633,14 @@ async function stepStagingGateway(
|
|
|
1634
1633
|
if (edge.dnsRecords.length > 0) {
|
|
1635
1634
|
log.info(` DNS for ${stagingHost} (Settings → Updates shows the same):`);
|
|
1636
1635
|
for (const d of edge.dnsRecords) log.info(` ${d.name} ${d.type} ${d.value}`);
|
|
1636
|
+
onDnsRecords(
|
|
1637
|
+
edge.dnsRecords.map((d) => ({
|
|
1638
|
+
hostname: d.name,
|
|
1639
|
+
type: d.type,
|
|
1640
|
+
value: d.value,
|
|
1641
|
+
purpose: `Protected staging site (${stagingHost})`,
|
|
1642
|
+
})),
|
|
1643
|
+
);
|
|
1637
1644
|
}
|
|
1638
1645
|
return true;
|
|
1639
1646
|
}
|
|
@@ -2596,7 +2603,7 @@ async function stepFinalize(installId: string, setupLink: "print" | "secret"): P
|
|
|
2596
2603
|
const setupLinkLine =
|
|
2597
2604
|
setupLink === "print"
|
|
2598
2605
|
? ` ${cyan(String(bootstrapUrl))}`
|
|
2599
|
-
: ` ${dim(`(shown in your Cloud Shell terminal; or
|
|
2606
|
+
: ` ${dim(`(shown in your Cloud Shell terminal; or, from any terminal: ${selfCommand("status", "--project", meta.projectId)})`)}`;
|
|
2600
2607
|
|
|
2601
2608
|
// Both providers report their records in `dnsRecordsRequiredOut`; the
|
|
2602
2609
|
// summary lists them in two groups so the main-domain records that take a
|
package/stacks/aws/index.ts
CHANGED
|
@@ -37,6 +37,7 @@ import * as awsx from "@pulumi/awsx";
|
|
|
37
37
|
import * as pulumi from "@pulumi/pulumi";
|
|
38
38
|
import type { CloudAdapterOutputs, DnsRecord } from "../../dist/adapter.js";
|
|
39
39
|
import {
|
|
40
|
+
AWS_SERVICE_DATABASE_PASSWORDS,
|
|
40
41
|
AWS_SERVICE_SECRETS,
|
|
41
42
|
type AwsSecret,
|
|
42
43
|
type AwsTaskService,
|
|
@@ -215,30 +216,19 @@ const db = new aws.rds.Instance(`${namePrefix}-pg`, {
|
|
|
215
216
|
applyImmediately: env !== "production",
|
|
216
217
|
});
|
|
217
218
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
const
|
|
224
|
-
.
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
);
|
|
219
|
+
// #1339 (epic #763 L5) — password-less, like on GCP: each task definition
|
|
220
|
+
// (#749) sets the password as an ECS `secrets` entry from Secrets Manager
|
|
221
|
+
// (AWS_SERVICE_DATABASE_PASSWORDS, exported as databasePasswordSecretsOut),
|
|
222
|
+
// never inside the URL, so it shows up neither in the task's env nor in its
|
|
223
|
+
// revision history (shared database-url.ts `<NAME>_PASSWORD`).
|
|
224
|
+
const dbUrl = (role: string, database: string) =>
|
|
225
|
+
pulumi.interpolate`postgresql://${role}@${db.address}:${db.port}/${database}?${RDS_TLS}`;
|
|
226
|
+
const adminDatabaseUrl = dbUrl("caelo_admin", "cms_admin");
|
|
227
|
+
const publicDatabaseUrl = dbUrl("public_role", "cms_public");
|
|
228
228
|
// #1329 — the admin's pool on the staging database, and the staging
|
|
229
229
|
// gateway's only login (no task definition reads them before #749).
|
|
230
|
-
const publicStagingAdminDatabaseUrl =
|
|
231
|
-
|
|
232
|
-
.apply(
|
|
233
|
-
([host, port, pw]) =>
|
|
234
|
-
`postgresql://caelo_admin:${pw}@${host}:${port}/cms_public_staging?${RDS_TLS}`,
|
|
235
|
-
);
|
|
236
|
-
const publicStagingDatabaseUrl = pulumi
|
|
237
|
-
.all([db.address, db.port, publicStagingRolePassword])
|
|
238
|
-
.apply(
|
|
239
|
-
([host, port, pw]) =>
|
|
240
|
-
`postgresql://public_staging_role:${pw}@${host}:${port}/cms_public_staging?${RDS_TLS}`,
|
|
241
|
-
);
|
|
230
|
+
const publicStagingAdminDatabaseUrl = dbUrl("caelo_admin", "cms_public_staging");
|
|
231
|
+
const publicStagingDatabaseUrl = dbUrl("public_staging_role", "cms_public_staging");
|
|
242
232
|
|
|
243
233
|
// === 4. S3 buckets ===
|
|
244
234
|
const mediaBucket = new aws.s3.BucketV2(`${namePrefix}-media`, {
|
|
@@ -585,6 +575,7 @@ const dnsRecordsRequired: DnsRecord[] = [
|
|
|
585
575
|
];
|
|
586
576
|
|
|
587
577
|
const out: CloudAdapterOutputs = {
|
|
578
|
+
// Password-less — the passwords live only in Secrets Manager (#1339).
|
|
588
579
|
adminDatabaseUrl: adminDatabaseUrl as unknown as string,
|
|
589
580
|
publicDatabaseUrl: publicDatabaseUrl as unknown as string,
|
|
590
581
|
publicStagingDatabaseUrl: publicStagingDatabaseUrl as unknown as string,
|
|
@@ -621,6 +612,17 @@ export const adminTaskRoleArnOut = taskRoles.admin.arn;
|
|
|
621
612
|
export const gatewayTaskRoleArnOut = taskRoles.gateway.arn;
|
|
622
613
|
// #1328 — the role the MCP-Auth-Proxy task definition will run as (#749).
|
|
623
614
|
export const mcpAuthProxyTaskRoleArnOut = taskRoles["mcp-auth-proxy"].arn;
|
|
615
|
+
// #1339 — per task definition (#749): the ECS `secrets` entries
|
|
616
|
+
// (`{ name, valueFrom }`) that carry its database passwords.
|
|
617
|
+
export const databasePasswordSecretsOut = Object.fromEntries(
|
|
618
|
+
Object.entries(AWS_SERVICE_DATABASE_PASSWORDS).map(([service, vars]) => [
|
|
619
|
+
service,
|
|
620
|
+
Object.entries(vars).map(([name, secretName]) => ({
|
|
621
|
+
name,
|
|
622
|
+
valueFrom: secretArns[secretName],
|
|
623
|
+
})),
|
|
624
|
+
]),
|
|
625
|
+
);
|
|
624
626
|
// #1254 — the pool env the admin and gateway task definitions set.
|
|
625
627
|
export const poolBudgetEnvOut = poolBudget.env;
|
|
626
628
|
|