@geekmidas/cli 10.0.0-alpha.74 → 10.0.0-alpha.76
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/{LegacyStateStore-D_78eaHM.cjs → LegacyStateStore-DwngfJxr.cjs} +2 -2
- package/dist/{LegacyStateStore-D_78eaHM.cjs.map → LegacyStateStore-DwngfJxr.cjs.map} +1 -1
- package/dist/{LegacyStateStore-DTo7z924.mjs → LegacyStateStore-dyq07_Ir.mjs} +2 -2
- package/dist/{LegacyStateStore-DTo7z924.mjs.map → LegacyStateStore-dyq07_Ir.mjs.map} +1 -1
- package/dist/{LocalStateStore-BhrlQIXD.cjs → LocalStateStore-B0NCde8Z.cjs} +2 -2
- package/dist/{LocalStateStore-BhrlQIXD.cjs.map → LocalStateStore-B0NCde8Z.cjs.map} +1 -1
- package/dist/{LocalStateStore-CNjgkRk4.mjs → LocalStateStore-DLxCCatI.mjs} +2 -2
- package/dist/{LocalStateStore-CNjgkRk4.mjs.map → LocalStateStore-DLxCCatI.mjs.map} +1 -1
- package/dist/{S3StateStore-oCxRs6HM.cjs → S3StateStore-BOenb-3o.cjs} +2 -2
- package/dist/{S3StateStore-oCxRs6HM.cjs.map → S3StateStore-BOenb-3o.cjs.map} +1 -1
- package/dist/{S3StateStore-g2P7T_Mo.mjs → S3StateStore-CGK_4hlo.mjs} +2 -2
- package/dist/{S3StateStore-g2P7T_Mo.mjs.map → S3StateStore-CGK_4hlo.mjs.map} +1 -1
- package/dist/{SSMStateStore-CYenunmK.mjs → SSMStateStore-B_5_RqY-.mjs} +2 -2
- package/dist/{SSMStateStore-CYenunmK.mjs.map → SSMStateStore-B_5_RqY-.mjs.map} +1 -1
- package/dist/{SSMStateStore-DXp0m7XI.cjs → SSMStateStore-DYeD__7p.cjs} +2 -2
- package/dist/{SSMStateStore-DXp0m7XI.cjs.map → SSMStateStore-DYeD__7p.cjs.map} +1 -1
- package/dist/{add-BTH7WaH3.mjs → add-B7IMXzou.mjs} +3 -3
- package/dist/{add-BTH7WaH3.mjs.map → add-B7IMXzou.mjs.map} +1 -1
- package/dist/{add-Djrr12Xc.cjs → add-j2yI3cbS.cjs} +3 -3
- package/dist/{add-Djrr12Xc.cjs.map → add-j2yI3cbS.cjs.map} +1 -1
- package/dist/{aws-DojzQnLd.mjs → aws-Bja4zGSs.mjs} +13 -9
- package/dist/aws-Bja4zGSs.mjs.map +1 -0
- package/dist/{aws-DkHdTV-p.cjs → aws-CQAuluiu.cjs} +13 -9
- package/dist/aws-CQAuluiu.cjs.map +1 -0
- package/dist/awsStore-7VmS_cZR.cjs +54 -0
- package/dist/awsStore-7VmS_cZR.cjs.map +1 -0
- package/dist/awsStore-B529csle.mjs +43 -0
- package/dist/awsStore-B529csle.mjs.map +1 -0
- package/dist/{bundler-utHuESvL.cjs → bundler-Cf6OgaOe.cjs} +5 -5
- package/dist/bundler-Cf6OgaOe.cjs.map +1 -0
- package/dist/{bundler-BUojOkof.mjs → bundler-DO6bHhnb.mjs} +5 -5
- package/dist/bundler-DO6bHhnb.mjs.map +1 -0
- package/dist/{cli-CyYceKTS.mjs → cli-BCPOHmg9.mjs} +3 -3
- package/dist/{cli-CyYceKTS.mjs.map → cli-BCPOHmg9.mjs.map} +1 -1
- package/dist/{cli-Bx0sUzxH.cjs → cli-CNanUB7a.cjs} +3 -3
- package/dist/{cli-Bx0sUzxH.cjs.map → cli-CNanUB7a.cjs.map} +1 -1
- package/dist/{compose-DZp8DJ0A.mjs → compose-Dq4VCtu5.mjs} +221 -153
- package/dist/compose-Dq4VCtu5.mjs.map +1 -0
- package/dist/{compose-iuw8wfHk.cjs → compose-h_6oNnHC.cjs} +243 -151
- package/dist/compose-h_6oNnHC.cjs.map +1 -0
- package/dist/{config-B38YWicj.d.cts → config-CWyhLSY1.d.cts} +3 -3
- package/dist/{config-B38YWicj.d.cts.map → config-CWyhLSY1.d.cts.map} +1 -1
- package/dist/{config-DA0kRTQe.d.mts → config-CqAvPP-f.d.mts} +3 -3
- package/dist/{config-DA0kRTQe.d.mts.map → config-CqAvPP-f.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/deploy/public.cjs +7 -6
- package/dist/deploy/public.d.cts +14 -3
- package/dist/deploy/public.d.cts.map +1 -1
- package/dist/deploy/public.d.mts +14 -3
- package/dist/deploy/public.d.mts.map +1 -1
- package/dist/deploy/public.mjs +7 -7
- package/dist/{deploy-eWorhvQp.cjs → deploy-CT3R9de9.cjs} +27 -5
- package/dist/deploy-CT3R9de9.cjs.map +1 -0
- package/dist/{deploy-C17K7Imy.mjs → deploy-CVXEx7Nm.mjs} +22 -6
- package/dist/deploy-CVXEx7Nm.mjs.map +1 -0
- package/dist/{dokploy-DKa49Nqm.mjs → dokploy-CYm2ozFs.mjs} +2 -2
- package/dist/{dokploy-DKa49Nqm.mjs.map → dokploy-CYm2ozFs.mjs.map} +1 -1
- package/dist/{dokploy-DKzcI-RL.cjs → dokploy-eSGmlhhj.cjs} +2 -2
- package/dist/{dokploy-DKzcI-RL.cjs.map → dokploy-eSGmlhhj.cjs.map} +1 -1
- package/dist/{encryption-sTMz3aWi.mjs → encryption-DC0rsR1W.mjs} +3 -3
- package/dist/{encryption-sTMz3aWi.mjs.map → encryption-DC0rsR1W.mjs.map} +1 -1
- package/dist/{encryption-DSkJdoyk.cjs → encryption-vS3Qzw73.cjs} +3 -3
- package/dist/{encryption-DSkJdoyk.cjs.map → encryption-vS3Qzw73.cjs.map} +1 -1
- package/dist/{engine-B1b4I34Z.mjs → engine-BOO5TWZd.mjs} +193 -5
- package/dist/engine-BOO5TWZd.mjs.map +1 -0
- package/dist/{engine-Bh76sAHy.cjs → engine-C0N2d1i5.cjs} +196 -8
- package/dist/engine-C0N2d1i5.cjs.map +1 -0
- package/dist/{github-C9ODoyZU.mjs → github-CEaFDL6t.mjs} +6 -6
- package/dist/github-CEaFDL6t.mjs.map +1 -0
- package/dist/{github-BvN3CfxM.cjs → github-ClkdCOL9.cjs} +6 -6
- package/dist/github-ClkdCOL9.cjs.map +1 -0
- package/dist/{index-B-1lLGzy.d.mts → index-Ccu0f_2m.d.cts} +2 -2
- package/dist/{index-B-1lLGzy.d.mts.map → index-Ccu0f_2m.d.cts.map} +1 -1
- package/dist/{index-vMidfqhU.d.cts → index-DOxmDKqv.d.mts} +2 -2
- package/dist/{index-vMidfqhU.d.cts.map → index-DOxmDKqv.d.mts.map} +1 -1
- package/dist/index.cjs +106 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +105 -51
- package/dist/index.mjs.map +1 -1
- package/dist/migrate-BRbYtFXG.cjs +93 -0
- package/dist/migrate-BRbYtFXG.cjs.map +1 -0
- package/dist/migrate-D3NAT7Ns.mjs +93 -0
- package/dist/migrate-D3NAT7Ns.mjs.map +1 -0
- package/dist/{migrate-B0FCZNkp.cjs → migrate-D5_-ylI1.cjs} +3 -3
- package/dist/{migrate-B0FCZNkp.cjs.map → migrate-D5_-ylI1.cjs.map} +1 -1
- package/dist/{migrate-CTtJhGV9.mjs → migrate-DrO2p9Rl.mjs} +3 -3
- package/dist/{migrate-CTtJhGV9.mjs.map → migrate-DrO2p9Rl.mjs.map} +1 -1
- package/dist/openapi.cjs +16 -6
- package/dist/openapi.cjs.map +1 -1
- package/dist/openapi.d.cts +1 -1
- package/dist/openapi.d.cts.map +1 -1
- package/dist/openapi.d.mts +1 -1
- package/dist/openapi.d.mts.map +1 -1
- package/dist/openapi.mjs +16 -6
- package/dist/openapi.mjs.map +1 -1
- package/dist/reconcile/public.d.cts +1 -1
- package/dist/reconcile/public.d.mts +1 -1
- package/dist/{resolve-DSAXj_47.mjs → resolve-C1muFos5.mjs} +3 -3
- package/dist/{resolve-DSAXj_47.mjs.map → resolve-C1muFos5.mjs.map} +1 -1
- package/dist/{resolve-D_BU-wKA.cjs → resolve-Fa1Ii0BK.cjs} +3 -3
- package/dist/{resolve-D_BU-wKA.cjs.map → resolve-Fa1Ii0BK.cjs.map} +1 -1
- package/dist/{rollback-DJy3t696.cjs → rollback-C9N5lKVf.cjs} +5 -5
- package/dist/{rollback-DJy3t696.cjs.map → rollback-C9N5lKVf.cjs.map} +1 -1
- package/dist/{rollback-CWYTUhfW.mjs → rollback-DeQzbRqM.mjs} +5 -5
- package/dist/{rollback-CWYTUhfW.mjs.map → rollback-DeQzbRqM.mjs.map} +1 -1
- package/dist/{runtime-BzZD5HHi.d.cts → runtime-BSvzPqXW.d.mts} +2 -2
- package/dist/{runtime-BzZD5HHi.d.cts.map → runtime-BSvzPqXW.d.mts.map} +1 -1
- package/dist/{runtime-Cm6J6L7n.d.mts → runtime-Cm7QA53H.d.cts} +2 -2
- package/dist/{runtime-Cm6J6L7n.d.mts.map → runtime-Cm7QA53H.d.cts.map} +1 -1
- package/dist/secretsManager-DUXW3fQt.cjs +70 -0
- package/dist/secretsManager-DUXW3fQt.cjs.map +1 -0
- package/dist/secretsManager-Ti0oZwsS.mjs +70 -0
- package/dist/secretsManager-Ti0oZwsS.mjs.map +1 -0
- package/dist/{sniffer-BFmdZpZ2.mjs → sniffer-DR8AlRCk.mjs} +67 -15
- package/dist/sniffer-DR8AlRCk.mjs.map +1 -0
- package/dist/{sniffer-C-T7dSMN.cjs → sniffer-Y6GQOCXB.cjs} +83 -13
- package/dist/sniffer-Y6GQOCXB.cjs.map +1 -0
- package/dist/{state-DCwRWyh-.cjs → state-C2qi0iQw.cjs} +241 -334
- package/dist/state-C2qi0iQw.cjs.map +1 -0
- package/dist/{state-DpkxSwzI.mjs → state-CUecOCNJ.mjs} +213 -306
- package/dist/state-CUecOCNJ.mjs.map +1 -0
- 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/{types-TzCChNrA.d.cts → types-BdptGBFS.d.cts} +59 -6
- package/dist/types-BdptGBFS.d.cts.map +1 -0
- package/dist/{types-Dp9lgx_S.d.mts → types-OxE0OAn2.d.mts} +59 -6
- package/dist/types-OxE0OAn2.d.mts.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-vdrcRI-m.cjs → workspace-DOm81oUo.cjs} +54 -1
- package/dist/workspace-DOm81oUo.cjs.map +1 -0
- package/dist/{workspace-C7NqCsQF.mjs → workspace-QUTqYmVy.mjs} +43 -2
- package/dist/workspace-QUTqYmVy.mjs.map +1 -0
- package/package.json +18 -17
- package/dist/aws-DkHdTV-p.cjs.map +0 -1
- package/dist/aws-DojzQnLd.mjs.map +0 -1
- package/dist/bundler-BUojOkof.mjs.map +0 -1
- package/dist/bundler-utHuESvL.cjs.map +0 -1
- package/dist/compose-DZp8DJ0A.mjs.map +0 -1
- package/dist/compose-iuw8wfHk.cjs.map +0 -1
- package/dist/deploy-C17K7Imy.mjs.map +0 -1
- package/dist/deploy-eWorhvQp.cjs.map +0 -1
- package/dist/engine-B1b4I34Z.mjs.map +0 -1
- package/dist/engine-Bh76sAHy.cjs.map +0 -1
- package/dist/github-BvN3CfxM.cjs.map +0 -1
- package/dist/github-C9ODoyZU.mjs.map +0 -1
- package/dist/sniffer-BFmdZpZ2.mjs.map +0 -1
- package/dist/sniffer-C-T7dSMN.cjs.map +0 -1
- package/dist/state-DCwRWyh-.cjs.map +0 -1
- package/dist/state-DpkxSwzI.mjs.map +0 -1
- package/dist/types-Dp9lgx_S.d.mts.map +0 -1
- package/dist/types-TzCChNrA.d.cts.map +0 -1
- package/dist/workspace-C7NqCsQF.mjs.map +0 -1
- package/dist/workspace-vdrcRI-m.cjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_workspace = require("./workspace-
|
|
1
|
+
const require_workspace = require("./workspace-DOm81oUo.cjs");
|
|
2
2
|
const require_config = require("./config.cjs");
|
|
3
|
-
const require_state = require("./state-
|
|
3
|
+
const require_state = require("./state-C2qi0iQw.cjs");
|
|
4
4
|
let _geekmidas_manifest = require("@geekmidas/manifest");
|
|
5
5
|
let _geekmidas_constructs_encryption = require("@geekmidas/constructs/encryption");
|
|
6
6
|
//#region src/encryption/index.ts
|
|
@@ -86,4 +86,4 @@ async function updateKeyring(construct, { stage }, context, update) {
|
|
|
86
86
|
exports.encryptionRetireCommand = encryptionRetireCommand;
|
|
87
87
|
exports.encryptionRotateCommand = encryptionRotateCommand;
|
|
88
88
|
|
|
89
|
-
//# sourceMappingURL=encryption-
|
|
89
|
+
//# sourceMappingURL=encryption-vS3Qzw73.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encryption-
|
|
1
|
+
{"version":3,"file":"encryption-vS3Qzw73.cjs","names":["rotateKeyring","parseKeyring","retireKey","loadWorkspaceSettings","canonicalId","providerOf","secretsStoreFor","provideKey","withCustomSecret"],"sources":["../src/encryption/index.ts"],"sourcesContent":["/**\n * `gkm encryption:rotate` and `gkm encryption:retire` — the keyring of an\n * `Encryption` construct on a server stage.\n *\n * Rotating adds a key in front and keeps every older one, so what they wrote\n * still opens. Retiring removes one, and is the half that makes rotating worth\n * doing: until a key is gone, it still opens everything it ever wrote. It is\n * never automatic, because the only thing that knows nothing is left under a\n * key is the sweep that re-encrypted the column — so it is done after one,\n * deliberately, by name.\n *\n * Neither applies everywhere, and each says so rather than doing something\n * that looks right: a local stage's keyring is derived and would be replaced on\n * the next `gkm dev`, and on AWS the key is KMS's, which rotates it itself and\n * never strands a value.\n */\n\nimport {\n\tparseKeyring,\n\tretireKey,\n\trotateKeyring,\n} from '@geekmidas/constructs/encryption';\nimport { canonicalId, provideKey } from '@geekmidas/manifest';\nimport { loadWorkspaceSettings } from '../config';\nimport { withCustomSecret } from '../secrets/storage.js';\nimport { type SecretsStore, secretsStoreFor } from '../secrets/store.js';\nimport { providerOf } from '../workspace/backends.js';\nimport { assertDeployedStage } from '../workspace/stages.js';\nimport type { NormalizedWorkspace } from '../workspace/types.js';\n\nconst logger = console;\n\nexport class LocalKeyringIsDerived extends Error {\n\tconstructor(\n\t\treadonly construct: string,\n\t\treadonly stage: string,\n\t) {\n\t\tsuper(\n\t\t\t`'${stage}' is the local stage, where ${construct}'s keyring is derived from the project and stage — nothing stored there would be read. Rotate a deployed stage: gkm encryption:rotate ${construct} --stage <stage>.`,\n\t\t);\n\t\tthis.name = 'LocalKeyringIsDerived';\n\t}\n}\n\nexport class KmsRotatesItself extends Error {\n\tconstructor(readonly construct: string) {\n\t\tsuper(\n\t\t\t`${construct} is a KMS key on AWS: KMS rotates it yearly and keeps every version, so no value is ever stranded and there is no key to retire. Nothing to do here.`,\n\t\t);\n\t\tthis.name = 'KmsRotatesItself';\n\t}\n}\n\nexport class NoKeyringYet extends Error {\n\tconstructor(\n\t\treadonly construct: string,\n\t\treadonly stage: string,\n\t\treadonly key: string,\n\t) {\n\t\tsuper(\n\t\t\t`'${stage}' has no ${key} yet. The first deploy generates ${construct}'s keyring: gkm deploy --stage ${stage}.`,\n\t\t);\n\t\tthis.name = 'NoKeyringYet';\n\t}\n}\n\nexport interface EncryptionCommandOptions {\n\tstage: string;\n}\n\n/** Where a command reads and writes; the real ones unless a test says. */\nexport interface EncryptionCommandContext {\n\tworkspace?: NormalizedWorkspace;\n\tstore?: SecretsStore;\n}\n\nexport async function encryptionRotateCommand(\n\tconstruct: string,\n\toptions: EncryptionCommandOptions,\n\tcontext: EncryptionCommandContext = {},\n): Promise<string> {\n\treturn updateKeyring(construct, options, context, (id, url) => {\n\t\tconst next = rotateKeyring(id, url);\n\t\tconst [current, ...older] = parseKeyring(id, next).keys.map(({ id }) => id);\n\n\t\tlogger.log(`\\n✓ ${id} on '${options.stage}' now writes with '${current}'.`);\n\t\tlogger.log(\n\t\t\t` Still opening: ${older.join(', ')}. Redeploy to start writing with '${current}', reencrypt what is stored, then: gkm encryption:retire ${id} <key> --stage ${options.stage}`,\n\t\t);\n\t\treturn next;\n\t});\n}\n\nexport async function encryptionRetireCommand(\n\tconstruct: string,\n\tkeyId: string,\n\toptions: EncryptionCommandOptions,\n\tcontext: EncryptionCommandContext = {},\n): Promise<string> {\n\treturn updateKeyring(construct, options, context, (id, url) => {\n\t\tconst next = retireKey(id, url, keyId);\n\n\t\tlogger.log(\n\t\t\t`\\n✓ ${id} on '${options.stage}' no longer holds '${keyId}'. Anything still under it cannot be read after the next deploy.`,\n\t\t);\n\t\treturn next;\n\t});\n}\n\nasync function updateKeyring(\n\tconstruct: string,\n\t{ stage }: EncryptionCommandOptions,\n\tcontext: EncryptionCommandContext,\n\tupdate: (id: string, url: string) => string,\n): Promise<string> {\n\tconst workspace = context.workspace ?? (await loadWorkspaceSettings());\n\tconst id = canonicalId(construct);\n\n\tif (stage === workspace.stages.local) {\n\t\tthrow new LocalKeyringIsDerived(id, stage);\n\t}\n\tassertDeployedStage(workspace.stages, stage);\n\tif (providerOf(workspace) === 'aws') throw new KmsRotatesItself(id);\n\n\tconst store = context.store ?? (await secretsStoreFor(workspace, stage));\n\tconst key = provideKey(id, 'url');\n\tconst secrets = await store.read(stage);\n\tconst url = secrets?.custom[key];\n\tif (!secrets || !url) throw new NoKeyringYet(id, stage, key);\n\n\tconst next = update(id, url);\n\tawait store.write(stage, withCustomSecret(secrets, key, next));\n\treturn next;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,SAAS;AAEf,IAAa,wBAAb,cAA2C,MAAM;CAEtC;CACA;CAFV,YACC,WACA,OACC;EACD,MACC,IAAI,MAAM,8BAA8B,UAAU,wIAAwI,UAAU,kBACrM;EALS,KAAA,YAAA;EACA,KAAA,QAAA;EAKT,KAAK,OAAO;CACb;AACD;AAEA,IAAa,mBAAb,cAAsC,MAAM;CACtB;CAArB,YAAY,WAA4B;EACvC,MACC,GAAG,UAAU,qJACd;EAHoB,KAAA,YAAA;EAIpB,KAAK,OAAO;CACb;AACD;AAEA,IAAa,eAAb,cAAkC,MAAM;CAE7B;CACA;CACA;CAHV,YACC,WACA,OACA,KACC;EACD,MACC,IAAI,MAAM,WAAW,IAAI,mCAAmC,UAAU,iCAAiC,MAAM,EAC9G;EANS,KAAA,YAAA;EACA,KAAA,QAAA;EACA,KAAA,MAAA;EAKT,KAAK,OAAO;CACb;AACD;AAYA,eAAsB,wBACrB,WACA,SACA,UAAoC,CAAC,GACnB;CAClB,OAAO,cAAc,WAAW,SAAS,UAAU,IAAI,QAAQ;EAC9D,MAAM,QAAA,GAAOA,iCAAAA,cAAAA,CAAc,IAAI,GAAG;EAClC,MAAM,CAAC,SAAS,GAAG,UAAA,GAASC,iCAAAA,aAAAA,CAAa,IAAI,IAAI,CAAC,CAAC,KAAK,KAAK,EAAE,SAAS,EAAE;EAE1E,OAAO,IAAI,OAAO,GAAG,OAAO,QAAQ,MAAM,qBAAqB,QAAQ,GAAG;EAC1E,OAAO,IACN,oBAAoB,MAAM,KAAK,IAAI,EAAE,oCAAoC,QAAQ,2DAA2D,GAAG,iBAAiB,QAAQ,OACzK;EACA,OAAO;CACR,CAAC;AACF;AAEA,eAAsB,wBACrB,WACA,OACA,SACA,UAAoC,CAAC,GACnB;CAClB,OAAO,cAAc,WAAW,SAAS,UAAU,IAAI,QAAQ;EAC9D,MAAM,QAAA,GAAOC,iCAAAA,UAAAA,CAAU,IAAI,KAAK,KAAK;EAErC,OAAO,IACN,OAAO,GAAG,OAAO,QAAQ,MAAM,qBAAqB,MAAM,iEAC3D;EACA,OAAO;CACR,CAAC;AACF;AAEA,eAAe,cACd,WACA,EAAE,SACF,SACA,QACkB;CAClB,MAAM,YAAY,QAAQ,aAAc,MAAMC,eAAAA,sBAAsB;CACpE,MAAM,MAAA,GAAKC,oBAAAA,YAAAA,CAAY,SAAS;CAEhC,IAAI,UAAU,UAAU,OAAO,OAC9B,MAAM,IAAI,sBAAsB,IAAI,KAAK;CAE1C,kBAAA,oBAAoB,UAAU,QAAQ,KAAK;CAC3C,IAAIC,cAAAA,WAAW,SAAS,MAAM,OAAO,MAAM,IAAI,iBAAiB,EAAE;CAElE,MAAM,QAAQ,QAAQ,SAAU,MAAMC,cAAAA,gBAAgB,WAAW,KAAK;CACtE,MAAM,OAAA,GAAMC,oBAAAA,WAAAA,CAAW,IAAI,KAAK;CAChC,MAAM,UAAU,MAAM,MAAM,KAAK,KAAK;CACtC,MAAM,MAAM,SAAS,OAAO;CAC5B,IAAI,CAAC,WAAW,CAAC,KAAK,MAAM,IAAI,aAAa,IAAI,OAAO,GAAG;CAE3D,MAAM,OAAO,OAAO,IAAI,GAAG;CAC3B,MAAM,MAAM,MAAM,OAAOC,cAAAA,iBAAiB,SAAS,KAAK,IAAI,CAAC;CAC7D,OAAO;AACR"}
|
|
@@ -1,20 +1,208 @@
|
|
|
1
|
+
import { a as runOutput, i as run } from "./run-BJLIerMM.mjs";
|
|
1
2
|
import { i as LocalSandbox, t as MissingCredential } from "./credentials-pAtB70k3.mjs";
|
|
2
3
|
import { a as discriminatedUnion, c as looseObject, f as string, n as array, s as literal, u as object } from "./schemas-D-xeKJDD.mjs";
|
|
3
4
|
import { c as runWorker, d as output, r as discover } from "./discover-BPelzeGW.mjs";
|
|
4
5
|
import { i as activeSandbox } from "./sandbox-Dm247NGx.mjs";
|
|
5
6
|
import { t as appKey } from "./derive-B4vDpzgP.mjs";
|
|
6
|
-
import { g as stripPublicPrefix, h as getPublicEnvPrefix, s as getAppBuildOrder } from "./workspace-
|
|
7
|
-
import { $
|
|
8
|
-
import { f as StateStoreBusy, m as StateVersionConflict, o as DokployApi, s as DokployApiError, t as sniffAllApps, v as eventError } from "./sniffer-
|
|
7
|
+
import { g as stripPublicPrefix, h as getPublicEnvPrefix, s as getAppBuildOrder } from "./workspace-QUTqYmVy.mjs";
|
|
8
|
+
import { $t as applicationName, A as ExternalServicesNotConfigured, At as providerOf, Ct as WORKER_PORT, D as otelEnv, F as externalServices, I as manifestServiceDeclarations, N as assertExternalServices, Ot as cacheBackendFor, P as devServicesUsed, R as reportDevServices, S as validateImageRef, T as resolveHost, V as workerUnits, Y as constructGlobs, a as recordRelease, an as ownershipMarker, c as setBackupState, d as setGeneratedSecret, f as setPostgresBackupId, ft as dockerfileOf, g as DockerPushFailed, h as DockerBuildFailed, i as isDnsVerified, in as markerOf, j as STORAGE_KEY_PAIR, jt as storageBackendFor, kt as eventsBackendFor, l as setDnsRecord, m as withGeneratedSecrets, mt as workerEnvKeys, n as getBackupState, nn as imageRef, o as recordRollback, on as projectName, p as DeployJournal, r as getGeneratedSecret, rn as isOwnedBy, rt as applyPostgres, s as setApplicationId, sn as initStageSecrets, t as createEmptyState, tn as imageName, u as setDnsVerification, un as toEmbeddableSecrets, v as dockerCommand, vt as resourceName, w as isMainFrontendApp, x as workerDockerfileOf } from "./state-CUecOCNJ.mjs";
|
|
9
|
+
import { f as StateStoreBusy, m as StateVersionConflict, o as DokployApi, s as DokployApiError, t as sniffAllApps, v as eventError, x as keyFingerprint, y as encryptSecrets } from "./sniffer-DR8AlRCk.mjs";
|
|
9
10
|
import { o as migrationFiles } from "./provider-D7rQzzzf.mjs";
|
|
10
11
|
import { n as assertStageCredentials } from "./credentialSchemas-BJqRJNK4.mjs";
|
|
11
|
-
import { join } from "node:path";
|
|
12
|
+
import { join, relative } from "node:path";
|
|
13
|
+
import { chmod, mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
14
|
+
import { tmpdir } from "node:os";
|
|
12
15
|
import { cacheTable, cloudName, cookieDomain, dependentsOf, externalApiUrl, migrationTargets, mobileOrigins, provideKey, provisionOrder, schemeBase } from "@geekmidas/manifest";
|
|
13
16
|
import { createHash, randomBytes } from "node:crypto";
|
|
14
17
|
import { ownerRole, readerRole, roleStatements } from "@geekmidas/db/pg/roles";
|
|
15
18
|
import { Client } from "pg";
|
|
16
19
|
import { cacheTableStatements } from "@geekmidas/cache/postgres";
|
|
17
20
|
import { lookup } from "node:dns/promises";
|
|
21
|
+
//#region src/deploy/docker.ts
|
|
22
|
+
const logger$3 = output;
|
|
23
|
+
/**
|
|
24
|
+
* The id the Dockerfile templates mount the encrypted credentials under:
|
|
25
|
+
* `RUN --mount=type=secret,id=gkm_credentials`.
|
|
26
|
+
*/
|
|
27
|
+
const CREDENTIALS_SECRET_ID = "gkm_credentials";
|
|
28
|
+
/**
|
|
29
|
+
* Get the full image reference
|
|
30
|
+
*/
|
|
31
|
+
function getImageRef(registry, imageName, tag) {
|
|
32
|
+
if (registry) return `${registry}/${imageName}:${tag}`;
|
|
33
|
+
return `${imageName}:${tag}`;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The `docker build` argv for an image.
|
|
37
|
+
*
|
|
38
|
+
* One element per value, so nothing in a ref or a build arg is read by a
|
|
39
|
+
* shell, and `--opt=value` rather than `--opt value`, so a value that starts
|
|
40
|
+
* with `-` cannot be taken for one of docker's own flags.
|
|
41
|
+
*
|
|
42
|
+
* @internal Exported for testing
|
|
43
|
+
*/
|
|
44
|
+
function dockerBuildArgs(options) {
|
|
45
|
+
const { dockerfilePath, imageRef, buildArgs = [], credentialsFile } = options;
|
|
46
|
+
return [
|
|
47
|
+
"build",
|
|
48
|
+
"--platform=linux/amd64",
|
|
49
|
+
`--file=${dockerfilePath}`,
|
|
50
|
+
`--tag=${imageRef}`,
|
|
51
|
+
...buildArgs.map((arg) => `--build-arg=${arg}`),
|
|
52
|
+
...credentialsFile ? [`--secret=id=${CREDENTIALS_SECRET_ID},src=${credentialsFile}`] : [],
|
|
53
|
+
"."
|
|
54
|
+
];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The build arg that names which credentials an image embeds: a hash of the
|
|
58
|
+
* ciphertext, which is not a secret. A BuildKit secret is no part of the
|
|
59
|
+
* build cache's key, so without it a rebuild with credentials encrypted under
|
|
60
|
+
* a new key would reuse the layer that embedded the old ones.
|
|
61
|
+
*/
|
|
62
|
+
function credentialsBuildArg(credentials) {
|
|
63
|
+
return `GKM_CIPHERTEXT_HASH=${createHash("sha256").update(`${credentials.encrypted}\n${credentials.iv}`).digest("hex").slice(0, 16)}`;
|
|
64
|
+
}
|
|
65
|
+
/** The secret file's content: ciphertext, then IV, one per line. */
|
|
66
|
+
function credentialsFileContent(credentials) {
|
|
67
|
+
return `${credentials.encrypted}\n${credentials.iv}\n`;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Write the encrypted credentials where `docker build --secret` reads them.
|
|
71
|
+
*
|
|
72
|
+
* Two lines — ciphertext, then IV — so a template can split them with `sed`
|
|
73
|
+
* in any base image. Owner-only, in a directory of its own, and the returned
|
|
74
|
+
* cleanup removes both whatever the build did.
|
|
75
|
+
*
|
|
76
|
+
* @internal Exported for testing
|
|
77
|
+
*/
|
|
78
|
+
async function writeCredentialsFile(credentials) {
|
|
79
|
+
const dir = await mkdtemp(join(tmpdir(), "gkm-credentials-"));
|
|
80
|
+
const path = join(dir, CREDENTIALS_SECRET_ID);
|
|
81
|
+
await writeFile(path, credentialsFileContent(credentials), { mode: 384 });
|
|
82
|
+
await chmod(path, 384);
|
|
83
|
+
return {
|
|
84
|
+
path,
|
|
85
|
+
cleanup: () => rm(dir, {
|
|
86
|
+
recursive: true,
|
|
87
|
+
force: true
|
|
88
|
+
})
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Build Docker image
|
|
93
|
+
* @param imageRef - Full image reference (registry/name:tag)
|
|
94
|
+
* @param buildArgs - Build arguments to pass to docker build
|
|
95
|
+
* @param credentials - Encrypted credentials, passed as a build secret
|
|
96
|
+
*/
|
|
97
|
+
async function buildImage(imageRef, buildArgs, credentials, { cwd, dockerfile, signal, stdio }) {
|
|
98
|
+
logger$3.log(`\n🔨 Building Docker image: ${imageRef}`);
|
|
99
|
+
logger$3.log(" Generating Dockerfile...");
|
|
100
|
+
const { buildRoot } = await dockerCommand({ cwd });
|
|
101
|
+
const dockerfilePath = relative(buildRoot, dockerfile);
|
|
102
|
+
const secret = credentials ? await writeCredentialsFile(credentials) : void 0;
|
|
103
|
+
try {
|
|
104
|
+
await run("docker", dockerBuildArgs({
|
|
105
|
+
dockerfilePath,
|
|
106
|
+
imageRef,
|
|
107
|
+
buildArgs: [...buildArgs ?? [], ...credentials ? [credentialsBuildArg(credentials)] : []],
|
|
108
|
+
credentialsFile: secret?.path
|
|
109
|
+
}), {
|
|
110
|
+
cwd: buildRoot,
|
|
111
|
+
env: {
|
|
112
|
+
...process.env,
|
|
113
|
+
DOCKER_BUILDKIT: "1"
|
|
114
|
+
},
|
|
115
|
+
...signal ? { signal } : {},
|
|
116
|
+
...stdio ? { stdio } : {}
|
|
117
|
+
});
|
|
118
|
+
logger$3.log(`✅ Image built: ${imageRef}`);
|
|
119
|
+
} catch (error) {
|
|
120
|
+
throw new DockerBuildFailed(imageRef, error);
|
|
121
|
+
} finally {
|
|
122
|
+
await secret?.cleanup();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Push Docker image to registry
|
|
127
|
+
*/
|
|
128
|
+
async function pushImage(imageRef, { cwd, signal, stdio }) {
|
|
129
|
+
logger$3.log(`\n☁️ Pushing image: ${imageRef}`);
|
|
130
|
+
try {
|
|
131
|
+
await run("docker", ["push", imageRef], {
|
|
132
|
+
cwd,
|
|
133
|
+
...signal ? { signal } : {},
|
|
134
|
+
...stdio ? { stdio } : {}
|
|
135
|
+
});
|
|
136
|
+
logger$3.log(`✅ Image pushed: ${imageRef}`);
|
|
137
|
+
} catch (error) {
|
|
138
|
+
throw new DockerPushFailed(imageRef, error);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* The digest the registry gave a pushed image, `sha256:…`.
|
|
143
|
+
*
|
|
144
|
+
* A tag can be pushed over — by the next deploy, or by anything else that
|
|
145
|
+
* shares the repository — and the digest is what says which image a stage
|
|
146
|
+
* actually ran. `RepoDigests` has one entry per repository the image was
|
|
147
|
+
* pushed to, so the one for this ref's repository is picked by name.
|
|
148
|
+
*
|
|
149
|
+
* @internal Exported for testing
|
|
150
|
+
*/
|
|
151
|
+
async function pushedDigest(imageRef, { cwd, signal } = { cwd: process.cwd() }) {
|
|
152
|
+
const repository = imageRef.split("@")[0].replace(/:[\w][\w.-]*$/, "");
|
|
153
|
+
const output = await runOutput("docker", [
|
|
154
|
+
"image",
|
|
155
|
+
"inspect",
|
|
156
|
+
"--format={{json .RepoDigests}}",
|
|
157
|
+
imageRef
|
|
158
|
+
], {
|
|
159
|
+
cwd,
|
|
160
|
+
...signal ? { signal } : {}
|
|
161
|
+
});
|
|
162
|
+
let digests;
|
|
163
|
+
try {
|
|
164
|
+
digests = JSON.parse(output.trim() || "[]");
|
|
165
|
+
} catch {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (!Array.isArray(digests)) return void 0;
|
|
169
|
+
return digests.find((entry) => typeof entry === "string" && entry.startsWith(`${repository}@`))?.slice(repository.length + 1);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Deploy using Docker (build and optionally push image)
|
|
173
|
+
*/
|
|
174
|
+
async function deployDocker(options) {
|
|
175
|
+
const { stage, tag, skipPush, masterKey, config, buildArgs, credentials } = options;
|
|
176
|
+
const imageName = config.imageName;
|
|
177
|
+
const imageRef = validateImageRef(getImageRef(config.registry, imageName, tag));
|
|
178
|
+
const cwd = options.cwd ?? process.cwd();
|
|
179
|
+
const docker = {
|
|
180
|
+
cwd,
|
|
181
|
+
dockerfile: join(cwd, options.dockerfile ?? dockerfileOf(config.appName ?? imageName, options.appPath ?? ".")),
|
|
182
|
+
...options.signal ? { signal: options.signal } : {},
|
|
183
|
+
...options.stdio ? { stdio: options.stdio } : {}
|
|
184
|
+
};
|
|
185
|
+
await buildImage(imageRef, buildArgs, credentials, docker);
|
|
186
|
+
let digest;
|
|
187
|
+
if (!skipPush) {
|
|
188
|
+
if (!config.registry) logger$3.warn("\n⚠️ No registry configured. Use --skip-push or configure docker.registry in gkm.config.ts");
|
|
189
|
+
else {
|
|
190
|
+
await pushImage(imageRef, docker);
|
|
191
|
+
digest = await pushedDigest(imageRef, docker);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
logger$3.log("\n✅ Docker deployment ready!");
|
|
195
|
+
logger$3.log(`\n📋 Deployment details:`);
|
|
196
|
+
logger$3.log(` Image: ${imageRef}`);
|
|
197
|
+
logger$3.log(` Stage: ${stage}`);
|
|
198
|
+
if (masterKey) logger$3.log(`\n🔐 Run the container with GKM_MASTER_KEY set to the key with fingerprint ${keyFingerprint(masterKey)}.`);
|
|
199
|
+
return {
|
|
200
|
+
imageRef,
|
|
201
|
+
...digest ? { digest } : {},
|
|
202
|
+
masterKey
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
//#endregion
|
|
18
206
|
//#region src/deploy/ownership.ts
|
|
19
207
|
/**
|
|
20
208
|
* Which Dokploy project a deploy is allowed to deploy into.
|
|
@@ -3204,4 +3392,4 @@ const MOBILE_SKIP_REASON = "deploys via its framework toolchain";
|
|
|
3204
3392
|
//#endregion
|
|
3205
3393
|
export { RegistryNotConfigured as _, dokployResult as a, releaseDokploy as c, validateDokploy as d, verifyDokploy as f, RegistryAmbiguous as g, HealthCheckTimedOut as h, dokployApi as i, restoreImage as l, DeployMigrationsFailed as m, FrontendDeployFailed as n, planDokploy as o, verifySettings as p, MissingEnvVars as r, provisionDokploy as s, BackendDeployFailed as t, rollbackDokploy as u, RegistryNotFound as v, ProjectNotOwned as y };
|
|
3206
3394
|
|
|
3207
|
-
//# sourceMappingURL=engine-
|
|
3395
|
+
//# sourceMappingURL=engine-BOO5TWZd.mjs.map
|