@geekmidas/cli 10.0.0-alpha.94 → 10.0.0-alpha.96
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/{GoDaddyProvider-BRZUWD8z.mjs → GoDaddyProvider-BsUKjGcg.mjs} +3 -3
- package/dist/{GoDaddyProvider-BRZUWD8z.mjs.map → GoDaddyProvider-BsUKjGcg.mjs.map} +1 -1
- package/dist/{GoDaddyProvider-DzguxU_a.cjs → GoDaddyProvider-DyHXHDHe.cjs} +3 -3
- package/dist/{GoDaddyProvider-DzguxU_a.cjs.map → GoDaddyProvider-DyHXHDHe.cjs.map} +1 -1
- package/dist/{HostingerProvider-Cjh_2Ml6.mjs → HostingerProvider-BNpS9aRJ.mjs} +2 -2
- package/dist/{HostingerProvider-Cjh_2Ml6.mjs.map → HostingerProvider-BNpS9aRJ.mjs.map} +1 -1
- package/dist/{HostingerProvider-OdQmKXE3.cjs → HostingerProvider-DR1iws1P.cjs} +2 -2
- package/dist/{HostingerProvider-OdQmKXE3.cjs.map → HostingerProvider-DR1iws1P.cjs.map} +1 -1
- package/dist/{LegacyStateStore-BQZb6-j2.mjs → LegacyStateStore-B6SOqRFi.mjs} +3 -3
- package/dist/{LegacyStateStore-BQZb6-j2.mjs.map → LegacyStateStore-B6SOqRFi.mjs.map} +1 -1
- package/dist/{LegacyStateStore-D50dgUPc.cjs → LegacyStateStore-BnMcONE0.cjs} +3 -3
- package/dist/{LegacyStateStore-D50dgUPc.cjs.map → LegacyStateStore-BnMcONE0.cjs.map} +1 -1
- package/dist/{LocalStateStore-BSaS2535.mjs → LocalStateStore-6CrsZzqI.mjs} +2 -2
- package/dist/{LocalStateStore-BSaS2535.mjs.map → LocalStateStore-6CrsZzqI.mjs.map} +1 -1
- package/dist/{LocalStateStore-EFBUjuMX.cjs → LocalStateStore-pd4bbdJJ.cjs} +2 -2
- package/dist/{LocalStateStore-EFBUjuMX.cjs.map → LocalStateStore-pd4bbdJJ.cjs.map} +1 -1
- package/dist/{S3StateStore-C5mv8To3.cjs → S3StateStore-CoGk6ZKU.cjs} +2 -2
- package/dist/{S3StateStore-C5mv8To3.cjs.map → S3StateStore-CoGk6ZKU.cjs.map} +1 -1
- package/dist/{S3StateStore-CrFq4UZU.mjs → S3StateStore-DP_7Q4yb.mjs} +2 -2
- package/dist/{S3StateStore-CrFq4UZU.mjs.map → S3StateStore-DP_7Q4yb.mjs.map} +1 -1
- package/dist/{SSMStateStore-D3Z6mZnA.mjs → SSMStateStore-Bo6_KDYY.mjs} +2 -2
- package/dist/{SSMStateStore-D3Z6mZnA.mjs.map → SSMStateStore-Bo6_KDYY.mjs.map} +1 -1
- package/dist/{SSMStateStore-DuZCH7_v.cjs → SSMStateStore-D9s4_Do3.cjs} +2 -2
- package/dist/{SSMStateStore-DuZCH7_v.cjs.map → SSMStateStore-D9s4_Do3.cjs.map} +1 -1
- package/dist/{add-C85isXFl.mjs → add-BQS2QZHp.mjs} +22 -51
- package/dist/add-BQS2QZHp.mjs.map +1 -0
- package/dist/{add-DsVDdvon.cjs → add-CjURJ-vI.cjs} +23 -52
- package/dist/add-CjURJ-vI.cjs.map +1 -0
- package/dist/{bundler-BSHog8CH.mjs → bundler-BMM3UsGm.mjs} +5 -5
- package/dist/{bundler-BSHog8CH.mjs.map → bundler-BMM3UsGm.mjs.map} +1 -1
- package/dist/{bundler-BEgUKc4j.cjs → bundler-DmLJQ7AY.cjs} +5 -5
- package/dist/{bundler-BEgUKc4j.cjs.map → bundler-DmLJQ7AY.cjs.map} +1 -1
- package/dist/{cli-BvBdv660.cjs → cli-C2c-jOVK.cjs} +4 -4
- package/dist/{cli-BvBdv660.cjs.map → cli-C2c-jOVK.cjs.map} +1 -1
- package/dist/{cli-BsFenyaf.mjs → cli-Ce6NgaQF.mjs} +4 -4
- package/dist/{cli-BsFenyaf.mjs.map → cli-Ce6NgaQF.mjs.map} +1 -1
- package/dist/{compose-D2RFYd_f.mjs → compose-BJDPFBAN.mjs} +43 -47
- package/dist/compose-BJDPFBAN.mjs.map +1 -0
- package/dist/{compose-Cd09gW-n.cjs → compose-ETFKqkTu.cjs} +60 -64
- package/dist/compose-ETFKqkTu.cjs.map +1 -0
- package/dist/{config-Ngesg4O8.d.mts → config-4yirvxS8.d.cts} +4 -4
- package/dist/{config-DvHNMoOp.d.cts.map → config-4yirvxS8.d.cts.map} +1 -1
- package/dist/{config-DvHNMoOp.d.cts → config-C8NPCn1l.d.mts} +4 -4
- package/dist/{config-Ngesg4O8.d.mts.map → config-C8NPCn1l.d.mts.map} +1 -1
- package/dist/config.cjs +1 -1
- package/dist/config.d.cts +3 -3
- package/dist/config.d.mts +3 -3
- package/dist/config.mjs +1 -1
- package/dist/{credentials-DpfnUvIR.mjs → credentials-B5N5yKk6.mjs} +4 -132
- package/dist/credentials-B5N5yKk6.mjs.map +1 -0
- package/dist/{credentials-D7XJypNd.cjs → credentials-Zqr3QQYB.cjs} +3 -173
- package/dist/credentials-Zqr3QQYB.cjs.map +1 -0
- package/dist/deploy/public.cjs +16 -15
- package/dist/deploy/public.cjs.map +1 -1
- package/dist/deploy/public.d.cts +5 -5
- package/dist/deploy/public.d.cts.map +1 -1
- package/dist/deploy/public.d.mts +5 -5
- package/dist/deploy/public.d.mts.map +1 -1
- package/dist/deploy/public.mjs +11 -10
- package/dist/deploy/public.mjs.map +1 -1
- package/dist/deploy-BdN0ym2i.cjs +2057 -0
- package/dist/deploy-BdN0ym2i.cjs.map +1 -0
- package/dist/deploy-DktQl7ti.mjs +2008 -0
- package/dist/deploy-DktQl7ti.mjs.map +1 -0
- package/dist/{discover-CTzOSGUF.d.cts → discover-BtFofyQB.d.cts} +2 -2
- package/dist/{discover-CTzOSGUF.d.cts.map → discover-BtFofyQB.d.cts.map} +1 -1
- package/dist/{discover-CihAtaoj.d.mts → discover-D-MdXZgm.d.mts} +2 -2
- package/dist/{discover-CihAtaoj.d.mts.map → discover-D-MdXZgm.d.mts.map} +1 -1
- package/dist/dns-BjHECDO7.mjs +44 -0
- package/dist/dns-BjHECDO7.mjs.map +1 -0
- package/dist/dns-C-X6PLkV.cjs +663 -0
- package/dist/dns-C-X6PLkV.cjs.map +1 -0
- package/dist/dns-C2EeR6n2.mjs +610 -0
- package/dist/dns-C2EeR6n2.mjs.map +1 -0
- package/dist/dns-ClI7-d5g.cjs +55 -0
- package/dist/dns-ClI7-d5g.cjs.map +1 -0
- package/dist/{dokploy-CV7GcobZ.cjs → dokploy-CD_Bc4EV.cjs} +2 -2
- package/dist/{dokploy-CV7GcobZ.cjs.map → dokploy-CD_Bc4EV.cjs.map} +1 -1
- package/dist/{dokploy-D_aat2Xj.mjs → dokploy-CxtkS5hl.mjs} +2 -2
- package/dist/{dokploy-D_aat2Xj.mjs.map → dokploy-CxtkS5hl.mjs.map} +1 -1
- package/dist/{encryption-_4qKqtTx.mjs → encryption-BgQd4f2S.mjs} +3 -3
- package/dist/{encryption-_4qKqtTx.mjs.map → encryption-BgQd4f2S.mjs.map} +1 -1
- package/dist/{encryption-DFcivJaO.cjs → encryption-CqVfz-m7.cjs} +3 -3
- package/dist/{encryption-DFcivJaO.cjs.map → encryption-CqVfz-m7.cjs.map} +1 -1
- package/dist/{engine-Bv-LZpmj.cjs → engine-OVVKtPmW.cjs} +18 -36
- package/dist/engine-OVVKtPmW.cjs.map +1 -0
- package/dist/{engine-DPMHThkg.mjs → engine-YlXzlTUl.mjs} +14 -32
- package/dist/{engine-DPMHThkg.mjs.map → engine-YlXzlTUl.mjs.map} +1 -1
- package/dist/{github-Br42NMrW.cjs → github-CsMloeSL.cjs} +9 -7
- package/dist/{github-Br42NMrW.cjs.map → github-CsMloeSL.cjs.map} +1 -1
- package/dist/{github-xsDT19im.mjs → github-DuuvqI3Z.mjs} +5 -3
- package/dist/{github-xsDT19im.mjs.map → github-DuuvqI3Z.mjs.map} +1 -1
- package/dist/{index-CwLvFqtH.d.cts → index-5eL8rM6H.d.mts} +2 -2
- package/dist/{index-BlpcClwM.d.mts.map → index-5eL8rM6H.d.mts.map} +1 -1
- package/dist/{index-BlpcClwM.d.mts → index-Dz-gyjm_.d.cts} +2 -2
- package/dist/{index-CwLvFqtH.d.cts.map → index-Dz-gyjm_.d.cts.map} +1 -1
- package/dist/index.cjs +54 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +52 -51
- package/dist/index.mjs.map +1 -1
- package/dist/{local-B7Zv1NoA.mjs → local-BwC2v2Y8.mjs} +2 -2
- package/dist/{local-B7Zv1NoA.mjs.map → local-BwC2v2Y8.mjs.map} +1 -1
- package/dist/{local-OPC9BCZt.cjs → local-DNhnkugT.cjs} +3 -3
- package/dist/{local-OPC9BCZt.cjs.map → local-DNhnkugT.cjs.map} +1 -1
- package/dist/{migrate-D5jUz20_.cjs → migrate-BAmJeVq1.cjs} +3 -3
- package/dist/{migrate-D5jUz20_.cjs.map → migrate-BAmJeVq1.cjs.map} +1 -1
- package/dist/{migrate-SkWJotn5.cjs → migrate-BdkoNdIu.cjs} +3 -3
- package/dist/{migrate-SkWJotn5.cjs.map → migrate-BdkoNdIu.cjs.map} +1 -1
- package/dist/{migrate-DhvFPGLi.mjs → migrate-CB8B6W9y.mjs} +3 -3
- package/dist/{migrate-DhvFPGLi.mjs.map → migrate-CB8B6W9y.mjs.map} +1 -1
- package/dist/{migrate-B7evHv7O.mjs → migrate-CsPFHgTs.mjs} +3 -3
- package/dist/{migrate-B7evHv7O.mjs.map → migrate-CsPFHgTs.mjs.map} +1 -1
- package/dist/openapi.cjs +1 -1
- package/dist/openapi.d.cts +1 -1
- package/dist/openapi.d.mts +1 -1
- package/dist/openapi.mjs +1 -1
- package/dist/reconcile/public.d.cts +2 -2
- package/dist/reconcile/public.d.mts +2 -2
- package/dist/{resolve-CFEOtRsl.cjs → resolve-BDatNOoG.cjs} +4 -4
- package/dist/{resolve-CFEOtRsl.cjs.map → resolve-BDatNOoG.cjs.map} +1 -1
- package/dist/{resolve-Dyd1S2wn.mjs → resolve-CUne0qOm.mjs} +4 -4
- package/dist/{resolve-Dyd1S2wn.mjs.map → resolve-CUne0qOm.mjs.map} +1 -1
- package/dist/{rollback-NroNbGC0.mjs → rollback-CCdEEEcF.mjs} +7 -8
- package/dist/{rollback-NroNbGC0.mjs.map → rollback-CCdEEEcF.mjs.map} +1 -1
- package/dist/{rollback-D720SFhV.cjs → rollback-CuG3DkTY.cjs} +8 -9
- package/dist/{rollback-D720SFhV.cjs.map → rollback-CuG3DkTY.cjs.map} +1 -1
- package/dist/run-BJLIerMM.mjs +133 -0
- package/dist/run-BJLIerMM.mjs.map +1 -0
- package/dist/run-fVZ-rLnc.cjs +174 -0
- package/dist/run-fVZ-rLnc.cjs.map +1 -0
- package/dist/{runtime-VktAo_8B.d.cts → runtime-DUQdM-mW.d.cts} +2 -2
- package/dist/{runtime-BRCq6dQ7.d.mts.map → runtime-DUQdM-mW.d.cts.map} +1 -1
- package/dist/{runtime-BRCq6dQ7.d.mts → runtime-Vr6mleo2.d.mts} +2 -2
- package/dist/{runtime-VktAo_8B.d.cts.map → runtime-Vr6mleo2.d.mts.map} +1 -1
- package/dist/{sandbox-D1gd0iDz.d.cts → sandbox-BbJmh2rI.d.cts} +2 -2
- package/dist/{sandbox-D1gd0iDz.d.cts.map → sandbox-BbJmh2rI.d.cts.map} +1 -1
- package/dist/{sandbox-zHnRLCj0.d.mts → sandbox-DGOsMPMf.d.mts} +2 -2
- package/dist/{sandbox-zHnRLCj0.d.mts.map → sandbox-DGOsMPMf.d.mts.map} +1 -1
- package/dist/{secrets-DAvi_O9g.cjs → secrets-C5qROlbp.cjs} +3 -3
- package/dist/{secrets-DAvi_O9g.cjs.map → secrets-C5qROlbp.cjs.map} +1 -1
- package/dist/{secrets-CwLauUB_.mjs → secrets-ZikTIxEm.mjs} +3 -3
- package/dist/{secrets-CwLauUB_.mjs.map → secrets-ZikTIxEm.mjs.map} +1 -1
- package/dist/{seeds-BCg8X36S.cjs → seeds-BjXW-Krf.cjs} +193 -946
- package/dist/seeds-BjXW-Krf.cjs.map +1 -0
- package/dist/{seeds-CTxTZa-R.mjs → seeds-CbJSne1A.mjs} +156 -825
- package/dist/seeds-CbJSne1A.mjs.map +1 -0
- package/dist/{sniffer-DCcuzHz_.mjs → sniffer-DQGBYY8i.mjs} +8 -8
- package/dist/{sniffer-DCcuzHz_.mjs.map → sniffer-DQGBYY8i.mjs.map} +1 -1
- package/dist/{sniffer-C0z3NB2A.cjs → sniffer-NPD1dyab.cjs} +8 -8
- package/dist/{sniffer-C0z3NB2A.cjs.map → sniffer-NPD1dyab.cjs.map} +1 -1
- package/dist/{sst-DRDSDwOk.mjs → sst-CGdjHn2A.mjs} +4 -3
- package/dist/{sst-DRDSDwOk.mjs.map → sst-CGdjHn2A.mjs.map} +1 -1
- package/dist/{sst-DKNH243z.cjs → sst-DGuHDxVU.cjs} +5 -4
- package/dist/{sst-DKNH243z.cjs.map → sst-DGuHDxVU.cjs.map} +1 -1
- package/dist/{stack-NrdH5ngX.mjs → stack-BFq3K-_z.mjs} +14 -52
- package/dist/stack-BFq3K-_z.mjs.map +1 -0
- package/dist/{stack-B3fPDTBg.cjs → stack-DOVvEd1T.cjs} +14 -52
- package/dist/stack-DOVvEd1T.cjs.map +1 -0
- package/dist/{stages-veC4TcQe.mjs → stages-BEn2ArJZ.mjs} +4 -3
- package/dist/{stages-veC4TcQe.mjs.map → stages-BEn2ArJZ.mjs.map} +1 -1
- package/dist/{stages-CkqP1N4S.cjs → stages-Cw6urZyJ.cjs} +5 -4
- package/dist/{stages-CkqP1N4S.cjs.map → stages-Cw6urZyJ.cjs.map} +1 -1
- package/dist/target/public.cjs +1 -1
- package/dist/target/public.d.cts +2 -2
- package/dist/target/public.d.mts +2 -2
- package/dist/target/public.mjs +1 -1
- package/dist/{terminal-CkUYuAPd.cjs → terminal-CPHuH4S1.cjs} +2 -2
- package/dist/{terminal-CkUYuAPd.cjs.map → terminal-CPHuH4S1.cjs.map} +1 -1
- package/dist/{terminal-DAHs2Zko.mjs → terminal-iNmAXXjs.mjs} +2 -2
- package/dist/{terminal-DAHs2Zko.mjs.map → terminal-iNmAXXjs.mjs.map} +1 -1
- package/dist/{types-DMoaFrjg.d.mts → types-bkqVscdN.d.mts} +12 -3
- package/dist/types-bkqVscdN.d.mts.map +1 -0
- package/dist/{types-DXyaSmqu.d.cts → types-dipJRmKV.d.cts} +12 -3
- package/dist/types-dipJRmKV.d.cts.map +1 -0
- package/dist/workspace/index.cjs +1 -1
- package/dist/workspace/index.d.cts +2 -2
- package/dist/workspace/index.d.mts +2 -2
- package/dist/workspace/index.mjs +1 -1
- package/dist/{workspace-DWK1PTXP.mjs → workspace-CqFUjObk.mjs} +54 -2
- package/dist/workspace-CqFUjObk.mjs.map +1 -0
- package/dist/{workspace-cSyi5nb1.cjs → workspace-DDkm4y6D.cjs} +71 -1
- package/dist/workspace-DDkm4y6D.cjs.map +1 -0
- package/package.json +15 -15
- package/dist/add-C85isXFl.mjs.map +0 -1
- package/dist/add-DsVDdvon.cjs.map +0 -1
- package/dist/compose-Cd09gW-n.cjs.map +0 -1
- package/dist/compose-D2RFYd_f.mjs.map +0 -1
- package/dist/credentials-D7XJypNd.cjs.map +0 -1
- package/dist/credentials-DpfnUvIR.mjs.map +0 -1
- package/dist/deploy-C911Akkn.cjs +0 -670
- package/dist/deploy-C911Akkn.cjs.map +0 -1
- package/dist/deploy-CeJ5D0xn.mjs +0 -641
- package/dist/deploy-CeJ5D0xn.mjs.map +0 -1
- package/dist/engine-Bv-LZpmj.cjs.map +0 -1
- package/dist/providers-BFeP_mYw.cjs +0 -1098
- package/dist/providers-BFeP_mYw.cjs.map +0 -1
- package/dist/providers-sTj-BG0S.mjs +0 -1079
- package/dist/providers-sTj-BG0S.mjs.map +0 -1
- package/dist/seeds-BCg8X36S.cjs.map +0 -1
- package/dist/seeds-CTxTZa-R.mjs.map +0 -1
- package/dist/stack-B3fPDTBg.cjs.map +0 -1
- package/dist/stack-NrdH5ngX.mjs.map +0 -1
- package/dist/types-DMoaFrjg.d.mts.map +0 -1
- package/dist/types-DXyaSmqu.d.cts.map +0 -1
- package/dist/workspace-DWK1PTXP.mjs.map +0 -1
- package/dist/workspace-cSyi5nb1.cjs.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
2
|
import { t as GkmError } from "./errors-D8Gwp5kU.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { i as run$1, s as gkmHome } from "./run-BJLIerMM.mjs";
|
|
4
4
|
import { d as output, r as discover, u as ConstructGenerator } from "./discover-qjFapetL.mjs";
|
|
5
5
|
import { t as appKey } from "./derive-B4vDpzgP.mjs";
|
|
6
|
-
import { B as LOGS_PORT, H as provisioningOf, R as stageSampleRate, U as stageProvider, _ as PUBLIC_ENV_PREFIXES, a as allConstructGlobs,
|
|
6
|
+
import { B as LOGS_PORT, H as provisioningOf, R as stageSampleRate, U as stageProvider, _ as PUBLIC_ENV_PREFIXES, a as allConstructGlobs, ct as SERVER_IPV6_KEY, ft as UnknownSecretsStoreProvider, j as TEST_STAGE, st as SERVER_IPV4_KEY, ut as isReservedStageKey, v as getPublicEnvPrefix, z as telemetryEnv } from "./workspace-CqFUjObk.mjs";
|
|
7
7
|
import { ConfigNotFound, NotInAnApp, loadWorkspaceAppInfo, loadWorkspaceConfig } from "./config.mjs";
|
|
8
8
|
import { a as telemetryArgs, c as startTelemetryCode, n as runtimeFor, u as writeTelemetryModule } from "./EndpointGenerator-Bor2tZCm.mjs";
|
|
9
9
|
import { a as DEFAULT_STORAGE, i as DEFAULT_EVENTS$1, n as readFakes, o as holdsEveryCache, r as DEFAULT_CACHE, t as SubscriberGenerator } from "./SubscriberGenerator-CyN2VF5X.mjs";
|
|
10
|
-
import { c as runtimeOf } from "./resolve-
|
|
10
|
+
import { c as runtimeOf } from "./resolve-CUne0qOm.mjs";
|
|
11
11
|
import { basename, dirname, isAbsolute, join, parse, relative, resolve, sep } from "node:path";
|
|
12
12
|
import { constants, existsSync, readFileSync } from "node:fs";
|
|
13
13
|
import { appendFile, chmod, copyFile, mkdir, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
|
|
@@ -16,7 +16,7 @@ import { promisify } from "node:util";
|
|
|
16
16
|
import { Cron } from "@geekmidas/constructs/crons";
|
|
17
17
|
import { Queue } from "@geekmidas/constructs/queue";
|
|
18
18
|
import { CLIENT_IP_HEADER, DEFAULT_POSTGRES_VERSION, TELEMETRY_KEYS, cacheTable, cookieDomain, dependenciesOf, dependentsOf, externalApiUrl, kebabCase, mobileOrigins, provideKey, providedKeyFor, provisionOrder, publicEnvFor, schemeBase, scopedName } from "@geekmidas/manifest";
|
|
19
|
-
import { createServer
|
|
19
|
+
import { createServer } from "node:net";
|
|
20
20
|
import { execFile, spawn } from "node:child_process";
|
|
21
21
|
import { createCipheriv, createDecipheriv, createHash, randomBytes, randomInt } from "node:crypto";
|
|
22
22
|
import { config } from "dotenv";
|
|
@@ -6667,7 +6667,7 @@ async function createDnsProvider(options) {
|
|
|
6667
6667
|
if (isDnsProvider(config.provider)) return config.provider;
|
|
6668
6668
|
const provider = config.provider;
|
|
6669
6669
|
if (provider === "hostinger") {
|
|
6670
|
-
const { HostingerProvider } = await import("./HostingerProvider-
|
|
6670
|
+
const { HostingerProvider } = await import("./HostingerProvider-BNpS9aRJ.mjs");
|
|
6671
6671
|
return new HostingerProvider(options.hostinger);
|
|
6672
6672
|
}
|
|
6673
6673
|
if (provider === "route53") {
|
|
@@ -6680,7 +6680,7 @@ async function createDnsProvider(options) {
|
|
|
6680
6680
|
});
|
|
6681
6681
|
}
|
|
6682
6682
|
if (provider === "godaddy") {
|
|
6683
|
-
const { GoDaddyProvider } = await import("./GoDaddyProvider-
|
|
6683
|
+
const { GoDaddyProvider } = await import("./GoDaddyProvider-BsUKjGcg.mjs");
|
|
6684
6684
|
return new GoDaddyProvider(options.godaddy ?? {});
|
|
6685
6685
|
}
|
|
6686
6686
|
if (provider === "cloudflare") throw new DnsProviderNotImplemented("cloudflare");
|
|
@@ -7235,644 +7235,121 @@ async function verifyDnsRecords(appHostnames, serverIp, state) {
|
|
|
7235
7235
|
return results;
|
|
7236
7236
|
}
|
|
7237
7237
|
//#endregion
|
|
7238
|
-
//#region src/
|
|
7239
|
-
|
|
7240
|
-
|
|
7241
|
-
* they resolve to its server before a certificate is asked for.
|
|
7242
|
-
*
|
|
7243
|
-
* - **The server** (`serverAddress`): the stage's own secrets hold its public
|
|
7244
|
-
* addresses — `GKM_SERVER_IPV4`, and `GKM_SERVER_IPV6` where it has one.
|
|
7245
|
-
* Reserved for gkm: never handed to an app.
|
|
7246
|
-
* - **The plan** (`planStackDns`, pure): every public host the stack serves —
|
|
7247
|
-
* its apex, each app, each file server, the public log UI — pointed at the
|
|
7248
|
-
* server. An A record per host (and an AAAA with an IPv6 address), or, where
|
|
7249
|
-
* the domain's `dns` entry says `records: { mode: 'cname', target }`, one A
|
|
7250
|
-
* record for the target and a CNAME to it for every other host but the
|
|
7251
|
-
* apex, which DNS forbids a CNAME at.
|
|
7252
|
-
* - **Applying it** (`applyStackDns`): through the domain's provider in `dns`,
|
|
7253
|
-
* a record set at a time. A record with the right value is left alone; one
|
|
7254
|
-
* with another value is replaced and the change printed. A `manual` domain
|
|
7255
|
-
* is printed and nothing else. A dry run reads, prints and writes nothing.
|
|
7256
|
-
* - **The check** (`checkStackDns`): each host resolved with the system
|
|
7257
|
-
* resolver. One that is not the server stops the deploy with
|
|
7258
|
-
* {@link HostNotPointingAtServer}, before Caddy or Traefik ask Let's Encrypt
|
|
7259
|
-
* for a certificate it cannot get — and use up the rate limit trying.
|
|
7260
|
-
* - **The step** (`stageDns`): all three, as every deploy runs them — the plan applied through each provider,
|
|
7261
|
-
* what was written read back from the provider, and only the hosts no
|
|
7262
|
-
* provider wrote resolved publicly. A brand-new name is never looked up
|
|
7263
|
-
* before its record exists, so no resolver caches it as missing.
|
|
7264
|
-
*/
|
|
7265
|
-
/** The line that says how to set the server's address. */
|
|
7266
|
-
function serverAddressHint(stage) {
|
|
7267
|
-
return `gkm secrets:set ${SERVER_IPV4_KEY} '<ip>' --stage ${stage}`;
|
|
7268
|
-
}
|
|
7269
|
-
/** A server address in the stage's secrets that is not an address. */
|
|
7270
|
-
var ServerAddressInvalid = class extends GkmError {
|
|
7238
|
+
//#region src/deploy/journal.ts
|
|
7239
|
+
var DeployJournal = class DeployJournal {
|
|
7240
|
+
store;
|
|
7271
7241
|
stage;
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
this.
|
|
7278
|
-
this.key = key;
|
|
7279
|
-
this.value = value;
|
|
7280
|
-
this.name = "ServerAddressInvalid";
|
|
7281
|
-
}
|
|
7282
|
-
};
|
|
7283
|
-
/**
|
|
7284
|
-
* A compose stage that serves real domains with no server address: its hosts
|
|
7285
|
-
* cannot be pointed or checked, and a certificate would be asked for blind.
|
|
7286
|
-
*/
|
|
7287
|
-
var ServerAddressMissing = class extends GkmError {
|
|
7288
|
-
stage;
|
|
7289
|
-
domain;
|
|
7290
|
-
constructor(stage, domain) {
|
|
7291
|
-
super(`The '${stage}' stage serves ${domain} and its secrets hold no ${SERVER_IPV4_KEY} — the public address of the server its stack runs on, which its hosts' DNS records point at and every deploy checks before asking for certificates. Set it: ${serverAddressHint(stage)} (and ${SERVER_IPV6_KEY} for an IPv6 address).`);
|
|
7242
|
+
state;
|
|
7243
|
+
resources;
|
|
7244
|
+
version;
|
|
7245
|
+
existed;
|
|
7246
|
+
constructor(store, stage, state, resources, version, existed) {
|
|
7247
|
+
this.store = store;
|
|
7292
7248
|
this.stage = stage;
|
|
7293
|
-
this.
|
|
7294
|
-
this.
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7299
|
-
|
|
7300
|
-
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
*/
|
|
7318
|
-
function isLocalHost(host) {
|
|
7319
|
-
const name = host.toLowerCase().replace(/\.$/, "");
|
|
7320
|
-
return name === "localhost" || name.endsWith(".localhost");
|
|
7321
|
-
}
|
|
7322
|
-
/**
|
|
7323
|
-
* The server's address, required where the stage serves real domains — not
|
|
7324
|
-
* `*.localhost` ones, which point at this machine already.
|
|
7325
|
-
*
|
|
7326
|
-
* @throws {ServerAddressMissing} when the stage has a domain and no address
|
|
7327
|
-
* @throws {ServerAddressInvalid} for a value that is not an address
|
|
7328
|
-
*/
|
|
7329
|
-
function requiredServerAddress(stage, domain, custom) {
|
|
7330
|
-
const server = serverAddress(stage, custom);
|
|
7331
|
-
if (!server && domain && !isLocalHost(domain)) throw new ServerAddressMissing(stage, domain);
|
|
7332
|
-
return server;
|
|
7333
|
-
}
|
|
7334
|
-
const MANAGED = [
|
|
7335
|
-
"A",
|
|
7336
|
-
"AAAA",
|
|
7337
|
-
"CNAME"
|
|
7338
|
-
];
|
|
7339
|
-
/** Every public host the stack serves, once each, sorted. */
|
|
7340
|
-
function stackHosts(stack) {
|
|
7341
|
-
return [...new Set(stack.routes.map((route) => route.host))].sort();
|
|
7342
|
-
}
|
|
7343
|
-
/** The TTL a domain's records are written with. */
|
|
7344
|
-
function recordTtl(config) {
|
|
7345
|
-
const ttl = "ttl" in config ? config.ttl : void 0;
|
|
7346
|
-
if (ttl) return ttl;
|
|
7347
|
-
return config.provider === "godaddy" ? 600 : 300;
|
|
7348
|
-
}
|
|
7349
|
-
function providerName(config) {
|
|
7350
|
-
return typeof config.provider === "string" ? config.provider : "custom";
|
|
7351
|
-
}
|
|
7352
|
-
/**
|
|
7353
|
-
* A wildcard host: gkm writes one record per public host, so a stage on
|
|
7354
|
-
* another server — or a name someone else points elsewhere — is never caught
|
|
7355
|
-
* by a record it did not ask for.
|
|
7356
|
-
*/
|
|
7357
|
-
var DnsWildcardRefused = class extends GkmError {
|
|
7358
|
-
stage;
|
|
7359
|
-
host;
|
|
7360
|
-
constructor(stage, host) {
|
|
7361
|
-
super(`'${stage}' would point ${host} at its server, and gkm never writes a wildcard record: each public host gets its own. Give the app a subdomain of its own instead.`);
|
|
7362
|
-
this.stage = stage;
|
|
7363
|
-
this.host = host;
|
|
7364
|
-
this.name = "DnsWildcardRefused";
|
|
7365
|
-
}
|
|
7366
|
-
};
|
|
7367
|
-
/** The records a stage's hosts need — pure. */
|
|
7368
|
-
function planStackDns(input) {
|
|
7369
|
-
const { stage, server } = input;
|
|
7370
|
-
const dns = input.dns ? normalizeDnsConfig(input.dns) : {};
|
|
7371
|
-
const records = /* @__PURE__ */ new Map();
|
|
7372
|
-
const uncovered = [];
|
|
7373
|
-
const add = (host, domain, type, value) => {
|
|
7374
|
-
const name = extractSubdomain(host, domain);
|
|
7375
|
-
records.set(`${domain} ${name} ${type}`, {
|
|
7376
|
-
host,
|
|
7377
|
-
domain,
|
|
7378
|
-
name,
|
|
7379
|
-
type,
|
|
7380
|
-
value,
|
|
7381
|
-
ttl: recordTtl(dns[domain])
|
|
7249
|
+
this.state = state;
|
|
7250
|
+
this.resources = resources;
|
|
7251
|
+
this.version = version;
|
|
7252
|
+
this.existed = existed;
|
|
7253
|
+
}
|
|
7254
|
+
static async open(store, stage, initial, adopt = (stored) => stored) {
|
|
7255
|
+
const stored = await store.read(stage);
|
|
7256
|
+
if (stored) return new DeployJournal(store, stage, adopt(stored.state), stored.resources, stored.version, true);
|
|
7257
|
+
const state = initial();
|
|
7258
|
+
const version = await store.write(stage, state, { expectedVersion: null });
|
|
7259
|
+
return new DeployJournal(store, stage, state, {}, version, false);
|
|
7260
|
+
}
|
|
7261
|
+
record(key) {
|
|
7262
|
+
return this.resources[key];
|
|
7263
|
+
}
|
|
7264
|
+
/** The keys a previous run marked `pending` and never saw created. */
|
|
7265
|
+
unfinished() {
|
|
7266
|
+
return Object.values(this.resources).filter((record) => record.status === "pending").map((record) => record.key);
|
|
7267
|
+
}
|
|
7268
|
+
/** Records that `entry` is about to be created. */
|
|
7269
|
+
async pending(entry) {
|
|
7270
|
+
await this.put({
|
|
7271
|
+
...entry,
|
|
7272
|
+
status: "pending"
|
|
7382
7273
|
});
|
|
7383
|
-
};
|
|
7384
|
-
const pointAt = (host, domain) => {
|
|
7385
|
-
add(host, domain, "A", server.ipv4);
|
|
7386
|
-
if (server.ipv6) add(host, domain, "AAAA", server.ipv6);
|
|
7387
|
-
};
|
|
7388
|
-
for (const raw of input.hosts) {
|
|
7389
|
-
const host = raw.toLowerCase();
|
|
7390
|
-
if (host.includes("*")) throw new DnsWildcardRefused(stage, host);
|
|
7391
|
-
const domain = findRootDomain(host, dns);
|
|
7392
|
-
if (!domain) {
|
|
7393
|
-
uncovered.push(host);
|
|
7394
|
-
continue;
|
|
7395
|
-
}
|
|
7396
|
-
const target = cnameTarget(dns[domain].records, stage);
|
|
7397
|
-
if (target) pointAt(target, domain);
|
|
7398
|
-
if (target && host !== domain && host !== target) add(host, domain, "CNAME", target);
|
|
7399
|
-
else pointAt(host, domain);
|
|
7400
|
-
}
|
|
7401
|
-
const domains = /* @__PURE__ */ new Map();
|
|
7402
|
-
for (const record of [...records.values()].sort((a, b) => a.domain.localeCompare(b.domain) || a.name.localeCompare(b.name) || a.type.localeCompare(b.type))) {
|
|
7403
|
-
const config = dns[record.domain];
|
|
7404
|
-
const plan = domains.get(record.domain) ?? {
|
|
7405
|
-
domain: record.domain,
|
|
7406
|
-
provider: providerName(config),
|
|
7407
|
-
config,
|
|
7408
|
-
records: []
|
|
7409
|
-
};
|
|
7410
|
-
plan.records.push(record);
|
|
7411
|
-
domains.set(record.domain, plan);
|
|
7412
7274
|
}
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
provider;
|
|
7425
|
-
records;
|
|
7426
|
-
constructor(stage, domain, provider, records) {
|
|
7427
|
-
const lines = records.map((r) => ` - ${r.host} ${r.type}: ${r.found.length > 0 ? r.found.join(", ") : "nothing"}, expected ${r.expected}`);
|
|
7428
|
-
super(`${provider} accepted '${stage}''s records for ${domain}, and reading them back does not show them:\n${lines.join("\n")}\nDeploy again; if it persists, check the records in the provider's console — another tool may be writing the same names.`);
|
|
7429
|
-
this.stage = stage;
|
|
7430
|
-
this.domain = domain;
|
|
7431
|
-
this.provider = provider;
|
|
7432
|
-
this.records = records;
|
|
7433
|
-
this.name = "DnsRecordsNotConfirmed";
|
|
7434
|
-
}
|
|
7435
|
-
};
|
|
7436
|
-
/** `api.example.com A 203.0.113.10 (TTL 600)` */
|
|
7437
|
-
function describe(record) {
|
|
7438
|
-
return `${record.host.padEnd(32)} ${record.type.padEnd(5)} ${record.value} (TTL ${record.ttl})`;
|
|
7439
|
-
}
|
|
7440
|
-
function printManual(plan, log, why) {
|
|
7441
|
-
log(` ${plan.domain}: ${why} — create these records at its DNS host:`);
|
|
7442
|
-
for (const record of plan.records) log(` ${describe(record)}`);
|
|
7443
|
-
return plan.records.map((r) => ({
|
|
7444
|
-
domain: r.domain,
|
|
7445
|
-
name: r.name,
|
|
7446
|
-
type: r.type,
|
|
7447
|
-
action: "manual",
|
|
7448
|
-
value: r.value,
|
|
7449
|
-
ttl: r.ttl
|
|
7450
|
-
}));
|
|
7451
|
-
}
|
|
7452
|
-
/** The existing records of every planned name, for the types gkm manages. */
|
|
7453
|
-
async function existingRecords(provider, plan) {
|
|
7454
|
-
const names = [...new Set(plan.records.map((r) => r.name))];
|
|
7455
|
-
const wanted = names.flatMap((name) => MANAGED.map((type) => ({
|
|
7456
|
-
name,
|
|
7457
|
-
type
|
|
7458
|
-
})));
|
|
7459
|
-
if (provider.readRecords) return provider.readRecords(plan.domain, wanted);
|
|
7460
|
-
return (await provider.getRecords(plan.domain)).filter((r) => names.includes(r.name) && MANAGED.includes(r.type));
|
|
7461
|
-
}
|
|
7462
|
-
const same = (a, b) => a.trim().replace(/\.$/, "").toLowerCase() === b.trim().replace(/\.$/, "").toLowerCase();
|
|
7463
|
-
/**
|
|
7464
|
-
* What each domain's records need, compared with what is there: creates,
|
|
7465
|
-
* updates, and the deletes a change of mode needs — a name moving from an A
|
|
7466
|
-
* record to a CNAME, or back, cannot hold both. Nothing else is deleted.
|
|
7467
|
-
*/
|
|
7468
|
-
function diffDomainDns(plan, existing) {
|
|
7469
|
-
const changes = [];
|
|
7470
|
-
const find = (name, type) => existing.find((r) => r.name === name && r.type === type);
|
|
7471
|
-
const planned = /* @__PURE__ */ new Map();
|
|
7472
|
-
for (const record of plan.records) {
|
|
7473
|
-
const types = planned.get(record.name) ?? /* @__PURE__ */ new Set();
|
|
7474
|
-
types.add(record.type);
|
|
7475
|
-
planned.set(record.name, types);
|
|
7476
|
-
}
|
|
7477
|
-
for (const [name, types] of planned) {
|
|
7478
|
-
const conflicting = types.has("CNAME") ? ["A", "AAAA"] : ["CNAME"];
|
|
7479
|
-
for (const type of conflicting) {
|
|
7480
|
-
const found = find(name, type);
|
|
7481
|
-
if (!found || found.values.length === 0) continue;
|
|
7482
|
-
changes.push({
|
|
7483
|
-
domain: plan.domain,
|
|
7484
|
-
name,
|
|
7485
|
-
type,
|
|
7486
|
-
action: "delete",
|
|
7487
|
-
previous: found.values.join(", ")
|
|
7488
|
-
});
|
|
7489
|
-
}
|
|
7490
|
-
}
|
|
7491
|
-
for (const record of plan.records) {
|
|
7492
|
-
const found = find(record.name, record.type);
|
|
7493
|
-
const base = {
|
|
7494
|
-
domain: plan.domain,
|
|
7495
|
-
name: record.name,
|
|
7496
|
-
type: record.type,
|
|
7497
|
-
value: record.value,
|
|
7498
|
-
ttl: record.ttl
|
|
7499
|
-
};
|
|
7500
|
-
if (!found || found.values.length === 0) changes.push({
|
|
7501
|
-
...base,
|
|
7502
|
-
action: "create"
|
|
7503
|
-
});
|
|
7504
|
-
else if (found.values.length === 1 && same(found.values[0], record.value)) changes.push({
|
|
7505
|
-
...base,
|
|
7506
|
-
action: "unchanged"
|
|
7507
|
-
});
|
|
7508
|
-
else changes.push({
|
|
7509
|
-
...base,
|
|
7510
|
-
action: "update",
|
|
7511
|
-
previous: found.values.join(", ")
|
|
7275
|
+
/**
|
|
7276
|
+
* Records `entry` as existing with `id`; a no-op if it already is, with
|
|
7277
|
+
* the same data.
|
|
7278
|
+
*/
|
|
7279
|
+
async ready(entry, id) {
|
|
7280
|
+
const current = this.resources[entry.key];
|
|
7281
|
+
if (current?.status === "ready" && current.id === id && JSON.stringify(current.data) === JSON.stringify(entry.data)) return;
|
|
7282
|
+
await this.put({
|
|
7283
|
+
...entry,
|
|
7284
|
+
status: "ready",
|
|
7285
|
+
id
|
|
7512
7286
|
});
|
|
7513
7287
|
}
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
|
|
7529
|
-
|
|
7530
|
-
|
|
7531
|
-
|
|
7532
|
-
|
|
7533
|
-
break;
|
|
7534
|
-
case "write":
|
|
7535
|
-
log(dryRun ? ` ? ${host} ${type} ${change.value} (TTL ${change.ttl}) — would write; current value unknown (key cannot read DNS)` : ` ! ${host} ${type} ${change.value} (TTL ${change.ttl}) — written (not diffed)`);
|
|
7536
|
-
break;
|
|
7537
|
-
case "delete": log(` - ${host} ${type} ${change.previous} — ${would}delete (a name cannot hold a CNAME and an A record)`);
|
|
7538
|
-
}
|
|
7539
|
-
}
|
|
7540
|
-
/**
|
|
7541
|
-
* Each domain's records, through its provider — and, with `confirm`, what was
|
|
7542
|
-
* written read back from it. A record already holding its value is neither
|
|
7543
|
-
* written nor read again.
|
|
7544
|
-
*
|
|
7545
|
-
* @throws {DnsRecordsNotConfirmed} when a written record does not read back
|
|
7546
|
-
*/
|
|
7547
|
-
async function settleStackDns(plan, options = {}) {
|
|
7548
|
-
const dryRun = options.dryRun === true;
|
|
7549
|
-
const log = options.log ?? ((line) => console.log(line));
|
|
7550
|
-
const providerFor = options.providerFor ?? ((config) => createDnsProvider({
|
|
7551
|
-
config,
|
|
7552
|
-
...options.credentials ? { godaddy: options.credentials } : {},
|
|
7553
|
-
...options.hostinger ? { hostinger: options.hostinger } : {}
|
|
7554
|
-
}));
|
|
7555
|
-
const changes = [];
|
|
7556
|
-
const confirmed = /* @__PURE__ */ new Set();
|
|
7557
|
-
const unconfirmed = /* @__PURE__ */ new Set();
|
|
7558
|
-
const hostsOf = (domain) => new Set(domain.records.map((r) => r.host));
|
|
7559
|
-
for (const host of plan.uncovered) log(` ⚠ ${host} is under no domain in dns — point it at ${plan.server.ipv4} yourself`);
|
|
7560
|
-
for (const domain of plan.domains) {
|
|
7561
|
-
if (domain.provider === "manual") {
|
|
7562
|
-
changes.push(...printManual(domain, log, "manual"));
|
|
7563
|
-
for (const host of hostsOf(domain)) unconfirmed.add(host);
|
|
7564
|
-
continue;
|
|
7565
|
-
}
|
|
7566
|
-
const provider = await providerFor(domain.config);
|
|
7567
|
-
if (!provider) {
|
|
7568
|
-
changes.push(...printManual(domain, log, "manual"));
|
|
7569
|
-
for (const host of hostsOf(domain)) unconfirmed.add(host);
|
|
7570
|
-
continue;
|
|
7571
|
-
}
|
|
7572
|
-
log(` ${domain.domain} (${provider.name})${dryRun ? " — dry run" : ""}`);
|
|
7573
|
-
let existing;
|
|
7574
|
-
let diff;
|
|
7575
|
-
let unreadable = false;
|
|
7576
|
-
try {
|
|
7577
|
-
existing = await existingRecords(provider, domain);
|
|
7578
|
-
diff = diffDomainDns(domain, existing);
|
|
7579
|
-
} catch (error) {
|
|
7580
|
-
if (!(error instanceof DnsRecordsUnreadable)) throw error;
|
|
7581
|
-
log(` ℹ The ${provider.name} key cannot read ${domain.domain}'s DNS records, so changes cannot be diffed: every record is written (idempotent).`);
|
|
7582
|
-
unreadable = true;
|
|
7583
|
-
existing = [];
|
|
7584
|
-
diff = domain.records.map((r) => ({
|
|
7585
|
-
domain: r.domain,
|
|
7586
|
-
name: r.name,
|
|
7587
|
-
type: r.type,
|
|
7588
|
-
action: "write",
|
|
7589
|
-
value: r.value,
|
|
7590
|
-
ttl: r.ttl
|
|
7591
|
-
}));
|
|
7288
|
+
/**
|
|
7289
|
+
* The resource `entry` names: by its recorded id, else by looking it up,
|
|
7290
|
+
* else created — with `pending` written before the create and `ready`
|
|
7291
|
+
* after, so a run that dies in between leaves a record the next run
|
|
7292
|
+
* resolves by looking the resource up rather than creating another.
|
|
7293
|
+
*/
|
|
7294
|
+
async ensure(entry, steps) {
|
|
7295
|
+
const record = this.resources[entry.key];
|
|
7296
|
+
let staleId;
|
|
7297
|
+
if (record?.status === "ready" && record.id && steps.get) {
|
|
7298
|
+
const known = await steps.get(record.id);
|
|
7299
|
+
if (known) {
|
|
7300
|
+
await this.ready(entry, steps.id(known));
|
|
7301
|
+
return {
|
|
7302
|
+
resource: known,
|
|
7303
|
+
via: "recorded"
|
|
7304
|
+
};
|
|
7305
|
+
}
|
|
7306
|
+
staleId = record.id;
|
|
7592
7307
|
}
|
|
7593
|
-
|
|
7594
|
-
if (
|
|
7595
|
-
|
|
7596
|
-
|
|
7597
|
-
|
|
7308
|
+
const existing = await steps.find();
|
|
7309
|
+
if (existing) {
|
|
7310
|
+
await this.ready(entry, steps.id(existing));
|
|
7311
|
+
return {
|
|
7312
|
+
resource: existing,
|
|
7313
|
+
via: record?.status === "pending" ? "resumed" : "found",
|
|
7314
|
+
...staleId ? { staleId } : {}
|
|
7315
|
+
};
|
|
7598
7316
|
}
|
|
7599
|
-
|
|
7600
|
-
const
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
if (deletes.length > 0) await provider.deleteRecords(domain.domain, deletes.map((c) => ({
|
|
7607
|
-
name: c.name,
|
|
7608
|
-
type: c.type
|
|
7609
|
-
})));
|
|
7610
|
-
const writes = diff.filter((c) => c.action === "create" || c.action === "update" || c.action === "write");
|
|
7611
|
-
if (writes.length > 0) await provider.upsertRecords(domain.domain, writes.map((c) => ({
|
|
7612
|
-
name: c.name,
|
|
7613
|
-
type: c.type,
|
|
7614
|
-
value: c.value,
|
|
7615
|
-
ttl: c.ttl
|
|
7616
|
-
})));
|
|
7617
|
-
if (!options.confirm || unreadable || written.size === 0) continue;
|
|
7618
|
-
const rewritten = {
|
|
7619
|
-
...domain,
|
|
7620
|
-
records: domain.records.filter((r) => written.has(r.host))
|
|
7317
|
+
await this.pending(entry);
|
|
7318
|
+
const created = await steps.create();
|
|
7319
|
+
await this.ready(entry, steps.id(created));
|
|
7320
|
+
return {
|
|
7321
|
+
resource: created,
|
|
7322
|
+
via: "created",
|
|
7323
|
+
...staleId ? { staleId } : {}
|
|
7621
7324
|
};
|
|
7622
|
-
const after = await existingRecords(provider, rewritten);
|
|
7623
|
-
const missing = [];
|
|
7624
|
-
for (const record of rewritten.records) {
|
|
7625
|
-
const values = after.find((r) => r.name === record.name && r.type === record.type)?.values ?? [];
|
|
7626
|
-
if (values.length !== 1 || !same(values[0], record.value)) missing.push({
|
|
7627
|
-
host: record.host,
|
|
7628
|
-
type: record.type,
|
|
7629
|
-
expected: record.value,
|
|
7630
|
-
found: values
|
|
7631
|
-
});
|
|
7632
|
-
}
|
|
7633
|
-
if (missing.length > 0) throw new DnsRecordsNotConfirmed(plan.stage, domain.domain, provider.name, missing);
|
|
7634
|
-
for (const host of written) confirmed.add(host);
|
|
7635
|
-
log(` ✓ ${written.size} host${written.size === 1 ? "" : "s"} read back from ${provider.name}`);
|
|
7636
|
-
}
|
|
7637
|
-
for (const host of plan.uncovered) unconfirmed.add(host);
|
|
7638
|
-
return {
|
|
7639
|
-
changes,
|
|
7640
|
-
confirmed: [...confirmed].sort(),
|
|
7641
|
-
unconfirmed: [...unconfirmed].filter((h) => !confirmed.has(h)).sort()
|
|
7642
|
-
};
|
|
7643
|
-
}
|
|
7644
|
-
/** The system resolver: what the server's own clients would be told. */
|
|
7645
|
-
const systemLookup = async (host) => {
|
|
7646
|
-
return (await lookup(host, { all: true })).map((a) => a.address);
|
|
7647
|
-
};
|
|
7648
|
-
/** Hosts that do not resolve to the stage's server. */
|
|
7649
|
-
var HostNotPointingAtServer = class extends GkmError {
|
|
7650
|
-
stage;
|
|
7651
|
-
hosts;
|
|
7652
|
-
expected;
|
|
7653
|
-
fix;
|
|
7654
|
-
constructor(stage, hosts, expected, fix) {
|
|
7655
|
-
const want = expected.ipv6 ? `${expected.ipv4} (and ${expected.ipv6})` : expected.ipv4;
|
|
7656
|
-
const lines = hosts.map((h) => ` - ${h.host} → ${h.resolved.length > 0 ? h.resolved.join(", ") : `nothing${h.error ? ` (${h.error})` : ""}`}, expected ${want}`);
|
|
7657
|
-
super(`${hosts.length === 1 ? "A host" : `${hosts.length} hosts`} of '${stage}' do${hosts.length === 1 ? "es" : ""} not resolve to its server, so a certificate for ${hosts.length === 1 ? "it" : "them"} cannot be issued:\n${lines.join("\n")}\n${fix}\nRecords can take a few minutes to propagate. With a CDN or proxy in front of the server, pass --skip-dns.`);
|
|
7658
|
-
this.stage = stage;
|
|
7659
|
-
this.hosts = hosts;
|
|
7660
|
-
this.expected = expected;
|
|
7661
|
-
this.fix = fix;
|
|
7662
|
-
this.name = "HostNotPointingAtServer";
|
|
7663
7325
|
}
|
|
7664
|
-
|
|
7665
|
-
|
|
7666
|
-
|
|
7667
|
-
|
|
7668
|
-
|
|
7669
|
-
|
|
7670
|
-
|
|
7671
|
-
|
|
7672
|
-
|
|
7673
|
-
|
|
7674
|
-
|
|
7675
|
-
|
|
7676
|
-
|
|
7677
|
-
|
|
7678
|
-
|
|
7679
|
-
|
|
7680
|
-
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
|
|
7684
|
-
|
|
7685
|
-
|
|
7686
|
-
|
|
7687
|
-
}
|
|
7688
|
-
continue;
|
|
7689
|
-
}
|
|
7690
|
-
if (resolved.some((a) => a.toLowerCase() === server.ipv4.toLowerCase()) && resolved.every((a) => ours.has(a.toLowerCase()))) ok.push(host);
|
|
7691
|
-
else bad.push({
|
|
7692
|
-
host,
|
|
7693
|
-
resolved
|
|
7694
|
-
});
|
|
7695
|
-
}
|
|
7696
|
-
if (bad.length > 0) throw new HostNotPointingAtServer(input.stage, bad, {
|
|
7697
|
-
ipv4: server.ipv4,
|
|
7698
|
-
...server.ipv6 ? { ipv6: server.ipv6 } : {}
|
|
7699
|
-
}, dnsFix(input, bad));
|
|
7700
|
-
return ok;
|
|
7701
|
-
}
|
|
7702
|
-
/** How to fix it: the deploy, or the records to create by hand. */
|
|
7703
|
-
function dnsFix(input, bad) {
|
|
7704
|
-
const hosts = bad.map((h) => h.host);
|
|
7705
|
-
let plan;
|
|
7706
|
-
try {
|
|
7707
|
-
plan = planStackDns({
|
|
7708
|
-
stage: input.stage,
|
|
7709
|
-
hosts,
|
|
7710
|
-
server: input.server,
|
|
7711
|
-
dns: input.dns
|
|
7712
|
-
});
|
|
7713
|
-
} catch {
|
|
7714
|
-
plan = {
|
|
7715
|
-
stage: input.stage,
|
|
7716
|
-
server: input.server,
|
|
7717
|
-
domains: [],
|
|
7718
|
-
uncovered: hosts
|
|
7326
|
+
/** Removes `key`'s record — a resource that no longer exists. */
|
|
7327
|
+
async forget(key) {
|
|
7328
|
+
if (!(key in this.resources)) return;
|
|
7329
|
+
this.version = await this.store.deleteResource(this.stage, key, { expectedVersion: this.version });
|
|
7330
|
+
const { [key]: _removed, ...resources } = this.resources;
|
|
7331
|
+
this.resources = resources;
|
|
7332
|
+
}
|
|
7333
|
+
/** Every record, as the journal last wrote or read it. */
|
|
7334
|
+
records() {
|
|
7335
|
+
return this.resources;
|
|
7336
|
+
}
|
|
7337
|
+
/** Writes the stage's state, keeping its resource records. */
|
|
7338
|
+
async save() {
|
|
7339
|
+
this.state.lastDeployedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7340
|
+
this.version = await this.store.write(this.stage, this.state, { expectedVersion: this.version });
|
|
7341
|
+
}
|
|
7342
|
+
async put(record) {
|
|
7343
|
+
this.version = await this.store.putResource(this.stage, record, { expectedVersion: this.version });
|
|
7344
|
+
this.resources = {
|
|
7345
|
+
...this.resources,
|
|
7346
|
+
[record.key]: {
|
|
7347
|
+
...record,
|
|
7348
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
7349
|
+
}
|
|
7719
7350
|
};
|
|
7720
7351
|
}
|
|
7721
|
-
const automatic = plan.domains.filter((d) => d.provider !== "manual");
|
|
7722
|
-
const byHand = [...plan.domains.filter((d) => d.provider === "manual").flatMap((d) => d.records.map(describe)), ...plan.uncovered.flatMap((host) => [`${host.padEnd(32)} A ${input.server.ipv4}`, ...input.server.ipv6 ? [`${host.padEnd(32)} AAAA ${input.server.ipv6}`] : []])];
|
|
7723
|
-
const lines = [];
|
|
7724
|
-
if (automatic.length > 0) lines.push(`Fix: gkm deploy --stage ${input.stage} writes the records for ${automatic.map((d) => d.domain).join(", ")} through their provider (--dry-run shows them first).`);
|
|
7725
|
-
if (byHand.length > 0) lines.push(`${automatic.length > 0 ? "And create" : "Fix: create"} these records at the DNS host:`, ...byHand.map((line) => ` ${line}`));
|
|
7726
|
-
return lines.join("\n");
|
|
7727
|
-
}
|
|
7728
|
-
/** The environment variable each token-authenticated provider reads. */
|
|
7729
|
-
const DNS_TOKEN_KEYS = {
|
|
7730
|
-
godaddy: "GODADDY_API_TOKEN",
|
|
7731
|
-
hostinger: "HOSTINGER_API_TOKEN"
|
|
7732
|
-
};
|
|
7733
|
-
/**
|
|
7734
|
-
* A domain whose records the deploy writes, and no token to write them with.
|
|
7735
|
-
* Raised before anything is built, started or written.
|
|
7736
|
-
*/
|
|
7737
|
-
var DnsCredentialMissing = class extends GkmError {
|
|
7738
|
-
stage;
|
|
7739
|
-
domain;
|
|
7740
|
-
provider;
|
|
7741
|
-
key;
|
|
7742
|
-
constructor(stage, domain, provider, key) {
|
|
7743
|
-
super(`'${stage}''s hosts are under ${domain}, whose DNS is ${provider}'s, and the deploy writes their records — but ${key} is not set. In CI, add ${key} as a secret on the '${stage}' GitHub environment and pass it to the step that writes the records: env: { ${key}: \${{ secrets.${key} }} }. On this machine, export ${key} or run gkm login --provider ${provider}. With a CDN or proxy in front of the server, pass --skip-dns.`);
|
|
7744
|
-
this.stage = stage;
|
|
7745
|
-
this.domain = domain;
|
|
7746
|
-
this.provider = provider;
|
|
7747
|
-
this.key = key;
|
|
7748
|
-
this.name = "DnsCredentialMissing";
|
|
7749
|
-
}
|
|
7750
7352
|
};
|
|
7751
|
-
/**
|
|
7752
|
-
* The `dns` domain a stage's own domain (`domains.<stage>`) is under — where
|
|
7753
|
-
* its hosts' records go — or none.
|
|
7754
|
-
*/
|
|
7755
|
-
function stageDnsDomains(stage, domains, dns) {
|
|
7756
|
-
const own = domains?.[stage];
|
|
7757
|
-
if (!own || !dns || isLocalHost(own)) return [];
|
|
7758
|
-
const normalized = normalizeDnsConfig(dns);
|
|
7759
|
-
const root = findRootDomain(own.toLowerCase(), normalized);
|
|
7760
|
-
return root ? [{
|
|
7761
|
-
domain: root,
|
|
7762
|
-
config: normalized[root]
|
|
7763
|
-
}] : [];
|
|
7764
|
-
}
|
|
7765
|
-
/**
|
|
7766
|
-
* Each token the domains' providers need, from `credentials` — `manual`,
|
|
7767
|
-
* Route53 (the AWS SDK's own chain) and a provider object need none.
|
|
7768
|
-
*
|
|
7769
|
-
* @throws {DnsCredentialMissing} naming the first domain with no token
|
|
7770
|
-
*/
|
|
7771
|
-
async function dnsCredentials(stage, domains, credentials) {
|
|
7772
|
-
const found = {};
|
|
7773
|
-
for (const { domain, config } of domains) {
|
|
7774
|
-
const provider = config.provider;
|
|
7775
|
-
if (provider !== "godaddy" && provider !== "hostinger") continue;
|
|
7776
|
-
if (found[provider]) continue;
|
|
7777
|
-
const token = await credentials.get({ kind: provider });
|
|
7778
|
-
if (!token?.token) throw new DnsCredentialMissing(stage, domain, provider, DNS_TOKEN_KEYS[provider]);
|
|
7779
|
-
found[provider] = token;
|
|
7780
|
-
}
|
|
7781
|
-
return found;
|
|
7782
|
-
}
|
|
7783
|
-
/**
|
|
7784
|
-
* A stage's DNS, as every deploy runs it: the
|
|
7785
|
-
* stage's own hosts planned, written through each domain's provider where
|
|
7786
|
-
* they differ, and read back from it. Only A, AAAA and CNAME records of
|
|
7787
|
-
* those names are touched; nothing is a wildcard, and no other name is read,
|
|
7788
|
-
* written or deleted. What no provider confirms — a `manual` domain, a host
|
|
7789
|
-
* under no domain in `dns`, a key that cannot read — is resolved publicly.
|
|
7790
|
-
* A dry run prints the plan and writes nothing.
|
|
7791
|
-
*
|
|
7792
|
-
* @throws {DnsCredentialMissing} before anything is read or written
|
|
7793
|
-
* @throws {DnsRecordsNotConfirmed} when a written record does not read back
|
|
7794
|
-
* @throws {HostNotPointingAtServer} when a resolved host is not the server
|
|
7795
|
-
*/
|
|
7796
|
-
async function stageDns(input) {
|
|
7797
|
-
const { stage, server } = input;
|
|
7798
|
-
const log = input.log ?? ((line) => console.log(line));
|
|
7799
|
-
const plan = planStackDns({
|
|
7800
|
-
stage,
|
|
7801
|
-
hosts: input.hosts,
|
|
7802
|
-
server,
|
|
7803
|
-
dns: input.dns
|
|
7804
|
-
});
|
|
7805
|
-
const tokens = await dnsCredentials(stage, plan.domains.map(({ domain, config }) => ({
|
|
7806
|
-
domain,
|
|
7807
|
-
config
|
|
7808
|
-
})), input.credentials);
|
|
7809
|
-
const applied = !input.dns ? {
|
|
7810
|
-
changes: [],
|
|
7811
|
-
confirmed: [],
|
|
7812
|
-
unconfirmed: [...plan.uncovered]
|
|
7813
|
-
} : await settleStackDns(plan, {
|
|
7814
|
-
...input.dryRun ? { dryRun: true } : { confirm: true },
|
|
7815
|
-
log,
|
|
7816
|
-
credentials: {
|
|
7817
|
-
...input.godaddy ?? {},
|
|
7818
|
-
...tokens.godaddy ? { credential: tokens.godaddy } : {},
|
|
7819
|
-
log
|
|
7820
|
-
},
|
|
7821
|
-
...tokens.hostinger ? { hostinger: tokens.hostinger } : {},
|
|
7822
|
-
...input.providerFor ? { providerFor: input.providerFor } : {}
|
|
7823
|
-
});
|
|
7824
|
-
let resolved = [];
|
|
7825
|
-
if (applied.unconfirmed.length > 0) resolved = await checkStackDns({
|
|
7826
|
-
stage,
|
|
7827
|
-
hosts: applied.unconfirmed,
|
|
7828
|
-
server,
|
|
7829
|
-
dns: input.dns,
|
|
7830
|
-
...input.lookup ? { lookup: input.lookup } : {}
|
|
7831
|
-
});
|
|
7832
|
-
return {
|
|
7833
|
-
plan,
|
|
7834
|
-
changes: applied.changes,
|
|
7835
|
-
confirmed: applied.confirmed,
|
|
7836
|
-
resolved
|
|
7837
|
-
};
|
|
7838
|
-
}
|
|
7839
|
-
//#endregion
|
|
7840
|
-
//#region src/providers/dns.ts
|
|
7841
|
-
var dns_exports = /* @__PURE__ */ __exportAll({
|
|
7842
|
-
composeStageHosts: () => composeStageHosts,
|
|
7843
|
-
deploysWithCompose: () => deploysWithCompose
|
|
7844
|
-
});
|
|
7845
|
-
/** Whether the workspace deploys through the compose target. */
|
|
7846
|
-
function deploysWithCompose(workspace) {
|
|
7847
|
-
return workspace.deploy?.default === "compose" || Object.values(workspace.apps).some((app) => app.resolvedDeployTarget === "compose");
|
|
7848
|
-
}
|
|
7849
|
-
/**
|
|
7850
|
-
* The hosts a compose stage serves: its stack composed as a deploy would —
|
|
7851
|
-
* with the secrets it would generate made up in memory, never written — and
|
|
7852
|
-
* every route's host read off it.
|
|
7853
|
-
*/
|
|
7854
|
-
async function composeStageHosts(options) {
|
|
7855
|
-
const { workspace, stage, manifest } = options;
|
|
7856
|
-
const { deployedStackSecrets } = await import("./secrets-CwLauUB_.mjs").then((n) => n.n);
|
|
7857
|
-
const { composeStack } = await import("./stack-NrdH5ngX.mjs").then((n) => n.c);
|
|
7858
|
-
const { secrets } = deployedStackSecrets(workspace, stage, options.stored, manifest);
|
|
7859
|
-
return stackHosts(composeStack({
|
|
7860
|
-
workspace,
|
|
7861
|
-
manifest,
|
|
7862
|
-
runnables: options.runnables,
|
|
7863
|
-
background: options.background,
|
|
7864
|
-
stage,
|
|
7865
|
-
identity: deployIdentity(workspace, stage),
|
|
7866
|
-
images: {
|
|
7867
|
-
mode: "pull",
|
|
7868
|
-
tag: "dns",
|
|
7869
|
-
...workspace.deploy?.registry ? { registry: workspace.deploy.registry } : {}
|
|
7870
|
-
},
|
|
7871
|
-
secrets,
|
|
7872
|
-
buildOnly: true,
|
|
7873
|
-
allowDevServices: true
|
|
7874
|
-
}));
|
|
7875
|
-
}
|
|
7876
7353
|
//#endregion
|
|
7877
7354
|
//#region src/providers/types.ts
|
|
7878
7355
|
/** The manifest kinds a stage can name a provider for. */
|
|
@@ -7938,88 +7415,6 @@ function assertStageProvidersEnabled(workspace, manifest, stage) {
|
|
|
7938
7415
|
if (stageProvider(workspace, kind, stage).mode === "none") throw new StageProviderDisabled(kind, stage, ids);
|
|
7939
7416
|
}
|
|
7940
7417
|
}
|
|
7941
|
-
const SUFFIX_ALPHABET = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
7942
|
-
/** A name that S3 would refuse — what the name builder never returns. */
|
|
7943
|
-
var InvalidBucketName = class extends GkmError {
|
|
7944
|
-
bucket;
|
|
7945
|
-
reason;
|
|
7946
|
-
constructor(bucket, reason) {
|
|
7947
|
-
super(`'${bucket}' is not a valid S3 bucket name: ${reason}. Rename the construct or set deploy.namespace in gkm.config.ts to something that leaves room for it.`);
|
|
7948
|
-
this.bucket = bucket;
|
|
7949
|
-
this.reason = reason;
|
|
7950
|
-
this.name = "InvalidBucketName";
|
|
7951
|
-
}
|
|
7952
|
-
};
|
|
7953
|
-
/** Lowercase `[a-z0-9-]`, runs of anything else one `-`, no edge dashes. */
|
|
7954
|
-
function part(value) {
|
|
7955
|
-
return kebabCase(value).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
7956
|
-
}
|
|
7957
|
-
/**
|
|
7958
|
-
* `parts` joined by `-`, shortened to `max` characters by trimming the longest
|
|
7959
|
-
* part one character at a time — so a long construct id gives way before a
|
|
7960
|
-
* short stage name does, and every part keeps its start.
|
|
7961
|
-
*/
|
|
7962
|
-
function fitParts(parts, max) {
|
|
7963
|
-
const kept = parts.map(part).filter(Boolean);
|
|
7964
|
-
const length = () => kept.reduce((sum, p) => sum + p.length, 0) + kept.length - 1;
|
|
7965
|
-
while (length() > max) {
|
|
7966
|
-
let longest = 0;
|
|
7967
|
-
for (let i = 1; i < kept.length; i++) if (kept[i].length > kept[longest].length) longest = i;
|
|
7968
|
-
if (kept[longest].length <= 1) break;
|
|
7969
|
-
kept[longest] = kept[longest].slice(0, -1).replace(/-+$/, "");
|
|
7970
|
-
}
|
|
7971
|
-
return kept.join("-");
|
|
7972
|
-
}
|
|
7973
|
-
/** Why `name` is not a valid bucket name, or undefined when it is. */
|
|
7974
|
-
function bucketNameProblem(name) {
|
|
7975
|
-
if (name.length < 3 || name.length > 63) return `it is ${name.length} characters, and S3 takes 3 to 63`;
|
|
7976
|
-
if (!/^[a-z0-9-]+$/.test(name)) return "it may hold only lowercase letters, digits and -";
|
|
7977
|
-
if (!/^[a-z0-9].*[a-z0-9]$/.test(name)) return "it must start and end with a letter or a digit";
|
|
7978
|
-
if (name.startsWith("xn--") || name.startsWith("sthree-")) return "it starts with a prefix S3 reserves ('xn--', 'sthree-')";
|
|
7979
|
-
if (name.endsWith("-s3alias") || name.endsWith("--ol-s3")) return "it ends with a suffix S3 reserves ('-s3alias', '--ol-s3')";
|
|
7980
|
-
}
|
|
7981
|
-
/**
|
|
7982
|
-
* The good name: `<namespace>-<project>-<stage>-<bucket id>`, lowercased, no
|
|
7983
|
-
* dots, shortened to leave room for a clash's suffix.
|
|
7984
|
-
*
|
|
7985
|
-
* @throws {InvalidBucketName} when nothing usable is left
|
|
7986
|
-
*/
|
|
7987
|
-
function bucketName(input) {
|
|
7988
|
-
const name = fitParts([
|
|
7989
|
-
input.scope,
|
|
7990
|
-
input.stage,
|
|
7991
|
-
input.id
|
|
7992
|
-
], 56);
|
|
7993
|
-
const problem = bucketNameProblem(name);
|
|
7994
|
-
if (problem) throw new InvalidBucketName(name, problem);
|
|
7995
|
-
return name;
|
|
7996
|
-
}
|
|
7997
|
-
/** Six random `[a-z0-9]` characters. */
|
|
7998
|
-
function randomSuffix(random = randomInt) {
|
|
7999
|
-
let suffix = "";
|
|
8000
|
-
for (let i = 0; i < 6; i++) suffix += SUFFIX_ALPHABET[random(36)];
|
|
8001
|
-
return suffix;
|
|
8002
|
-
}
|
|
8003
|
-
/** The good name with a clash's suffix. */
|
|
8004
|
-
function suffixedBucketName(good, suffix) {
|
|
8005
|
-
return `${good}-${suffix}`;
|
|
8006
|
-
}
|
|
8007
|
-
/**
|
|
8008
|
-
* The IAM user a bucket is reached with on a stage:
|
|
8009
|
-
* `gkm-<project>-<stage>-<bucket id>`, at most 64 characters.
|
|
8010
|
-
*/
|
|
8011
|
-
function iamUserName(input) {
|
|
8012
|
-
return fitParts([
|
|
8013
|
-
"gkm",
|
|
8014
|
-
input.scope,
|
|
8015
|
-
input.stage,
|
|
8016
|
-
input.id
|
|
8017
|
-
], 64);
|
|
8018
|
-
}
|
|
8019
|
-
/** The path every user gkm creates is under, so it finds its own. */
|
|
8020
|
-
const IAM_USER_PATH = "/gkm/";
|
|
8021
|
-
/** The inline policy each user is given. */
|
|
8022
|
-
const IAM_POLICY_NAME = "gkm-bucket";
|
|
8023
7418
|
//#endregion
|
|
8024
7419
|
//#region src/deploy/devServices.ts
|
|
8025
7420
|
/**
|
|
@@ -8120,22 +7515,58 @@ var ExternalServicesNotConfigured = class extends GkmError {
|
|
|
8120
7515
|
this.name = "ExternalServicesNotConfigured";
|
|
8121
7516
|
}
|
|
8122
7517
|
};
|
|
7518
|
+
/** The kinds a deployed stage takes from its secrets, or a dev service. */
|
|
7519
|
+
const SERVICE_KINDS = {
|
|
7520
|
+
email: "email",
|
|
7521
|
+
objects: "objects",
|
|
7522
|
+
"file-server": "file-server"
|
|
7523
|
+
};
|
|
8123
7524
|
/**
|
|
8124
|
-
* Every mail and storage construct a manifest declares, with the apps
|
|
8125
|
-
*
|
|
7525
|
+
* Every mail and storage construct a manifest declares, each with the apps
|
|
7526
|
+
* and workers that read it — a process's environment, a site's build args. A
|
|
7527
|
+
* file server's reader reads its bucket too.
|
|
7528
|
+
*
|
|
7529
|
+
* The one list a deploy's readiness check refuses a stage by, every server
|
|
7530
|
+
* target decides its dev services from, and `gkm secrets:add` offers — so
|
|
7531
|
+
* none of them can disagree.
|
|
8126
7532
|
*/
|
|
8127
|
-
function
|
|
7533
|
+
function stageServiceDeclarations(input) {
|
|
7534
|
+
const { manifest } = input;
|
|
7535
|
+
const runnables = input.runnables ?? {};
|
|
7536
|
+
const owners = /* @__PURE__ */ new Map();
|
|
7537
|
+
for (const [id, declaration] of Object.entries(manifest)) {
|
|
7538
|
+
if (!SERVICE_KINDS[declaration.kind]) continue;
|
|
7539
|
+
owners.set(provideKey(id, "url"), id);
|
|
7540
|
+
if (declaration.kind === "email") owners.set(provideKey(id, "from"), id);
|
|
7541
|
+
}
|
|
7542
|
+
const readers = /* @__PURE__ */ new Map();
|
|
7543
|
+
const read = (process, keys) => {
|
|
7544
|
+
for (const key of keys) {
|
|
7545
|
+
const id = owners.get(key);
|
|
7546
|
+
if (!id) continue;
|
|
7547
|
+
const declaration = manifest[id];
|
|
7548
|
+
const of = declaration?.kind === "file-server" ? declaration.of : void 0;
|
|
7549
|
+
for (const owner of of ? [id, of] : [id]) {
|
|
7550
|
+
const set = readers.get(owner) ?? /* @__PURE__ */ new Set();
|
|
7551
|
+
set.add(process);
|
|
7552
|
+
readers.set(owner, set);
|
|
7553
|
+
}
|
|
7554
|
+
}
|
|
7555
|
+
};
|
|
7556
|
+
for (const [id, declaration] of Object.entries(manifest)) {
|
|
7557
|
+
const name = appKey(id);
|
|
7558
|
+
if (declaration.kind === "rest-api" || declaration.kind === "site" || declaration.kind === "mobile-app") read(name, appEnvKeys(manifest, name, runnables) ?? []);
|
|
7559
|
+
if (declaration.kind === "site") read(name, Object.values(publicEnvFor(declaration, manifest)));
|
|
7560
|
+
if (declaration.kind === "worker") read(name, workerEnvKeys(manifest, id, runnables) ?? []);
|
|
7561
|
+
}
|
|
8128
7562
|
return Object.entries(manifest).flatMap(([id, declaration]) => {
|
|
8129
|
-
const
|
|
8130
|
-
if (kind
|
|
8131
|
-
const apps =
|
|
8132
|
-
const callerKind = manifest[caller]?.kind;
|
|
8133
|
-
return callerKind === "rest-api" || callerKind === "site";
|
|
8134
|
-
}).map(appKey);
|
|
7563
|
+
const kind = SERVICE_KINDS[declaration.kind];
|
|
7564
|
+
if (!kind) return [];
|
|
7565
|
+
const apps = [...readers.get(id) ?? []].sort();
|
|
8135
7566
|
return [{
|
|
8136
7567
|
id,
|
|
8137
7568
|
kind,
|
|
8138
|
-
...declaration.kind === "file-server" ? { of: declaration.of } : {},
|
|
7569
|
+
...declaration.kind === "file-server" && declaration.of ? { of: declaration.of } : {},
|
|
8139
7570
|
...apps.length ? { apps } : {}
|
|
8140
7571
|
}];
|
|
8141
7572
|
});
|
|
@@ -8279,16 +7710,6 @@ function externalServices(input) {
|
|
|
8279
7710
|
mailpit
|
|
8280
7711
|
};
|
|
8281
7712
|
}
|
|
8282
|
-
/**
|
|
8283
|
-
* `externalServices`, refusing a stage that lacks anything.
|
|
8284
|
-
*
|
|
8285
|
-
* @throws {ExternalServicesNotConfigured} naming every missing key
|
|
8286
|
-
*/
|
|
8287
|
-
function assertExternalServices(input) {
|
|
8288
|
-
const services = externalServices(input);
|
|
8289
|
-
if (services.missing.length > 0) throw new ExternalServicesNotConfigured(input.stage, services.missing);
|
|
8290
|
-
return services;
|
|
8291
|
-
}
|
|
8292
7713
|
/** The dev services a run uses, one entry per service it runs. */
|
|
8293
7714
|
function devServicesUsed(services) {
|
|
8294
7715
|
const used = [];
|
|
@@ -8753,96 +8174,6 @@ function printRunInstructions(workspace) {
|
|
|
8753
8174
|
logger.log(` docker compose -f ${COMPOSE_PATH}${project} --profile apps up --build`);
|
|
8754
8175
|
}
|
|
8755
8176
|
//#endregion
|
|
8756
|
-
//#region src/secrets/stale.ts
|
|
8757
|
-
/**
|
|
8758
|
-
* Stored secrets an older gkm generated that now shadow a derived value.
|
|
8759
|
-
*
|
|
8760
|
-
* Before constructs, initialising a stage wrote an address for each app into
|
|
8761
|
-
* its custom secrets: `<APP>_DATABASE_URL` as a `postgresql://…@localhost`
|
|
8762
|
-
* URL with a password of its own, and `http://localhost:<port>` for a site or
|
|
8763
|
-
* an auth server. Those keys are now a construct's — `database.schema('AuthDatabase')`
|
|
8764
|
-
* provides `AUTH_DATABASE_URL`, `new BetterAuth('Auth')` provides `AUTH_URL`
|
|
8765
|
-
* — and a deploy derives them. A value the stage holds is a value set by hand,
|
|
8766
|
-
* and set by hand wins: the container is handed `localhost`, where nothing
|
|
8767
|
-
* answers, with a password no role has.
|
|
8768
|
-
*
|
|
8769
|
-
* So a deploy refuses such a stage rather than run it, naming each key and
|
|
8770
|
-
* the command that removes it. Nothing is deleted for the user: the value is
|
|
8771
|
-
* theirs, and only they can say it is stale. A URL that names a real host — a
|
|
8772
|
-
* managed database — is a deliberate choice and still wins.
|
|
8773
|
-
*/
|
|
8774
|
-
/** The kinds whose URL an older gkm wrote into a stage's secrets. */
|
|
8775
|
-
const ADDRESSED = /* @__PURE__ */ new Set([
|
|
8776
|
-
"database",
|
|
8777
|
-
"database-reader",
|
|
8778
|
-
"database-schema",
|
|
8779
|
-
"rest-api",
|
|
8780
|
-
"site"
|
|
8781
|
-
]);
|
|
8782
|
-
/** Hosts that are this machine — never anything, inside a container. */
|
|
8783
|
-
const LOOPBACK = /* @__PURE__ */ new Set([
|
|
8784
|
-
"localhost",
|
|
8785
|
-
"127.0.0.1",
|
|
8786
|
-
"[::1]",
|
|
8787
|
-
"::1"
|
|
8788
|
-
]);
|
|
8789
|
-
/**
|
|
8790
|
-
* A stage holds a construct's address as a custom secret, pointing at
|
|
8791
|
-
* `localhost` — what an older `gkm secrets:init`, `gkm setup` or `gkm init`
|
|
8792
|
-
* generated. Set by hand wins over derived, so the app would be handed it.
|
|
8793
|
-
*/
|
|
8794
|
-
var StaleStageSecrets = class extends GkmError {
|
|
8795
|
-
stage;
|
|
8796
|
-
stale;
|
|
8797
|
-
constructor(stage, stale) {
|
|
8798
|
-
const one = stale.length === 1;
|
|
8799
|
-
super(`The stage '${stage}' holds ${one ? "a value" : "values"} an older gkm generated for ${one ? "an address a construct" : "addresses constructs"} now ${one ? "provides" : "provide"}:\n` + stale.map((s) => ` ${s.key}: ${s.construct}'s, stored pointing at ${s.host}`).join("\n") + `
|
|
8800
|
-
A stored value wins over the derived one, so the app would be handed an address where nothing answers inside its container. Remove ${one ? "it" : "each"}, and the construct's own value is used:\n` + stale.map((s) => ` gkm secrets:unset ${s.key} --stage ${stage}`).join("\n") + "\nA managed service set with its real host is not affected.");
|
|
8801
|
-
this.stage = stage;
|
|
8802
|
-
this.stale = stale;
|
|
8803
|
-
this.name = "StaleStageSecrets";
|
|
8804
|
-
}
|
|
8805
|
-
};
|
|
8806
|
-
/** The host a stored value names, if it is a URL. */
|
|
8807
|
-
function hostOf(value) {
|
|
8808
|
-
try {
|
|
8809
|
-
return new URL(value).hostname;
|
|
8810
|
-
} catch {
|
|
8811
|
-
return;
|
|
8812
|
-
}
|
|
8813
|
-
}
|
|
8814
|
-
/**
|
|
8815
|
-
* Each stored key that a construct provides an address for, holding an
|
|
8816
|
-
* address on this machine.
|
|
8817
|
-
*/
|
|
8818
|
-
function staleStageSecrets(manifest, supplied) {
|
|
8819
|
-
const stale = [];
|
|
8820
|
-
for (const [id, declaration] of Object.entries(manifest)) {
|
|
8821
|
-
if (!ADDRESSED.has(declaration.kind)) continue;
|
|
8822
|
-
const key = providedKeyFor(id, declaration.kind, "url");
|
|
8823
|
-
const value = supplied[key];
|
|
8824
|
-
if (value === void 0) continue;
|
|
8825
|
-
const host = hostOf(value);
|
|
8826
|
-
if (host === void 0 || !LOOPBACK.has(host)) continue;
|
|
8827
|
-
stale.push({
|
|
8828
|
-
key,
|
|
8829
|
-
construct: id,
|
|
8830
|
-
host
|
|
8831
|
-
});
|
|
8832
|
-
}
|
|
8833
|
-
return stale.sort((a, b) => a.key.localeCompare(b.key));
|
|
8834
|
-
}
|
|
8835
|
-
/**
|
|
8836
|
-
* Refuse a stage whose stored secrets would shadow a construct's address with
|
|
8837
|
-
* `localhost`.
|
|
8838
|
-
*
|
|
8839
|
-
* @throws {StaleStageSecrets} naming each key and the command removing it
|
|
8840
|
-
*/
|
|
8841
|
-
function assertNoStaleSecrets(options) {
|
|
8842
|
-
const stale = staleStageSecrets(options.manifest, options.supplied);
|
|
8843
|
-
if (stale.length > 0) throw new StaleStageSecrets(options.stage, stale);
|
|
8844
|
-
}
|
|
8845
|
-
//#endregion
|
|
8846
8177
|
//#region src/target/seeds.ts
|
|
8847
8178
|
/** A seed of a deployed stage failed; the release stopped before any app. */
|
|
8848
8179
|
var DeploySeedsFailed = class extends Error {
|
|
@@ -8901,6 +8232,6 @@ function reportPlannedSeeds(planned, log) {
|
|
|
8901
8232
|
for (const { folder, seeds } of planned) log(`🌱 ${folder}: would run ${seeds.length} (${seeds.join(", ")})`);
|
|
8902
8233
|
}
|
|
8903
8234
|
//#endregion
|
|
8904
|
-
export {
|
|
8235
|
+
export { createDnsProvider as $, stackLogs as $n, storageBackendFor as $t, StageProviderDisabled as A, store_exports as An, postgresStatements as At, verifyDnsRecords as B, isOwnedBy as Bn, envFor as Bt, assertDevServicesFlag as C, loadEnvFiles as Cn, LOCAL_CA_PATH as Ct, requiredStageKeys as D, isRemoteStore as Dn, applyPostgres as Dt, reportDevServices as E, prepareEntryCredentials as En, applyPolicies as Et, DeployJournal as F, readKey as Fn, pgClient as Ft, getGeneratedSecret as G, maskPassword as Gn, WORKER_PORT as Gt, createComposeState as H, ownershipMarker as Hn, composeBuildPaths as Ht, extractSubdomain as I, applicationName as In, appEnvKeys as It, setApplicationId as J, withCustomSecret as Jn, imageBuildCredentials as Jt, recordRelease as K, storage_exports as Kn, detectPackageManager as Kt, findRootDomain as L, deployIdentity as Ln, dockerfileOf as Lt, provisionCommand as M, getKeyPath as Mn, LEGACY_LOCAL_LOGIN as Mt, stageProviderNotes as N, keystoreProject as Nn, ensurePostgresLogin as Nt, stageServiceDeclarations as O, secretsStoreFor as On, bucketPolicies as Ot, PROVIDER_KINDS as P, projectKey as Pn, bucketClient as Pt, DnsRecordsUnreadable as Q, logsService as Qn, providerOf as Qt, normalizeDnsConfig as R, imageName as Rn, networkEnv as Rt, STORAGE_KEY_PAIR as S, isPortAvailable as Sn, withRedisPassword as St, externalServices as T, loadSecretsForApp as Tn, applyBuckets as Tt, createEmptyState as U, projectName as Un, imageLayout as Ut, asDokployState as V, markerOf as Vn, localRolePassword as Vt, getBackupState as W, initStageSecrets as Wn, TURBO_VERSION as Wt, setGeneratedSecret as X, LOGS_SERVICE as Xn, cacheBackendFor as Xt, setBackupState as Y, LOCAL_LOGS_EMAIL as Yn, isImageBuild as Yt, setPostgresBackupId as Z, logsAccess as Zn, eventsBackendFor as Zt, isCi as _, portsOf as _n, REDIS_SERVICE as _t, DockerPushFailed as a, resourceName as an, CronGenerator as at, DevServicesNeedServerTarget as b, createEntryWrapper as bn, runsRedis as bt, ensureDockerignore as c, isTelemetryKey as cn, constructGlobs as ct, validateImageRef as d, telemetryOf as dn, workspace_exports as dt, CLUSTER_DATABASE as en, withLogsPassword as er, workerUnits as et, dnsRecordResource as f, usesTelemetry as fn, LOCAL_RABBITMQ_USER as ft, describeActor as g, portKeys as gn, withGeneratedSecrets as gt, currentActor as h, fakeKey as hn, readLocalCredentials as ht, DockerBuildFailed as i, planFor as in, QueueGenerator as it, assertStageProvidersEnabled as j, FileSecretsStore as jn, quoteIdentifier as jt, suppliedOnly as k, storeFromConfig as kn, postgresDatabaseNames as kt, workerDockerfile as l, scopeTelemetryEnv as ln, derivedContainers as lt, recordDnsChanges as m, describeServices as mn, postgresSuperuser as mt, reportDatabaseRuns as n, EMULATOR_ACCESS_KEY_ID as nn, isMainFrontendApp as nr, workerBundleName as nt, appDockerfile as o, hostFor as on, FAKE_ENV as ot, dnsResources as p, DEFAULT_IMAGES as pn, loadLocalCredentials as pt, recordRollback as q, toEmbeddableSecrets as qn, findBuildRoot as qt, reportPlannedSeeds as r, TELEMETRY_CONTAINER as rn, resolveHost as rr, workerEntryDir as rt, dockerCommand as s, appTelemetry as sn, backendsOf as st, DeploySeedsFailed as t, composeFor as tn, NoDomainForStage as tr, WorkerGenerator as tt, workerDockerfileOf as u, surfaceClientTraced as un, reconcileWorkspace as ut, AllowDevServicesTakesNoValue as v, primaryPortKey as vn, STACK_CACHE as vt, devServicesUsed as w, loadPortState as wn, forgetState as wt, ExternalServicesNotConfigured as x, findAvailablePort as xn, stackRedis as xt, DEV_SERVICES as y, createCredentialsPreload as yn, redisService as yt, orchestrateDns as z, imageRef as zn, workerEnvKeys as zt };
|
|
8905
8236
|
|
|
8906
|
-
//# sourceMappingURL=seeds-
|
|
8237
|
+
//# sourceMappingURL=seeds-CbJSne1A.mjs.map
|