@geekmidas/cli 10.0.0-alpha.66 → 10.0.0-alpha.67

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.
Files changed (114) hide show
  1. package/README.md +110 -178
  2. package/dist/{HostingerProvider-CY_VpVud.mjs → HostingerProvider-D85ayzTi.mjs} +2 -2
  3. package/dist/{HostingerProvider-CY_VpVud.mjs.map → HostingerProvider-D85ayzTi.mjs.map} +1 -1
  4. package/dist/{HostingerProvider-BznqRC2S.cjs → HostingerProvider-dxkwynSs.cjs} +2 -2
  5. package/dist/{HostingerProvider-BznqRC2S.cjs.map → HostingerProvider-dxkwynSs.cjs.map} +1 -1
  6. package/dist/{LegacyStateStore-BFcTT2QL.cjs → LegacyStateStore-BZiO9-Lw.cjs} +2 -2
  7. package/dist/{LegacyStateStore-BFcTT2QL.cjs.map → LegacyStateStore-BZiO9-Lw.cjs.map} +1 -1
  8. package/dist/{LegacyStateStore-CFheFo62.mjs → LegacyStateStore-C39UKwmf.mjs} +2 -2
  9. package/dist/{LegacyStateStore-CFheFo62.mjs.map → LegacyStateStore-C39UKwmf.mjs.map} +1 -1
  10. package/dist/{LocalStateStore-BVUexSvu.cjs → LocalStateStore-DHVsZLyF.cjs} +2 -2
  11. package/dist/{LocalStateStore-BVUexSvu.cjs.map → LocalStateStore-DHVsZLyF.cjs.map} +1 -1
  12. package/dist/{LocalStateStore-Bm3x9oOg.mjs → LocalStateStore-Dk3Wbvzk.mjs} +2 -2
  13. package/dist/{LocalStateStore-Bm3x9oOg.mjs.map → LocalStateStore-Dk3Wbvzk.mjs.map} +1 -1
  14. package/dist/{S3StateStore-CoXBhILd.cjs → S3StateStore--4tYVMAL.cjs} +2 -2
  15. package/dist/{S3StateStore-CoXBhILd.cjs.map → S3StateStore--4tYVMAL.cjs.map} +1 -1
  16. package/dist/{S3StateStore-BFHuctWM.mjs → S3StateStore-B_ZF9eHt.mjs} +2 -2
  17. package/dist/{S3StateStore-BFHuctWM.mjs.map → S3StateStore-B_ZF9eHt.mjs.map} +1 -1
  18. package/dist/{SSMStateStore-BqCA9TP2.cjs → SSMStateStore-ACZ8hRvZ.cjs} +2 -2
  19. package/dist/{SSMStateStore-BqCA9TP2.cjs.map → SSMStateStore-ACZ8hRvZ.cjs.map} +1 -1
  20. package/dist/{SSMStateStore-C1kvHScY.mjs → SSMStateStore-DjPuKqrm.mjs} +2 -2
  21. package/dist/{SSMStateStore-C1kvHScY.mjs.map → SSMStateStore-DjPuKqrm.mjs.map} +1 -1
  22. package/dist/{bundler-Dvaiud0h.mjs → bundler-Bq3HaLOZ.mjs} +20 -5
  23. package/dist/bundler-Bq3HaLOZ.mjs.map +1 -0
  24. package/dist/{bundler-orRqUJNZ.cjs → bundler-pyLj-gS0.cjs} +20 -5
  25. package/dist/bundler-pyLj-gS0.cjs.map +1 -0
  26. package/dist/{cli-CfHm0AO7.mjs → cli-C2Tjbn27.mjs} +4 -4
  27. package/dist/{cli-CfHm0AO7.mjs.map → cli-C2Tjbn27.mjs.map} +1 -1
  28. package/dist/{cli-D1JkkOwg.cjs → cli-DR7B2_fX.cjs} +4 -4
  29. package/dist/{cli-D1JkkOwg.cjs.map → cli-DR7B2_fX.cjs.map} +1 -1
  30. package/dist/{compose-jrLy7KGO.cjs → compose-5oNHAKNT.cjs} +135 -110
  31. package/dist/compose-5oNHAKNT.cjs.map +1 -0
  32. package/dist/{compose-CNQL8BnO.mjs → compose-BjToENzG.mjs} +128 -103
  33. package/dist/compose-BjToENzG.mjs.map +1 -0
  34. package/dist/{credentials-Bzbg23n8.cjs → credentials-BVs7mrtw.cjs} +239 -3
  35. package/dist/credentials-BVs7mrtw.cjs.map +1 -0
  36. package/dist/{credentials-Dq1MnWQf.mjs → credentials-pAtB70k3.mjs} +223 -5
  37. package/dist/credentials-pAtB70k3.mjs.map +1 -0
  38. package/dist/deploy/public.cjs +17 -17
  39. package/dist/deploy/public.cjs.map +1 -1
  40. package/dist/deploy/public.mjs +9 -9
  41. package/dist/{deploy-B7aJi_Ah.cjs → deploy-BucRfbvX.cjs} +9 -9
  42. package/dist/{deploy-B7aJi_Ah.cjs.map → deploy-BucRfbvX.cjs.map} +1 -1
  43. package/dist/{deploy-DWn7YfIc.mjs → deploy-DRAwTG72.mjs} +6 -6
  44. package/dist/{deploy-DWn7YfIc.mjs.map → deploy-DRAwTG72.mjs.map} +1 -1
  45. package/dist/{dokploy-DalwLML5.mjs → dokploy-DIt1IZl1.mjs} +2 -2
  46. package/dist/{dokploy-DalwLML5.mjs.map → dokploy-DIt1IZl1.mjs.map} +1 -1
  47. package/dist/{dokploy-B4LcYG1E.cjs → dokploy-m345Zx02.cjs} +2 -2
  48. package/dist/{dokploy-B4LcYG1E.cjs.map → dokploy-m345Zx02.cjs.map} +1 -1
  49. package/dist/{encryption-CPfENwWO.mjs → encryption-Ccbahik7.mjs} +2 -2
  50. package/dist/{encryption-CPfENwWO.mjs.map → encryption-Ccbahik7.mjs.map} +1 -1
  51. package/dist/{encryption-3KlGS1sl.cjs → encryption-rZ3BghXy.cjs} +2 -2
  52. package/dist/{encryption-3KlGS1sl.cjs.map → encryption-rZ3BghXy.cjs.map} +1 -1
  53. package/dist/{engine-DR6KurWX.cjs → engine-Cx_dvx9q.cjs} +9 -187
  54. package/dist/engine-Cx_dvx9q.cjs.map +1 -0
  55. package/dist/{engine-CunvOG3s.mjs → engine-Gs0abjuj.mjs} +5 -183
  56. package/dist/engine-Gs0abjuj.mjs.map +1 -0
  57. package/dist/{github-MXA9v7Ge.mjs → github-CJANTYqi.mjs} +2 -2
  58. package/dist/{github-MXA9v7Ge.mjs.map → github-CJANTYqi.mjs.map} +1 -1
  59. package/dist/{github-BJ5gh9bw.cjs → github-CrcGFkfD.cjs} +2 -2
  60. package/dist/{github-BJ5gh9bw.cjs.map → github-CrcGFkfD.cjs.map} +1 -1
  61. package/dist/index.cjs +51 -65
  62. package/dist/index.cjs.map +1 -1
  63. package/dist/index.mjs +47 -61
  64. package/dist/index.mjs.map +1 -1
  65. package/dist/{migrate-CF4J4GQS.cjs → migrate-CQdSpttI.cjs} +2 -2
  66. package/dist/{migrate-CF4J4GQS.cjs.map → migrate-CQdSpttI.cjs.map} +1 -1
  67. package/dist/{migrate-BJBcm4sG.mjs → migrate-DCVo5gLS.mjs} +2 -2
  68. package/dist/{migrate-BJBcm4sG.mjs.map → migrate-DCVo5gLS.mjs.map} +1 -1
  69. package/dist/{resolve-CVmch0wI.cjs → resolve-BexmDcsN.cjs} +4 -4
  70. package/dist/{resolve-CVmch0wI.cjs.map → resolve-BexmDcsN.cjs.map} +1 -1
  71. package/dist/{resolve-Db0tNlrW.mjs → resolve-DhZgtvZe.mjs} +4 -4
  72. package/dist/{resolve-Db0tNlrW.mjs.map → resolve-DhZgtvZe.mjs.map} +1 -1
  73. package/dist/{rollback-DxJK84hy.cjs → rollback-BnY7KuG_.cjs} +6 -7
  74. package/dist/{rollback-DxJK84hy.cjs.map → rollback-BnY7KuG_.cjs.map} +1 -1
  75. package/dist/{rollback-DvAo4OKS.mjs → rollback-m4Yeym5x.mjs} +5 -6
  76. package/dist/{rollback-DvAo4OKS.mjs.map → rollback-m4Yeym5x.mjs.map} +1 -1
  77. package/dist/run-BJLIerMM.mjs +133 -0
  78. package/dist/run-BJLIerMM.mjs.map +1 -0
  79. package/dist/run-fVZ-rLnc.cjs +174 -0
  80. package/dist/run-fVZ-rLnc.cjs.map +1 -0
  81. package/dist/{sniffer-BAQhLEsI.mjs → sniffer-BdFeLSmA.mjs} +8 -60
  82. package/dist/sniffer-BdFeLSmA.mjs.map +1 -0
  83. package/dist/{sniffer-5xmrkh2a.cjs → sniffer-D66HIvi9.cjs} +7 -77
  84. package/dist/{sniffer-5xmrkh2a.cjs.map → sniffer-D66HIvi9.cjs.map} +1 -1
  85. package/dist/{sst-B2HbrDR3.mjs → sst-DRi3H5TB.mjs} +3 -3
  86. package/dist/{sst-B2HbrDR3.mjs.map → sst-DRi3H5TB.mjs.map} +1 -1
  87. package/dist/{sst-DcfsVH6x.cjs → sst-hBrKouBy.cjs} +5 -5
  88. package/dist/{sst-DcfsVH6x.cjs.map → sst-hBrKouBy.cjs.map} +1 -1
  89. package/dist/{state-Y6ATakMX.cjs → state-DgmM4EKq.cjs} +3588 -3415
  90. package/dist/state-DgmM4EKq.cjs.map +1 -0
  91. package/dist/{state-uuYqnRVO.mjs → state-DkUStoqJ.mjs} +3528 -3385
  92. package/dist/state-DkUStoqJ.mjs.map +1 -0
  93. package/dist/target/public.cjs +1 -1
  94. package/dist/target/public.mjs +1 -1
  95. package/dist/{terminal-DUhcZ1ND.mjs → terminal-C3cv-OQu.mjs} +2 -2
  96. package/dist/{terminal-DUhcZ1ND.mjs.map → terminal-C3cv-OQu.mjs.map} +1 -1
  97. package/dist/{terminal-CHy_MdjG.cjs → terminal-DjzgLu6m.cjs} +2 -2
  98. package/dist/{terminal-CHy_MdjG.cjs.map → terminal-DjzgLu6m.cjs.map} +1 -1
  99. package/package.json +13 -13
  100. package/dist/bundler-Dvaiud0h.mjs.map +0 -1
  101. package/dist/bundler-orRqUJNZ.cjs.map +0 -1
  102. package/dist/compose-CNQL8BnO.mjs.map +0 -1
  103. package/dist/compose-jrLy7KGO.cjs.map +0 -1
  104. package/dist/credentials-Bzbg23n8.cjs.map +0 -1
  105. package/dist/credentials-Dq1MnWQf.mjs.map +0 -1
  106. package/dist/engine-CunvOG3s.mjs.map +0 -1
  107. package/dist/engine-DR6KurWX.cjs.map +0 -1
  108. package/dist/local-BdH4XN0E.cjs +0 -409
  109. package/dist/local-BdH4XN0E.cjs.map +0 -1
  110. package/dist/local-CWR4Y_kW.mjs +0 -350
  111. package/dist/local-CWR4Y_kW.mjs.map +0 -1
  112. package/dist/sniffer-BAQhLEsI.mjs.map +0 -1
  113. package/dist/state-Y6ATakMX.cjs.map +0 -1
  114. package/dist/state-uuYqnRVO.mjs.map +0 -1
@@ -1,197 +1,19 @@
1
- import { c as runOutput, s as run, t as LocalSandbox } from "./local-CWR4Y_kW.mjs";
2
- import { t as MissingCredential } from "./credentials-Dq1MnWQf.mjs";
1
+ import { i as LocalSandbox, t as MissingCredential } from "./credentials-pAtB70k3.mjs";
3
2
  import { a as discriminatedUnion, d as string, l as object, n as array, o as literal, s as looseObject } from "./schemas-Cfhtpdo0.mjs";
4
3
  import { c as runWorker, d as output, r as discover } from "./discover-BFoJWKGD.mjs";
5
4
  import { i as activeSandbox } from "./sandbox-Dm247NGx.mjs";
6
5
  import { t as appKey } from "./derive-B4vDpzgP.mjs";
7
6
  import { g as stripPublicPrefix, h as getPublicEnvPrefix, s as getAppBuildOrder } from "./workspace-Be6uBhlF.mjs";
8
- import { C as validateImageRef, Ct as markerOf, Et as initStageSecrets, J as cacheBackendFor, K as resourceName, O as constructGlobs, P as applyPostgres, St as isOwnedBy, T as resolveHost, Tt as projectName, V as dockerfileOf, X as providerOf, Y as eventsBackendFor, Z as storageBackendFor, a as recordRelease, bt as imageName, c as setBackupState, d as setGeneratedSecret, f as setPostgresBackupId, g as DockerPushFailed, h as DockerBuildFailed, i as isDnsVerified, kt as toEmbeddableSecrets, l as setDnsRecord, m as withGeneratedSecrets, n as getBackupState, o as recordRollback, p as DeployJournal, r as getGeneratedSecret, s as setApplicationId, t as createEmptyState, u as setDnsVerification, v as dockerCommand, vt as applicationName, w as isMainFrontendApp, wt as ownershipMarker, xt as imageRef } from "./state-uuYqnRVO.mjs";
9
- import { f as StateStoreBusy, m as StateVersionConflict, o as DokployApi, s as DokployApiError, t as sniffAllApps, v as eventError, x as keyFingerprint, y as encryptSecrets } from "./sniffer-BAQhLEsI.mjs";
7
+ import { $ as cacheBackendFor, At as projectName, C as resolveHost, Ct as applicationName, Dt as isOwnedBy, Et as imageRef, F as applyPostgres, K as resourceName, Ot as markerOf, Pt as toEmbeddableSecrets, S as isMainFrontendApp, Tt as imageName, _ as deployDocker, a as recordRelease, c as setBackupState, d as setGeneratedSecret, et as eventsBackendFor, f as setPostgresBackupId, i as isDnsVerified, jt as initStageSecrets, k as constructGlobs, kt as ownershipMarker, l as setDnsRecord, m as withGeneratedSecrets, n as getBackupState, nt as storageBackendFor, o as recordRollback, p as DeployJournal, r as getGeneratedSecret, s as setApplicationId, t as createEmptyState, tt as providerOf, u as setDnsVerification, w as encryptSecrets } from "./state-DkUStoqJ.mjs";
8
+ import { f as StateStoreBusy, m as StateVersionConflict, o as DokployApi, s as DokployApiError, t as sniffAllApps, v as eventError } from "./sniffer-BdFeLSmA.mjs";
10
9
  import { o as migrationFiles } from "./provider-D7rQzzzf.mjs";
11
10
  import { join } from "node:path";
12
- import { chmod, mkdtemp, rm, writeFile } from "node:fs/promises";
13
- import { tmpdir } from "node:os";
14
11
  import { cacheTable, cloudName, cookieDomain, dependentsOf, externalApiUrl, migrationTargets, mobileOrigins, provideKey, provisionOrder, schemeBase } from "@geekmidas/manifest";
15
12
  import { createHash, randomBytes } from "node:crypto";
16
13
  import { ownerRole, readerRole, roleStatements } from "@geekmidas/db/pg/roles";
17
14
  import { Client } from "pg";
18
15
  import { cacheTableStatements } from "@geekmidas/cache/postgres";
19
16
  import { lookup } from "node:dns/promises";
20
- //#region src/deploy/docker.ts
21
- const logger$3 = output;
22
- /**
23
- * The id the Dockerfile templates mount the encrypted credentials under:
24
- * `RUN --mount=type=secret,id=gkm_credentials`.
25
- */
26
- const CREDENTIALS_SECRET_ID = "gkm_credentials";
27
- /**
28
- * Get the full image reference
29
- */
30
- function getImageRef(registry, imageName, tag) {
31
- if (registry) return `${registry}/${imageName}:${tag}`;
32
- return `${imageName}:${tag}`;
33
- }
34
- /**
35
- * The `docker build` argv for an image.
36
- *
37
- * One element per value, so nothing in a ref or a build arg is read by a
38
- * shell, and `--opt=value` rather than `--opt value`, so a value that starts
39
- * with `-` cannot be taken for one of docker's own flags.
40
- *
41
- * @internal Exported for testing
42
- */
43
- function dockerBuildArgs(options) {
44
- const { dockerfilePath, imageRef, buildArgs = [], credentialsFile } = options;
45
- return [
46
- "build",
47
- "--platform=linux/amd64",
48
- `--file=${dockerfilePath}`,
49
- `--tag=${imageRef}`,
50
- ...buildArgs.map((arg) => `--build-arg=${arg}`),
51
- ...credentialsFile ? [`--secret=id=${CREDENTIALS_SECRET_ID},src=${credentialsFile}`] : [],
52
- "."
53
- ];
54
- }
55
- /**
56
- * Write the encrypted credentials where `docker build --secret` reads them.
57
- *
58
- * Two lines — ciphertext, then IV — so a template can split them with `sed`
59
- * in any base image. Owner-only, in a directory of its own, and the returned
60
- * cleanup removes both whatever the build did.
61
- *
62
- * @internal Exported for testing
63
- */
64
- async function writeCredentialsFile(credentials) {
65
- const dir = await mkdtemp(join(tmpdir(), "gkm-credentials-"));
66
- const path = join(dir, CREDENTIALS_SECRET_ID);
67
- await writeFile(path, `${credentials.encrypted}\n${credentials.iv}\n`, { mode: 384 });
68
- await chmod(path, 384);
69
- return {
70
- path,
71
- cleanup: () => rm(dir, {
72
- recursive: true,
73
- force: true
74
- })
75
- };
76
- }
77
- /**
78
- * Build Docker image
79
- * @param imageRef - Full image reference (registry/name:tag)
80
- * @param buildArgs - Build arguments to pass to docker build
81
- * @param credentials - Encrypted credentials, passed as a build secret
82
- */
83
- async function buildImage(imageRef, buildArgs, credentials, { cwd, dockerfile, signal, stdio }) {
84
- logger$3.log(`\n🔨 Building Docker image: ${imageRef}`);
85
- logger$3.log(" Generating Dockerfile...");
86
- await dockerCommand({
87
- slim: true,
88
- cwd
89
- });
90
- const dockerfilePath = dockerfile;
91
- const secret = credentials ? await writeCredentialsFile(credentials) : void 0;
92
- try {
93
- await run("docker", dockerBuildArgs({
94
- dockerfilePath,
95
- imageRef,
96
- buildArgs,
97
- credentialsFile: secret?.path
98
- }), {
99
- cwd,
100
- env: {
101
- ...process.env,
102
- DOCKER_BUILDKIT: "1"
103
- },
104
- ...signal ? { signal } : {},
105
- ...stdio ? { stdio } : {}
106
- });
107
- logger$3.log(`✅ Image built: ${imageRef}`);
108
- } catch (error) {
109
- throw new DockerBuildFailed(imageRef, error);
110
- } finally {
111
- await secret?.cleanup();
112
- }
113
- }
114
- /**
115
- * Push Docker image to registry
116
- */
117
- async function pushImage(imageRef, { cwd, signal, stdio }) {
118
- logger$3.log(`\n☁️ Pushing image: ${imageRef}`);
119
- try {
120
- await run("docker", ["push", imageRef], {
121
- cwd,
122
- ...signal ? { signal } : {},
123
- ...stdio ? { stdio } : {}
124
- });
125
- logger$3.log(`✅ Image pushed: ${imageRef}`);
126
- } catch (error) {
127
- throw new DockerPushFailed(imageRef, error);
128
- }
129
- }
130
- /**
131
- * The digest the registry gave a pushed image, `sha256:…`.
132
- *
133
- * A tag can be pushed over — by the next deploy, or by anything else that
134
- * shares the repository — and the digest is what says which image a stage
135
- * actually ran. `RepoDigests` has one entry per repository the image was
136
- * pushed to, so the one for this ref's repository is picked by name.
137
- *
138
- * @internal Exported for testing
139
- */
140
- async function pushedDigest(imageRef, { cwd, signal } = { cwd: process.cwd() }) {
141
- const repository = imageRef.split("@")[0].replace(/:[\w][\w.-]*$/, "");
142
- const output = await runOutput("docker", [
143
- "image",
144
- "inspect",
145
- "--format={{json .RepoDigests}}",
146
- imageRef
147
- ], {
148
- cwd,
149
- ...signal ? { signal } : {}
150
- });
151
- let digests;
152
- try {
153
- digests = JSON.parse(output.trim() || "[]");
154
- } catch {
155
- return;
156
- }
157
- if (!Array.isArray(digests)) return void 0;
158
- return digests.find((entry) => typeof entry === "string" && entry.startsWith(`${repository}@`))?.slice(repository.length + 1);
159
- }
160
- /**
161
- * Deploy using Docker (build and optionally push image)
162
- */
163
- async function deployDocker(options) {
164
- const { stage, tag, skipPush, masterKey, config, buildArgs, credentials } = options;
165
- const imageName = config.imageName;
166
- const imageRef = validateImageRef(getImageRef(config.registry, imageName, tag));
167
- const cwd = options.cwd ?? process.cwd();
168
- const docker = {
169
- cwd,
170
- dockerfile: join(cwd, dockerfileOf(config.appName ?? imageName, options.appPath ?? ".")),
171
- ...options.signal ? { signal: options.signal } : {},
172
- ...options.stdio ? { stdio: options.stdio } : {}
173
- };
174
- await buildImage(imageRef, buildArgs, credentials, docker);
175
- let digest;
176
- if (!skipPush) {
177
- if (!config.registry) logger$3.warn("\n⚠️ No registry configured. Use --skip-push or configure docker.registry in gkm.config.ts");
178
- else {
179
- await pushImage(imageRef, docker);
180
- digest = await pushedDigest(imageRef, docker);
181
- }
182
- }
183
- logger$3.log("\n✅ Docker deployment ready!");
184
- logger$3.log(`\n📋 Deployment details:`);
185
- logger$3.log(` Image: ${imageRef}`);
186
- logger$3.log(` Stage: ${stage}`);
187
- if (masterKey) logger$3.log(`\n🔐 Run the container with GKM_MASTER_KEY set to the key with fingerprint ${keyFingerprint(masterKey)}.`);
188
- return {
189
- imageRef,
190
- ...digest ? { digest } : {},
191
- masterKey
192
- };
193
- }
194
- //#endregion
195
17
  //#region src/deploy/ownership.ts
196
18
  /**
197
19
  * Which Dokploy project a deploy is allowed to deploy into.
@@ -1273,7 +1095,7 @@ async function createDnsProvider(options) {
1273
1095
  if (isDnsProvider(config.provider)) return config.provider;
1274
1096
  const provider = config.provider;
1275
1097
  if (provider === "hostinger") {
1276
- const { HostingerProvider } = await import("./HostingerProvider-CY_VpVud.mjs");
1098
+ const { HostingerProvider } = await import("./HostingerProvider-D85ayzTi.mjs");
1277
1099
  return new HostingerProvider();
1278
1100
  }
1279
1101
  if (provider === "route53") {
@@ -3163,4 +2985,4 @@ const MOBILE_SKIP_REASON = "deploys via its framework toolchain";
3163
2985
  //#endregion
3164
2986
  export { RegistryNotConfigured as _, dokployResult as a, releaseDokploy as c, validateDokploy as d, verifyDokploy as f, RegistryAmbiguous as g, HealthCheckTimedOut as h, dokployApi as i, restoreImage as l, DeployMigrationsFailed as m, FrontendDeployFailed as n, planDokploy as o, verifySettings as p, MissingEnvVars as r, provisionDokploy as s, BackendDeployFailed as t, rollbackDokploy as u, RegistryNotFound as v, ProjectNotOwned as y };
3165
2987
 
3166
- //# sourceMappingURL=engine-CunvOG3s.mjs.map
2988
+ //# sourceMappingURL=engine-Gs0abjuj.mjs.map