@geekmidas/cli 10.0.0-alpha.76 → 10.0.0-alpha.77
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-j2yI3cbS.cjs → add-DCsgtvDk.cjs} +7 -7
- package/dist/{add-j2yI3cbS.cjs.map → add-DCsgtvDk.cjs.map} +1 -1
- package/dist/{add-B7IMXzou.mjs → add-EPQO-_dt.mjs} +2 -2
- package/dist/{add-B7IMXzou.mjs.map → add-EPQO-_dt.mjs.map} +1 -1
- package/dist/{bundler-Cf6OgaOe.cjs → bundler-5spPyduN.cjs} +3 -3
- package/dist/{bundler-Cf6OgaOe.cjs.map → bundler-5spPyduN.cjs.map} +1 -1
- package/dist/{bundler-DO6bHhnb.mjs → bundler-DgO_EMVs.mjs} +3 -3
- package/dist/{bundler-DO6bHhnb.mjs.map → bundler-DgO_EMVs.mjs.map} +1 -1
- package/dist/{cli-BCPOHmg9.mjs → cli-B74Ru-V1.mjs} +3 -3
- package/dist/{cli-BCPOHmg9.mjs.map → cli-B74Ru-V1.mjs.map} +1 -1
- package/dist/{cli-CNanUB7a.cjs → cli-ZpFTMbGw.cjs} +4 -4
- package/dist/{cli-CNanUB7a.cjs.map → cli-ZpFTMbGw.cjs.map} +1 -1
- package/dist/{compose-h_6oNnHC.cjs → compose-CePlrbUw.cjs} +66 -59
- package/dist/{compose-h_6oNnHC.cjs.map → compose-CePlrbUw.cjs.map} +1 -1
- package/dist/{compose-Dq4VCtu5.mjs → compose-IUuxRW0J.mjs} +16 -9
- package/dist/{compose-Dq4VCtu5.mjs.map → compose-IUuxRW0J.mjs.map} +1 -1
- package/dist/{config-CqAvPP-f.d.mts → config-Ckmoj56i.d.mts} +3 -3
- package/dist/{config-CWyhLSY1.d.cts.map → config-Ckmoj56i.d.mts.map} +1 -1
- package/dist/{config-CWyhLSY1.d.cts → config-aAeLXH86.d.cts} +3 -3
- package/dist/{config-CqAvPP-f.d.mts.map → config-aAeLXH86.d.cts.map} +1 -1
- package/dist/config.d.cts +3 -3
- package/dist/config.d.mts +3 -3
- package/dist/deploy/public.cjs +11 -11
- package/dist/deploy/public.d.cts +3 -3
- package/dist/deploy/public.d.cts.map +1 -1
- package/dist/deploy/public.d.mts +3 -3
- package/dist/deploy/public.d.mts.map +1 -1
- package/dist/deploy/public.mjs +5 -5
- package/dist/{deploy-CVXEx7Nm.mjs → deploy-Q6X6RXRG.mjs} +3 -3
- package/dist/{deploy-CVXEx7Nm.mjs.map → deploy-Q6X6RXRG.mjs.map} +1 -1
- package/dist/{deploy-CT3R9de9.cjs → deploy-XHXi-_tL.cjs} +9 -9
- package/dist/{deploy-CT3R9de9.cjs.map → deploy-XHXi-_tL.cjs.map} +1 -1
- package/dist/{dokploy-CYm2ozFs.mjs → dokploy-BtP5XSrS.mjs} +2 -2
- package/dist/{dokploy-CYm2ozFs.mjs.map → dokploy-BtP5XSrS.mjs.map} +1 -1
- package/dist/{dokploy-eSGmlhhj.cjs → dokploy-MSsPBO-t.cjs} +2 -2
- package/dist/{dokploy-eSGmlhhj.cjs.map → dokploy-MSsPBO-t.cjs.map} +1 -1
- package/dist/{encryption-DC0rsR1W.mjs → encryption-D4Ykywfr.mjs} +2 -2
- package/dist/{encryption-DC0rsR1W.mjs.map → encryption-D4Ykywfr.mjs.map} +1 -1
- package/dist/{encryption-vS3Qzw73.cjs → encryption-DY0na43R.cjs} +5 -5
- package/dist/{encryption-vS3Qzw73.cjs.map → encryption-DY0na43R.cjs.map} +1 -1
- package/dist/{engine-BOO5TWZd.mjs → engine-BI2xjCKt.mjs} +7 -2
- package/dist/{engine-BOO5TWZd.mjs.map → engine-BI2xjCKt.mjs.map} +1 -1
- package/dist/{engine-C0N2d1i5.cjs → engine-y53kE_3H.cjs} +71 -66
- package/dist/{engine-C0N2d1i5.cjs.map → engine-y53kE_3H.cjs.map} +1 -1
- package/dist/{github-CEaFDL6t.mjs → github-BBIqk1Jv.mjs} +2 -2
- package/dist/{github-CEaFDL6t.mjs.map → github-BBIqk1Jv.mjs.map} +1 -1
- package/dist/{github-ClkdCOL9.cjs → github-Bmb45xUQ.cjs} +6 -6
- package/dist/{github-ClkdCOL9.cjs.map → github-Bmb45xUQ.cjs.map} +1 -1
- package/dist/{index-DOxmDKqv.d.mts → index-C7Tma2m1.d.cts} +2 -2
- package/dist/{index-Ccu0f_2m.d.cts.map → index-C7Tma2m1.d.cts.map} +1 -1
- package/dist/{index-Ccu0f_2m.d.cts → index-CNdSRwar.d.mts} +2 -2
- package/dist/{index-DOxmDKqv.d.mts.map → index-CNdSRwar.d.mts.map} +1 -1
- package/dist/index.cjs +175 -215
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +103 -143
- package/dist/index.mjs.map +1 -1
- package/dist/{migrate-BRbYtFXG.cjs → migrate-31JXUOaG.cjs} +4 -4
- package/dist/{migrate-BRbYtFXG.cjs.map → migrate-31JXUOaG.cjs.map} +1 -1
- package/dist/{migrate-DrO2p9Rl.mjs → migrate-BUBsUiM3.mjs} +2 -2
- package/dist/{migrate-DrO2p9Rl.mjs.map → migrate-BUBsUiM3.mjs.map} +1 -1
- package/dist/{migrate-D3NAT7Ns.mjs → migrate-DWVl5PQK.mjs} +2 -2
- package/dist/{migrate-D3NAT7Ns.mjs.map → migrate-DWVl5PQK.mjs.map} +1 -1
- package/dist/{migrate-D5_-ylI1.cjs → migrate-sny0NjKe.cjs} +7 -7
- package/dist/{migrate-D5_-ylI1.cjs.map → migrate-sny0NjKe.cjs.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-C1muFos5.mjs → resolve-BF1ICosS.mjs} +3 -3
- package/dist/{resolve-C1muFos5.mjs.map → resolve-BF1ICosS.mjs.map} +1 -1
- package/dist/{resolve-Fa1Ii0BK.cjs → resolve-DokLtTUb.cjs} +3 -3
- package/dist/{resolve-Fa1Ii0BK.cjs.map → resolve-DokLtTUb.cjs.map} +1 -1
- package/dist/{rollback-C9N5lKVf.cjs → rollback-CpOWRR9H.cjs} +5 -5
- package/dist/{rollback-C9N5lKVf.cjs.map → rollback-CpOWRR9H.cjs.map} +1 -1
- package/dist/{rollback-DeQzbRqM.mjs → rollback-sg0ZhKGG.mjs} +3 -3
- package/dist/{rollback-DeQzbRqM.mjs.map → rollback-sg0ZhKGG.mjs.map} +1 -1
- package/dist/{runtime-BSvzPqXW.d.mts → runtime-B5bYom9w.d.mts} +2 -2
- package/dist/{runtime-BSvzPqXW.d.mts.map → runtime-B5bYom9w.d.mts.map} +1 -1
- package/dist/{runtime-Cm7QA53H.d.cts → runtime-BozOkPtG.d.cts} +2 -2
- package/dist/{runtime-Cm7QA53H.d.cts.map → runtime-BozOkPtG.d.cts.map} +1 -1
- package/dist/{state-CUecOCNJ.mjs → stale-DGzpiN5S.mjs} +103 -23
- package/dist/stale-DGzpiN5S.mjs.map +1 -0
- package/dist/{state-C2qi0iQw.cjs → stale-yu2FkH3G.cjs} +108 -22
- package/dist/stale-yu2FkH3G.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-OxE0OAn2.d.mts → types-B9yWJAis.d.mts} +1 -3
- package/dist/types-B9yWJAis.d.mts.map +1 -0
- package/dist/{types-BdptGBFS.d.cts → types-ct7pdQRf.d.cts} +1 -3
- package/dist/types-ct7pdQRf.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/state-C2qi0iQw.cjs.map +0 -1
- package/dist/state-CUecOCNJ.mjs.map +0 -1
- package/dist/types-BdptGBFS.d.cts.map +0 -1
- package/dist/types-OxE0OAn2.d.mts.map +0 -1
|
@@ -5,7 +5,7 @@ const require_discover = require("./discover-D1It5r_h.cjs");
|
|
|
5
5
|
const require_sandbox = require("./sandbox-CL--ZDui.cjs");
|
|
6
6
|
const require_derive = require("./derive-DAbo49sm.cjs");
|
|
7
7
|
const require_workspace = require("./workspace-DOm81oUo.cjs");
|
|
8
|
-
const
|
|
8
|
+
const require_stale = require("./stale-yu2FkH3G.cjs");
|
|
9
9
|
const require_sniffer = require("./sniffer-Y6GQOCXB.cjs");
|
|
10
10
|
const require_provider = require("./provider-B3Sv_a74.cjs");
|
|
11
11
|
const require_credentialSchemas = require("./credentialSchemas-DCR4Wd1W.cjs");
|
|
@@ -97,7 +97,7 @@ async function writeCredentialsFile(credentials) {
|
|
|
97
97
|
async function buildImage(imageRef, buildArgs, credentials, { cwd, dockerfile, signal, stdio }) {
|
|
98
98
|
logger$3.log(`\n🔨 Building Docker image: ${imageRef}`);
|
|
99
99
|
logger$3.log(" Generating Dockerfile...");
|
|
100
|
-
const { buildRoot } = await
|
|
100
|
+
const { buildRoot } = await require_stale.dockerCommand({ cwd });
|
|
101
101
|
const dockerfilePath = (0, node_path.relative)(buildRoot, dockerfile);
|
|
102
102
|
const secret = credentials ? await writeCredentialsFile(credentials) : void 0;
|
|
103
103
|
try {
|
|
@@ -117,7 +117,7 @@ async function buildImage(imageRef, buildArgs, credentials, { cwd, dockerfile, s
|
|
|
117
117
|
});
|
|
118
118
|
logger$3.log(`✅ Image built: ${imageRef}`);
|
|
119
119
|
} catch (error) {
|
|
120
|
-
throw new
|
|
120
|
+
throw new require_stale.DockerBuildFailed(imageRef, error);
|
|
121
121
|
} finally {
|
|
122
122
|
await secret?.cleanup();
|
|
123
123
|
}
|
|
@@ -135,7 +135,7 @@ async function pushImage(imageRef, { cwd, signal, stdio }) {
|
|
|
135
135
|
});
|
|
136
136
|
logger$3.log(`✅ Image pushed: ${imageRef}`);
|
|
137
137
|
} catch (error) {
|
|
138
|
-
throw new
|
|
138
|
+
throw new require_stale.DockerPushFailed(imageRef, error);
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
/**
|
|
@@ -174,11 +174,11 @@ async function pushedDigest(imageRef, { cwd, signal } = { cwd: process.cwd() })
|
|
|
174
174
|
async function deployDocker(options) {
|
|
175
175
|
const { stage, tag, skipPush, masterKey, config, buildArgs, credentials } = options;
|
|
176
176
|
const imageName = config.imageName;
|
|
177
|
-
const imageRef =
|
|
177
|
+
const imageRef = require_stale.validateImageRef(getImageRef(config.registry, imageName, tag));
|
|
178
178
|
const cwd = options.cwd ?? process.cwd();
|
|
179
179
|
const docker = {
|
|
180
180
|
cwd,
|
|
181
|
-
dockerfile: (0, node_path.join)(cwd, options.dockerfile ??
|
|
181
|
+
dockerfile: (0, node_path.join)(cwd, options.dockerfile ?? require_stale.dockerfileOf(config.appName ?? imageName, options.appPath ?? ".")),
|
|
182
182
|
...options.signal ? { signal: options.signal } : {},
|
|
183
183
|
...options.stdio ? { stdio: options.stdio } : {}
|
|
184
184
|
};
|
|
@@ -258,12 +258,12 @@ async function projectById(api, projectId) {
|
|
|
258
258
|
* another identity's, raises `ProjectNotOwned` — it is never adopted.
|
|
259
259
|
*/
|
|
260
260
|
async function findProject(api, identity, stateProjectId) {
|
|
261
|
-
const name =
|
|
262
|
-
const marker =
|
|
261
|
+
const name = require_stale.projectName(identity);
|
|
262
|
+
const marker = require_stale.ownershipMarker(identity);
|
|
263
263
|
if (stateProjectId) {
|
|
264
264
|
const known = await projectById(api, stateProjectId);
|
|
265
265
|
if (known) {
|
|
266
|
-
const claimed =
|
|
266
|
+
const claimed = require_stale.markerOf(known.description);
|
|
267
267
|
if (claimed && claimed !== marker) throw new ProjectNotOwned(known.name, known.projectId, identity.key, claimed);
|
|
268
268
|
return {
|
|
269
269
|
projectId: known.projectId,
|
|
@@ -276,7 +276,7 @@ async function findProject(api, identity, stateProjectId) {
|
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
const projects = await api.listProjects();
|
|
279
|
-
const owned = projects.find((p) => p.name.toLowerCase() === name.toLowerCase() &&
|
|
279
|
+
const owned = projects.find((p) => p.name.toLowerCase() === name.toLowerCase() && require_stale.isOwnedBy(p.description, identity));
|
|
280
280
|
if (owned) {
|
|
281
281
|
const details = await api.getProject(owned.projectId);
|
|
282
282
|
return {
|
|
@@ -289,7 +289,7 @@ async function findProject(api, identity, stateProjectId) {
|
|
|
289
289
|
};
|
|
290
290
|
}
|
|
291
291
|
const clash = projects.find((p) => p.name.toLowerCase() === name.toLowerCase());
|
|
292
|
-
if (clash) throw new ProjectNotOwned(clash.name, clash.projectId, identity.key,
|
|
292
|
+
if (clash) throw new ProjectNotOwned(clash.name, clash.projectId, identity.key, require_stale.markerOf(clash.description));
|
|
293
293
|
return null;
|
|
294
294
|
}
|
|
295
295
|
/**
|
|
@@ -298,7 +298,7 @@ async function findProject(api, identity, stateProjectId) {
|
|
|
298
298
|
* deploy without state still finds it — or a new one, marked.
|
|
299
299
|
*/
|
|
300
300
|
async function resolveProject(api, identity, stateProjectId, log = () => {}, hooks = {}) {
|
|
301
|
-
const marker =
|
|
301
|
+
const marker = require_stale.ownershipMarker(identity);
|
|
302
302
|
const found = await findProject(api, identity, stateProjectId);
|
|
303
303
|
if (found) {
|
|
304
304
|
if (found.needsClaim) {
|
|
@@ -316,7 +316,7 @@ async function resolveProject(api, identity, stateProjectId, log = () => {}, hoo
|
|
|
316
316
|
};
|
|
317
317
|
}
|
|
318
318
|
await hooks.beforeCreate?.();
|
|
319
|
-
const created = await api.createProject(
|
|
319
|
+
const created = await api.createProject(require_stale.projectName(identity), withMarker("Deployed by gkm.", marker));
|
|
320
320
|
return {
|
|
321
321
|
projectId: created.project.projectId,
|
|
322
322
|
name: created.project.name,
|
|
@@ -427,7 +427,7 @@ async function resolveRegistry(api, options) {
|
|
|
427
427
|
* @returns Filtered secrets with found/missing tracking
|
|
428
428
|
*/
|
|
429
429
|
function filterSecretsForApp(stageSecrets, sniffedEnv) {
|
|
430
|
-
const allSecrets =
|
|
430
|
+
const allSecrets = require_stale.toEmbeddableSecrets(stageSecrets);
|
|
431
431
|
const filtered = {};
|
|
432
432
|
const found = [];
|
|
433
433
|
const missing = [];
|
|
@@ -582,7 +582,7 @@ const PROVISIONERS = {
|
|
|
582
582
|
*/
|
|
583
583
|
database: async (declaration, context) => {
|
|
584
584
|
if (declaration.kind !== "database") throw new WrongKind(declaration.kind);
|
|
585
|
-
const name =
|
|
585
|
+
const name = require_stale.resourceName(declaration.id, declaration.kind, context.stage);
|
|
586
586
|
const { postgres } = await context.api.findOrCreatePostgres(serviceName({
|
|
587
587
|
stage: context.stage,
|
|
588
588
|
app: context.scope ?? context.project
|
|
@@ -619,7 +619,7 @@ const PROVISIONERS = {
|
|
|
619
619
|
if (declaration.kind !== "database-schema") throw new WrongKind(declaration.kind);
|
|
620
620
|
const parent = context.provisioned[declaration.of];
|
|
621
621
|
if (!parent) throw new UnresolvedParent(declaration.id, declaration.of);
|
|
622
|
-
const runtime =
|
|
622
|
+
const runtime = require_stale.resourceName(declaration.id, declaration.kind, context.stage);
|
|
623
623
|
const owner = (0, _geekmidas_db_pg_roles.ownerRole)(runtime);
|
|
624
624
|
const reads = readsFrom(context.manifest, declaration.id);
|
|
625
625
|
const parentUrl = new URL(parent.provides[(0, _geekmidas_manifest.provideKey)(declaration.of, "url")] ?? "");
|
|
@@ -734,7 +734,7 @@ const PROVISIONERS = {
|
|
|
734
734
|
stage: context.stage,
|
|
735
735
|
app: context.scope ?? context.project
|
|
736
736
|
}, declaration.id);
|
|
737
|
-
const bucket =
|
|
737
|
+
const bucket = require_stale.resourceName(declaration.id, declaration.kind, context.stage);
|
|
738
738
|
const user = context.supplied?.AWS_ACCESS_KEY_ID ?? `${bucket}-root`;
|
|
739
739
|
const password = context.supplied?.AWS_SECRET_ACCESS_KEY ?? derivedPassword(context, `objects:${declaration.id}`);
|
|
740
740
|
const { compose } = await context.api.findOrCreateCompose(service, context.projectId, context.environmentId, minioCompose({
|
|
@@ -1070,7 +1070,7 @@ function mailpitCompose(service) {
|
|
|
1070
1070
|
*/
|
|
1071
1071
|
function storageKeys(values) {
|
|
1072
1072
|
const keys = {};
|
|
1073
|
-
for (const key of [...
|
|
1073
|
+
for (const key of [...require_stale.STORAGE_KEY_PAIR, "AWS_REGION"]) {
|
|
1074
1074
|
const value = values?.[key];
|
|
1075
1075
|
if (value !== void 0) keys[key] = value;
|
|
1076
1076
|
}
|
|
@@ -1081,7 +1081,7 @@ function storageKeys(values) {
|
|
|
1081
1081
|
* `validate` already refused, should a provisioner be reached without it.
|
|
1082
1082
|
*/
|
|
1083
1083
|
function notConfigured(id, kind, context) {
|
|
1084
|
-
const { missing } =
|
|
1084
|
+
const { missing } = require_stale.externalServices({
|
|
1085
1085
|
stage: context.stage,
|
|
1086
1086
|
declarations: [{
|
|
1087
1087
|
id,
|
|
@@ -1091,7 +1091,7 @@ function notConfigured(id, kind, context) {
|
|
|
1091
1091
|
allow: [],
|
|
1092
1092
|
...context.domain ? { domain: context.domain } : {}
|
|
1093
1093
|
});
|
|
1094
|
-
return new
|
|
1094
|
+
return new require_stale.ExternalServicesNotConfigured(context.stage, missing);
|
|
1095
1095
|
}
|
|
1096
1096
|
/** Whether anything reads through a reader on this construct. */
|
|
1097
1097
|
function readsFrom(manifest, id) {
|
|
@@ -1265,7 +1265,7 @@ async function provisionDeclared(options) {
|
|
|
1265
1265
|
clusters: {}
|
|
1266
1266
|
};
|
|
1267
1267
|
const manifest = options.manifest ?? await require_discover.discover({
|
|
1268
|
-
patterns:
|
|
1268
|
+
patterns: require_stale.constructGlobs(workspace),
|
|
1269
1269
|
cwd: workspace.root
|
|
1270
1270
|
});
|
|
1271
1271
|
if (Object.keys(manifest).length === 0) return empty;
|
|
@@ -1278,9 +1278,9 @@ async function provisionDeclared(options) {
|
|
|
1278
1278
|
stage: options.stage,
|
|
1279
1279
|
project: workspace.name,
|
|
1280
1280
|
scope: options.scope ?? workspace.name,
|
|
1281
|
-
cache:
|
|
1282
|
-
events:
|
|
1283
|
-
storage:
|
|
1281
|
+
cache: require_stale.cacheBackendFor(require_stale.providerOf(workspace)),
|
|
1282
|
+
events: require_stale.eventsBackendFor(require_stale.providerOf(workspace)),
|
|
1283
|
+
storage: require_stale.storageBackendFor(require_stale.providerOf(workspace)),
|
|
1284
1284
|
...options.devServices ? { devServices: options.devServices } : {},
|
|
1285
1285
|
...workspace.deploy?.domains?.[options.stage] ? { domain: workspace.deploy.domains[options.stage] } : {},
|
|
1286
1286
|
addresses: surfaceAddresses(manifest, options.appUrls),
|
|
@@ -1320,7 +1320,7 @@ async function provisionDeclared(options) {
|
|
|
1320
1320
|
* run again.
|
|
1321
1321
|
*/
|
|
1322
1322
|
async function applyDeclared(client, statements) {
|
|
1323
|
-
return (await
|
|
1323
|
+
return (await require_stale.applyPostgres(client, statements)).filter((entry) => entry.created).length;
|
|
1324
1324
|
}
|
|
1325
1325
|
/**
|
|
1326
1326
|
* The provisioning order, with queues and topics moved to the end.
|
|
@@ -1653,7 +1653,7 @@ async function orchestrateDns(appHostnames, dnsConfig, dokployEndpoint, state) {
|
|
|
1653
1653
|
hasFailures = true;
|
|
1654
1654
|
}
|
|
1655
1655
|
if (state) {
|
|
1656
|
-
for (const record of domainRecords) if (record.created || record.existed)
|
|
1656
|
+
for (const record of domainRecords) if (record.created || record.existed) require_stale.setDnsRecord(state, {
|
|
1657
1657
|
domain: rootDomain,
|
|
1658
1658
|
name: record.subdomain,
|
|
1659
1659
|
type: record.type,
|
|
@@ -1688,7 +1688,7 @@ async function verifyDnsRecords(appHostnames, serverIp, state) {
|
|
|
1688
1688
|
const results = [];
|
|
1689
1689
|
logger$2.log("\n🔍 Verifying DNS records...");
|
|
1690
1690
|
for (const [appName, hostname] of appHostnames) {
|
|
1691
|
-
if (
|
|
1691
|
+
if (require_stale.isDnsVerified(state, hostname, serverIp)) {
|
|
1692
1692
|
logger$2.log(` ✓ ${hostname} (previously verified)`);
|
|
1693
1693
|
results.push({
|
|
1694
1694
|
hostname,
|
|
@@ -1702,7 +1702,7 @@ async function verifyDnsRecords(appHostnames, serverIp, state) {
|
|
|
1702
1702
|
try {
|
|
1703
1703
|
const resolvedIp = await resolveHostnameToIp(hostname);
|
|
1704
1704
|
if (resolvedIp === serverIp) {
|
|
1705
|
-
|
|
1705
|
+
require_stale.setDnsVerification(state, hostname, serverIp);
|
|
1706
1706
|
logger$2.log(` ✓ ${hostname} → ${resolvedIp}`);
|
|
1707
1707
|
results.push({
|
|
1708
1708
|
hostname,
|
|
@@ -1763,10 +1763,10 @@ function generateSecret() {
|
|
|
1763
1763
|
* Otherwise generates a new one and stores it.
|
|
1764
1764
|
*/
|
|
1765
1765
|
function getOrGenerateSecret(state, appName, secretName) {
|
|
1766
|
-
const existing =
|
|
1766
|
+
const existing = require_stale.getGeneratedSecret(state, appName, secretName);
|
|
1767
1767
|
if (existing) return existing;
|
|
1768
1768
|
const generated = generateSecret();
|
|
1769
|
-
|
|
1769
|
+
require_stale.setGeneratedSecret(state, appName, secretName, generated);
|
|
1770
1770
|
return generated;
|
|
1771
1771
|
}
|
|
1772
1772
|
/**
|
|
@@ -2275,24 +2275,29 @@ async function validateDokploy(phase) {
|
|
|
2275
2275
|
ctx
|
|
2276
2276
|
};
|
|
2277
2277
|
const stored = await phase.secrets.read();
|
|
2278
|
-
const services =
|
|
2278
|
+
const services = require_stale.assertExternalServices({
|
|
2279
2279
|
stage,
|
|
2280
|
-
declarations:
|
|
2280
|
+
declarations: require_stale.manifestServiceDeclarations(phase.manifest),
|
|
2281
2281
|
supplied: stored?.custom ?? {},
|
|
2282
2282
|
allow: phase.allowDevServices,
|
|
2283
2283
|
...workspace.deploy?.domains?.[stage] ? { domain: workspace.deploy.domains[stage] } : {}
|
|
2284
2284
|
});
|
|
2285
|
-
|
|
2285
|
+
require_stale.reportDevServices(phase, require_stale.devServicesUsed(services));
|
|
2286
|
+
require_stale.assertNoStaleSecrets({
|
|
2287
|
+
manifest: phase.manifest,
|
|
2288
|
+
stage,
|
|
2289
|
+
supplied: stored?.custom ?? {}
|
|
2290
|
+
});
|
|
2286
2291
|
await require_credentialSchemas.assertStageCredentials({
|
|
2287
2292
|
root: workspace.root,
|
|
2288
|
-
patterns:
|
|
2293
|
+
patterns: require_stale.constructGlobs(workspace),
|
|
2289
2294
|
manifest: phase.manifest,
|
|
2290
2295
|
stage,
|
|
2291
2296
|
supplied: stored?.custom ?? {}
|
|
2292
2297
|
});
|
|
2293
2298
|
const runnables = phase.runnables ?? {};
|
|
2294
2299
|
const background = phase.background ?? {};
|
|
2295
|
-
const workers =
|
|
2300
|
+
const workers = require_stale.workerUnits(workspace, phase.manifest, background).filter((worker) => appsToDeployNames.includes(worker.app));
|
|
2296
2301
|
if (workers.length > 0) logger.log(` Deploying workers: ${workers.map((w) => `${w.name} (from ${w.app})`).join(", ")}`);
|
|
2297
2302
|
return {
|
|
2298
2303
|
...run,
|
|
@@ -2317,7 +2322,7 @@ async function preflight({ workspace, manifest, stage, secrets: secretsStore, ct
|
|
|
2317
2322
|
logger.log("\n🔐 Loading secrets and analyzing environment requirements...");
|
|
2318
2323
|
const stored = await secretsStore.read();
|
|
2319
2324
|
if (!stored) logger.log(` ⚠️ No secrets found for stage "${stage}"; starting them`);
|
|
2320
|
-
const { secrets: stageSecrets, generated } =
|
|
2325
|
+
const { secrets: stageSecrets, generated } = require_stale.withGeneratedSecrets(stored ?? require_stale.initStageSecrets(stage), manifest);
|
|
2321
2326
|
if (generated.length > 0) {
|
|
2322
2327
|
if (ctx.dryRun) logger.log(` 🔑 Would generate for "${stage}" (${secretsStore.store}): ${generated.join(", ")}`);
|
|
2323
2328
|
else {
|
|
@@ -2370,7 +2375,7 @@ async function provision(run) {
|
|
|
2370
2375
|
};
|
|
2371
2376
|
const { api, endpoint } = await dokployApi(workspace, ctx);
|
|
2372
2377
|
logger.log("\n📋 Loading deploy state...");
|
|
2373
|
-
const journal = await
|
|
2378
|
+
const journal = await require_stale.DeployJournal.open(store, stage, () => require_stale.createEmptyState(stage, "", ""));
|
|
2374
2379
|
const state = journal.state;
|
|
2375
2380
|
if (journal.existed) logger.log(` Found existing state for stage "${stage}"`);
|
|
2376
2381
|
else logger.log(` Creating new state for stage "${stage}"`);
|
|
@@ -2382,7 +2387,7 @@ async function provision(run) {
|
|
|
2382
2387
|
key: "project",
|
|
2383
2388
|
type: "project",
|
|
2384
2389
|
data: {
|
|
2385
|
-
name:
|
|
2390
|
+
name: require_stale.projectName(identity),
|
|
2386
2391
|
identity: identity.key
|
|
2387
2392
|
}
|
|
2388
2393
|
};
|
|
@@ -2509,10 +2514,10 @@ async function provision(run) {
|
|
|
2509
2514
|
projectName: identity.scope,
|
|
2510
2515
|
stage,
|
|
2511
2516
|
config: workspace.deploy.backups,
|
|
2512
|
-
existingState:
|
|
2517
|
+
existingState: require_stale.getBackupState(state),
|
|
2513
2518
|
logger
|
|
2514
2519
|
});
|
|
2515
|
-
|
|
2520
|
+
require_stale.setBackupState(state, backupState);
|
|
2516
2521
|
if (!backupState.postgresBackupId) {
|
|
2517
2522
|
const backupSchedule = workspace.deploy.backups.schedule ?? "0 2 * * *";
|
|
2518
2523
|
const backupRetention = workspace.deploy.backups.retention ?? 30;
|
|
@@ -2526,7 +2531,7 @@ async function provision(run) {
|
|
|
2526
2531
|
enabled: true,
|
|
2527
2532
|
keepLatestCount: backupRetention
|
|
2528
2533
|
});
|
|
2529
|
-
|
|
2534
|
+
require_stale.setPostgresBackupId(state, backup.backupId);
|
|
2530
2535
|
logger.log(` ✓ Postgres backup schedule created (${backupSchedule})`);
|
|
2531
2536
|
} else logger.log(" ✓ Using existing postgres backup schedule");
|
|
2532
2537
|
}
|
|
@@ -2645,7 +2650,7 @@ async function releaseDokploy(run) {
|
|
|
2645
2650
|
intervalMs: run.verify.intervalMs,
|
|
2646
2651
|
signal: ctx.signal
|
|
2647
2652
|
});
|
|
2648
|
-
|
|
2653
|
+
require_stale.recordRelease(state, appName, {
|
|
2649
2654
|
...image,
|
|
2650
2655
|
tag: imageTag
|
|
2651
2656
|
});
|
|
@@ -2661,14 +2666,14 @@ async function releaseDokploy(run) {
|
|
|
2661
2666
|
const app = workspace.apps[appName];
|
|
2662
2667
|
logger.log(`\n ⚙️ Deploying ${appName}...`);
|
|
2663
2668
|
try {
|
|
2664
|
-
const application = await ensureApplication(api, journal, appName,
|
|
2669
|
+
const application = await ensureApplication(api, journal, appName, require_stale.applicationName(identity, appName), project.projectId, environmentId, applied);
|
|
2665
2670
|
const appSecrets = encryptedSecrets.get(appName);
|
|
2666
2671
|
const credentials = appSecrets && appSecrets.secretCount > 0 ? {
|
|
2667
2672
|
encrypted: appSecrets.payload.encrypted,
|
|
2668
2673
|
iv: appSecrets.payload.iv
|
|
2669
2674
|
} : void 0;
|
|
2670
2675
|
if (appSecrets && credentials) logger.log(` Encrypted ${appSecrets.secretCount} secrets`);
|
|
2671
|
-
const imageRef$1 =
|
|
2676
|
+
const imageRef$1 = require_stale.imageRef(identity, appName, registry, imageTag);
|
|
2672
2677
|
logger.log(` Building Docker image: ${imageRef$1}`);
|
|
2673
2678
|
const image = await deployDocker({
|
|
2674
2679
|
stage,
|
|
@@ -2676,7 +2681,7 @@ async function releaseDokploy(run) {
|
|
|
2676
2681
|
skipPush: false,
|
|
2677
2682
|
config: {
|
|
2678
2683
|
registry,
|
|
2679
|
-
imageName:
|
|
2684
|
+
imageName: require_stale.imageName(identity, appName),
|
|
2680
2685
|
appName
|
|
2681
2686
|
},
|
|
2682
2687
|
credentials,
|
|
@@ -2710,7 +2715,7 @@ async function releaseDokploy(run) {
|
|
|
2710
2715
|
const withDeclared = {
|
|
2711
2716
|
...resolved,
|
|
2712
2717
|
...declaredEnv,
|
|
2713
|
-
...
|
|
2718
|
+
...require_stale.otelEnv(stageSecrets?.custom ?? {}, appName)
|
|
2714
2719
|
};
|
|
2715
2720
|
const envVars = Object.entries(withDeclared).map(([key, value]) => `${key}=${value}`);
|
|
2716
2721
|
if (Object.keys(withDeclared).length > 0) logger.log(` Resolved ${Object.keys(withDeclared).length} env vars: ${Object.keys(withDeclared).sort().join(", ")}`);
|
|
@@ -2747,8 +2752,8 @@ async function releaseDokploy(run) {
|
|
|
2747
2752
|
ctx.signal?.throwIfAborted();
|
|
2748
2753
|
logger.log(`\n 🧵 Deploying ${worker.name} (worker ${worker.id})...`);
|
|
2749
2754
|
try {
|
|
2750
|
-
const application = await ensureApplication(api, journal, worker.name,
|
|
2751
|
-
const keys = [...
|
|
2755
|
+
const application = await ensureApplication(api, journal, worker.name, require_stale.applicationName(identity, worker.name), project.projectId, environmentId, applied);
|
|
2756
|
+
const keys = [...require_stale.workerEnvKeys(run.manifest, worker.id, run.runnables) ?? []].sort();
|
|
2752
2757
|
const secrets = prepareSecretsForApp(stageSecrets, {
|
|
2753
2758
|
appName: worker.name,
|
|
2754
2759
|
requiredEnvVars: keys,
|
|
@@ -2758,7 +2763,7 @@ async function releaseDokploy(run) {
|
|
|
2758
2763
|
encrypted: secrets.payload.encrypted,
|
|
2759
2764
|
iv: secrets.payload.iv
|
|
2760
2765
|
} : void 0;
|
|
2761
|
-
const imageRef$2 =
|
|
2766
|
+
const imageRef$2 = require_stale.imageRef(identity, worker.name, registry, imageTag);
|
|
2762
2767
|
logger.log(` Building Docker image: ${imageRef$2}`);
|
|
2763
2768
|
const image = await deployDocker({
|
|
2764
2769
|
stage,
|
|
@@ -2766,22 +2771,22 @@ async function releaseDokploy(run) {
|
|
|
2766
2771
|
skipPush: false,
|
|
2767
2772
|
config: {
|
|
2768
2773
|
registry,
|
|
2769
|
-
imageName:
|
|
2774
|
+
imageName: require_stale.imageName(identity, worker.name),
|
|
2770
2775
|
appName: worker.name
|
|
2771
2776
|
},
|
|
2772
2777
|
credentials,
|
|
2773
2778
|
cwd: workspace.root,
|
|
2774
|
-
dockerfile:
|
|
2779
|
+
dockerfile: require_stale.workerDockerfileOf(worker.name),
|
|
2775
2780
|
...ctx.signal ? { signal: ctx.signal } : {},
|
|
2776
2781
|
...ctx.stdio ? { stdio: ctx.stdio } : {}
|
|
2777
2782
|
});
|
|
2778
2783
|
built(worker.name, image, imageRef$2);
|
|
2779
2784
|
const env = {
|
|
2780
2785
|
...Object.fromEntries(Object.entries(declaredEnv).filter(([key]) => keys.includes(key))),
|
|
2781
|
-
...
|
|
2786
|
+
...require_stale.otelEnv(stageSecrets?.custom ?? {}, worker.name),
|
|
2782
2787
|
...credentials ? { GKM_MASTER_KEY: secrets.masterKey } : {},
|
|
2783
2788
|
NODE_ENV: "production",
|
|
2784
|
-
PORT: String(
|
|
2789
|
+
PORT: String(require_stale.WORKER_PORT),
|
|
2785
2790
|
STAGE: stage
|
|
2786
2791
|
};
|
|
2787
2792
|
logger.log(` Resolved ${Object.keys(env).length} env vars: ${Object.keys(env).sort().join(", ")}`);
|
|
@@ -2814,7 +2819,7 @@ async function releaseDokploy(run) {
|
|
|
2814
2819
|
const app = workspace.apps[appName];
|
|
2815
2820
|
logger.log(`\n 🌐 Deploying ${appName}...`);
|
|
2816
2821
|
try {
|
|
2817
|
-
const application = await ensureApplication(api, journal, appName,
|
|
2822
|
+
const application = await ensureApplication(api, journal, appName, require_stale.applicationName(identity, appName), project.projectId, environmentId, applied);
|
|
2818
2823
|
const dependencyUrls = {};
|
|
2819
2824
|
if (app.dependencies) {
|
|
2820
2825
|
for (const dep of app.dependencies) if (publicUrls[dep]) dependencyUrls[dep] = publicUrls[dep];
|
|
@@ -2843,7 +2848,7 @@ async function releaseDokploy(run) {
|
|
|
2843
2848
|
}
|
|
2844
2849
|
}
|
|
2845
2850
|
if (buildArgs.length > 0) logger.log(` Build args: ${publicUrlArgNames.join(", ")}`);
|
|
2846
|
-
const imageRef$3 =
|
|
2851
|
+
const imageRef$3 = require_stale.imageRef(identity, appName, registry, imageTag);
|
|
2847
2852
|
logger.log(` Building Docker image: ${imageRef$3}`);
|
|
2848
2853
|
const image = await deployDocker({
|
|
2849
2854
|
stage,
|
|
@@ -2851,7 +2856,7 @@ async function releaseDokploy(run) {
|
|
|
2851
2856
|
skipPush: false,
|
|
2852
2857
|
config: {
|
|
2853
2858
|
registry,
|
|
2854
|
-
imageName:
|
|
2859
|
+
imageName: require_stale.imageName(identity, appName),
|
|
2855
2860
|
appName
|
|
2856
2861
|
},
|
|
2857
2862
|
buildArgs,
|
|
@@ -2958,7 +2963,7 @@ async function migrate(run) {
|
|
|
2958
2963
|
root: workspace.root,
|
|
2959
2964
|
stage,
|
|
2960
2965
|
manifest,
|
|
2961
|
-
patterns:
|
|
2966
|
+
patterns: require_stale.constructGlobs(workspace),
|
|
2962
2967
|
urls,
|
|
2963
2968
|
signal: ctx.signal
|
|
2964
2969
|
});
|
|
@@ -3069,7 +3074,7 @@ async function rollbackDokploy(run, failure) {
|
|
|
3069
3074
|
verify: run.verify,
|
|
3070
3075
|
signal: run.ctx.signal
|
|
3071
3076
|
});
|
|
3072
|
-
|
|
3077
|
+
require_stale.recordRollback(state, appName, before);
|
|
3073
3078
|
await journal.save();
|
|
3074
3079
|
logger.log(` ✓ ${appName} rolled back to ${before.ref}`);
|
|
3075
3080
|
}
|
|
@@ -3138,7 +3143,7 @@ async function ensureApplication(api, journal, appName, dokployAppName, projectI
|
|
|
3138
3143
|
action: via === "created" ? "create" : "reuse",
|
|
3139
3144
|
id: resource.applicationId
|
|
3140
3145
|
}, via);
|
|
3141
|
-
|
|
3146
|
+
require_stale.setApplicationId(journal.state, appName, resource.applicationId);
|
|
3142
3147
|
return resource;
|
|
3143
3148
|
}
|
|
3144
3149
|
/**
|
|
@@ -3220,7 +3225,7 @@ async function dokployApi(workspace, ctx) {
|
|
|
3220
3225
|
/** Each app's public host, the same way the deploy resolves it. */
|
|
3221
3226
|
function hostOf(workspace, appName, stage) {
|
|
3222
3227
|
const app = workspace.apps[appName];
|
|
3223
|
-
return
|
|
3228
|
+
return require_stale.resolveHost(appName, app, stage, workspace.deploy?.domains, app.type === "web" && require_stale.isMainFrontendApp(appName, app, workspace.apps));
|
|
3224
3229
|
}
|
|
3225
3230
|
/**
|
|
3226
3231
|
* What a deploy would do, from the same lookups it starts with — and nothing
|
|
@@ -3254,7 +3259,7 @@ async function planDokploy(run) {
|
|
|
3254
3259
|
key: "project",
|
|
3255
3260
|
resourceType: "project",
|
|
3256
3261
|
action: "create"
|
|
3257
|
-
},
|
|
3262
|
+
}, require_stale.projectName(identity));
|
|
3258
3263
|
const environment = project?.environments.find((e) => e.name.toLowerCase() === stage.toLowerCase());
|
|
3259
3264
|
plan(environment ? {
|
|
3260
3265
|
key: "environment",
|
|
@@ -3301,7 +3306,7 @@ async function planDokploy(run) {
|
|
|
3301
3306
|
for (const appName of appsToDeployNames) {
|
|
3302
3307
|
const app = workspace.apps[appName];
|
|
3303
3308
|
if (app.type === "mobile") continue;
|
|
3304
|
-
const dokployAppName =
|
|
3309
|
+
const dokployAppName = require_stale.applicationName(identity, appName);
|
|
3305
3310
|
const recordedId = state?.applications?.[appName];
|
|
3306
3311
|
const existing = project && environment ? (recordedId ? await api.getApplication(recordedId).catch(() => null) : null) ?? await api.findApplicationByName(project.projectId, dokployAppName, environment.environmentId) : null;
|
|
3307
3312
|
plan(existing ? {
|
|
@@ -3314,7 +3319,7 @@ async function planDokploy(run) {
|
|
|
3314
3319
|
resourceType: "application",
|
|
3315
3320
|
action: "create"
|
|
3316
3321
|
}, dokployAppName);
|
|
3317
|
-
const ref =
|
|
3322
|
+
const ref = require_stale.imageRef(identity, appName, workspace.deploy.registry, imageTag);
|
|
3318
3323
|
plan({
|
|
3319
3324
|
key: `image:${appName}`,
|
|
3320
3325
|
resourceType: "image",
|
|
@@ -3343,7 +3348,7 @@ async function planDokploy(run) {
|
|
|
3343
3348
|
});
|
|
3344
3349
|
}
|
|
3345
3350
|
for (const worker of run.workers) {
|
|
3346
|
-
const dokployAppName =
|
|
3351
|
+
const dokployAppName = require_stale.applicationName(identity, worker.name);
|
|
3347
3352
|
const recordedId = state?.applications?.[worker.name];
|
|
3348
3353
|
const existing = project && environment ? (recordedId ? await api.getApplication(recordedId).catch(() => null) : null) ?? await api.findApplicationByName(project.projectId, dokployAppName, environment.environmentId) : null;
|
|
3349
3354
|
plan(existing ? {
|
|
@@ -3356,7 +3361,7 @@ async function planDokploy(run) {
|
|
|
3356
3361
|
resourceType: "application",
|
|
3357
3362
|
action: "create"
|
|
3358
3363
|
}, `${dokployAppName}, worker ${worker.id} — no domain`);
|
|
3359
|
-
const ref =
|
|
3364
|
+
const ref = require_stale.imageRef(identity, worker.name, workspace.deploy.registry, imageTag);
|
|
3360
3365
|
plan({
|
|
3361
3366
|
key: `image:${worker.name}`,
|
|
3362
3367
|
resourceType: "image",
|
|
@@ -3505,4 +3510,4 @@ Object.defineProperty(exports, "verifySettings", {
|
|
|
3505
3510
|
}
|
|
3506
3511
|
});
|
|
3507
3512
|
|
|
3508
|
-
//# sourceMappingURL=engine-
|
|
3513
|
+
//# sourceMappingURL=engine-y53kE_3H.cjs.map
|