@geekmidas/cli 10.0.0-alpha.78 → 10.0.0-alpha.80
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/{add-D2XKszYP.mjs → add-CIxT-Iq6.mjs} +2 -2
- package/dist/{add-D2XKszYP.mjs.map → add-CIxT-Iq6.mjs.map} +1 -1
- package/dist/{add-BvOICikp.cjs → add-DJ0VE-y-.cjs} +7 -7
- package/dist/{add-BvOICikp.cjs.map → add-DJ0VE-y-.cjs.map} +1 -1
- package/dist/{aws-Bja4zGSs.mjs → aws-B-6uEhgP.mjs} +8 -2
- package/dist/{aws-Bja4zGSs.mjs.map → aws-B-6uEhgP.mjs.map} +1 -1
- package/dist/{aws-CQAuluiu.cjs → aws-BTawF0F-.cjs} +19 -2
- package/dist/{aws-CQAuluiu.cjs.map → aws-BTawF0F-.cjs.map} +1 -1
- package/dist/{bundler-C6T-1OLT.cjs → bundler-BlbSLFLn.cjs} +3 -3
- package/dist/{bundler-C6T-1OLT.cjs.map → bundler-BlbSLFLn.cjs.map} +1 -1
- package/dist/{bundler-CtHzKqnZ.mjs → bundler-D4pl87A5.mjs} +3 -3
- package/dist/{bundler-CtHzKqnZ.mjs.map → bundler-D4pl87A5.mjs.map} +1 -1
- package/dist/{cli-BgPyhx1i.mjs → cli-7aLfgIGt.mjs} +3 -3
- package/dist/{cli-BgPyhx1i.mjs.map → cli-7aLfgIGt.mjs.map} +1 -1
- package/dist/{cli-K6Vj_pPW.cjs → cli-BkNZBe_-.cjs} +4 -4
- package/dist/{cli-K6Vj_pPW.cjs.map → cli-BkNZBe_-.cjs.map} +1 -1
- package/dist/{compose-B7MC19eC.cjs → compose-Bn4OJONR.cjs} +88 -60
- package/dist/{compose-B7MC19eC.cjs.map → compose-Bn4OJONR.cjs.map} +1 -1
- package/dist/{compose-DByK353T.mjs → compose-n7K8H5j8.mjs} +36 -8
- package/dist/{compose-DByK353T.mjs.map → compose-n7K8H5j8.mjs.map} +1 -1
- package/dist/{config-Bql0AmJt.d.mts → config-L_6NivCp.d.mts} +3 -3
- package/dist/{config-Bql0AmJt.d.mts.map → config-L_6NivCp.d.mts.map} +1 -1
- package/dist/{config-DlNpHK8p.d.cts → config-Mr4rcXFC.d.cts} +3 -3
- package/dist/{config-DlNpHK8p.d.cts.map → config-Mr4rcXFC.d.cts.map} +1 -1
- package/dist/config.d.cts +3 -3
- package/dist/config.d.mts +3 -3
- package/dist/{databases-C2p5LGAp.cjs → databases-BY-pEImp.cjs} +185 -7
- package/dist/databases-BY-pEImp.cjs.map +1 -0
- package/dist/{databases-hUHTuwhx.mjs → databases-CzszQV0N.mjs} +153 -5
- package/dist/databases-CzszQV0N.mjs.map +1 -0
- package/dist/deploy/public.cjs +12 -11
- package/dist/deploy/public.d.cts +19 -3
- package/dist/deploy/public.d.cts.map +1 -1
- package/dist/deploy/public.d.mts +19 -3
- package/dist/deploy/public.d.mts.map +1 -1
- package/dist/deploy/public.mjs +6 -6
- package/dist/{deploy-BerP7ppB.mjs → deploy-DK4Y6ev4.mjs} +3 -3
- package/dist/{deploy-BerP7ppB.mjs.map → deploy-DK4Y6ev4.mjs.map} +1 -1
- package/dist/{deploy-Dt42xiQA.cjs → deploy-Ppnh8MHS.cjs} +9 -9
- package/dist/{deploy-Dt42xiQA.cjs.map → deploy-Ppnh8MHS.cjs.map} +1 -1
- package/dist/{dokploy-ssZQRK2C.mjs → dokploy-Bjq05wkw.mjs} +2 -2
- package/dist/{dokploy-ssZQRK2C.mjs.map → dokploy-Bjq05wkw.mjs.map} +1 -1
- package/dist/{dokploy-NG9UrVrP.cjs → dokploy-CJvdoNc3.cjs} +2 -2
- package/dist/{dokploy-NG9UrVrP.cjs.map → dokploy-CJvdoNc3.cjs.map} +1 -1
- package/dist/{encryption-De6MN0O5.mjs → encryption-BrsOJFFz.mjs} +2 -2
- package/dist/{encryption-De6MN0O5.mjs.map → encryption-BrsOJFFz.mjs.map} +1 -1
- package/dist/{encryption-CbMI24fI.cjs → encryption-CAyR6D7B.cjs} +5 -5
- package/dist/{encryption-CbMI24fI.cjs.map → encryption-CAyR6D7B.cjs.map} +1 -1
- package/dist/{engine-CoCsNoW_.cjs → engine-DzBZR5D0.cjs} +118 -82
- package/dist/engine-DzBZR5D0.cjs.map +1 -0
- package/dist/{engine-DOjGIgl4.mjs → engine-ba9CvjTo.mjs} +53 -17
- package/dist/engine-ba9CvjTo.mjs.map +1 -0
- package/dist/github-BLjU59Ye.cjs +669 -0
- package/dist/github-BLjU59Ye.cjs.map +1 -0
- package/dist/github-CVdbVlT5.mjs +669 -0
- package/dist/github-CVdbVlT5.mjs.map +1 -0
- package/dist/{index-BXO0vlme.d.mts → index-C0UmP_lg.d.mts} +2 -2
- package/dist/{index-BXO0vlme.d.mts.map → index-C0UmP_lg.d.mts.map} +1 -1
- package/dist/{index-Rs0Fua-q.d.cts → index-DTEPwLml.d.cts} +2 -2
- package/dist/{index-Rs0Fua-q.d.cts.map → index-DTEPwLml.d.cts.map} +1 -1
- package/dist/index.cjs +114 -114
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +41 -41
- package/dist/index.mjs.map +1 -1
- package/dist/{migrate-Cgoy58Sh.cjs → migrate-DkB833Jj.cjs} +8 -9
- package/dist/{migrate-Cgoy58Sh.cjs.map → migrate-DkB833Jj.cjs.map} +1 -1
- package/dist/{migrate-CNKaQl3K.mjs → migrate-DlBgATa-.mjs} +3 -4
- package/dist/{migrate-CNKaQl3K.mjs.map → migrate-DlBgATa-.mjs.map} +1 -1
- package/dist/{migrate-B4GBvCNY.cjs → migrate-iEdyEx4S.cjs} +4 -4
- package/dist/{migrate-B4GBvCNY.cjs.map → migrate-iEdyEx4S.cjs.map} +1 -1
- package/dist/{migrate-BQ4wVKq_.mjs → migrate-pfu4aYzX.mjs} +2 -2
- package/dist/{migrate-BQ4wVKq_.mjs.map → migrate-pfu4aYzX.mjs.map} +1 -1
- package/dist/openapi.d.cts +1 -1
- package/dist/openapi.d.mts +1 -1
- package/dist/reconcile/public.d.cts +1 -1
- package/dist/reconcile/public.d.mts +1 -1
- package/dist/{resolve-CEaqRBzY.cjs → resolve-4_5N67Fk.cjs} +3 -3
- package/dist/{resolve-CEaqRBzY.cjs.map → resolve-4_5N67Fk.cjs.map} +1 -1
- package/dist/{resolve-mvaystiE.mjs → resolve-CQPn66jr.mjs} +3 -3
- package/dist/{resolve-mvaystiE.mjs.map → resolve-CQPn66jr.mjs.map} +1 -1
- package/dist/{rollback-S2C-Y9pB.mjs → rollback-C0cbdsM-.mjs} +3 -3
- package/dist/{rollback-S2C-Y9pB.mjs.map → rollback-C0cbdsM-.mjs.map} +1 -1
- package/dist/{rollback-F3P-rA-r.cjs → rollback-CgYUPLbq.cjs} +5 -5
- package/dist/{rollback-F3P-rA-r.cjs.map → rollback-CgYUPLbq.cjs.map} +1 -1
- package/dist/{runtime-D9AxGzrw.d.cts → runtime-D6A-C6zh.d.cts} +2 -2
- package/dist/{runtime-D9AxGzrw.d.cts.map → runtime-D6A-C6zh.d.cts.map} +1 -1
- package/dist/{runtime-Dflki3Vs.d.mts → runtime-ekxfPNM-.d.mts} +2 -2
- package/dist/{runtime-Dflki3Vs.d.mts.map → runtime-ekxfPNM-.d.mts.map} +1 -1
- package/dist/sandbox/migrate-worker.cjs +22 -8
- package/dist/sandbox/migrate-worker.cjs.map +1 -1
- package/dist/sandbox/migrate-worker.mjs +22 -8
- package/dist/sandbox/migrate-worker.mjs.map +1 -1
- package/dist/{secretsManager-Ti0oZwsS.mjs → secretsManager-Chs9VV2r.mjs} +8 -2
- package/dist/{secretsManager-Ti0oZwsS.mjs.map → secretsManager-Chs9VV2r.mjs.map} +1 -1
- package/dist/{secretsManager-DUXW3fQt.cjs → secretsManager-DcMlHnRC.cjs} +19 -2
- package/dist/{secretsManager-DUXW3fQt.cjs.map → secretsManager-DcMlHnRC.cjs.map} +1 -1
- package/dist/{stale-C5FqIVc8.mjs → seeds-BdkFpW0P.mjs} +64 -6
- package/dist/seeds-BdkFpW0P.mjs.map +1 -0
- package/dist/{stale-BsiPJI7Y.cjs → seeds-ZljwYV_p.cjs} +81 -5
- package/dist/seeds-ZljwYV_p.cjs.map +1 -0
- package/dist/sniffer-BjG-1mlD.cjs.map +1 -1
- package/dist/sniffer-ByWtH28i.mjs.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/{types-DKxkXsKC.d.mts → types-BzCavjGt.d.mts} +29 -2
- package/dist/types-BzCavjGt.d.mts.map +1 -0
- package/dist/{types-ByY0zi3n.d.cts → types-DZtj9jeI.d.cts} +29 -2
- package/dist/types-DZtj9jeI.d.cts.map +1 -0
- package/dist/workspace/index.d.cts +2 -2
- package/dist/workspace/index.d.mts +2 -2
- package/package.json +15 -15
- package/dist/databases-C2p5LGAp.cjs.map +0 -1
- package/dist/databases-hUHTuwhx.mjs.map +0 -1
- package/dist/engine-CoCsNoW_.cjs.map +0 -1
- package/dist/engine-DOjGIgl4.mjs.map +0 -1
- package/dist/github-CwX9z89E.mjs +0 -213
- package/dist/github-CwX9z89E.mjs.map +0 -1
- package/dist/github-D9vGqdLk.cjs +0 -213
- package/dist/github-D9vGqdLk.cjs.map +0 -1
- package/dist/provider-B3Sv_a74.cjs +0 -173
- package/dist/provider-B3Sv_a74.cjs.map +0 -1
- package/dist/provider-D7rQzzzf.mjs +0 -138
- package/dist/provider-D7rQzzzf.mjs.map +0 -1
- package/dist/stale-BsiPJI7Y.cjs.map +0 -1
- package/dist/stale-C5FqIVc8.mjs.map +0 -1
- package/dist/types-ByY0zi3n.d.cts.map +0 -1
- package/dist/types-DKxkXsKC.d.mts.map +0 -1
|
@@ -4,10 +4,10 @@ const require_discover = require("./discover-D1It5r_h.cjs");
|
|
|
4
4
|
const require_derive = require("./derive-DAbo49sm.cjs");
|
|
5
5
|
const require_workspace = require("./workspace-Bp8FEkF-.cjs");
|
|
6
6
|
const require_define = require("./define-DzRz8FgH.cjs");
|
|
7
|
-
const
|
|
7
|
+
const require_seeds = require("./seeds-ZljwYV_p.cjs");
|
|
8
8
|
const require_SubscriberGenerator = require("./SubscriberGenerator-CajwOa5W.cjs");
|
|
9
9
|
const require_drivers = require("./drivers-BdvtCKc7.cjs");
|
|
10
|
-
const require_databases = require("./databases-
|
|
10
|
+
const require_databases = require("./databases-BY-pEImp.cjs");
|
|
11
11
|
const require_credentialSchemas = require("./credentialSchemas-DCR4Wd1W.cjs");
|
|
12
12
|
let node_path = require("node:path");
|
|
13
13
|
let node_fs = require("node:fs");
|
|
@@ -898,9 +898,9 @@ function otlpHeaders(email, password) {
|
|
|
898
898
|
/** The stack's OpenObserve for one stage. */
|
|
899
899
|
function stackLogs(options) {
|
|
900
900
|
const { config, stage, local, custom } = options;
|
|
901
|
-
const conflicting = Object.keys(custom).filter(
|
|
901
|
+
const conflicting = Object.keys(custom).filter(require_seeds.isOtlpDestination).sort();
|
|
902
902
|
if (conflicting.length > 0) throw new LogsEndpointConflict(stage, conflicting);
|
|
903
|
-
if (!local && !options.domain) throw new
|
|
903
|
+
if (!local && !options.domain) throw new require_seeds.NoDomainForStage(stage);
|
|
904
904
|
const email = custom["ZO_ROOT_USER_EMAIL"] ?? (local ? "admin@gkm.localhost" : `admin@${options.domain}`);
|
|
905
905
|
const set = custom[LOGS_PASSWORD_KEY];
|
|
906
906
|
if (!set && !local) throw new LogsPasswordMissing(stage);
|
|
@@ -998,7 +998,7 @@ const REDIS_SERVICE = "redis";
|
|
|
998
998
|
/** The port it answers on, inside the network. */
|
|
999
999
|
const REDIS_PORT = 6379;
|
|
1000
1000
|
/** Reconcile's pin, so `gkm dev` and the stack run one Redis. */
|
|
1001
|
-
const REDIS_IMAGE =
|
|
1001
|
+
const REDIS_IMAGE = require_seeds.DEFAULT_IMAGES.redis;
|
|
1002
1002
|
/**
|
|
1003
1003
|
* How much it may hold before it evicts. A cache that grows until the box
|
|
1004
1004
|
* runs out of memory takes the apps with it; 256 MB is a lot of sessions and
|
|
@@ -1321,7 +1321,7 @@ function composeStack(input) {
|
|
|
1321
1321
|
const http = input.ports?.http ?? 80;
|
|
1322
1322
|
const proxy = require_workspace.proxyFor(workspace.deploy?.compose, stage, local);
|
|
1323
1323
|
const certificate = local ? void 0 : require_workspace.certificateFor(workspace.deploy?.compose, stage, workspace.root);
|
|
1324
|
-
const plan =
|
|
1324
|
+
const plan = require_seeds.planFor(manifest, stage, (0, _geekmidas_manifest.provisionOrder)(manifest), {
|
|
1325
1325
|
localStage: workspace.stages.local,
|
|
1326
1326
|
events: require_SubscriberGenerator.DEFAULT_EVENTS.server,
|
|
1327
1327
|
cache: STACK_CACHE,
|
|
@@ -1331,7 +1331,7 @@ function composeStack(input) {
|
|
|
1331
1331
|
const seed = local ? void 0 : input.secrets?.seed;
|
|
1332
1332
|
if (!local && !seed) throw new StageSeedMissing(stage);
|
|
1333
1333
|
const credential = {
|
|
1334
|
-
master: local ? "geekmidas" :
|
|
1334
|
+
master: local ? "geekmidas" : require_seeds.localRolePassword(workspace.name, plan, "master", seed),
|
|
1335
1335
|
...seed ? { seed } : {}
|
|
1336
1336
|
};
|
|
1337
1337
|
const apps = stackApps(workspace, manifest, plan, {
|
|
@@ -1341,7 +1341,7 @@ function composeStack(input) {
|
|
|
1341
1341
|
identity,
|
|
1342
1342
|
images: input.images
|
|
1343
1343
|
});
|
|
1344
|
-
const workers = stackWorkers(
|
|
1344
|
+
const workers = stackWorkers(require_seeds.workerUnits(workspace, manifest, input.background ?? {}), {
|
|
1345
1345
|
stage,
|
|
1346
1346
|
identity,
|
|
1347
1347
|
images: input.images
|
|
@@ -1359,9 +1359,9 @@ function composeStack(input) {
|
|
|
1359
1359
|
const reads = /* @__PURE__ */ new Map();
|
|
1360
1360
|
for (const app of apps) {
|
|
1361
1361
|
const site = manifest[app.id];
|
|
1362
|
-
reads.set(app.name, site?.kind === "site" ? Object.values((0, _geekmidas_manifest.publicEnvFor)(site, manifest)) : [...
|
|
1362
|
+
reads.set(app.name, site?.kind === "site" ? Object.values((0, _geekmidas_manifest.publicEnvFor)(site, manifest)) : [...require_seeds.appEnvKeys(manifest, app.name, input.runnables) ?? []]);
|
|
1363
1363
|
}
|
|
1364
|
-
for (const worker of workers) reads.set(worker.name, [...
|
|
1364
|
+
for (const worker of workers) reads.set(worker.name, [...require_seeds.workerEnvKeys(manifest, worker.id, input.runnables) ?? []]);
|
|
1365
1365
|
const domain = workspace.deploy?.domains?.[stage];
|
|
1366
1366
|
const logsConfig = require_workspace.resolveLogs(workspace.deploy?.compose?.logs);
|
|
1367
1367
|
const logsBase = logsConfig ? stackLogs({
|
|
@@ -1377,7 +1377,7 @@ function composeStack(input) {
|
|
|
1377
1377
|
missing: [],
|
|
1378
1378
|
minio: plan.resources.filter((r) => r.kind === "objects").map((r) => r.id),
|
|
1379
1379
|
mailpit: plan.resources.filter((r) => r.kind === "email").map((r) => r.id)
|
|
1380
|
-
} :
|
|
1380
|
+
} : require_seeds.assertExternalServices({
|
|
1381
1381
|
stage,
|
|
1382
1382
|
declarations: serviceDeclarations(plan, reads, owners),
|
|
1383
1383
|
supplied: custom,
|
|
@@ -1395,9 +1395,9 @@ function composeStack(input) {
|
|
|
1395
1395
|
const buckets = services.minio.map((id) => byId.get(id)?.name).filter((name) => Boolean(name)).sort();
|
|
1396
1396
|
return {
|
|
1397
1397
|
user: custom.AWS_ACCESS_KEY_ID ?? (local ? "geekmidas" : `${workspace.name}-minio`),
|
|
1398
|
-
password: custom.AWS_SECRET_ACCESS_KEY ?? (local ? "geekmidas" :
|
|
1398
|
+
password: custom.AWS_SECRET_ACCESS_KEY ?? (local ? "geekmidas" : require_seeds.localRolePassword(workspace.name, plan, "minio", seed)),
|
|
1399
1399
|
buckets,
|
|
1400
|
-
policies:
|
|
1400
|
+
policies: require_seeds.bucketPolicies(plan).filter((p) => buckets.includes(p.bucket))
|
|
1401
1401
|
};
|
|
1402
1402
|
})() : void 0;
|
|
1403
1403
|
const fileServers = /* @__PURE__ */ new Map();
|
|
@@ -1408,9 +1408,9 @@ function composeStack(input) {
|
|
|
1408
1408
|
const bucket = byId.get(resource.of);
|
|
1409
1409
|
if (!bucket) continue;
|
|
1410
1410
|
let host;
|
|
1411
|
-
if (local) host =
|
|
1411
|
+
if (local) host = require_seeds.hostFor(resource, workspace.name);
|
|
1412
1412
|
else {
|
|
1413
|
-
if (!domain) throw new
|
|
1413
|
+
if (!domain) throw new require_seeds.NoDomainForStage(stage);
|
|
1414
1414
|
host = `${resource.subdomain ?? require_derive.appKey(resource.id)}.${domain}`;
|
|
1415
1415
|
}
|
|
1416
1416
|
fileServers.set(resource.id, {
|
|
@@ -1446,11 +1446,11 @@ function composeStack(input) {
|
|
|
1446
1446
|
...credential.seed ? { seed: credential.seed } : {},
|
|
1447
1447
|
...!local && domain ? { mailFrom: `noreply@${domain}` } : {}
|
|
1448
1448
|
};
|
|
1449
|
-
const outside =
|
|
1449
|
+
const outside = require_seeds.networkEnv(plan, {
|
|
1450
1450
|
...derivation,
|
|
1451
1451
|
addresses: Object.fromEntries(apps.map((app) => [app.id, app.url]))
|
|
1452
1452
|
}, hostOf);
|
|
1453
|
-
const inside =
|
|
1453
|
+
const inside = require_seeds.networkEnv(plan, {
|
|
1454
1454
|
...derivation,
|
|
1455
1455
|
addresses: Object.fromEntries(apps.map((app) => [app.id, `http://${hostOf(app.name)}:${app.port}`]))
|
|
1456
1456
|
}, hostOf);
|
|
@@ -1466,7 +1466,7 @@ function composeStack(input) {
|
|
|
1466
1466
|
if (owner.kind === "file-server") return fileServers.get(owner.id)?.url;
|
|
1467
1467
|
return outside[key];
|
|
1468
1468
|
}
|
|
1469
|
-
if (owner &&
|
|
1469
|
+
if (owner && require_seeds.suppliedOnly(owner.kind, owner.id, key, local)) {
|
|
1470
1470
|
const value = custom[key];
|
|
1471
1471
|
if (value === void 0) throw new StageSecretMissing(app.name, key, stage);
|
|
1472
1472
|
return value;
|
|
@@ -1506,7 +1506,7 @@ function composeStack(input) {
|
|
|
1506
1506
|
continue;
|
|
1507
1507
|
}
|
|
1508
1508
|
if (input.buildOnly) continue;
|
|
1509
|
-
const keys =
|
|
1509
|
+
const keys = require_seeds.appEnvKeys(manifest, app.name, input.runnables) ?? /* @__PURE__ */ new Set();
|
|
1510
1510
|
const values = valuesFor(app, keys);
|
|
1511
1511
|
const trusted = (0, _geekmidas_manifest.provideKey)(app.id, "trustedOrigins");
|
|
1512
1512
|
if (keys.has(trusted)) {
|
|
@@ -1516,7 +1516,7 @@ function composeStack(input) {
|
|
|
1516
1516
|
}
|
|
1517
1517
|
app.env = {
|
|
1518
1518
|
...values,
|
|
1519
|
-
...
|
|
1519
|
+
...require_seeds.otelEnv({
|
|
1520
1520
|
...custom,
|
|
1521
1521
|
...logs?.appEnv
|
|
1522
1522
|
}, app.name),
|
|
@@ -1527,14 +1527,14 @@ function composeStack(input) {
|
|
|
1527
1527
|
for (const [key, value] of Object.entries(app.env)) if (/[\r\n]/.test(value)) throw new EnvValueMultiline(app.name, key);
|
|
1528
1528
|
}
|
|
1529
1529
|
for (const worker of input.buildOnly ? [] : workers) {
|
|
1530
|
-
const keys =
|
|
1530
|
+
const keys = require_seeds.workerEnvKeys(manifest, worker.id, input.runnables) ?? /* @__PURE__ */ new Set();
|
|
1531
1531
|
worker.env = {
|
|
1532
1532
|
...valuesFor({
|
|
1533
1533
|
name: worker.name,
|
|
1534
1534
|
id: worker.id,
|
|
1535
1535
|
kind: "rest-api"
|
|
1536
1536
|
}, keys),
|
|
1537
|
-
...
|
|
1537
|
+
...require_seeds.otelEnv({
|
|
1538
1538
|
...custom,
|
|
1539
1539
|
...logs?.appEnv
|
|
1540
1540
|
}, worker.name),
|
|
@@ -1599,7 +1599,7 @@ function composeStack(input) {
|
|
|
1599
1599
|
const dockerfiles = {};
|
|
1600
1600
|
for (const app of apps) {
|
|
1601
1601
|
if (!app.build) continue;
|
|
1602
|
-
dockerfiles[app.build.dockerfile] =
|
|
1602
|
+
dockerfiles[app.build.dockerfile] = require_seeds.appDockerfile(app.name, workspace.apps[app.name], {
|
|
1603
1603
|
layout,
|
|
1604
1604
|
workspaceRoot: workspace.root,
|
|
1605
1605
|
apps: workspace.apps,
|
|
@@ -1609,7 +1609,7 @@ function composeStack(input) {
|
|
|
1609
1609
|
}
|
|
1610
1610
|
for (const worker of workers) {
|
|
1611
1611
|
if (!worker.build) continue;
|
|
1612
|
-
dockerfiles[worker.build.dockerfile] =
|
|
1612
|
+
dockerfiles[worker.build.dockerfile] = require_seeds.workerDockerfile({
|
|
1613
1613
|
id: worker.id,
|
|
1614
1614
|
name: worker.name,
|
|
1615
1615
|
app: worker.host
|
|
@@ -1638,7 +1638,7 @@ function composeStack(input) {
|
|
|
1638
1638
|
plan,
|
|
1639
1639
|
credential,
|
|
1640
1640
|
...storage ? { storage } : {},
|
|
1641
|
-
devServices: local ? [] :
|
|
1641
|
+
devServices: local ? [] : require_seeds.devServicesUsed(services),
|
|
1642
1642
|
...logs ? { logs } : {},
|
|
1643
1643
|
...redis ? { redis } : {}
|
|
1644
1644
|
};
|
|
@@ -1699,7 +1699,7 @@ function stackApps(workspace, manifest, plan, options) {
|
|
|
1699
1699
|
if (!app || !resource || !app.port) continue;
|
|
1700
1700
|
const host = hostOf(name, app, workspace, resource, options);
|
|
1701
1701
|
const tag = declaration.kind === "site" ? siteTag(options.images.tag, options.stage) : options.images.tag;
|
|
1702
|
-
const ref =
|
|
1702
|
+
const ref = require_seeds.validateImageRef(require_seeds.imageRef(options.identity, name, options.images.registry, tag));
|
|
1703
1703
|
apps.push({
|
|
1704
1704
|
app: name,
|
|
1705
1705
|
name,
|
|
@@ -1723,8 +1723,8 @@ function stackWorkers(units, options) {
|
|
|
1723
1723
|
name: unit.name,
|
|
1724
1724
|
id: unit.id,
|
|
1725
1725
|
host: unit.app,
|
|
1726
|
-
port:
|
|
1727
|
-
ref:
|
|
1726
|
+
port: require_seeds.WORKER_PORT,
|
|
1727
|
+
ref: require_seeds.validateImageRef(require_seeds.imageRef(options.identity, unit.name, options.images.registry, options.images.tag)),
|
|
1728
1728
|
tag: options.images.tag,
|
|
1729
1729
|
...options.images.mode === "build" ? { build: { dockerfile: `${stackDir(options.stage)}/Dockerfile.${unit.name}` } } : {}
|
|
1730
1730
|
}));
|
|
@@ -1735,19 +1735,19 @@ function stackWorkers(units, options) {
|
|
|
1735
1735
|
* same rule a deploy follows — for any other.
|
|
1736
1736
|
*/
|
|
1737
1737
|
function hostOf(name, app, workspace, resource, options) {
|
|
1738
|
-
if (options.local) return
|
|
1739
|
-
return
|
|
1738
|
+
if (options.local) return require_seeds.hostFor(resource, workspace.name);
|
|
1739
|
+
return require_seeds.resolveHost(name, app, options.stage, workspace.deploy?.domains, require_seeds.isMainFrontendApp(name, app, workspace.apps));
|
|
1740
1740
|
}
|
|
1741
1741
|
/** The compose document: the infrastructure, the apps, and the edge. */
|
|
1742
1742
|
function stackFile(options) {
|
|
1743
1743
|
const { project, plan, apps } = options;
|
|
1744
1744
|
const infra = options.infra.filter((name) => name !== LOGS_SERVICE);
|
|
1745
|
-
const derived =
|
|
1745
|
+
const derived = require_seeds.composeFor({
|
|
1746
1746
|
...plan,
|
|
1747
1747
|
containers: [...infra]
|
|
1748
1748
|
}, {
|
|
1749
1749
|
project,
|
|
1750
|
-
ports: Object.fromEntries(
|
|
1750
|
+
ports: Object.fromEntries(require_seeds.portKeys(infra, plan.fakes).map((key) => [key, 0]))
|
|
1751
1751
|
});
|
|
1752
1752
|
const services = {};
|
|
1753
1753
|
const volumes = {
|
|
@@ -1787,7 +1787,7 @@ function stackFile(options) {
|
|
|
1787
1787
|
for (const app of apps) services[app.name] = {
|
|
1788
1788
|
image: app.ref,
|
|
1789
1789
|
...app.build ? { build: {
|
|
1790
|
-
...
|
|
1790
|
+
...require_seeds.composeBuildPaths({
|
|
1791
1791
|
composeDir: options.composeDir,
|
|
1792
1792
|
buildRoot: options.buildRoot,
|
|
1793
1793
|
workspaceRoot: options.workspaceRoot,
|
|
@@ -1807,7 +1807,7 @@ function stackFile(options) {
|
|
|
1807
1807
|
};
|
|
1808
1808
|
for (const worker of options.workers) services[worker.name] = {
|
|
1809
1809
|
image: worker.ref,
|
|
1810
|
-
...worker.build ? { build:
|
|
1810
|
+
...worker.build ? { build: require_seeds.composeBuildPaths({
|
|
1811
1811
|
composeDir: options.composeDir,
|
|
1812
1812
|
buildRoot: options.buildRoot,
|
|
1813
1813
|
workspaceRoot: options.workspaceRoot,
|
|
@@ -1822,7 +1822,7 @@ function stackFile(options) {
|
|
|
1822
1822
|
healthcheck: probe(worker.port, "/health")
|
|
1823
1823
|
};
|
|
1824
1824
|
if (options.proxy === "caddy") services.caddy = {
|
|
1825
|
-
image:
|
|
1825
|
+
image: require_seeds.DEFAULT_IMAGES.caddy,
|
|
1826
1826
|
restart: "unless-stopped",
|
|
1827
1827
|
ports: [`${options.https}:443`, `${options.http}:80`],
|
|
1828
1828
|
volumes: [
|
|
@@ -1878,7 +1878,7 @@ function defaultLayout(root) {
|
|
|
1878
1878
|
gkmRoot: ".",
|
|
1879
1879
|
tools: {
|
|
1880
1880
|
packageManager: "pnpm",
|
|
1881
|
-
turboVersion:
|
|
1881
|
+
turboVersion: require_seeds.TURBO_VERSION,
|
|
1882
1882
|
monorepo: true
|
|
1883
1883
|
},
|
|
1884
1884
|
gkmPaths: ["gkm.config.*"]
|
|
@@ -1965,8 +1965,9 @@ var ComposeAppsUnhealthy = class extends Error {
|
|
|
1965
1965
|
* is asked of the registry first; one missing image stops the run naming
|
|
1966
1966
|
* them all, and nothing is written, pulled or started.
|
|
1967
1967
|
* - The databases exist before the apps do (`provision`). Postgres comes up
|
|
1968
|
-
* alone, its databases, roles and grants are created
|
|
1969
|
-
* applied from this machine, and only then do the apps
|
|
1968
|
+
* alone, its databases, roles and grants are created, its migrations
|
|
1969
|
+
* applied and its seeds run from this machine, and only then do the apps
|
|
1970
|
+
* start — so an app
|
|
1970
1971
|
* never boots against a schema that is not there yet.
|
|
1971
1972
|
* - What a stage runs is recorded (`release`). Each app's image, the tag it
|
|
1972
1973
|
* was released under and the digest it resolved to are written to the
|
|
@@ -2061,9 +2062,10 @@ function edgePorts(env = process.env) {
|
|
|
2061
2062
|
const defaultDeps = {
|
|
2062
2063
|
docker: dockerCompose,
|
|
2063
2064
|
revision: gitRevision,
|
|
2064
|
-
sql:
|
|
2065
|
-
buckets:
|
|
2065
|
+
sql: require_seeds.pgClient,
|
|
2066
|
+
buckets: require_seeds.bucketClient,
|
|
2066
2067
|
migrate: require_databases.migrateDatabases,
|
|
2068
|
+
seed: require_databases.seedDatabases,
|
|
2067
2069
|
probe: httpsProbe,
|
|
2068
2070
|
healthAttempts: 90,
|
|
2069
2071
|
healthIntervalMs: 2e3,
|
|
@@ -2082,31 +2084,31 @@ async function validateCompose(ctx, deps, options = {}) {
|
|
|
2082
2084
|
if (push && mode !== "build") throw new ComposePushNeedsBuild();
|
|
2083
2085
|
if (options.pin && mode !== "pull") throw new ComposePinNeedsPull();
|
|
2084
2086
|
const registry = workspace.deploy?.registry;
|
|
2085
|
-
if (!registry && (push || mode === "pull")) throw new RegistryRequired(push ? "push" : "pull",
|
|
2087
|
+
if (!registry && (push || mode === "pull")) throw new RegistryRequired(push ? "push" : "pull", require_seeds.imageRef(identity, ctx.apps[0] ?? workspace.name, void 0, tag));
|
|
2086
2088
|
const runnables = {};
|
|
2087
2089
|
const background = {};
|
|
2088
2090
|
const manifest = await require_discover.discover({
|
|
2089
|
-
patterns:
|
|
2091
|
+
patterns: require_seeds.constructGlobs(workspace),
|
|
2090
2092
|
cwd: root,
|
|
2091
2093
|
runnables,
|
|
2092
2094
|
background
|
|
2093
2095
|
});
|
|
2094
2096
|
const { secrets, generated } = await stageSecrets(ctx, manifest);
|
|
2095
2097
|
if (!push) {
|
|
2096
|
-
|
|
2098
|
+
require_seeds.assertNoStaleSecrets({
|
|
2097
2099
|
manifest,
|
|
2098
2100
|
stage,
|
|
2099
2101
|
supplied: secrets?.custom ?? {}
|
|
2100
2102
|
});
|
|
2101
2103
|
await require_credentialSchemas.assertStageCredentials({
|
|
2102
2104
|
root,
|
|
2103
|
-
patterns:
|
|
2105
|
+
patterns: require_seeds.constructGlobs(workspace),
|
|
2104
2106
|
manifest,
|
|
2105
2107
|
stage,
|
|
2106
2108
|
supplied: secrets?.custom ?? {}
|
|
2107
2109
|
});
|
|
2108
2110
|
}
|
|
2109
|
-
const layout = mode === "build" ?
|
|
2111
|
+
const layout = mode === "build" ? require_seeds.imageLayout(workspace) : void 0;
|
|
2110
2112
|
const composed = composeStack({
|
|
2111
2113
|
workspace,
|
|
2112
2114
|
manifest,
|
|
@@ -2125,7 +2127,7 @@ async function validateCompose(ctx, deps, options = {}) {
|
|
|
2125
2127
|
...layout ? { layout } : {},
|
|
2126
2128
|
...push ? { buildOnly: true } : {}
|
|
2127
2129
|
});
|
|
2128
|
-
|
|
2130
|
+
require_seeds.reportDevServices(ctx, composed.devServices);
|
|
2129
2131
|
if (mode === "build") assertRedisClient(workspace, composed);
|
|
2130
2132
|
const stack = options.pin ? withPinnedImages(composed, options.pin.file, options.pin.digests) : composed;
|
|
2131
2133
|
if (mode === "pull" && !ctx.dryRun) await assertImagesExist(deps.docker, tag, [...stack.apps, ...stack.workers]);
|
|
@@ -2205,7 +2207,7 @@ async function stageSecrets(ctx, manifest) {
|
|
|
2205
2207
|
secrets: stored,
|
|
2206
2208
|
generated: []
|
|
2207
2209
|
};
|
|
2208
|
-
const withSeed =
|
|
2210
|
+
const withSeed = require_seeds.withGeneratedSecrets(stored ?? require_seeds.initStageSecrets(ctx.stage), manifest);
|
|
2209
2211
|
const withLogs = require_workspace.resolveLogs(ctx.workspace.deploy?.compose?.logs) ? withLogsPassword(withSeed.secrets) : {
|
|
2210
2212
|
secrets: withSeed.secrets,
|
|
2211
2213
|
generated: []
|
|
@@ -2259,6 +2261,13 @@ async function planCompose(ctx, run) {
|
|
|
2259
2261
|
if (run.generated.length > 0) ctx.logger.info(`🔑 "${ctx.stage}" has no ${run.generated.join(", ")} yet; this dry run used values it did not keep.`);
|
|
2260
2262
|
run.files = await writeStack(ctx.cwd, run.dir, run.stack);
|
|
2261
2263
|
printPlan(ctx, run);
|
|
2264
|
+
if (!run.push && run.stack.infra.includes("postgres")) require_seeds.reportPlannedSeeds((await require_databases.plannedSeeds({
|
|
2265
|
+
root: ctx.workspace.root,
|
|
2266
|
+
manifest: ctx.manifest
|
|
2267
|
+
})).map(({ target, seeds }) => ({
|
|
2268
|
+
folder: target.seeds,
|
|
2269
|
+
seeds
|
|
2270
|
+
})), (line) => ctx.logger.info(line));
|
|
2262
2271
|
const planned = (change) => {
|
|
2263
2272
|
run.changes.push(change);
|
|
2264
2273
|
ctx.emit({
|
|
@@ -2370,38 +2379,57 @@ async function prepareBuckets(ctx, run, deps) {
|
|
|
2370
2379
|
if (storage.buckets.length === 0) return;
|
|
2371
2380
|
const port = await deps.docker.port(run.ref, "minio", 9e3);
|
|
2372
2381
|
const client = deps.buckets(port, storage);
|
|
2373
|
-
const created = [...await
|
|
2382
|
+
const created = [...await require_seeds.applyBuckets(client, storage.buckets), ...await require_seeds.applyPolicies(client, storage.policies)].filter((entry) => entry.created).length;
|
|
2374
2383
|
ctx.logger.info(`🪣 Buckets: ${storage.buckets.join(", ")}${created ? ` (${created} change(s))` : ""}`);
|
|
2375
2384
|
}
|
|
2376
|
-
/**
|
|
2385
|
+
/**
|
|
2386
|
+
* Create what the plan names in the stack's Postgres, migrate it, then run
|
|
2387
|
+
* its seeds — every one, every time, as each construct's owner.
|
|
2388
|
+
*/
|
|
2377
2389
|
async function prepareDatabases(ctx, run, deps) {
|
|
2378
2390
|
const { stack } = run;
|
|
2379
2391
|
const workspace = ctx.workspace;
|
|
2380
2392
|
const port = await deps.docker.port(run.ref, "postgres", 5432);
|
|
2381
|
-
const statements =
|
|
2393
|
+
const statements = require_seeds.postgresStatements(stack.plan, workspace.name, stack.credential.seed);
|
|
2382
2394
|
if (statements.length > 0) {
|
|
2383
2395
|
ctx.logger.info("🗄️ Creating databases, roles and grants…");
|
|
2384
|
-
await
|
|
2396
|
+
await require_seeds.applyPostgres(deps.sql(port, stack.credential.master), statements);
|
|
2385
2397
|
}
|
|
2386
2398
|
const sources = {};
|
|
2387
2399
|
const manifest = await require_discover.discover({
|
|
2388
|
-
patterns:
|
|
2400
|
+
patterns: require_seeds.constructGlobs(workspace),
|
|
2389
2401
|
cwd: workspace.root,
|
|
2390
2402
|
sources
|
|
2391
2403
|
});
|
|
2392
|
-
const env =
|
|
2393
|
-
ports: { [
|
|
2404
|
+
const env = require_seeds.envFor(stack.plan, {
|
|
2405
|
+
ports: { [require_seeds.primaryPortKey("postgres")]: port },
|
|
2394
2406
|
project: workspace.name,
|
|
2395
2407
|
master: stack.credential.master,
|
|
2396
2408
|
...stack.credential.seed ? { seed: stack.credential.seed } : {}
|
|
2397
2409
|
});
|
|
2398
|
-
const
|
|
2410
|
+
const options = {
|
|
2399
2411
|
root: workspace.root,
|
|
2400
2412
|
manifest,
|
|
2401
2413
|
sources,
|
|
2402
2414
|
env
|
|
2415
|
+
};
|
|
2416
|
+
const runs = await deps.migrate(options);
|
|
2417
|
+
const seeds = await deps.seed({
|
|
2418
|
+
...options,
|
|
2419
|
+
stage: ctx.stage
|
|
2420
|
+
}).catch((error) => {
|
|
2421
|
+
if (error instanceof require_databases.SeedFailed) throw new require_seeds.DeploySeedsFailed(ctx.stage, error.construct, error.seed, error);
|
|
2422
|
+
throw error;
|
|
2403
2423
|
});
|
|
2404
|
-
|
|
2424
|
+
require_seeds.reportDatabaseRuns(runs.map(({ target, applied }) => ({
|
|
2425
|
+
construct: target.id,
|
|
2426
|
+
folder: target.migrations,
|
|
2427
|
+
applied
|
|
2428
|
+
})), seeds.map(({ target, seeded }) => ({
|
|
2429
|
+
construct: target.id,
|
|
2430
|
+
folder: target.seeds,
|
|
2431
|
+
seeded
|
|
2432
|
+
})), (line) => ctx.logger.info(line), (event) => ctx.emit(event));
|
|
2405
2433
|
}
|
|
2406
2434
|
/**
|
|
2407
2435
|
* Each app's image: built from this checkout — inside Docker, every one of
|
|
@@ -2498,13 +2526,13 @@ async function releaseCompose(ctx, run, deps) {
|
|
|
2498
2526
|
* the tag resolved to.
|
|
2499
2527
|
*/
|
|
2500
2528
|
async function recordImages(ctx, run) {
|
|
2501
|
-
const journal = await
|
|
2529
|
+
const journal = await require_seeds.DeployJournal.open(ctx.state, ctx.stage, () => require_seeds.createEmptyState(ctx.stage, "", ""));
|
|
2502
2530
|
for (const app of [...run.stack.apps, ...run.stack.workers]) {
|
|
2503
2531
|
const image = run.images[app.app] ?? {
|
|
2504
2532
|
ref: app.ref,
|
|
2505
2533
|
tag: app.tag
|
|
2506
2534
|
};
|
|
2507
|
-
|
|
2535
|
+
require_seeds.recordRelease(journal.state, app.app, image);
|
|
2508
2536
|
}
|
|
2509
2537
|
journal.state.identity = ctx.identity.key;
|
|
2510
2538
|
await journal.save();
|
|
@@ -2736,7 +2764,7 @@ async function writeStack(root, dir, stack) {
|
|
|
2736
2764
|
if (stack.redis && stack.compose.services["redis"]?.env_file) await write((0, node_path.join)(dir, `${REDIS_SERVICE}.env`), envFile(stack.redis.env), 384);
|
|
2737
2765
|
for (const entry of await (0, node_fs_promises.readdir)(dir)) if (entry.endsWith(".credentials")) await (0, node_fs_promises.rm)((0, node_path.join)(dir, entry));
|
|
2738
2766
|
for (const [path, content] of Object.entries(stack.dockerfiles)) await write((0, node_path.join)(root, path), content);
|
|
2739
|
-
await
|
|
2767
|
+
await require_seeds.ensureDockerignore(require_seeds.findBuildRoot(root));
|
|
2740
2768
|
return files;
|
|
2741
2769
|
}
|
|
2742
2770
|
function composeYaml(stack) {
|
|
@@ -2905,4 +2933,4 @@ Object.defineProperty(exports, "stackOverrideFile", {
|
|
|
2905
2933
|
}
|
|
2906
2934
|
});
|
|
2907
2935
|
|
|
2908
|
-
//# sourceMappingURL=compose-
|
|
2936
|
+
//# sourceMappingURL=compose-Bn4OJONR.cjs.map
|