@geekmidas/cli 10.0.0-alpha.65 → 10.0.0-alpha.66
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/README.md +14 -0
- package/dist/{HostingerProvider-Dlmbfass.cjs → HostingerProvider-BznqRC2S.cjs} +3 -3
- package/dist/HostingerProvider-BznqRC2S.cjs.map +1 -0
- package/dist/{HostingerProvider-x9gQTAGZ.mjs → HostingerProvider-CY_VpVud.mjs} +3 -3
- package/dist/HostingerProvider-CY_VpVud.mjs.map +1 -0
- package/dist/{LegacyStateStore-BGoo__sO.cjs → LegacyStateStore-BFcTT2QL.cjs} +2 -2
- package/dist/{LegacyStateStore-BGoo__sO.cjs.map → LegacyStateStore-BFcTT2QL.cjs.map} +1 -1
- package/dist/{LegacyStateStore-BUu1nQ5u.mjs → LegacyStateStore-CFheFo62.mjs} +2 -2
- package/dist/{LegacyStateStore-BUu1nQ5u.mjs.map → LegacyStateStore-CFheFo62.mjs.map} +1 -1
- package/dist/{LocalStateStore-93urXyQe.cjs → LocalStateStore-BVUexSvu.cjs} +2 -2
- package/dist/{LocalStateStore-93urXyQe.cjs.map → LocalStateStore-BVUexSvu.cjs.map} +1 -1
- package/dist/{LocalStateStore-BRhMQRuy.mjs → LocalStateStore-Bm3x9oOg.mjs} +2 -2
- package/dist/{LocalStateStore-BRhMQRuy.mjs.map → LocalStateStore-Bm3x9oOg.mjs.map} +1 -1
- package/dist/{OpenApiTsGenerator-BWuDRHe9.cjs → OpenApiTsGenerator-B2zrdyP4.cjs} +2 -2
- package/dist/{OpenApiTsGenerator-BWuDRHe9.cjs.map → OpenApiTsGenerator-B2zrdyP4.cjs.map} +1 -1
- package/dist/{OpenApiTsGenerator-C6v-IeHt.mjs → OpenApiTsGenerator-BmUAcR7d.mjs} +2 -2
- package/dist/{OpenApiTsGenerator-C6v-IeHt.mjs.map → OpenApiTsGenerator-BmUAcR7d.mjs.map} +1 -1
- package/dist/{Route53Provider-DVILBsvV.cjs → Route53Provider-Bllus2NR.cjs} +2 -2
- package/dist/Route53Provider-Bllus2NR.cjs.map +1 -0
- package/dist/{Route53Provider-Cvj40A8I.mjs → Route53Provider-QXxjkZO1.mjs} +2 -2
- package/dist/Route53Provider-QXxjkZO1.mjs.map +1 -0
- package/dist/{S3StateStore-pw1GhWwt.mjs → S3StateStore-BFHuctWM.mjs} +2 -2
- package/dist/{S3StateStore-pw1GhWwt.mjs.map → S3StateStore-BFHuctWM.mjs.map} +1 -1
- package/dist/{S3StateStore-F4dxw6kS.cjs → S3StateStore-CoXBhILd.cjs} +2 -2
- package/dist/{S3StateStore-F4dxw6kS.cjs.map → S3StateStore-CoXBhILd.cjs.map} +1 -1
- package/dist/{SSMStateStore-Bt9acuAF.cjs → SSMStateStore-BqCA9TP2.cjs} +2 -2
- package/dist/{SSMStateStore-Bt9acuAF.cjs.map → SSMStateStore-BqCA9TP2.cjs.map} +1 -1
- package/dist/{SSMStateStore-Dmj7zzFO.mjs → SSMStateStore-C1kvHScY.mjs} +2 -2
- package/dist/{SSMStateStore-Dmj7zzFO.mjs.map → SSMStateStore-C1kvHScY.mjs.map} +1 -1
- package/dist/{backup-provisioner-DIVCbfee.mjs → backup-provisioner-C8DnCmxK.mjs} +2 -2
- package/dist/backup-provisioner-C8DnCmxK.mjs.map +1 -0
- package/dist/{backup-provisioner-BmhIO_Yr.cjs → backup-provisioner-oDEsPj02.cjs} +2 -2
- package/dist/backup-provisioner-oDEsPj02.cjs.map +1 -0
- package/dist/{bundler-D_14JLZF.mjs → bundler-Dvaiud0h.mjs} +4 -4
- package/dist/{bundler-D_14JLZF.mjs.map → bundler-Dvaiud0h.mjs.map} +1 -1
- package/dist/{bundler-D6MlIfBT.cjs → bundler-orRqUJNZ.cjs} +4 -4
- package/dist/{bundler-D6MlIfBT.cjs.map → bundler-orRqUJNZ.cjs.map} +1 -1
- package/dist/{cli-P56vvrDQ.mjs → cli-CfHm0AO7.mjs} +5 -4
- package/dist/cli-CfHm0AO7.mjs.map +1 -0
- package/dist/{cli-BfH1deAT.cjs → cli-D1JkkOwg.cjs} +5 -4
- package/dist/cli-D1JkkOwg.cjs.map +1 -0
- package/dist/{compose-DprE3ASm.mjs → compose-CNQL8BnO.mjs} +18 -482
- package/dist/compose-CNQL8BnO.mjs.map +1 -0
- package/dist/{compose-391oEKj1.cjs → compose-jrLy7KGO.cjs} +16 -571
- package/dist/compose-jrLy7KGO.cjs.map +1 -0
- package/dist/{config-V_X_BMpm.d.cts → config-4XFxX1al.d.cts} +3 -3
- package/dist/{config-BonvTW8p.d.mts.map → config-4XFxX1al.d.cts.map} +1 -1
- package/dist/{config-BonvTW8p.d.mts → config-UtKzhpFb.d.mts} +3 -3
- package/dist/{config-V_X_BMpm.d.cts.map → config-UtKzhpFb.d.mts.map} +1 -1
- package/dist/config.cjs +3 -3
- package/dist/config.d.cts +3 -3
- package/dist/config.d.mts +3 -3
- package/dist/config.mjs +3 -3
- package/dist/databases-C2p5LGAp.cjs +419 -0
- package/dist/databases-C2p5LGAp.cjs.map +1 -0
- package/dist/databases-hUHTuwhx.mjs +346 -0
- package/dist/databases-hUHTuwhx.mjs.map +1 -0
- package/dist/deploy/public.cjs +26 -17
- package/dist/deploy/public.d.cts +136 -19
- package/dist/deploy/public.d.cts.map +1 -1
- package/dist/deploy/public.d.mts +136 -19
- package/dist/deploy/public.d.mts.map +1 -1
- package/dist/deploy/public.mjs +8 -8
- package/dist/deploy-B7aJi_Ah.cjs +511 -0
- package/dist/deploy-B7aJi_Ah.cjs.map +1 -0
- package/dist/deploy-DWn7YfIc.mjs +488 -0
- package/dist/deploy-DWn7YfIc.mjs.map +1 -0
- package/dist/{discover-LMrqsWSU.mjs → discover-BFoJWKGD.mjs} +4 -2
- package/dist/discover-BFoJWKGD.mjs.map +1 -0
- package/dist/{discover-DHdECueV.cjs → discover-OEfZ9OkA.cjs} +4 -2
- package/dist/discover-OEfZ9OkA.cjs.map +1 -0
- package/dist/dokploy-B4LcYG1E.cjs +38 -0
- package/dist/dokploy-B4LcYG1E.cjs.map +1 -0
- package/dist/dokploy-DalwLML5.mjs +38 -0
- package/dist/dokploy-DalwLML5.mjs.map +1 -0
- package/dist/{encryption-B1wJwgae.cjs → encryption-3KlGS1sl.cjs} +5 -7
- package/dist/{encryption-B1wJwgae.cjs.map → encryption-3KlGS1sl.cjs.map} +1 -1
- package/dist/{encryption-DF_hgIpl.mjs → encryption-CPfENwWO.mjs} +3 -5
- package/dist/{encryption-DF_hgIpl.mjs.map → encryption-CPfENwWO.mjs.map} +1 -1
- package/dist/{deploy-CZ5nlpsu.mjs → engine-CunvOG3s.mjs} +2100 -1733
- package/dist/engine-CunvOG3s.mjs.map +1 -0
- package/dist/{deploy-Cy8igpQF.cjs → engine-DR6KurWX.cjs} +2136 -1727
- package/dist/engine-DR6KurWX.cjs.map +1 -0
- package/dist/{github-CYcmTdFs.cjs → github-BJ5gh9bw.cjs} +7 -7
- package/dist/{github-CYcmTdFs.cjs.map → github-BJ5gh9bw.cjs.map} +1 -1
- package/dist/{github-B0YYE98x.mjs → github-MXA9v7Ge.mjs} +3 -3
- package/dist/{github-B0YYE98x.mjs.map → github-MXA9v7Ge.mjs.map} +1 -1
- package/dist/{index-DwKD_8lt.d.mts → index-CyApaHVe.d.cts} +2 -2
- package/dist/{index-DPUAGJaK.d.cts.map → index-CyApaHVe.d.cts.map} +1 -1
- package/dist/{index-DPUAGJaK.d.cts → index-DD1FfUHh.d.mts} +2 -2
- package/dist/{index-DwKD_8lt.d.mts.map → index-DD1FfUHh.d.mts.map} +1 -1
- package/dist/index.cjs +276 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +254 -50
- package/dist/index.mjs.map +1 -1
- package/dist/{migrate-B2qL5wj4.mjs → migrate-BJBcm4sG.mjs} +6 -6
- package/dist/{migrate-B2qL5wj4.mjs.map → migrate-BJBcm4sG.mjs.map} +1 -1
- package/dist/{migrate-q4pPAXtO.cjs → migrate-CF4J4GQS.cjs} +16 -16
- package/dist/{migrate-q4pPAXtO.cjs.map → migrate-CF4J4GQS.cjs.map} +1 -1
- package/dist/openapi.cjs +1 -1
- package/dist/openapi.d.cts +1 -1
- package/dist/openapi.d.mts +1 -1
- package/dist/openapi.mjs +1 -1
- package/dist/provider-B3Sv_a74.cjs +173 -0
- package/dist/provider-B3Sv_a74.cjs.map +1 -0
- package/dist/provider-D7rQzzzf.mjs +138 -0
- package/dist/provider-D7rQzzzf.mjs.map +1 -0
- package/dist/{ready-bQfu9GES.mjs → ready-2s3-CndS.mjs} +3 -3
- package/dist/{ready-bQfu9GES.mjs.map → ready-2s3-CndS.mjs.map} +1 -1
- package/dist/{ready-brEhh68f.cjs → ready-B6uHr4sm.cjs} +3 -3
- package/dist/{ready-brEhh68f.cjs.map → ready-B6uHr4sm.cjs.map} +1 -1
- package/dist/reconcile/public.cjs +1 -1
- package/dist/reconcile/public.d.cts +1 -1
- package/dist/reconcile/public.d.mts +1 -1
- package/dist/reconcile/public.mjs +1 -1
- package/dist/{resolve-N_i4XNd-.cjs → resolve-CVmch0wI.cjs} +3 -3
- package/dist/{resolve-N_i4XNd-.cjs.map → resolve-CVmch0wI.cjs.map} +1 -1
- package/dist/{resolve-DLkIXTct.mjs → resolve-Db0tNlrW.mjs} +3 -3
- package/dist/{resolve-DLkIXTct.mjs.map → resolve-Db0tNlrW.mjs.map} +1 -1
- package/dist/rollback-DvAo4OKS.mjs +133 -0
- package/dist/rollback-DvAo4OKS.mjs.map +1 -0
- package/dist/rollback-DxJK84hy.cjs +162 -0
- package/dist/rollback-DxJK84hy.cjs.map +1 -0
- package/dist/{runtime-BnD7Nn96.d.cts → runtime-BRqFOvPM.d.cts} +2 -2
- package/dist/{runtime-BnD7Nn96.d.cts.map → runtime-BRqFOvPM.d.cts.map} +1 -1
- package/dist/{runtime-j-tmFL65.d.mts → runtime-CEk5n4VH.d.mts} +2 -2
- package/dist/{runtime-j-tmFL65.d.mts.map → runtime-CEk5n4VH.d.mts.map} +1 -1
- package/dist/sandbox/discover-worker.cjs +1 -1
- package/dist/sandbox/discover-worker.mjs +1 -1
- package/dist/sandbox/migrate-worker.cjs +61 -0
- package/dist/sandbox/migrate-worker.cjs.map +1 -0
- package/dist/sandbox/migrate-worker.d.cts +1 -0
- package/dist/sandbox/migrate-worker.d.mts +1 -0
- package/dist/sandbox/migrate-worker.mjs +62 -0
- package/dist/sandbox/migrate-worker.mjs.map +1 -0
- package/dist/{schemas-D2LCF689.mjs → schemas-Cfhtpdo0.mjs} +10 -2
- package/dist/{schemas-Ckm_aBnF.cjs.map → schemas-Cfhtpdo0.mjs.map} +1 -1
- package/dist/{schemas-Ckm_aBnF.cjs → schemas-RUlKHu27.cjs} +15 -1
- package/dist/{schemas-D2LCF689.mjs.map → schemas-RUlKHu27.cjs.map} +1 -1
- package/dist/{sniffer-BSwaL-dX.cjs → sniffer-5xmrkh2a.cjs} +112 -606
- package/dist/sniffer-5xmrkh2a.cjs.map +1 -0
- package/dist/{sniffer-BZ-OJO4Y.mjs → sniffer-BAQhLEsI.mjs} +95 -546
- package/dist/sniffer-BAQhLEsI.mjs.map +1 -0
- package/dist/{state-DF26e_lo.cjs → state-Y6ATakMX.cjs} +744 -20
- package/dist/state-Y6ATakMX.cjs.map +1 -0
- package/dist/{state-B8YwmUZU.mjs → state-uuYqnRVO.mjs} +605 -19
- package/dist/state-uuYqnRVO.mjs.map +1 -0
- package/dist/target/public.cjs +1 -1
- package/dist/target/public.d.cts +2 -2
- package/dist/target/public.d.mts +2 -2
- package/dist/target/public.mjs +1 -1
- package/dist/{terminal-Bs5E1oxm.cjs → terminal-CHy_MdjG.cjs} +11 -15
- package/dist/{terminal-Bs5E1oxm.cjs.map → terminal-CHy_MdjG.cjs.map} +1 -1
- package/dist/{terminal-CfbiYUbZ.mjs → terminal-DUhcZ1ND.mjs} +4 -4
- package/dist/{terminal-CfbiYUbZ.mjs.map → terminal-DUhcZ1ND.mjs.map} +1 -1
- package/dist/{types-ByMWkXKP.d.cts → types-CSw2w69a.d.mts} +68 -10
- package/dist/types-CSw2w69a.d.mts.map +1 -0
- package/dist/{types-BCzMWBb6.d.mts → types-D5WIxRDP.d.cts} +69 -9
- package/dist/types-D5WIxRDP.d.cts.map +1 -0
- package/dist/vitest.cjs +1 -1
- package/dist/vitest.mjs +1 -1
- package/dist/workspace/index.cjs +1 -1
- package/dist/workspace/index.d.cts +2 -2
- package/dist/workspace/index.d.mts +2 -2
- package/dist/workspace/index.mjs +1 -1
- package/dist/{workspace-C06_pW4g.mjs → workspace-Be6uBhlF.mjs} +10 -3
- package/dist/workspace-Be6uBhlF.mjs.map +1 -0
- package/dist/{workspace-BewAHZIo.cjs → workspace-ON-bqiJz.cjs} +10 -3
- package/dist/workspace-ON-bqiJz.cjs.map +1 -0
- package/package.json +13 -13
- package/dist/HostingerProvider-Dlmbfass.cjs.map +0 -1
- package/dist/HostingerProvider-x9gQTAGZ.mjs.map +0 -1
- package/dist/Route53Provider-Cvj40A8I.mjs.map +0 -1
- package/dist/Route53Provider-DVILBsvV.cjs.map +0 -1
- package/dist/backup-provisioner-BmhIO_Yr.cjs.map +0 -1
- package/dist/backup-provisioner-DIVCbfee.mjs.map +0 -1
- package/dist/cli-BfH1deAT.cjs.map +0 -1
- package/dist/cli-P56vvrDQ.mjs.map +0 -1
- package/dist/compose-391oEKj1.cjs.map +0 -1
- package/dist/compose-DprE3ASm.mjs.map +0 -1
- package/dist/deploy-9MBG_QLd.mjs +0 -137
- package/dist/deploy-9MBG_QLd.mjs.map +0 -1
- package/dist/deploy-B80idPUZ.cjs +0 -142
- package/dist/deploy-B80idPUZ.cjs.map +0 -1
- package/dist/deploy-CZ5nlpsu.mjs.map +0 -1
- package/dist/deploy-Cy8igpQF.cjs.map +0 -1
- package/dist/discover-DHdECueV.cjs.map +0 -1
- package/dist/discover-LMrqsWSU.mjs.map +0 -1
- package/dist/dokploy-BdtBePjp.mjs +0 -32
- package/dist/dokploy-BdtBePjp.mjs.map +0 -1
- package/dist/dokploy-iFY8MY-L.cjs +0 -32
- package/dist/dokploy-iFY8MY-L.cjs.map +0 -1
- package/dist/sniffer-BSwaL-dX.cjs.map +0 -1
- package/dist/sniffer-BZ-OJO4Y.mjs.map +0 -1
- package/dist/state-B8YwmUZU.mjs.map +0 -1
- package/dist/state-DF26e_lo.cjs.map +0 -1
- package/dist/storage-BzaUxmqe.mjs +0 -124
- package/dist/storage-BzaUxmqe.mjs.map +0 -1
- package/dist/storage-CSGoC3bK.cjs +0 -152
- package/dist/storage-CSGoC3bK.cjs.map +0 -1
- package/dist/store-CJF1Tqkq.cjs +0 -510
- package/dist/store-CJF1Tqkq.cjs.map +0 -1
- package/dist/store-CLiHnqOY.mjs +0 -415
- package/dist/store-CLiHnqOY.mjs.map +0 -1
- package/dist/types-BCzMWBb6.d.mts.map +0 -1
- package/dist/types-ByMWkXKP.d.cts.map +0 -1
- package/dist/workspace-BewAHZIo.cjs.map +0 -1
- package/dist/workspace-C06_pW4g.mjs.map +0 -1
|
@@ -1,207 +1,13 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
|
|
2
2
|
const require_local = require("./local-BdH4XN0E.cjs");
|
|
3
|
-
const
|
|
4
|
-
const require_discover = require("./discover-DHdECueV.cjs");
|
|
3
|
+
const require_discover = require("./discover-OEfZ9OkA.cjs");
|
|
5
4
|
const require_sandbox = require("./sandbox-CL--ZDui.cjs");
|
|
6
|
-
const
|
|
7
|
-
const require_define = require("./define-DzRz8FgH.cjs");
|
|
8
|
-
const require_workspace = require("./workspace-BewAHZIo.cjs");
|
|
9
|
-
const require_store = require("./store-CJF1Tqkq.cjs");
|
|
10
|
-
const require_state = require("./state-DF26e_lo.cjs");
|
|
11
|
-
const require_resolve = require("./resolve-N_i4XNd-.cjs");
|
|
5
|
+
const require_workspace = require("./workspace-ON-bqiJz.cjs");
|
|
12
6
|
let node_path = require("node:path");
|
|
13
|
-
let node_process = require("node:process");
|
|
14
|
-
let node_readline_promises = require("node:readline/promises");
|
|
15
|
-
node_readline_promises = require_rolldown_runtime.__toESM(node_readline_promises, 1);
|
|
16
7
|
let node_fs = require("node:fs");
|
|
17
8
|
let node_os = require("node:os");
|
|
18
9
|
let node_url = require("node:url");
|
|
19
10
|
let node_crypto = require("node:crypto");
|
|
20
|
-
//#region src/prompt.ts
|
|
21
|
-
/**
|
|
22
|
-
* Asking the person at the terminal.
|
|
23
|
-
*
|
|
24
|
-
* CLI layer only: a command's action may prompt, nothing it calls may. A
|
|
25
|
-
* library call (`deploy()`) that needs something it was not given raises a
|
|
26
|
-
* named error instead, and the command decides whether to ask.
|
|
27
|
-
*/
|
|
28
|
-
/** A prompt was needed with no terminal to ask at. */
|
|
29
|
-
var PromptNeedsTerminal = class extends Error {
|
|
30
|
-
question;
|
|
31
|
-
instead;
|
|
32
|
-
constructor(question, instead) {
|
|
33
|
-
super(`Interactive input required. ${instead}`);
|
|
34
|
-
this.question = question;
|
|
35
|
-
this.instead = instead;
|
|
36
|
-
this.name = "PromptNeedsTerminal";
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
/** Whether there is a person at a terminal to ask. */
|
|
40
|
-
function canPrompt() {
|
|
41
|
-
return process.stdin.isTTY === true;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Ask `message` and resolve with the line typed — without echoing it when
|
|
45
|
-
* `hidden`. Ctrl+C at a hidden prompt exits, as it would anywhere else in a
|
|
46
|
-
* terminal program: raw mode has taken the signal away from the shell.
|
|
47
|
-
*/
|
|
48
|
-
async function prompt(message, options) {
|
|
49
|
-
if (!canPrompt()) throw new PromptNeedsTerminal(message, options.instead);
|
|
50
|
-
if (options.hidden) {
|
|
51
|
-
process.stdout.write(message);
|
|
52
|
-
return new Promise((resolve, reject) => {
|
|
53
|
-
let value = "";
|
|
54
|
-
const cleanup = () => {
|
|
55
|
-
process.stdin.setRawMode(false);
|
|
56
|
-
process.stdin.pause();
|
|
57
|
-
process.stdin.removeListener("data", onData);
|
|
58
|
-
process.stdin.removeListener("error", onError);
|
|
59
|
-
};
|
|
60
|
-
const onError = (err) => {
|
|
61
|
-
cleanup();
|
|
62
|
-
reject(err);
|
|
63
|
-
};
|
|
64
|
-
const onData = (char) => {
|
|
65
|
-
const c = char.toString();
|
|
66
|
-
if (c === "\n" || c === "\r") {
|
|
67
|
-
cleanup();
|
|
68
|
-
process.stdout.write("\n");
|
|
69
|
-
resolve(value);
|
|
70
|
-
} else if (c === "") {
|
|
71
|
-
cleanup();
|
|
72
|
-
process.stdout.write("\n");
|
|
73
|
-
process.exit(1);
|
|
74
|
-
} else if (c === "" || c === "\b") {
|
|
75
|
-
if (value.length > 0) value = value.slice(0, -1);
|
|
76
|
-
} else value += c;
|
|
77
|
-
};
|
|
78
|
-
process.stdin.setRawMode(true);
|
|
79
|
-
process.stdin.resume();
|
|
80
|
-
process.stdin.on("data", onData);
|
|
81
|
-
process.stdin.on("error", onError);
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
const rl = node_readline_promises.createInterface({
|
|
85
|
-
input: node_process.stdin,
|
|
86
|
-
output: node_process.stdout
|
|
87
|
-
});
|
|
88
|
-
try {
|
|
89
|
-
return await rl.question(message);
|
|
90
|
-
} finally {
|
|
91
|
-
rl.close();
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
//#endregion
|
|
95
|
-
//#region src/auth/index.ts
|
|
96
|
-
const logger = console;
|
|
97
|
-
/**
|
|
98
|
-
* Validate Dokploy token by making a test API call
|
|
99
|
-
*/
|
|
100
|
-
async function validateDokployToken(endpoint, token) {
|
|
101
|
-
const { DokployApi } = await Promise.resolve().then(() => dokploy_api_exports);
|
|
102
|
-
return new DokployApi({
|
|
103
|
-
baseUrl: endpoint,
|
|
104
|
-
token
|
|
105
|
-
}).validateToken();
|
|
106
|
-
}
|
|
107
|
-
/** What answers a login prompt without a terminal. */
|
|
108
|
-
const LOGIN_INSTEAD = "Please provide --token option.";
|
|
109
|
-
/**
|
|
110
|
-
* Login to a service
|
|
111
|
-
*/
|
|
112
|
-
async function loginCommand(options) {
|
|
113
|
-
const { provider, token: providedToken, endpoint: providedEndpoint } = options;
|
|
114
|
-
if (provider === "dokploy") {
|
|
115
|
-
logger.log("\n🔐 Logging in to Dokploy...\n");
|
|
116
|
-
let endpoint = providedEndpoint;
|
|
117
|
-
if (!endpoint) endpoint = await prompt("Dokploy URL (e.g., https://dokploy.example.com): ", { instead: LOGIN_INSTEAD });
|
|
118
|
-
endpoint = endpoint.replace(/\/$/, "");
|
|
119
|
-
try {
|
|
120
|
-
new URL(endpoint);
|
|
121
|
-
} catch {
|
|
122
|
-
logger.error("Invalid URL format");
|
|
123
|
-
process.exit(1);
|
|
124
|
-
}
|
|
125
|
-
let token = providedToken;
|
|
126
|
-
if (!token) {
|
|
127
|
-
logger.log(`\nGenerate a token at: ${endpoint}/settings/profile\n`);
|
|
128
|
-
token = await prompt("API Token: ", {
|
|
129
|
-
hidden: true,
|
|
130
|
-
instead: LOGIN_INSTEAD
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
if (!token) {
|
|
134
|
-
logger.error("Token is required");
|
|
135
|
-
process.exit(1);
|
|
136
|
-
}
|
|
137
|
-
logger.log("\nValidating credentials...");
|
|
138
|
-
if (!await validateDokployToken(endpoint, token)) {
|
|
139
|
-
logger.error("\n✗ Invalid credentials. Please check your token and try again.");
|
|
140
|
-
process.exit(1);
|
|
141
|
-
}
|
|
142
|
-
await require_credentials.storeDokployCredentials(token, endpoint);
|
|
143
|
-
logger.log("\n✓ Successfully logged in to Dokploy!");
|
|
144
|
-
logger.log(` Endpoint: ${endpoint}`);
|
|
145
|
-
logger.log(` Credentials stored in: ${require_credentials.getCredentialsPath()}`);
|
|
146
|
-
logger.log("\nYou can now use deploy commands without setting DOKPLOY_API_TOKEN.");
|
|
147
|
-
}
|
|
148
|
-
if (provider === "hostinger") {
|
|
149
|
-
logger.log("\n🔐 Logging in to Hostinger...\n");
|
|
150
|
-
let token = providedToken;
|
|
151
|
-
if (!token) {
|
|
152
|
-
logger.log("\nGenerate a token at: https://hpanel.hostinger.com/profile/api\n");
|
|
153
|
-
token = await prompt("API Token: ", {
|
|
154
|
-
hidden: true,
|
|
155
|
-
instead: LOGIN_INSTEAD
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
if (!token) {
|
|
159
|
-
logger.error("Token is required");
|
|
160
|
-
process.exit(1);
|
|
161
|
-
}
|
|
162
|
-
await require_credentials.storeHostingerToken(token);
|
|
163
|
-
logger.log("\n✓ Hostinger token stored.");
|
|
164
|
-
logger.log(` Credentials stored in: ${require_credentials.getCredentialsPath()}`);
|
|
165
|
-
logger.log(" Not validated here: every DNS endpoint is scoped to a domain, so the\n first deploy that touches DNS is where a bad token reports itself.");
|
|
166
|
-
logger.log("\nYou can now use it as a DNS provider without setting HOSTINGER_API_TOKEN.");
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Logout from a service
|
|
171
|
-
*/
|
|
172
|
-
async function logoutCommand(options) {
|
|
173
|
-
const { provider = "dokploy" } = options;
|
|
174
|
-
if (provider === "all") {
|
|
175
|
-
if (await require_credentials.removeDokployCredentials()) logger.log("\n✓ Logged out from all services");
|
|
176
|
-
else logger.log("\nNo stored credentials found");
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
if (provider === "dokploy") {
|
|
180
|
-
if (await require_credentials.removeDokployCredentials()) logger.log("\n✓ Logged out from Dokploy");
|
|
181
|
-
else logger.log("\nNo Dokploy credentials found");
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Show current login status
|
|
186
|
-
*/
|
|
187
|
-
async function whoamiCommand() {
|
|
188
|
-
logger.log("\n📋 Current credentials:\n");
|
|
189
|
-
const dokploy = await require_credentials.getDokployCredentials();
|
|
190
|
-
if (dokploy) {
|
|
191
|
-
logger.log(" Dokploy:");
|
|
192
|
-
logger.log(` Endpoint: ${dokploy.endpoint}`);
|
|
193
|
-
logger.log(` Token: ${maskToken(dokploy.token)}`);
|
|
194
|
-
} else logger.log(" Dokploy: Not logged in");
|
|
195
|
-
logger.log(`\n Credentials file: ${require_credentials.getCredentialsPath()}`);
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Mask a token for display
|
|
199
|
-
*/
|
|
200
|
-
function maskToken(token) {
|
|
201
|
-
if (token.length <= 8) return "****";
|
|
202
|
-
return `${token.slice(0, 4)}...${token.slice(-4)}`;
|
|
203
|
-
}
|
|
204
|
-
//#endregion
|
|
205
11
|
//#region src/workspace/client-generator.ts
|
|
206
12
|
/**
|
|
207
13
|
* Normalize routes to an array of patterns.
|
|
@@ -265,66 +71,6 @@ function keyFingerprint(masterKey) {
|
|
|
265
71
|
return (0, node_crypto.createHash)("sha256").update(masterKey).digest("hex").slice(0, 8);
|
|
266
72
|
}
|
|
267
73
|
//#endregion
|
|
268
|
-
//#region src/target/secrets.ts
|
|
269
|
-
/**
|
|
270
|
-
* A stage's secrets as a target sees them: read and written through the
|
|
271
|
-
* stage's own store, and masked in everything the run prints once read.
|
|
272
|
-
*/
|
|
273
|
-
/**
|
|
274
|
-
* Shorter values are left alone: what a progress line legitimately prints —
|
|
275
|
-
* a port, a stage, an app name — would otherwise come out as `***` wherever
|
|
276
|
-
* a secret happened to share it.
|
|
277
|
-
*/
|
|
278
|
-
const SHORTEST_MASKED = 6;
|
|
279
|
-
/** The values a run must never print, and the rewrite that keeps it so. */
|
|
280
|
-
var Redactor = class {
|
|
281
|
-
values = /* @__PURE__ */ new Set();
|
|
282
|
-
add(value) {
|
|
283
|
-
if (value && value.length >= SHORTEST_MASKED) this.values.add(value);
|
|
284
|
-
}
|
|
285
|
-
/** `text` with every masked value replaced by `***`, longest first. */
|
|
286
|
-
redact(text) {
|
|
287
|
-
if (this.values.size === 0) return text;
|
|
288
|
-
let out = text;
|
|
289
|
-
const longestFirst = [...this.values].sort((a, b) => b.length - a.length);
|
|
290
|
-
for (const value of longestFirst) out = out.replaceAll(value, "***");
|
|
291
|
-
return out;
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
/** Every value in `secrets` that is a secret rather than a label. */
|
|
295
|
-
function secretValues(secrets) {
|
|
296
|
-
return [
|
|
297
|
-
secrets.seed,
|
|
298
|
-
...Object.values(secrets.custom ?? {}),
|
|
299
|
-
...Object.values(secrets.urls ?? {}),
|
|
300
|
-
...Object.values(secrets.services ?? {}).map((service) => service?.password)
|
|
301
|
-
].filter((value) => typeof value === "string");
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* The stage's secrets through the store `secrets.store` names for it. Opening
|
|
305
|
-
* one builds a client and makes no request, so a target that never reads them
|
|
306
|
-
* costs nothing.
|
|
307
|
-
*/
|
|
308
|
-
async function deploySecrets(workspace, stage, redactor, options = {}) {
|
|
309
|
-
const store = await require_store.secretsStoreFor(workspace, stage, options);
|
|
310
|
-
const mask = (secrets) => {
|
|
311
|
-
for (const value of secretValues(secrets)) redactor.add(value);
|
|
312
|
-
};
|
|
313
|
-
return {
|
|
314
|
-
store: store.name,
|
|
315
|
-
async read() {
|
|
316
|
-
const secrets = await store.read(stage);
|
|
317
|
-
if (secrets) mask(secrets);
|
|
318
|
-
return secrets;
|
|
319
|
-
},
|
|
320
|
-
async write(secrets) {
|
|
321
|
-
mask(secrets);
|
|
322
|
-
await store.write(stage, secrets);
|
|
323
|
-
},
|
|
324
|
-
mask: (value) => redactor.add(value)
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
//#endregion
|
|
328
74
|
//#region src/deploy/events.ts
|
|
329
75
|
/** An error as an event carries it: its name and message, nothing else. */
|
|
330
76
|
function eventError(error) {
|
|
@@ -659,17 +405,17 @@ function isStateStore(value) {
|
|
|
659
405
|
async function createStateStore(options) {
|
|
660
406
|
const { config, workspaceRoot, workspaceName } = options;
|
|
661
407
|
if (!config || config.provider === "local") {
|
|
662
|
-
const { LocalStateStore } = await Promise.resolve().then(() => require("./LocalStateStore-
|
|
408
|
+
const { LocalStateStore } = await Promise.resolve().then(() => require("./LocalStateStore-BVUexSvu.cjs")).then((n) => n.LocalStateStore_exports);
|
|
663
409
|
return new LocalStateStore(workspaceRoot);
|
|
664
410
|
}
|
|
665
411
|
if (isStateStore(config.provider)) return config.provider;
|
|
666
412
|
if (isStateProvider(config.provider)) {
|
|
667
|
-
const { LegacyStateStore } = await Promise.resolve().then(() => require("./LegacyStateStore-
|
|
413
|
+
const { LegacyStateStore } = await Promise.resolve().then(() => require("./LegacyStateStore-BFcTT2QL.cjs"));
|
|
668
414
|
return new LegacyStateStore(config.provider, { warn: options.warn });
|
|
669
415
|
}
|
|
670
416
|
if (config.provider === "ssm") {
|
|
671
417
|
if (!workspaceName) throw new StateStoreNeedsWorkspaceName("ssm");
|
|
672
|
-
const { SSMStateStore } = await Promise.resolve().then(() => require("./SSMStateStore-
|
|
418
|
+
const { SSMStateStore } = await Promise.resolve().then(() => require("./SSMStateStore-BqCA9TP2.cjs"));
|
|
673
419
|
const ssm = config;
|
|
674
420
|
return SSMStateStore.create({
|
|
675
421
|
workspaceName,
|
|
@@ -679,7 +425,7 @@ async function createStateStore(options) {
|
|
|
679
425
|
}
|
|
680
426
|
if (config.provider === "s3") {
|
|
681
427
|
if (!workspaceName) throw new StateStoreNeedsWorkspaceName("s3");
|
|
682
|
-
const { S3StateStore } = await Promise.resolve().then(() => require("./S3StateStore-
|
|
428
|
+
const { S3StateStore } = await Promise.resolve().then(() => require("./S3StateStore-CoXBhILd.cjs"));
|
|
683
429
|
const s3 = config;
|
|
684
430
|
return S3StateStore.create({
|
|
685
431
|
workspaceName,
|
|
@@ -692,293 +438,12 @@ async function createStateStore(options) {
|
|
|
692
438
|
throw new UnknownStateProvider(config);
|
|
693
439
|
}
|
|
694
440
|
//#endregion
|
|
695
|
-
//#region src/
|
|
696
|
-
/**
|
|
697
|
-
* The run around a target: what every deploy does whatever it deploys
|
|
698
|
-
* through.
|
|
699
|
-
*
|
|
700
|
-
* It loads the workspace, resolves the target, works out the apps and the
|
|
701
|
-
* identity, takes the stage's lock, and calls the target's phases in order,
|
|
702
|
-
* reporting each as it starts, finishes or fails. Everything that is about
|
|
703
|
-
* *where* the stage goes is the target's.
|
|
704
|
-
*/
|
|
705
|
-
/** Apps were asked for by name that the workspace does not have. */
|
|
706
|
-
var UnknownDeployApps = class extends Error {
|
|
707
|
-
apps;
|
|
708
|
-
available;
|
|
709
|
-
constructor(apps, available) {
|
|
710
|
-
super(`Unknown apps: ${apps.join(", ")}\nAvailable apps: ${available.join(", ")}`);
|
|
711
|
-
this.apps = apps;
|
|
712
|
-
this.available = available;
|
|
713
|
-
this.name = "UnknownDeployApps";
|
|
714
|
-
}
|
|
715
|
-
};
|
|
716
|
-
/** Every app asked for deploys through some other target. */
|
|
717
|
-
var NoDeployableApps = class extends Error {
|
|
718
|
-
stage;
|
|
719
|
-
target;
|
|
720
|
-
constructor(stage, target) {
|
|
721
|
-
super(`No apps to deploy through "${target}": every selected app deploys somewhere else. Pick the target with --target, or set each app's deploy in gkm.config.ts.`);
|
|
722
|
-
this.stage = stage;
|
|
723
|
-
this.target = target;
|
|
724
|
-
this.name = "NoDeployableApps";
|
|
725
|
-
}
|
|
726
|
-
};
|
|
727
|
-
/** A failed rollback, after the failure that called for it. */
|
|
728
|
-
var RollbackFailed = class extends Error {
|
|
729
|
-
target;
|
|
730
|
-
failure;
|
|
731
|
-
constructor(target, failure, cause) {
|
|
732
|
-
super(`Deploying through "${target}" failed, and so did rolling it back: ${cause instanceof Error ? cause.message : String(cause)}. The stage may be part-released; deploy again, or roll it back by hand. The first failure: ${failure instanceof Error ? failure.message : String(failure)}`, { cause });
|
|
733
|
-
this.target = target;
|
|
734
|
-
this.failure = failure;
|
|
735
|
-
this.name = "RollbackFailed";
|
|
736
|
-
}
|
|
737
|
-
};
|
|
738
|
-
/**
|
|
739
|
-
* Generate image tag from stage and timestamp
|
|
740
|
-
*/
|
|
741
|
-
function generateTag(stage) {
|
|
742
|
-
return `${stage}-${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19)}`;
|
|
743
|
-
}
|
|
744
|
-
/** Why an app that deploys through another target is left out. */
|
|
745
|
-
function elsewhere(target, stage) {
|
|
746
|
-
const instead = require_define.builtinTarget(target)?.instead?.(stage);
|
|
747
|
-
if (instead) return `it deploys through "${target}" — ${instead}`;
|
|
748
|
-
return `it deploys through "${target}" — run \`gkm deploy --target ${target} --stage ${stage}\``;
|
|
749
|
-
}
|
|
750
|
-
/**
|
|
751
|
-
* Deploy a workspace's stage through its target.
|
|
752
|
-
*
|
|
753
|
-
* The engine under `deploy()` and `gkm deploy`. It never prompts and never
|
|
754
|
-
* exits: credentials come from `ctx.credentials`, progress goes to
|
|
755
|
-
* `ctx.emit` and to `output`, and every failure is thrown.
|
|
756
|
-
*
|
|
757
|
-
* @internal
|
|
758
|
-
*/
|
|
759
|
-
async function runDeploy(source, request, ctx) {
|
|
760
|
-
const { stage } = request;
|
|
761
|
-
const redactor = ctx.redactor ?? new Redactor();
|
|
762
|
-
const emit = (event) => ctx.emit(event.type === "log" ? {
|
|
763
|
-
...event,
|
|
764
|
-
message: redactor.redact(event.message)
|
|
765
|
-
} : event);
|
|
766
|
-
/** Run one phase between its events. */
|
|
767
|
-
const phase = async (name, body) => {
|
|
768
|
-
ctx.signal?.throwIfAborted();
|
|
769
|
-
emit({
|
|
770
|
-
type: "phase.started",
|
|
771
|
-
phase: name
|
|
772
|
-
});
|
|
773
|
-
try {
|
|
774
|
-
const value = await body();
|
|
775
|
-
emit({
|
|
776
|
-
type: "phase.finished",
|
|
777
|
-
phase: name
|
|
778
|
-
});
|
|
779
|
-
return value;
|
|
780
|
-
} catch (error) {
|
|
781
|
-
emit({
|
|
782
|
-
type: "phase.failed",
|
|
783
|
-
phase: name,
|
|
784
|
-
error: eventError(error)
|
|
785
|
-
});
|
|
786
|
-
throw error;
|
|
787
|
-
}
|
|
788
|
-
};
|
|
789
|
-
ctx.signal?.throwIfAborted();
|
|
790
|
-
emit({
|
|
791
|
-
type: "phase.started",
|
|
792
|
-
phase: "validate"
|
|
793
|
-
});
|
|
794
|
-
let prepared;
|
|
795
|
-
try {
|
|
796
|
-
prepared = await prepare(source, request, ctx, emit, redactor);
|
|
797
|
-
} catch (error) {
|
|
798
|
-
emit({
|
|
799
|
-
type: "phase.failed",
|
|
800
|
-
phase: "validate",
|
|
801
|
-
error: eventError(error)
|
|
802
|
-
});
|
|
803
|
-
throw error;
|
|
804
|
-
}
|
|
805
|
-
const { resolved, phaseCtx, store } = prepared;
|
|
806
|
-
const { target } = resolved;
|
|
807
|
-
if (ctx.dryRun) {
|
|
808
|
-
const run = await validate(target, phaseCtx, emit);
|
|
809
|
-
await phase("plan", () => target.plan(phaseCtx, run));
|
|
810
|
-
return target.result(phaseCtx, run);
|
|
811
|
-
}
|
|
812
|
-
let lock;
|
|
813
|
-
try {
|
|
814
|
-
lock = await store.lock(stage, { operation: "deploy" });
|
|
815
|
-
} catch (error) {
|
|
816
|
-
emit({
|
|
817
|
-
type: "phase.failed",
|
|
818
|
-
phase: "validate",
|
|
819
|
-
error: eventError(error)
|
|
820
|
-
});
|
|
821
|
-
throw error;
|
|
822
|
-
}
|
|
823
|
-
try {
|
|
824
|
-
const run = await validate(target, phaseCtx, emit);
|
|
825
|
-
if (target.provision) await phase("provision", () => target.provision(phaseCtx, run));
|
|
826
|
-
if (target.build) await phase("build", () => target.build(phaseCtx, run));
|
|
827
|
-
let releasing = "release";
|
|
828
|
-
try {
|
|
829
|
-
await phase("release", () => target.release(phaseCtx, run));
|
|
830
|
-
releasing = "verify";
|
|
831
|
-
if (target.verify) await phase("verify", () => target.verify(phaseCtx, run));
|
|
832
|
-
} catch (error) {
|
|
833
|
-
if (ctx.signal?.aborted || !target.capabilities.rollback) throw error;
|
|
834
|
-
if (!target.rollback) throw error;
|
|
835
|
-
try {
|
|
836
|
-
await phase("rollback", () => target.rollback(phaseCtx, run, {
|
|
837
|
-
phase: releasing,
|
|
838
|
-
error
|
|
839
|
-
}));
|
|
840
|
-
} catch (rollbackError) {
|
|
841
|
-
throw new RollbackFailed(resolved.name, error, rollbackError);
|
|
842
|
-
}
|
|
843
|
-
throw error;
|
|
844
|
-
}
|
|
845
|
-
return await target.result(phaseCtx, run);
|
|
846
|
-
} finally {
|
|
847
|
-
await lock.release();
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
/** `validate`, then the run's `deploy.started`, inside the validate phase. */
|
|
851
|
-
async function validate(target, phaseCtx, emit) {
|
|
852
|
-
try {
|
|
853
|
-
const run = await target.validate(phaseCtx);
|
|
854
|
-
const skipped = new Set(phaseCtx.skipped.map((s) => s.app));
|
|
855
|
-
emit({
|
|
856
|
-
type: "deploy.started",
|
|
857
|
-
stage: phaseCtx.stage,
|
|
858
|
-
target: phaseCtx.target,
|
|
859
|
-
identity: phaseCtx.identity.key,
|
|
860
|
-
tag: phaseCtx.tag,
|
|
861
|
-
apps: phaseCtx.apps.filter((app) => !skipped.has(app)),
|
|
862
|
-
dryRun: phaseCtx.dryRun
|
|
863
|
-
});
|
|
864
|
-
emit({
|
|
865
|
-
type: "phase.finished",
|
|
866
|
-
phase: "validate"
|
|
867
|
-
});
|
|
868
|
-
return run;
|
|
869
|
-
} catch (error) {
|
|
870
|
-
emit({
|
|
871
|
-
type: "phase.failed",
|
|
872
|
-
phase: "validate",
|
|
873
|
-
error: eventError(error)
|
|
874
|
-
});
|
|
875
|
-
throw error;
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
/** Everything the phases are handed, worked out before the first of them. */
|
|
879
|
-
async function prepare(source, request, ctx, emit, redactor) {
|
|
880
|
-
const { stage } = request;
|
|
881
|
-
const configured = typeof source === "function" ? await source() : source;
|
|
882
|
-
const local = stage === configured.stages.local;
|
|
883
|
-
if (!local) require_workspace.assertDeployedStage(configured.stages, stage);
|
|
884
|
-
const targetName = request.target ?? configured.deploy?.default ?? "dokploy";
|
|
885
|
-
const resolved = await require_resolve.resolveTarget(targetName, {
|
|
886
|
-
workspace: configured,
|
|
887
|
-
stage,
|
|
888
|
-
...ctx.targets ? { host: ctx.targets } : {}
|
|
889
|
-
});
|
|
890
|
-
if (local && !resolved.target.capabilities.localStage) require_workspace.assertDeployedStage(configured.stages, stage);
|
|
891
|
-
const options = await require_resolve.parseTargetOptions(resolved);
|
|
892
|
-
const manifest = await require_discover.discover({
|
|
893
|
-
patterns: require_state.constructGlobs(configured),
|
|
894
|
-
cwd: configured.root
|
|
895
|
-
});
|
|
896
|
-
const units = require_derive.derivedApps(manifest, configured);
|
|
897
|
-
const workspace = Object.keys(units).length > 0 ? {
|
|
898
|
-
...configured,
|
|
899
|
-
apps: units
|
|
900
|
-
} : configured;
|
|
901
|
-
const identity = require_store.deployIdentity(workspace, stage);
|
|
902
|
-
const tag = request.tag ?? (resolved.target.tag ? await resolved.target.tag({
|
|
903
|
-
cwd: workspace.root,
|
|
904
|
-
stage
|
|
905
|
-
}) : generateTag(stage));
|
|
906
|
-
const buildOrder = require_workspace.getAppBuildOrder(workspace);
|
|
907
|
-
let selected = buildOrder;
|
|
908
|
-
if (request.apps && request.apps.length > 0) {
|
|
909
|
-
const unknown = request.apps.filter((name) => !workspace.apps[name]);
|
|
910
|
-
if (unknown.length > 0) throw new UnknownDeployApps(unknown, Object.keys(workspace.apps));
|
|
911
|
-
selected = buildOrder.filter((name) => request.apps.includes(name));
|
|
912
|
-
}
|
|
913
|
-
const skipped = [];
|
|
914
|
-
const skip = (app, reason) => {
|
|
915
|
-
skipped.push({
|
|
916
|
-
app,
|
|
917
|
-
reason
|
|
918
|
-
});
|
|
919
|
-
emit({
|
|
920
|
-
type: "app.skipped",
|
|
921
|
-
app,
|
|
922
|
-
reason
|
|
923
|
-
});
|
|
924
|
-
};
|
|
925
|
-
const byDefault = configured.deploy?.default ?? "dokploy";
|
|
926
|
-
const apps = selected.filter((name) => {
|
|
927
|
-
const own = workspace.apps[name].resolvedDeployTarget;
|
|
928
|
-
const deploysThrough = own === byDefault ? targetName : own;
|
|
929
|
-
if (deploysThrough === targetName) return true;
|
|
930
|
-
skip(name, elsewhere(deploysThrough, stage));
|
|
931
|
-
return false;
|
|
932
|
-
});
|
|
933
|
-
if (apps.length === 0) throw new NoDeployableApps(stage, targetName);
|
|
934
|
-
const store = await createStateStore({
|
|
935
|
-
config: workspace.state,
|
|
936
|
-
workspaceRoot: workspace.root,
|
|
937
|
-
workspaceName: workspace.name
|
|
938
|
-
});
|
|
939
|
-
const secrets = await deploySecrets(workspace, stage, redactor, { ...ctx.home ? { home: ctx.home } : {} });
|
|
940
|
-
const line = (level) => (message) => emit({
|
|
941
|
-
type: "log",
|
|
942
|
-
level,
|
|
943
|
-
message
|
|
944
|
-
});
|
|
945
|
-
const logger = {
|
|
946
|
-
info: line("info"),
|
|
947
|
-
warn: line("warn"),
|
|
948
|
-
error: line("error")
|
|
949
|
-
};
|
|
950
|
-
return {
|
|
951
|
-
resolved,
|
|
952
|
-
phaseCtx: {
|
|
953
|
-
target: targetName,
|
|
954
|
-
cwd: workspace.root,
|
|
955
|
-
stage,
|
|
956
|
-
tag,
|
|
957
|
-
tagGiven: request.tag !== void 0,
|
|
958
|
-
apps,
|
|
959
|
-
skipped,
|
|
960
|
-
identity,
|
|
961
|
-
workspace,
|
|
962
|
-
manifest,
|
|
963
|
-
options,
|
|
964
|
-
dryRun: ctx.dryRun,
|
|
965
|
-
credentials: ctx.credentials,
|
|
966
|
-
state: store,
|
|
967
|
-
secrets,
|
|
968
|
-
logger,
|
|
969
|
-
signal: ctx.signal ?? new AbortController().signal,
|
|
970
|
-
childOutput: ctx.childOutput ?? "inherit",
|
|
971
|
-
emit,
|
|
972
|
-
skip,
|
|
973
|
-
name: (resource) => require_store.applicationName(identity, resource)
|
|
974
|
-
},
|
|
975
|
-
store
|
|
976
|
-
};
|
|
977
|
-
}
|
|
978
|
-
//#endregion
|
|
979
|
-
//#region src/deploy/dokploy-api.ts
|
|
441
|
+
//#region src/target/dokploy/dokploy-api.ts
|
|
980
442
|
var dokploy_api_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
|
|
443
|
+
DEFAULT_DEPLOYMENT_TIMEOUT_MS: () => DEFAULT_DEPLOYMENT_TIMEOUT_MS,
|
|
981
444
|
DEFAULT_DOKPLOY_TIMEOUT_MS: () => DEFAULT_DOKPLOY_TIMEOUT_MS,
|
|
445
|
+
DeploymentFailed: () => DeploymentFailed,
|
|
446
|
+
DeploymentTimedOut: () => DeploymentTimedOut,
|
|
982
447
|
DokployApi: () => DokployApi,
|
|
983
448
|
DokployApiError: () => DokployApiError,
|
|
984
449
|
DokployRequestTimedOut: () => DokployRequestTimedOut
|
|
@@ -1025,6 +490,32 @@ function pause(ms, signal) {
|
|
|
1025
490
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
1026
491
|
});
|
|
1027
492
|
}
|
|
493
|
+
/** How long a deployment may take to finish before a deploy gives up on it. */
|
|
494
|
+
const DEFAULT_DEPLOYMENT_TIMEOUT_MS = 6e5;
|
|
495
|
+
/** A deployment Dokploy ran and reported as failed. */
|
|
496
|
+
var DeploymentFailed = class extends Error {
|
|
497
|
+
applicationId;
|
|
498
|
+
deployment;
|
|
499
|
+
constructor(applicationId, deployment) {
|
|
500
|
+
super(`Dokploy's deployment ${deployment.deploymentId} of application ${applicationId} ended in "${deployment.status}"${deployment.errorMessage ? `: ${deployment.errorMessage}` : ""}. Its log in Dokploy says why — usually an image the server could not pull, or a container that exited on start.`);
|
|
501
|
+
this.applicationId = applicationId;
|
|
502
|
+
this.deployment = deployment;
|
|
503
|
+
this.name = "DeploymentFailed";
|
|
504
|
+
}
|
|
505
|
+
};
|
|
506
|
+
/** A deployment that had not finished when the deploy stopped waiting. */
|
|
507
|
+
var DeploymentTimedOut = class extends Error {
|
|
508
|
+
applicationId;
|
|
509
|
+
timeoutMs;
|
|
510
|
+
lastStatus;
|
|
511
|
+
constructor(applicationId, timeoutMs, lastStatus) {
|
|
512
|
+
super(`Application ${applicationId} did not finish deploying within ${Math.round(timeoutMs / 1e3)}s (${lastStatus ? `last status "${lastStatus}"` : "no deployment started"}). Check its deployment log in Dokploy, or raise deploy.dokploy.verify.deploymentTimeoutMs for an image that is slow to pull.`);
|
|
513
|
+
this.applicationId = applicationId;
|
|
514
|
+
this.timeoutMs = timeoutMs;
|
|
515
|
+
this.lastStatus = lastStatus;
|
|
516
|
+
this.name = "DeploymentTimedOut";
|
|
517
|
+
}
|
|
518
|
+
};
|
|
1028
519
|
var DokployApiError = class extends Error {
|
|
1029
520
|
status;
|
|
1030
521
|
statusText;
|
|
@@ -1332,6 +823,63 @@ var DokployApi = class {
|
|
|
1332
823
|
await this.post("application.deploy", { applicationId });
|
|
1333
824
|
}
|
|
1334
825
|
/**
|
|
826
|
+
* An application's deployments, newest first.
|
|
827
|
+
*
|
|
828
|
+
* Sorted here rather than trusted to arrive sorted: which deployment is
|
|
829
|
+
* the latest is the whole question `waitForDeployment` asks.
|
|
830
|
+
*/
|
|
831
|
+
async listDeployments(applicationId) {
|
|
832
|
+
return [...await this.get(`deployment.all?applicationId=${encodeURIComponent(applicationId)}`)].sort((a, b) => Date.parse(b.createdAt) - Date.parse(a.createdAt));
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
* When the application's latest deployment was created, by Dokploy's own
|
|
836
|
+
* clock — what `waitForDeployment`'s `since` is measured against. Epoch
|
|
837
|
+
* when it has none.
|
|
838
|
+
*/
|
|
839
|
+
async latestDeploymentAt(applicationId) {
|
|
840
|
+
const [latest] = await this.listDeployments(applicationId);
|
|
841
|
+
return new Date(latest ? Date.parse(latest.createdAt) : 0);
|
|
842
|
+
}
|
|
843
|
+
/**
|
|
844
|
+
* Wait for the deployment `application.deploy` queued to finish.
|
|
845
|
+
*
|
|
846
|
+
* `application.deploy` only queues one: it answers before the image is
|
|
847
|
+
* pulled, let alone running, so a deploy that stopped there reported
|
|
848
|
+
* success for containers that had not started. This polls the latest
|
|
849
|
+
* deployment created after `since` — Dokploy's clock, from
|
|
850
|
+
* `latestDeploymentAt` before deploying, so a laptop's skew cannot pick an
|
|
851
|
+
* older one — and the application's own status, backing off from
|
|
852
|
+
* `intervalMs` to `maxIntervalMs`.
|
|
853
|
+
*
|
|
854
|
+
* @throws {DeploymentFailed} when the deployment ends in `error` or is
|
|
855
|
+
* cancelled, or the application reports `error` once it has finished.
|
|
856
|
+
* @throws {DeploymentTimedOut} when it has not finished within `timeoutMs`.
|
|
857
|
+
*/
|
|
858
|
+
async waitForDeployment(applicationId, options) {
|
|
859
|
+
const { since, timeoutMs = DEFAULT_DEPLOYMENT_TIMEOUT_MS, signal, intervalMs = 2e3, maxIntervalMs = 15e3 } = options;
|
|
860
|
+
const after = since.getTime();
|
|
861
|
+
const deadline = Date.now() + timeoutMs;
|
|
862
|
+
let interval = intervalMs;
|
|
863
|
+
let last;
|
|
864
|
+
while (true) {
|
|
865
|
+
signal?.throwIfAborted();
|
|
866
|
+
const deployment = (await this.listDeployments(applicationId)).find((d) => Date.parse(d.createdAt) > after);
|
|
867
|
+
last = deployment ?? last;
|
|
868
|
+
if (deployment) {
|
|
869
|
+
if (deployment.status === "error" || deployment.status === "cancelled") throw new DeploymentFailed(applicationId, deployment);
|
|
870
|
+
if (deployment.status === "done") {
|
|
871
|
+
const { applicationStatus } = await this.get(`application.one?applicationId=${encodeURIComponent(applicationId)}`);
|
|
872
|
+
if (applicationStatus === "error") throw new DeploymentFailed(applicationId, deployment);
|
|
873
|
+
if (applicationStatus !== "running") return deployment;
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
const left = deadline - Date.now();
|
|
877
|
+
if (left <= 0) throw new DeploymentTimedOut(applicationId, timeoutMs, last?.status);
|
|
878
|
+
await pause(Math.min(interval, left), signal);
|
|
879
|
+
interval = Math.min(interval * 2, maxIntervalMs);
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
/**
|
|
1335
883
|
* Delete an application
|
|
1336
884
|
*/
|
|
1337
885
|
async deleteApplication(applicationId) {
|
|
@@ -2064,40 +1612,40 @@ async function sniffAllApps(apps, workspacePath, options = {}) {
|
|
|
2064
1612
|
return results;
|
|
2065
1613
|
}
|
|
2066
1614
|
//#endregion
|
|
2067
|
-
Object.defineProperty(exports, "
|
|
1615
|
+
Object.defineProperty(exports, "DEFAULT_DEPLOYMENT_TIMEOUT_MS", {
|
|
2068
1616
|
enumerable: true,
|
|
2069
1617
|
get: function() {
|
|
2070
|
-
return
|
|
1618
|
+
return DEFAULT_DEPLOYMENT_TIMEOUT_MS;
|
|
2071
1619
|
}
|
|
2072
1620
|
});
|
|
2073
|
-
Object.defineProperty(exports, "
|
|
1621
|
+
Object.defineProperty(exports, "DeploymentFailed", {
|
|
2074
1622
|
enumerable: true,
|
|
2075
1623
|
get: function() {
|
|
2076
|
-
return
|
|
1624
|
+
return DeploymentFailed;
|
|
2077
1625
|
}
|
|
2078
1626
|
});
|
|
2079
|
-
Object.defineProperty(exports, "
|
|
1627
|
+
Object.defineProperty(exports, "DeploymentTimedOut", {
|
|
2080
1628
|
enumerable: true,
|
|
2081
1629
|
get: function() {
|
|
2082
|
-
return
|
|
1630
|
+
return DeploymentTimedOut;
|
|
2083
1631
|
}
|
|
2084
1632
|
});
|
|
2085
|
-
Object.defineProperty(exports, "
|
|
1633
|
+
Object.defineProperty(exports, "DocumentStateStore", {
|
|
2086
1634
|
enumerable: true,
|
|
2087
1635
|
get: function() {
|
|
2088
|
-
return
|
|
1636
|
+
return DocumentStateStore;
|
|
2089
1637
|
}
|
|
2090
1638
|
});
|
|
2091
|
-
Object.defineProperty(exports, "
|
|
1639
|
+
Object.defineProperty(exports, "DokployApi", {
|
|
2092
1640
|
enumerable: true,
|
|
2093
1641
|
get: function() {
|
|
2094
|
-
return
|
|
1642
|
+
return DokployApi;
|
|
2095
1643
|
}
|
|
2096
1644
|
});
|
|
2097
|
-
Object.defineProperty(exports, "
|
|
1645
|
+
Object.defineProperty(exports, "DokployApiError", {
|
|
2098
1646
|
enumerable: true,
|
|
2099
1647
|
get: function() {
|
|
2100
|
-
return
|
|
1648
|
+
return DokployApiError;
|
|
2101
1649
|
}
|
|
2102
1650
|
});
|
|
2103
1651
|
Object.defineProperty(exports, "StageStateMissing", {
|
|
@@ -2130,18 +1678,6 @@ Object.defineProperty(exports, "StateVersionConflict", {
|
|
|
2130
1678
|
return StateVersionConflict;
|
|
2131
1679
|
}
|
|
2132
1680
|
});
|
|
2133
|
-
Object.defineProperty(exports, "UnknownDeployApps", {
|
|
2134
|
-
enumerable: true,
|
|
2135
|
-
get: function() {
|
|
2136
|
-
return UnknownDeployApps;
|
|
2137
|
-
}
|
|
2138
|
-
});
|
|
2139
|
-
Object.defineProperty(exports, "canPrompt", {
|
|
2140
|
-
enumerable: true,
|
|
2141
|
-
get: function() {
|
|
2142
|
-
return canPrompt;
|
|
2143
|
-
}
|
|
2144
|
-
});
|
|
2145
1681
|
Object.defineProperty(exports, "contentVersion", {
|
|
2146
1682
|
enumerable: true,
|
|
2147
1683
|
get: function() {
|
|
@@ -2154,6 +1690,12 @@ Object.defineProperty(exports, "createStateStore", {
|
|
|
2154
1690
|
return createStateStore;
|
|
2155
1691
|
}
|
|
2156
1692
|
});
|
|
1693
|
+
Object.defineProperty(exports, "dokploy_api_exports", {
|
|
1694
|
+
enumerable: true,
|
|
1695
|
+
get: function() {
|
|
1696
|
+
return dokploy_api_exports;
|
|
1697
|
+
}
|
|
1698
|
+
});
|
|
2157
1699
|
Object.defineProperty(exports, "encryptSecrets", {
|
|
2158
1700
|
enumerable: true,
|
|
2159
1701
|
get: function() {
|
|
@@ -2178,36 +1720,12 @@ Object.defineProperty(exports, "keyFingerprint", {
|
|
|
2178
1720
|
return keyFingerprint;
|
|
2179
1721
|
}
|
|
2180
1722
|
});
|
|
2181
|
-
Object.defineProperty(exports, "loginCommand", {
|
|
2182
|
-
enumerable: true,
|
|
2183
|
-
get: function() {
|
|
2184
|
-
return loginCommand;
|
|
2185
|
-
}
|
|
2186
|
-
});
|
|
2187
|
-
Object.defineProperty(exports, "logoutCommand", {
|
|
2188
|
-
enumerable: true,
|
|
2189
|
-
get: function() {
|
|
2190
|
-
return logoutCommand;
|
|
2191
|
-
}
|
|
2192
|
-
});
|
|
2193
1723
|
Object.defineProperty(exports, "newLockHolder", {
|
|
2194
1724
|
enumerable: true,
|
|
2195
1725
|
get: function() {
|
|
2196
1726
|
return newLockHolder;
|
|
2197
1727
|
}
|
|
2198
1728
|
});
|
|
2199
|
-
Object.defineProperty(exports, "prompt", {
|
|
2200
|
-
enumerable: true,
|
|
2201
|
-
get: function() {
|
|
2202
|
-
return prompt;
|
|
2203
|
-
}
|
|
2204
|
-
});
|
|
2205
|
-
Object.defineProperty(exports, "runDeploy", {
|
|
2206
|
-
enumerable: true,
|
|
2207
|
-
get: function() {
|
|
2208
|
-
return runDeploy;
|
|
2209
|
-
}
|
|
2210
|
-
});
|
|
2211
1729
|
Object.defineProperty(exports, "sniffAllApps", {
|
|
2212
1730
|
enumerable: true,
|
|
2213
1731
|
get: function() {
|
|
@@ -2220,17 +1738,5 @@ Object.defineProperty(exports, "sniffAppEnvironment", {
|
|
|
2220
1738
|
return sniffAppEnvironment;
|
|
2221
1739
|
}
|
|
2222
1740
|
});
|
|
2223
|
-
Object.defineProperty(exports, "validateDokployToken", {
|
|
2224
|
-
enumerable: true,
|
|
2225
|
-
get: function() {
|
|
2226
|
-
return validateDokployToken;
|
|
2227
|
-
}
|
|
2228
|
-
});
|
|
2229
|
-
Object.defineProperty(exports, "whoamiCommand", {
|
|
2230
|
-
enumerable: true,
|
|
2231
|
-
get: function() {
|
|
2232
|
-
return whoamiCommand;
|
|
2233
|
-
}
|
|
2234
|
-
});
|
|
2235
1741
|
|
|
2236
|
-
//# sourceMappingURL=sniffer-
|
|
1742
|
+
//# sourceMappingURL=sniffer-5xmrkh2a.cjs.map
|