@geekmidas/cli 10.0.0-alpha.73 → 10.0.0-alpha.75
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-BFnXUFlx.cjs} +2 -2
- package/dist/{LegacyStateStore-D_78eaHM.cjs.map → LegacyStateStore-BFnXUFlx.cjs.map} +1 -1
- package/dist/{LegacyStateStore-DTo7z924.mjs → LegacyStateStore-cpt3K1vx.mjs} +2 -2
- package/dist/{LegacyStateStore-DTo7z924.mjs.map → LegacyStateStore-cpt3K1vx.mjs.map} +1 -1
- package/dist/{LocalStateStore-CNjgkRk4.mjs → LocalStateStore-RH9F2ZEy.mjs} +2 -2
- package/dist/{LocalStateStore-CNjgkRk4.mjs.map → LocalStateStore-RH9F2ZEy.mjs.map} +1 -1
- package/dist/{LocalStateStore-BhrlQIXD.cjs → LocalStateStore-zQGZ9b4J.cjs} +2 -2
- package/dist/{LocalStateStore-BhrlQIXD.cjs.map → LocalStateStore-zQGZ9b4J.cjs.map} +1 -1
- package/dist/{S3StateStore-oCxRs6HM.cjs → S3StateStore-CT-ZMlQY.cjs} +2 -2
- package/dist/{S3StateStore-oCxRs6HM.cjs.map → S3StateStore-CT-ZMlQY.cjs.map} +1 -1
- package/dist/{S3StateStore-g2P7T_Mo.mjs → S3StateStore-DBeBc0c0.mjs} +2 -2
- package/dist/{S3StateStore-g2P7T_Mo.mjs.map → S3StateStore-DBeBc0c0.mjs.map} +1 -1
- package/dist/{SSMStateStore-DXp0m7XI.cjs → SSMStateStore-HmsH3c4v.cjs} +2 -2
- package/dist/{SSMStateStore-DXp0m7XI.cjs.map → SSMStateStore-HmsH3c4v.cjs.map} +1 -1
- package/dist/{SSMStateStore-CYenunmK.mjs → SSMStateStore-rnzNfOaV.mjs} +2 -2
- package/dist/{SSMStateStore-CYenunmK.mjs.map → SSMStateStore-rnzNfOaV.mjs.map} +1 -1
- package/dist/{SubscriberGenerator-DZk_pKDh.mjs → SubscriberGenerator-5looQ3gB.mjs} +18 -2
- package/dist/SubscriberGenerator-5looQ3gB.mjs.map +1 -0
- package/dist/{SubscriberGenerator-Bixm28fN.cjs → SubscriberGenerator-CajwOa5W.cjs} +29 -1
- package/dist/SubscriberGenerator-CajwOa5W.cjs.map +1 -0
- package/dist/{add-C1ojB2Yy.cjs → add-CHBin8TF.cjs} +2 -2
- package/dist/{add-C1ojB2Yy.cjs.map → add-CHBin8TF.cjs.map} +1 -1
- package/dist/{add-BiPlBUq3.mjs → add-Cvzdw8cf.mjs} +2 -2
- package/dist/{add-BiPlBUq3.mjs.map → add-Cvzdw8cf.mjs.map} +1 -1
- package/dist/{bundler-C35h0WKt.cjs → bundler-_8AEZhrs.cjs} +5 -5
- package/dist/{bundler-C35h0WKt.cjs.map → bundler-_8AEZhrs.cjs.map} +1 -1
- package/dist/{bundler-C2LZoLdP.mjs → bundler-xjp5RwRS.mjs} +5 -5
- package/dist/{bundler-C2LZoLdP.mjs.map → bundler-xjp5RwRS.mjs.map} +1 -1
- package/dist/{cli-DJVL2sL9.cjs → cli-B4ktxAsM.cjs} +3 -3
- package/dist/{cli-DJVL2sL9.cjs.map → cli-B4ktxAsM.cjs.map} +1 -1
- package/dist/{cli-BfdfyTF6.mjs → cli-BTGfA0B7.mjs} +3 -3
- package/dist/{cli-BfdfyTF6.mjs.map → cli-BTGfA0B7.mjs.map} +1 -1
- package/dist/{compose-9II-0IsK.mjs → compose-DdH2JQJD.mjs} +418 -159
- package/dist/compose-DdH2JQJD.mjs.map +1 -0
- package/dist/{compose-CNnw8meq.cjs → compose-UKyv_1yU.cjs} +440 -157
- package/dist/compose-UKyv_1yU.cjs.map +1 -0
- package/dist/{config-RLuR2o9A.d.cts → config-B38YWicj.d.cts} +3 -3
- package/dist/{config-B8OR_TrO.d.mts.map → config-B38YWicj.d.cts.map} +1 -1
- package/dist/{config-B8OR_TrO.d.mts → config-DA0kRTQe.d.mts} +3 -3
- package/dist/{config-RLuR2o9A.d.cts.map → config-DA0kRTQe.d.mts.map} +1 -1
- package/dist/config.d.cts +3 -3
- package/dist/config.d.mts +3 -3
- 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-nmov4j0B.mjs → deploy-CuSsiFIc.mjs} +21 -5
- package/dist/deploy-CuSsiFIc.mjs.map +1 -0
- package/dist/{deploy-BitZLdnY.cjs → deploy-XUZoA1us.cjs} +26 -4
- package/dist/deploy-XUZoA1us.cjs.map +1 -0
- package/dist/{dokploy-Ce_VTytN.cjs → dokploy-Cvgg_pID.cjs} +2 -2
- package/dist/{dokploy-Ce_VTytN.cjs.map → dokploy-Cvgg_pID.cjs.map} +1 -1
- package/dist/{dokploy-CZ1vZt21.mjs → dokploy-DZXTQX10.mjs} +2 -2
- package/dist/{dokploy-CZ1vZt21.mjs.map → dokploy-DZXTQX10.mjs.map} +1 -1
- package/dist/drivers-BdvtCKc7.cjs +200 -0
- package/dist/drivers-BdvtCKc7.cjs.map +1 -0
- package/dist/drivers-Ch1rJitn.mjs +177 -0
- package/dist/drivers-Ch1rJitn.mjs.map +1 -0
- package/dist/{encryption-CmfPICSN.mjs → encryption-JkeMPugf.mjs} +2 -2
- package/dist/{encryption-CmfPICSN.mjs.map → encryption-JkeMPugf.mjs.map} +1 -1
- package/dist/{encryption-CDGRdcMr.cjs → encryption-w-Ehh9DW.cjs} +2 -2
- package/dist/{encryption-CDGRdcMr.cjs.map → encryption-w-Ehh9DW.cjs.map} +1 -1
- package/dist/{engine-B37qBO5W.mjs → engine-CmozkHxq.mjs} +192 -4
- package/dist/engine-CmozkHxq.mjs.map +1 -0
- package/dist/{engine-DL2-PW6m.cjs → engine-zpWBMsQq.cjs} +195 -7
- package/dist/engine-zpWBMsQq.cjs.map +1 -0
- package/dist/{github-C6qF8kHg.cjs → github-BGdJ-Lnm.cjs} +2 -2
- package/dist/{github-C6qF8kHg.cjs.map → github-BGdJ-Lnm.cjs.map} +1 -1
- package/dist/{github-hjHHm7jM.mjs → github-BNngHoId.mjs} +2 -2
- package/dist/{github-hjHHm7jM.mjs.map → github-BNngHoId.mjs.map} +1 -1
- package/dist/{index-DHyTqGG3.d.mts → index-B-1lLGzy.d.mts} +2 -2
- package/dist/{index-DHyTqGG3.d.mts.map → index-B-1lLGzy.d.mts.map} +1 -1
- package/dist/{index-Dg-UZ4Hm.d.cts → index-vMidfqhU.d.cts} +2 -2
- package/dist/{index-Dg-UZ4Hm.d.cts.map → index-vMidfqhU.d.cts.map} +1 -1
- package/dist/index.cjs +89 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +86 -49
- package/dist/index.mjs.map +1 -1
- package/dist/{migrate-CFFC3esE.mjs → migrate-BLL1RTAj.mjs} +2 -2
- package/dist/{migrate-CFFC3esE.mjs.map → migrate-BLL1RTAj.mjs.map} +1 -1
- package/dist/{migrate-kA_j1TPK.cjs → migrate-CgjlYeun.cjs} +2 -2
- package/dist/{migrate-kA_j1TPK.cjs.map → migrate-CgjlYeun.cjs.map} +1 -1
- package/dist/openapi.d.cts +1 -1
- package/dist/openapi.d.mts +1 -1
- package/dist/{ready-BIuMw6wH.cjs → ready-BB9xS4S9.cjs} +6 -188
- package/dist/ready-BB9xS4S9.cjs.map +1 -0
- package/dist/{ready-C0U0NYfB.mjs → ready-ZZoNskrr.mjs} +5 -169
- package/dist/ready-ZZoNskrr.mjs.map +1 -0
- package/dist/reconcile/public.d.cts +1 -1
- package/dist/reconcile/public.d.mts +1 -1
- package/dist/{resolve-CV4eQkDa.mjs → resolve-DZNx7rLy.mjs} +3 -3
- package/dist/{resolve-CV4eQkDa.mjs.map → resolve-DZNx7rLy.mjs.map} +1 -1
- package/dist/{resolve-E5RfY0bm.cjs → resolve-fevXn-wZ.cjs} +3 -3
- package/dist/{resolve-E5RfY0bm.cjs.map → resolve-fevXn-wZ.cjs.map} +1 -1
- package/dist/{rollback-C-V-Rf4a.mjs → rollback-CLi5Pln_.mjs} +4 -4
- package/dist/{rollback-C-V-Rf4a.mjs.map → rollback-CLi5Pln_.mjs.map} +1 -1
- package/dist/{rollback-QGwomD64.cjs → rollback-Dw-FW3X2.cjs} +4 -4
- package/dist/{rollback-QGwomD64.cjs.map → rollback-Dw-FW3X2.cjs.map} +1 -1
- package/dist/{runtime-CWYLIeCU.d.mts → runtime-BzZD5HHi.d.cts} +2 -2
- package/dist/{runtime-CWYLIeCU.d.mts.map → runtime-BzZD5HHi.d.cts.map} +1 -1
- package/dist/{runtime-CmuQOT6A.d.cts → runtime-Cm6J6L7n.d.mts} +2 -2
- package/dist/{runtime-CmuQOT6A.d.cts.map → runtime-Cm6J6L7n.d.mts.map} +1 -1
- package/dist/{sniffer-BFmdZpZ2.mjs → sniffer-BmCvVyhq.mjs} +59 -7
- package/dist/sniffer-BmCvVyhq.mjs.map +1 -0
- package/dist/{sniffer-C-T7dSMN.cjs → sniffer-bMzrX4cO.cjs} +75 -5
- package/dist/{sniffer-C-T7dSMN.cjs.map → sniffer-bMzrX4cO.cjs.map} +1 -1
- package/dist/{state-DtS2HEfi.mjs → state-BrWIOce_.mjs} +60 -293
- package/dist/state-BrWIOce_.mjs.map +1 -0
- package/dist/{state-DMjFPOhf.cjs → state-kA4Fkufx.cjs} +70 -321
- package/dist/state-kA4Fkufx.cjs.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-BLdCL4fB.d.mts → types-Dp9lgx_S.d.mts} +6 -2
- package/dist/{types-BLdCL4fB.d.mts.map → types-Dp9lgx_S.d.mts.map} +1 -1
- package/dist/{types-DwCQCkC-.d.cts → types-TzCChNrA.d.cts} +6 -2
- package/dist/{types-DwCQCkC-.d.cts.map → types-TzCChNrA.d.cts.map} +1 -1
- package/dist/vitest.cjs +1 -1
- package/dist/vitest.mjs +1 -1
- package/dist/workspace/index.d.cts +2 -2
- package/dist/workspace/index.d.mts +2 -2
- package/package.json +17 -17
- package/dist/SubscriberGenerator-Bixm28fN.cjs.map +0 -1
- package/dist/SubscriberGenerator-DZk_pKDh.mjs.map +0 -1
- package/dist/compose-9II-0IsK.mjs.map +0 -1
- package/dist/compose-CNnw8meq.cjs.map +0 -1
- package/dist/deploy-BitZLdnY.cjs.map +0 -1
- package/dist/deploy-nmov4j0B.mjs.map +0 -1
- package/dist/engine-B37qBO5W.mjs.map +0 -1
- package/dist/engine-DL2-PW6m.cjs.map +0 -1
- package/dist/ready-BIuMw6wH.cjs.map +0 -1
- package/dist/ready-C0U0NYfB.mjs.map +0 -1
- package/dist/sniffer-BFmdZpZ2.mjs.map +0 -1
- package/dist/state-DMjFPOhf.cjs.map +0 -1
- package/dist/state-DtS2HEfi.mjs.map +0 -1
|
@@ -5,8 +5,8 @@ const require_derive = require("./derive-DAbo49sm.cjs");
|
|
|
5
5
|
const require_workspace = require("./workspace-vdrcRI-m.cjs");
|
|
6
6
|
const require_config = require("./config.cjs");
|
|
7
7
|
const require_EndpointGenerator = require("./EndpointGenerator-CP6sBvQV.cjs");
|
|
8
|
-
const require_resolve = require("./resolve-
|
|
9
|
-
const require_SubscriberGenerator = require("./SubscriberGenerator-
|
|
8
|
+
const require_resolve = require("./resolve-fevXn-wZ.cjs");
|
|
9
|
+
const require_SubscriberGenerator = require("./SubscriberGenerator-CajwOa5W.cjs");
|
|
10
10
|
let node_path = require("node:path");
|
|
11
11
|
let node_fs = require("node:fs");
|
|
12
12
|
let node_fs_promises = require("node:fs/promises");
|
|
@@ -276,7 +276,7 @@ function applicationName(identity, app) {
|
|
|
276
276
|
* old file stays, so an older CLI on the same machine keeps working.
|
|
277
277
|
*/
|
|
278
278
|
/** Key length for AES-256 encryption */
|
|
279
|
-
const KEY_LENGTH
|
|
279
|
+
const KEY_LENGTH = 32;
|
|
280
280
|
/** A keystore project key that is not `<namespace>/<project>`. */
|
|
281
281
|
var KeystoreProjectInvalid = class extends Error {
|
|
282
282
|
key;
|
|
@@ -369,7 +369,7 @@ async function generateKey(stage, project, flag = "w") {
|
|
|
369
369
|
recursive: true,
|
|
370
370
|
mode: 448
|
|
371
371
|
});
|
|
372
|
-
const key = (0, node_crypto.randomBytes)(KEY_LENGTH
|
|
372
|
+
const key = (0, node_crypto.randomBytes)(KEY_LENGTH).toString("hex");
|
|
373
373
|
await (0, node_fs_promises.writeFile)(keyPath, key, {
|
|
374
374
|
mode: 384,
|
|
375
375
|
encoding: "utf-8",
|
|
@@ -438,8 +438,8 @@ async function getOrCreateKey(stage, project) {
|
|
|
438
438
|
/** Where the files live, relative to the project root. */
|
|
439
439
|
const SECRETS_DIR = ".gkm/secrets";
|
|
440
440
|
/** AES-256-GCM configuration */
|
|
441
|
-
const ALGORITHM
|
|
442
|
-
const IV_LENGTH
|
|
441
|
+
const ALGORITHM = "aes-256-gcm";
|
|
442
|
+
const IV_LENGTH = 12;
|
|
443
443
|
/**
|
|
444
444
|
* A stage's secrets as an encrypted file on this machine:
|
|
445
445
|
* `.gkm/secrets/<stage>.json`, with its key in the CLI's home at
|
|
@@ -507,8 +507,8 @@ function packageName$1(root) {
|
|
|
507
507
|
}
|
|
508
508
|
function encrypt(secrets, keyHex) {
|
|
509
509
|
const key = Buffer.from(keyHex, "hex");
|
|
510
|
-
const iv = (0, node_crypto.randomBytes)(IV_LENGTH
|
|
511
|
-
const cipher = (0, node_crypto.createCipheriv)(ALGORITHM
|
|
510
|
+
const iv = (0, node_crypto.randomBytes)(IV_LENGTH);
|
|
511
|
+
const cipher = (0, node_crypto.createCipheriv)(ALGORITHM, key, iv);
|
|
512
512
|
const ciphertext = Buffer.concat([cipher.update(JSON.stringify(secrets), "utf-8"), cipher.final()]);
|
|
513
513
|
return {
|
|
514
514
|
version: 1,
|
|
@@ -519,7 +519,7 @@ function encrypt(secrets, keyHex) {
|
|
|
519
519
|
function decrypt(data, keyHex) {
|
|
520
520
|
const key = Buffer.from(keyHex, "hex");
|
|
521
521
|
const combined = Buffer.from(data.encrypted, "base64");
|
|
522
|
-
const decipher = (0, node_crypto.createDecipheriv)(ALGORITHM
|
|
522
|
+
const decipher = (0, node_crypto.createDecipheriv)(ALGORITHM, key, Buffer.from(data.iv, "hex"));
|
|
523
523
|
decipher.setAuthTag(combined.subarray(-16));
|
|
524
524
|
const plaintext = Buffer.concat([decipher.update(combined.subarray(0, -16)), decipher.final()]);
|
|
525
525
|
return JSON.parse(plaintext.toString("utf-8"));
|
|
@@ -556,7 +556,7 @@ function isRemoteStore(workspace, stage) {
|
|
|
556
556
|
}
|
|
557
557
|
//#endregion
|
|
558
558
|
//#region src/credentials/index.ts
|
|
559
|
-
const logger$
|
|
559
|
+
const logger$1 = console;
|
|
560
560
|
/**
|
|
561
561
|
* Load environment files
|
|
562
562
|
* @internal Exported for testing
|
|
@@ -607,7 +607,7 @@ async function findAvailablePort(preferredPort, maxAttempts = 10) {
|
|
|
607
607
|
for (let i = 0; i < maxAttempts; i++) {
|
|
608
608
|
const port = preferredPort + i;
|
|
609
609
|
if (await isPortAvailable(port)) return port;
|
|
610
|
-
logger$
|
|
610
|
+
logger$1.log(`⚠️ Port ${port} is in use, trying ${port + 1}...`);
|
|
611
611
|
}
|
|
612
612
|
throw new Error(`Could not find an available port after trying ${maxAttempts} ports starting from ${preferredPort}`);
|
|
613
613
|
}
|
|
@@ -642,7 +642,7 @@ async function loadSecretsForApp(store, stage, appName) {
|
|
|
642
642
|
let secrets = {};
|
|
643
643
|
const stageSecrets = await store.read(stage);
|
|
644
644
|
if (stageSecrets) {
|
|
645
|
-
logger$
|
|
645
|
+
logger$1.log(`🔐 Loading secrets from stage: ${stage}`);
|
|
646
646
|
secrets = toEmbeddableSecrets(stageSecrets);
|
|
647
647
|
}
|
|
648
648
|
if (Object.keys(secrets).length === 0) return {};
|
|
@@ -748,7 +748,7 @@ async function prepareEntryCredentials(options) {
|
|
|
748
748
|
free: isPortAvailable,
|
|
749
749
|
holder: holderOf
|
|
750
750
|
});
|
|
751
|
-
for (const { app, from, to, holder } of assigned.moved) logger$
|
|
751
|
+
for (const { app, from, to, holder } of assigned.moved) logger$1.log(`↪️ ${app}: ${from} is held by ${describeHolder(holder)}, which is not this workspace's — using ${to}`);
|
|
752
752
|
workspace = withAppPorts(workspace, assigned.ports);
|
|
753
753
|
workspaceAppPort = assigned.ports[appName] ?? workspaceAppPort;
|
|
754
754
|
}
|
|
@@ -772,7 +772,7 @@ async function prepareEntryCredentials(options) {
|
|
|
772
772
|
});
|
|
773
773
|
Object.assign(credentials, reconciled.env);
|
|
774
774
|
declaredKeys.push(...Object.keys(reconciled.env));
|
|
775
|
-
if (Object.keys(reconciled.env).length > 0) logger$
|
|
775
|
+
if (Object.keys(reconciled.env).length > 0) logger$1.log(`🔌 Resolved ${Object.keys(reconciled.env).length} declared URL(s)`);
|
|
776
776
|
}
|
|
777
777
|
const secretsDir = (0, node_path.join)(secretsRoot, ".gkm");
|
|
778
778
|
await (0, node_fs_promises.mkdir)(secretsDir, { recursive: true });
|
|
@@ -1281,23 +1281,22 @@ RUN --mount=type=cache,id=${pm.cacheId},target=${pm.cacheTarget} \\
|
|
|
1281
1281
|
*
|
|
1282
1282
|
* Nothing built on the host reaches the image — `.dockerignore` keeps every
|
|
1283
1283
|
* `dist` out — so a workspace package (a CLI that is a sibling package) is
|
|
1284
|
-
* built here:
|
|
1285
|
-
*
|
|
1284
|
+
* built here: turbo's build of the app's dependencies (`^build`) and nothing
|
|
1285
|
+
* else. The root's own `build` script is never run: the slice holds one app,
|
|
1286
|
+
* and a root `build` that is `gkm build` (what `gkm init` scaffolds) builds
|
|
1287
|
+
* every app the workspace declares, most of which are not in it. The app
|
|
1288
|
+
* itself is built after this, by `gkm build` or its framework.
|
|
1286
1289
|
*/
|
|
1287
1290
|
function builderStage(options, extra = {}) {
|
|
1288
|
-
const {
|
|
1291
|
+
const { turbo, monorepo } = layout(options);
|
|
1289
1292
|
const args = extra.args ?? [];
|
|
1290
1293
|
const argLines = args.length ? `\n# Build-time args: public values the bundler inlines\n${args.map((a) => `ARG ${a}=""`).join("\n")}\n${args.map((a) => `ENV ${a}=$${a}`).join("\n")}\n` : "";
|
|
1291
1294
|
const scopes = [options.turboPackage, ...options.prunePackages ?? []];
|
|
1292
|
-
const dependencies = monorepo ? `\nRUN ${turbo} run build ${scopes.map((s) => `--filter='${s}^...'`).join(" ")}` : "";
|
|
1293
1295
|
return `# Stage 3: Build
|
|
1294
1296
|
FROM deps AS builder
|
|
1295
1297
|
WORKDIR /app
|
|
1296
1298
|
${argLines}
|
|
1297
|
-
COPY --from=pruner /app/out/full/
|
|
1298
|
-
|
|
1299
|
-
# The workspace packages the app depends on, built from source.
|
|
1300
|
-
RUN ${pm.run} --if-present build${dependencies}`;
|
|
1299
|
+
COPY --from=pruner /app/out/full/ ./${monorepo ? `\n# The workspace packages the app depends on, built from source.\nRUN ${turbo} run build ${scopes.map((s) => `--filter='${s}^...'`).join(" ")}` : ""}`;
|
|
1301
1300
|
}
|
|
1302
1301
|
/**
|
|
1303
1302
|
* The PATH a command in the app's directory runs with: the app's binaries,
|
|
@@ -1580,7 +1579,7 @@ ${depsStage(options)}
|
|
|
1580
1579
|
${builderStage(options)}
|
|
1581
1580
|
|
|
1582
1581
|
# Bundle the production server, with the encrypted credentials embedded
|
|
1583
|
-
${credentialsStep(app, `cd ${app} && ${gkmCommand(
|
|
1582
|
+
${credentialsStep(app, `cd ${app} && ${gkmCommand(`build --provider server --production${options.cache ? ` --cache ${options.cache}` : ""}`)}`)}
|
|
1584
1583
|
${externals.stage}
|
|
1585
1584
|
# Production
|
|
1586
1585
|
FROM ${options.baseImage} AS runner
|
|
@@ -2182,7 +2181,8 @@ const CONTAINERS = {
|
|
|
2182
2181
|
*/
|
|
2183
2182
|
const CACHE_CONTAINERS = {
|
|
2184
2183
|
upstash: "redis-http",
|
|
2185
|
-
elasticache: "redis"
|
|
2184
|
+
elasticache: "redis",
|
|
2185
|
+
redis: "redis"
|
|
2186
2186
|
};
|
|
2187
2187
|
/**
|
|
2188
2188
|
* Kinds that resolve a value without anything running.
|
|
@@ -2295,7 +2295,7 @@ function containerFor(kind, events = DEFAULT_EVENTS, cache = require_SubscriberG
|
|
|
2295
2295
|
if (EVENT_KINDS[kind]) return EVENT_CONTAINERS[events] ?? CONTAINERS.database;
|
|
2296
2296
|
if (kind === "file-server") return edge ? "caddy" : CONTAINERS.objects;
|
|
2297
2297
|
if (kind === "cache") {
|
|
2298
|
-
if (derived) return CONTAINERS.database;
|
|
2298
|
+
if (derived && !require_SubscriberGenerator.holdsEveryCache(cache)) return CONTAINERS.database;
|
|
2299
2299
|
return CACHE_CONTAINERS[cache] ?? CONTAINERS.database;
|
|
2300
2300
|
}
|
|
2301
2301
|
return CONTAINERS[kind];
|
|
@@ -2328,6 +2328,7 @@ function planFor(manifest, stage, order, options = {}) {
|
|
|
2328
2328
|
port: fake.port
|
|
2329
2329
|
} : {}
|
|
2330
2330
|
};
|
|
2331
|
+
const detached = declaration.kind === "cache" && require_SubscriberGenerator.holdsEveryCache(cache);
|
|
2331
2332
|
const container = fake?.image ? fake.key : containerFor(declaration.kind, events, cache, "of" in declaration && typeof declaration.of === "string", options.edge !== false);
|
|
2332
2333
|
if (!container && !CONTAINERLESS[declaration.kind]) continue;
|
|
2333
2334
|
if (container) {
|
|
@@ -2354,11 +2355,11 @@ function planFor(manifest, stage, order, options = {}) {
|
|
|
2354
2355
|
credentials: fake.credentials
|
|
2355
2356
|
} } : {},
|
|
2356
2357
|
...declaration.kind === "external-api" && !fake ? { url: declaration.url } : {},
|
|
2357
|
-
..."of" in declaration ? { of: declaration.of } : {},
|
|
2358
|
+
..."of" in declaration && !detached ? { of: declaration.of } : {},
|
|
2358
2359
|
..."schema" in declaration && declaration.schema ? { schema: declaration.schema } : {},
|
|
2359
2360
|
..."version" in declaration && declaration.version ? { version: declaration.version } : {},
|
|
2360
2361
|
..."roles" in declaration && declaration.roles === false ? { roles: false } : {},
|
|
2361
|
-
..."table" in declaration && declaration.table ? { table: declaration.table } : {}
|
|
2362
|
+
..."table" in declaration && declaration.table && !detached ? { table: declaration.table } : {}
|
|
2362
2363
|
});
|
|
2363
2364
|
}
|
|
2364
2365
|
if (options.edge !== false && resources.some((r) => EDGE_KINDS[r.kind] === true)) containers.add("caddy");
|
|
@@ -2720,7 +2721,8 @@ function urlFor(resource, plan, ports, project, addresses = {}, credential = { m
|
|
|
2720
2721
|
return url ? withTable(url, resource.table ?? (0, _geekmidas_manifest.cacheTable)(resource.id)) : void 0;
|
|
2721
2722
|
}
|
|
2722
2723
|
switch (plan.cache) {
|
|
2723
|
-
case "elasticache":
|
|
2724
|
+
case "elasticache":
|
|
2725
|
+
case "redis": return `redis://${LOCAL_HOST}:${port}`;
|
|
2724
2726
|
default: return `http://:${LOCAL_TOKEN$1}@${LOCAL_HOST}:${port}`;
|
|
2725
2727
|
}
|
|
2726
2728
|
case "queue":
|
|
@@ -5290,58 +5292,6 @@ logger.info({ port }, 'Worker started');
|
|
|
5290
5292
|
`;
|
|
5291
5293
|
}
|
|
5292
5294
|
//#endregion
|
|
5293
|
-
//#region src/secrets/encryption.ts
|
|
5294
|
-
var encryption_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
|
|
5295
|
-
encryptSecrets: () => encryptSecrets,
|
|
5296
|
-
generateDefineOptions: () => generateDefineOptions,
|
|
5297
|
-
keyFingerprint: () => keyFingerprint
|
|
5298
|
-
});
|
|
5299
|
-
/** AES-256-GCM configuration */
|
|
5300
|
-
const ALGORITHM = "aes-256-gcm";
|
|
5301
|
-
const KEY_LENGTH = 32;
|
|
5302
|
-
const IV_LENGTH = 12;
|
|
5303
|
-
/**
|
|
5304
|
-
* Encrypt secrets for embedding in a bundle.
|
|
5305
|
-
* Uses AES-256-GCM with a randomly generated ephemeral key.
|
|
5306
|
-
*
|
|
5307
|
-
* @param secrets - Key-value pairs to encrypt
|
|
5308
|
-
* @returns Encrypted payload with ephemeral master key
|
|
5309
|
-
*/
|
|
5310
|
-
function encryptSecrets(secrets) {
|
|
5311
|
-
const masterKey = (0, node_crypto.randomBytes)(KEY_LENGTH);
|
|
5312
|
-
const iv = (0, node_crypto.randomBytes)(IV_LENGTH);
|
|
5313
|
-
const plaintext = JSON.stringify(secrets);
|
|
5314
|
-
const cipher = (0, node_crypto.createCipheriv)(ALGORITHM, masterKey, iv);
|
|
5315
|
-
const ciphertext = Buffer.concat([cipher.update(plaintext, "utf-8"), cipher.final()]);
|
|
5316
|
-
const authTag = cipher.getAuthTag();
|
|
5317
|
-
return {
|
|
5318
|
-
encrypted: Buffer.concat([ciphertext, authTag]).toString("base64"),
|
|
5319
|
-
iv: iv.toString("hex"),
|
|
5320
|
-
masterKey: masterKey.toString("hex")
|
|
5321
|
-
};
|
|
5322
|
-
}
|
|
5323
|
-
/**
|
|
5324
|
-
* Generate the define options for tsdown/esbuild.
|
|
5325
|
-
* These will be injected at build time.
|
|
5326
|
-
*/
|
|
5327
|
-
function generateDefineOptions(payload) {
|
|
5328
|
-
return {
|
|
5329
|
-
__GKM_ENCRYPTED_CREDENTIALS__: JSON.stringify(payload.encrypted),
|
|
5330
|
-
__GKM_CREDENTIALS_IV__: JSON.stringify(payload.iv)
|
|
5331
|
-
};
|
|
5332
|
-
}
|
|
5333
|
-
/**
|
|
5334
|
-
* A short, one-way name for a master key: the first 8 hex characters of its
|
|
5335
|
-
* SHA-256.
|
|
5336
|
-
*
|
|
5337
|
-
* Printed where the key itself used to be, so a person can tell which key a
|
|
5338
|
-
* build used — and match it against the one they hold — without the output
|
|
5339
|
-
* carrying a value that decrypts every secret of the stage.
|
|
5340
|
-
*/
|
|
5341
|
-
function keyFingerprint(masterKey) {
|
|
5342
|
-
return (0, node_crypto.createHash)("sha256").update(masterKey).digest("hex").slice(0, 8);
|
|
5343
|
-
}
|
|
5344
|
-
//#endregion
|
|
5345
5295
|
//#region src/build/workers.ts
|
|
5346
5296
|
/** A worker with background work and no backend app to build it from. */
|
|
5347
5297
|
var WorkerHasNoApp = class extends Error {
|
|
@@ -5829,7 +5779,7 @@ function validateImageRef(ref) {
|
|
|
5829
5779
|
}
|
|
5830
5780
|
//#endregion
|
|
5831
5781
|
//#region src/docker/index.ts
|
|
5832
|
-
const logger
|
|
5782
|
+
const logger = require_discover.output;
|
|
5833
5783
|
/** `docker build` failed; what docker printed above says why. */
|
|
5834
5784
|
var DockerBuildFailed = class extends Error {
|
|
5835
5785
|
imageRef;
|
|
@@ -5880,7 +5830,7 @@ async function buildDockerImage(app, buildRoot, options) {
|
|
|
5880
5830
|
const tag = options.tag ?? "latest";
|
|
5881
5831
|
const registry = options.registry;
|
|
5882
5832
|
const fullImageName = validateImageRef(registry ? `${registry}/${app.imageName}:${tag}` : `${app.imageName}:${tag}`);
|
|
5883
|
-
logger
|
|
5833
|
+
logger.log(`\n🐳 Building Docker image: ${fullImageName}`);
|
|
5884
5834
|
try {
|
|
5885
5835
|
await require_run.run("docker", [
|
|
5886
5836
|
"build",
|
|
@@ -5894,7 +5844,7 @@ async function buildDockerImage(app, buildRoot, options) {
|
|
|
5894
5844
|
DOCKER_BUILDKIT: "1"
|
|
5895
5845
|
}
|
|
5896
5846
|
});
|
|
5897
|
-
logger
|
|
5847
|
+
logger.log(`✅ Docker image built: ${fullImageName}`);
|
|
5898
5848
|
} catch (error) {
|
|
5899
5849
|
throw new DockerBuildFailed(fullImageName, error);
|
|
5900
5850
|
}
|
|
@@ -5907,10 +5857,10 @@ async function pushDockerImage(imageName, options, cwd) {
|
|
|
5907
5857
|
const registry = options.registry;
|
|
5908
5858
|
if (!registry) throw new PushNeedsRegistry(imageName);
|
|
5909
5859
|
const fullImageName = validateImageRef(`${registry}/${imageName}:${tag}`);
|
|
5910
|
-
logger
|
|
5860
|
+
logger.log(`\n🚀 Pushing Docker image: ${fullImageName}`);
|
|
5911
5861
|
try {
|
|
5912
5862
|
await require_run.run("docker", ["push", fullImageName], { cwd });
|
|
5913
|
-
logger
|
|
5863
|
+
logger.log(`✅ Docker image pushed: ${fullImageName}`);
|
|
5914
5864
|
} catch (error) {
|
|
5915
5865
|
throw new DockerPushFailed(fullImageName, error);
|
|
5916
5866
|
}
|
|
@@ -5922,16 +5872,16 @@ async function pushDockerImage(imageName, options, cwd) {
|
|
|
5922
5872
|
async function workspaceDockerCommand(workspace, manifest, imageNames = {}, background = {}) {
|
|
5923
5873
|
const results = [];
|
|
5924
5874
|
const layout = imageLayout(workspace);
|
|
5925
|
-
logger
|
|
5926
|
-
logger
|
|
5927
|
-
logger
|
|
5875
|
+
logger.log(`\n🐳 Generating Dockerfiles for workspace: ${workspace.name}`);
|
|
5876
|
+
logger.log(` Build root: ${layout.buildRoot}`);
|
|
5877
|
+
logger.log(` Package manager: ${layout.tools.packageManager}${layout.tools.packageManagerVersion ? `@${layout.tools.packageManagerVersion}` : ""}, turbo@${layout.tools.turboVersion}`);
|
|
5928
5878
|
for (const [appName, app] of Object.entries(workspace.apps)) {
|
|
5929
5879
|
if (app.type === "mobile") {
|
|
5930
|
-
logger
|
|
5880
|
+
logger.log(`\n 📱 Skipping Docker for ${appName} (mobile app — deploy via framework toolchain)`);
|
|
5931
5881
|
continue;
|
|
5932
5882
|
}
|
|
5933
5883
|
const buildType = app.entry ? "entry" : app.type;
|
|
5934
|
-
logger
|
|
5884
|
+
logger.log(`\n 📄 Generating Dockerfile for ${appName} (${buildType})`);
|
|
5935
5885
|
const dockerfile = appDockerfile(appName, app, {
|
|
5936
5886
|
layout,
|
|
5937
5887
|
workspaceRoot: workspace.root,
|
|
@@ -5941,7 +5891,7 @@ async function workspaceDockerCommand(workspace, manifest, imageNames = {}, back
|
|
|
5941
5891
|
const dockerfilePath = (0, node_path.join)(workspace.root, path);
|
|
5942
5892
|
await (0, node_fs_promises.mkdir)((0, node_path.dirname)(dockerfilePath), { recursive: true });
|
|
5943
5893
|
await (0, node_fs_promises.writeFile)(dockerfilePath, dockerfile);
|
|
5944
|
-
logger
|
|
5894
|
+
logger.log(` Generated: ${path}`);
|
|
5945
5895
|
results.push({
|
|
5946
5896
|
appName,
|
|
5947
5897
|
type: app.type,
|
|
@@ -5950,7 +5900,7 @@ async function workspaceDockerCommand(workspace, manifest, imageNames = {}, back
|
|
|
5950
5900
|
});
|
|
5951
5901
|
}
|
|
5952
5902
|
for (const worker of manifest ? workerUnits(workspace, manifest, background) : []) {
|
|
5953
|
-
logger
|
|
5903
|
+
logger.log(`\n 📄 Generating Dockerfile for ${worker.name} (worker ${worker.id}, built from ${worker.app})`);
|
|
5954
5904
|
const dockerfile = workerDockerfile(worker, workspace.apps[worker.app], {
|
|
5955
5905
|
layout,
|
|
5956
5906
|
workspaceRoot: workspace.root
|
|
@@ -5959,7 +5909,7 @@ async function workspaceDockerCommand(workspace, manifest, imageNames = {}, back
|
|
|
5959
5909
|
const dockerfilePath = (0, node_path.join)(workspace.root, path);
|
|
5960
5910
|
await (0, node_fs_promises.mkdir)((0, node_path.dirname)(dockerfilePath), { recursive: true });
|
|
5961
5911
|
await (0, node_fs_promises.writeFile)(dockerfilePath, dockerfile);
|
|
5962
|
-
logger
|
|
5912
|
+
logger.log(` Generated: ${path}`);
|
|
5963
5913
|
results.push({
|
|
5964
5914
|
appName: worker.name,
|
|
5965
5915
|
type: "backend",
|
|
@@ -5968,13 +5918,13 @@ async function workspaceDockerCommand(workspace, manifest, imageNames = {}, back
|
|
|
5968
5918
|
});
|
|
5969
5919
|
}
|
|
5970
5920
|
const dockerignorePath = await ensureDockerignore(layout.buildRoot);
|
|
5971
|
-
logger
|
|
5921
|
+
logger.log(`\n Ensured: ${dockerignorePath}`);
|
|
5972
5922
|
const composePath = await writeConstructsCompose(workspace);
|
|
5973
|
-
logger
|
|
5974
|
-
logger
|
|
5923
|
+
logger.log(`\n✅ Generated ${results.length} Dockerfile(s) + ${COMPOSE_PATH}`);
|
|
5924
|
+
logger.log(`\n📋 Build commands (from ${layout.buildRoot}):`);
|
|
5975
5925
|
for (const result of results) {
|
|
5976
5926
|
const icon = result.type === "backend" ? "⚙️" : result.type === "mobile" ? "📱" : "🌐";
|
|
5977
|
-
logger
|
|
5927
|
+
logger.log(` ${icon} docker build -f ${(0, node_path.relative)(layout.buildRoot, result.dockerfile)} -t ${result.imageName} .`);
|
|
5978
5928
|
}
|
|
5979
5929
|
printRunInstructions(workspace);
|
|
5980
5930
|
return {
|
|
@@ -6003,7 +5953,8 @@ function appDockerfile(appName, app, options) {
|
|
|
6003
5953
|
});
|
|
6004
5954
|
return generateBackendDockerfile({
|
|
6005
5955
|
...image,
|
|
6006
|
-
healthCheckPath: "/health"
|
|
5956
|
+
healthCheckPath: "/health",
|
|
5957
|
+
...options.cache ? { cache: options.cache } : {}
|
|
6007
5958
|
});
|
|
6008
5959
|
}
|
|
6009
5960
|
/** Where `gkm docker` writes a worker's Dockerfile. */
|
|
@@ -6021,7 +5972,8 @@ function workerDockerfile(worker, host, options) {
|
|
|
6021
5972
|
port: WORKER_PORT,
|
|
6022
5973
|
worker: worker.id,
|
|
6023
5974
|
bundle: workerBundleName(worker.id),
|
|
6024
|
-
healthCheckPath: "/health"
|
|
5975
|
+
healthCheckPath: "/health",
|
|
5976
|
+
...options.cache ? { cache: options.cache } : {}
|
|
6025
5977
|
});
|
|
6026
5978
|
}
|
|
6027
5979
|
/**
|
|
@@ -6091,199 +6043,14 @@ async function writeConstructsCompose(workspace) {
|
|
|
6091
6043
|
stage: workspace.stages.local,
|
|
6092
6044
|
start: false
|
|
6093
6045
|
});
|
|
6094
|
-
logger
|
|
6046
|
+
logger.log(` Generated: ${COMPOSE_PATH} (project root)`);
|
|
6095
6047
|
return (0, node_path.join)(workspace.root, COMPOSE_PATH);
|
|
6096
6048
|
}
|
|
6097
6049
|
function printRunInstructions(workspace) {
|
|
6098
6050
|
const project = (0, node_fs.existsSync)((0, node_path.join)(workspace.root, "docker-compose.yml")) ? " -f docker-compose.yml" : "";
|
|
6099
|
-
logger
|
|
6100
|
-
logger
|
|
6101
|
-
logger
|
|
6102
|
-
}
|
|
6103
|
-
//#endregion
|
|
6104
|
-
//#region src/deploy/docker.ts
|
|
6105
|
-
const logger = require_discover.output;
|
|
6106
|
-
/**
|
|
6107
|
-
* The id the Dockerfile templates mount the encrypted credentials under:
|
|
6108
|
-
* `RUN --mount=type=secret,id=gkm_credentials`.
|
|
6109
|
-
*/
|
|
6110
|
-
const CREDENTIALS_SECRET_ID = "gkm_credentials";
|
|
6111
|
-
/**
|
|
6112
|
-
* Get the full image reference
|
|
6113
|
-
*/
|
|
6114
|
-
function getImageRef(registry, imageName, tag) {
|
|
6115
|
-
if (registry) return `${registry}/${imageName}:${tag}`;
|
|
6116
|
-
return `${imageName}:${tag}`;
|
|
6117
|
-
}
|
|
6118
|
-
/**
|
|
6119
|
-
* The `docker build` argv for an image.
|
|
6120
|
-
*
|
|
6121
|
-
* One element per value, so nothing in a ref or a build arg is read by a
|
|
6122
|
-
* shell, and `--opt=value` rather than `--opt value`, so a value that starts
|
|
6123
|
-
* with `-` cannot be taken for one of docker's own flags.
|
|
6124
|
-
*
|
|
6125
|
-
* @internal Exported for testing
|
|
6126
|
-
*/
|
|
6127
|
-
function dockerBuildArgs(options) {
|
|
6128
|
-
const { dockerfilePath, imageRef, buildArgs = [], credentialsFile } = options;
|
|
6129
|
-
return [
|
|
6130
|
-
"build",
|
|
6131
|
-
"--platform=linux/amd64",
|
|
6132
|
-
`--file=${dockerfilePath}`,
|
|
6133
|
-
`--tag=${imageRef}`,
|
|
6134
|
-
...buildArgs.map((arg) => `--build-arg=${arg}`),
|
|
6135
|
-
...credentialsFile ? [`--secret=id=${CREDENTIALS_SECRET_ID},src=${credentialsFile}`] : [],
|
|
6136
|
-
"."
|
|
6137
|
-
];
|
|
6138
|
-
}
|
|
6139
|
-
/**
|
|
6140
|
-
* The build arg that names which credentials an image embeds: a hash of the
|
|
6141
|
-
* ciphertext, which is not a secret. A BuildKit secret is no part of the
|
|
6142
|
-
* build cache's key, so without it a rebuild with credentials encrypted under
|
|
6143
|
-
* a new key would reuse the layer that embedded the old ones.
|
|
6144
|
-
*/
|
|
6145
|
-
function credentialsBuildArg(credentials) {
|
|
6146
|
-
return `GKM_CIPHERTEXT_HASH=${(0, node_crypto.createHash)("sha256").update(`${credentials.encrypted}\n${credentials.iv}`).digest("hex").slice(0, 16)}`;
|
|
6147
|
-
}
|
|
6148
|
-
/** The secret file's content: ciphertext, then IV, one per line. */
|
|
6149
|
-
function credentialsFileContent(credentials) {
|
|
6150
|
-
return `${credentials.encrypted}\n${credentials.iv}\n`;
|
|
6151
|
-
}
|
|
6152
|
-
/**
|
|
6153
|
-
* Write the encrypted credentials where `docker build --secret` reads them.
|
|
6154
|
-
*
|
|
6155
|
-
* Two lines — ciphertext, then IV — so a template can split them with `sed`
|
|
6156
|
-
* in any base image. Owner-only, in a directory of its own, and the returned
|
|
6157
|
-
* cleanup removes both whatever the build did.
|
|
6158
|
-
*
|
|
6159
|
-
* @internal Exported for testing
|
|
6160
|
-
*/
|
|
6161
|
-
async function writeCredentialsFile(credentials) {
|
|
6162
|
-
const dir = await (0, node_fs_promises.mkdtemp)((0, node_path.join)((0, node_os.tmpdir)(), "gkm-credentials-"));
|
|
6163
|
-
const path = (0, node_path.join)(dir, CREDENTIALS_SECRET_ID);
|
|
6164
|
-
await (0, node_fs_promises.writeFile)(path, credentialsFileContent(credentials), { mode: 384 });
|
|
6165
|
-
await (0, node_fs_promises.chmod)(path, 384);
|
|
6166
|
-
return {
|
|
6167
|
-
path,
|
|
6168
|
-
cleanup: () => (0, node_fs_promises.rm)(dir, {
|
|
6169
|
-
recursive: true,
|
|
6170
|
-
force: true
|
|
6171
|
-
})
|
|
6172
|
-
};
|
|
6173
|
-
}
|
|
6174
|
-
/**
|
|
6175
|
-
* Build Docker image
|
|
6176
|
-
* @param imageRef - Full image reference (registry/name:tag)
|
|
6177
|
-
* @param buildArgs - Build arguments to pass to docker build
|
|
6178
|
-
* @param credentials - Encrypted credentials, passed as a build secret
|
|
6179
|
-
*/
|
|
6180
|
-
async function buildImage(imageRef, buildArgs, credentials, { cwd, dockerfile, signal, stdio }) {
|
|
6181
|
-
logger.log(`\n🔨 Building Docker image: ${imageRef}`);
|
|
6182
|
-
logger.log(" Generating Dockerfile...");
|
|
6183
|
-
const { buildRoot } = await dockerCommand({ cwd });
|
|
6184
|
-
const dockerfilePath = (0, node_path.relative)(buildRoot, dockerfile);
|
|
6185
|
-
const secret = credentials ? await writeCredentialsFile(credentials) : void 0;
|
|
6186
|
-
try {
|
|
6187
|
-
await require_run.run("docker", dockerBuildArgs({
|
|
6188
|
-
dockerfilePath,
|
|
6189
|
-
imageRef,
|
|
6190
|
-
buildArgs: [...buildArgs ?? [], ...credentials ? [credentialsBuildArg(credentials)] : []],
|
|
6191
|
-
credentialsFile: secret?.path
|
|
6192
|
-
}), {
|
|
6193
|
-
cwd: buildRoot,
|
|
6194
|
-
env: {
|
|
6195
|
-
...process.env,
|
|
6196
|
-
DOCKER_BUILDKIT: "1"
|
|
6197
|
-
},
|
|
6198
|
-
...signal ? { signal } : {},
|
|
6199
|
-
...stdio ? { stdio } : {}
|
|
6200
|
-
});
|
|
6201
|
-
logger.log(`✅ Image built: ${imageRef}`);
|
|
6202
|
-
} catch (error) {
|
|
6203
|
-
throw new DockerBuildFailed(imageRef, error);
|
|
6204
|
-
} finally {
|
|
6205
|
-
await secret?.cleanup();
|
|
6206
|
-
}
|
|
6207
|
-
}
|
|
6208
|
-
/**
|
|
6209
|
-
* Push Docker image to registry
|
|
6210
|
-
*/
|
|
6211
|
-
async function pushImage(imageRef, { cwd, signal, stdio }) {
|
|
6212
|
-
logger.log(`\n☁️ Pushing image: ${imageRef}`);
|
|
6213
|
-
try {
|
|
6214
|
-
await require_run.run("docker", ["push", imageRef], {
|
|
6215
|
-
cwd,
|
|
6216
|
-
...signal ? { signal } : {},
|
|
6217
|
-
...stdio ? { stdio } : {}
|
|
6218
|
-
});
|
|
6219
|
-
logger.log(`✅ Image pushed: ${imageRef}`);
|
|
6220
|
-
} catch (error) {
|
|
6221
|
-
throw new DockerPushFailed(imageRef, error);
|
|
6222
|
-
}
|
|
6223
|
-
}
|
|
6224
|
-
/**
|
|
6225
|
-
* The digest the registry gave a pushed image, `sha256:…`.
|
|
6226
|
-
*
|
|
6227
|
-
* A tag can be pushed over — by the next deploy, or by anything else that
|
|
6228
|
-
* shares the repository — and the digest is what says which image a stage
|
|
6229
|
-
* actually ran. `RepoDigests` has one entry per repository the image was
|
|
6230
|
-
* pushed to, so the one for this ref's repository is picked by name.
|
|
6231
|
-
*
|
|
6232
|
-
* @internal Exported for testing
|
|
6233
|
-
*/
|
|
6234
|
-
async function pushedDigest(imageRef, { cwd, signal } = { cwd: process.cwd() }) {
|
|
6235
|
-
const repository = imageRef.split("@")[0].replace(/:[\w][\w.-]*$/, "");
|
|
6236
|
-
const output = await require_run.runOutput("docker", [
|
|
6237
|
-
"image",
|
|
6238
|
-
"inspect",
|
|
6239
|
-
"--format={{json .RepoDigests}}",
|
|
6240
|
-
imageRef
|
|
6241
|
-
], {
|
|
6242
|
-
cwd,
|
|
6243
|
-
...signal ? { signal } : {}
|
|
6244
|
-
});
|
|
6245
|
-
let digests;
|
|
6246
|
-
try {
|
|
6247
|
-
digests = JSON.parse(output.trim() || "[]");
|
|
6248
|
-
} catch {
|
|
6249
|
-
return;
|
|
6250
|
-
}
|
|
6251
|
-
if (!Array.isArray(digests)) return void 0;
|
|
6252
|
-
return digests.find((entry) => typeof entry === "string" && entry.startsWith(`${repository}@`))?.slice(repository.length + 1);
|
|
6253
|
-
}
|
|
6254
|
-
/**
|
|
6255
|
-
* Deploy using Docker (build and optionally push image)
|
|
6256
|
-
*/
|
|
6257
|
-
async function deployDocker(options) {
|
|
6258
|
-
const { stage, tag, skipPush, masterKey, config, buildArgs, credentials } = options;
|
|
6259
|
-
const imageName = config.imageName;
|
|
6260
|
-
const imageRef = validateImageRef(getImageRef(config.registry, imageName, tag));
|
|
6261
|
-
const cwd = options.cwd ?? process.cwd();
|
|
6262
|
-
const docker = {
|
|
6263
|
-
cwd,
|
|
6264
|
-
dockerfile: (0, node_path.join)(cwd, options.dockerfile ?? dockerfileOf(config.appName ?? imageName, options.appPath ?? ".")),
|
|
6265
|
-
...options.signal ? { signal: options.signal } : {},
|
|
6266
|
-
...options.stdio ? { stdio: options.stdio } : {}
|
|
6267
|
-
};
|
|
6268
|
-
await buildImage(imageRef, buildArgs, credentials, docker);
|
|
6269
|
-
let digest;
|
|
6270
|
-
if (!skipPush) {
|
|
6271
|
-
if (!config.registry) logger.warn("\n⚠️ No registry configured. Use --skip-push or configure docker.registry in gkm.config.ts");
|
|
6272
|
-
else {
|
|
6273
|
-
await pushImage(imageRef, docker);
|
|
6274
|
-
digest = await pushedDigest(imageRef, docker);
|
|
6275
|
-
}
|
|
6276
|
-
}
|
|
6277
|
-
logger.log("\n✅ Docker deployment ready!");
|
|
6278
|
-
logger.log(`\n📋 Deployment details:`);
|
|
6279
|
-
logger.log(` Image: ${imageRef}`);
|
|
6280
|
-
logger.log(` Stage: ${stage}`);
|
|
6281
|
-
if (masterKey) logger.log(`\n🔐 Run the container with GKM_MASTER_KEY set to the key with fingerprint ${keyFingerprint(masterKey)}.`);
|
|
6282
|
-
return {
|
|
6283
|
-
imageRef,
|
|
6284
|
-
...digest ? { digest } : {},
|
|
6285
|
-
masterKey
|
|
6286
|
-
};
|
|
6051
|
+
logger.log("\n📋 Run everything (the apps sit behind the \"apps\" profile):");
|
|
6052
|
+
logger.log(" gkm setup # starts the containers and creates what they hold");
|
|
6053
|
+
logger.log(` docker compose -f ${COMPOSE_PATH}${project} --profile apps up --build`);
|
|
6287
6054
|
}
|
|
6288
6055
|
//#endregion
|
|
6289
6056
|
//#region src/deploy/generated.ts
|
|
@@ -6623,6 +6390,18 @@ Object.defineProperty(exports, "DevServicesNeedServerTarget", {
|
|
|
6623
6390
|
return DevServicesNeedServerTarget;
|
|
6624
6391
|
}
|
|
6625
6392
|
});
|
|
6393
|
+
Object.defineProperty(exports, "DockerBuildFailed", {
|
|
6394
|
+
enumerable: true,
|
|
6395
|
+
get: function() {
|
|
6396
|
+
return DockerBuildFailed;
|
|
6397
|
+
}
|
|
6398
|
+
});
|
|
6399
|
+
Object.defineProperty(exports, "DockerPushFailed", {
|
|
6400
|
+
enumerable: true,
|
|
6401
|
+
get: function() {
|
|
6402
|
+
return DockerPushFailed;
|
|
6403
|
+
}
|
|
6404
|
+
});
|
|
6626
6405
|
Object.defineProperty(exports, "ExternalServicesNotConfigured", {
|
|
6627
6406
|
enumerable: true,
|
|
6628
6407
|
get: function() {
|
|
@@ -6791,24 +6570,6 @@ Object.defineProperty(exports, "createEntryWrapper", {
|
|
|
6791
6570
|
return createEntryWrapper;
|
|
6792
6571
|
}
|
|
6793
6572
|
});
|
|
6794
|
-
Object.defineProperty(exports, "credentialsBuildArg", {
|
|
6795
|
-
enumerable: true,
|
|
6796
|
-
get: function() {
|
|
6797
|
-
return credentialsBuildArg;
|
|
6798
|
-
}
|
|
6799
|
-
});
|
|
6800
|
-
Object.defineProperty(exports, "credentialsFileContent", {
|
|
6801
|
-
enumerable: true,
|
|
6802
|
-
get: function() {
|
|
6803
|
-
return credentialsFileContent;
|
|
6804
|
-
}
|
|
6805
|
-
});
|
|
6806
|
-
Object.defineProperty(exports, "deployDocker", {
|
|
6807
|
-
enumerable: true,
|
|
6808
|
-
get: function() {
|
|
6809
|
-
return deployDocker;
|
|
6810
|
-
}
|
|
6811
|
-
});
|
|
6812
6573
|
Object.defineProperty(exports, "deployIdentity", {
|
|
6813
6574
|
enumerable: true,
|
|
6814
6575
|
get: function() {
|
|
@@ -6845,16 +6606,10 @@ Object.defineProperty(exports, "dockerCommand", {
|
|
|
6845
6606
|
return dockerCommand;
|
|
6846
6607
|
}
|
|
6847
6608
|
});
|
|
6848
|
-
Object.defineProperty(exports, "
|
|
6609
|
+
Object.defineProperty(exports, "dockerfileOf", {
|
|
6849
6610
|
enumerable: true,
|
|
6850
6611
|
get: function() {
|
|
6851
|
-
return
|
|
6852
|
-
}
|
|
6853
|
-
});
|
|
6854
|
-
Object.defineProperty(exports, "encryption_exports", {
|
|
6855
|
-
enumerable: true,
|
|
6856
|
-
get: function() {
|
|
6857
|
-
return encryption_exports;
|
|
6612
|
+
return dockerfileOf;
|
|
6858
6613
|
}
|
|
6859
6614
|
});
|
|
6860
6615
|
Object.defineProperty(exports, "ensureDockerignore", {
|
|
@@ -6989,12 +6744,6 @@ Object.defineProperty(exports, "isRemoteStore", {
|
|
|
6989
6744
|
return isRemoteStore;
|
|
6990
6745
|
}
|
|
6991
6746
|
});
|
|
6992
|
-
Object.defineProperty(exports, "keyFingerprint", {
|
|
6993
|
-
enumerable: true,
|
|
6994
|
-
get: function() {
|
|
6995
|
-
return keyFingerprint;
|
|
6996
|
-
}
|
|
6997
|
-
});
|
|
6998
6747
|
Object.defineProperty(exports, "keystoreProject", {
|
|
6999
6748
|
enumerable: true,
|
|
7000
6749
|
get: function() {
|
|
@@ -7308,4 +7057,4 @@ Object.defineProperty(exports, "workspace_exports", {
|
|
|
7308
7057
|
}
|
|
7309
7058
|
});
|
|
7310
7059
|
|
|
7311
|
-
//# sourceMappingURL=state-
|
|
7060
|
+
//# sourceMappingURL=state-kA4Fkufx.cjs.map
|