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

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 (101) hide show
  1. package/dist/{bundler-Bq3HaLOZ.mjs → bundler-C-w7aGoZ.mjs} +5 -5
  2. package/dist/{bundler-Bq3HaLOZ.mjs.map → bundler-C-w7aGoZ.mjs.map} +1 -1
  3. package/dist/{bundler-pyLj-gS0.cjs → bundler-C1pnNrR0.cjs} +5 -5
  4. package/dist/{bundler-pyLj-gS0.cjs.map → bundler-C1pnNrR0.cjs.map} +1 -1
  5. package/dist/{cli-DR7B2_fX.cjs → cli-BLyD4c0O.cjs} +12 -3
  6. package/dist/cli-BLyD4c0O.cjs.map +1 -0
  7. package/dist/{cli-C2Tjbn27.mjs → cli-Ce4pLL5O.mjs} +12 -3
  8. package/dist/cli-Ce4pLL5O.mjs.map +1 -0
  9. package/dist/{compose-BjToENzG.mjs → compose-DFxuYhn6.mjs} +165 -51
  10. package/dist/compose-DFxuYhn6.mjs.map +1 -0
  11. package/dist/{compose-5oNHAKNT.cjs → compose-DvsgumY2.cjs} +165 -51
  12. package/dist/compose-DvsgumY2.cjs.map +1 -0
  13. package/dist/{config-4XFxX1al.d.cts → config-BnA0kPTY.d.cts} +3 -3
  14. package/dist/{config-4XFxX1al.d.cts.map → config-BnA0kPTY.d.cts.map} +1 -1
  15. package/dist/{config-UtKzhpFb.d.mts → config-CxEp_g7j.d.mts} +3 -3
  16. package/dist/{config-UtKzhpFb.d.mts.map → config-CxEp_g7j.d.mts.map} +1 -1
  17. package/dist/config.d.cts +3 -3
  18. package/dist/config.d.mts +3 -3
  19. package/dist/deploy/public.cjs +9 -5
  20. package/dist/deploy/public.d.cts +15 -4
  21. package/dist/deploy/public.d.cts.map +1 -1
  22. package/dist/deploy/public.d.mts +15 -4
  23. package/dist/deploy/public.d.mts.map +1 -1
  24. package/dist/deploy/public.mjs +6 -6
  25. package/dist/{deploy-BucRfbvX.cjs → deploy-C08GONYW.cjs} +8 -4
  26. package/dist/deploy-C08GONYW.cjs.map +1 -0
  27. package/dist/{deploy-DRAwTG72.mjs → deploy-D-EVOWvu.mjs} +8 -4
  28. package/dist/deploy-D-EVOWvu.mjs.map +1 -0
  29. package/dist/{dokploy-m345Zx02.cjs → dokploy-CZ6nfSV9.cjs} +2 -2
  30. package/dist/{dokploy-m345Zx02.cjs.map → dokploy-CZ6nfSV9.cjs.map} +1 -1
  31. package/dist/{dokploy-DIt1IZl1.mjs → dokploy-DU-XJsoT.mjs} +2 -2
  32. package/dist/{dokploy-DIt1IZl1.mjs.map → dokploy-DU-XJsoT.mjs.map} +1 -1
  33. package/dist/{encryption-rZ3BghXy.cjs → encryption-CCcBSLZs.cjs} +2 -2
  34. package/dist/{encryption-rZ3BghXy.cjs.map → encryption-CCcBSLZs.cjs.map} +1 -1
  35. package/dist/{encryption-Ccbahik7.mjs → encryption-DSiLau1-.mjs} +2 -2
  36. package/dist/{encryption-Ccbahik7.mjs.map → encryption-DSiLau1-.mjs.map} +1 -1
  37. package/dist/{engine-Cx_dvx9q.cjs → engine-BM9Dy_DT.cjs} +134 -24
  38. package/dist/engine-BM9Dy_DT.cjs.map +1 -0
  39. package/dist/{engine-Gs0abjuj.mjs → engine-llWnMZH5.mjs} +134 -24
  40. package/dist/engine-llWnMZH5.mjs.map +1 -0
  41. package/dist/{github-CrcGFkfD.cjs → github-ZoMam0OH.cjs} +2 -2
  42. package/dist/{github-CrcGFkfD.cjs.map → github-ZoMam0OH.cjs.map} +1 -1
  43. package/dist/{github-CJANTYqi.mjs → github-yy6WpHIl.mjs} +2 -2
  44. package/dist/{github-CJANTYqi.mjs.map → github-yy6WpHIl.mjs.map} +1 -1
  45. package/dist/{index-CyApaHVe.d.cts → index-CkX89m6S.d.mts} +2 -2
  46. package/dist/{index-CyApaHVe.d.cts.map → index-CkX89m6S.d.mts.map} +1 -1
  47. package/dist/{index-DD1FfUHh.d.mts → index-EvZBkycu.d.cts} +2 -2
  48. package/dist/{index-DD1FfUHh.d.mts.map → index-EvZBkycu.d.cts.map} +1 -1
  49. package/dist/index.cjs +46 -43
  50. package/dist/index.cjs.map +1 -1
  51. package/dist/index.mjs +46 -43
  52. package/dist/index.mjs.map +1 -1
  53. package/dist/{migrate-DCVo5gLS.mjs → migrate-BWPuwiXk.mjs} +2 -2
  54. package/dist/{migrate-DCVo5gLS.mjs.map → migrate-BWPuwiXk.mjs.map} +1 -1
  55. package/dist/{migrate-CQdSpttI.cjs → migrate-tOwxQBTI.cjs} +2 -2
  56. package/dist/{migrate-CQdSpttI.cjs.map → migrate-tOwxQBTI.cjs.map} +1 -1
  57. package/dist/openapi.d.cts +1 -1
  58. package/dist/openapi.d.mts +1 -1
  59. package/dist/reconcile/public.d.cts +1 -1
  60. package/dist/reconcile/public.d.mts +1 -1
  61. package/dist/{resolve-BexmDcsN.cjs → resolve-BymzGtuT.cjs} +3 -3
  62. package/dist/{resolve-BexmDcsN.cjs.map → resolve-BymzGtuT.cjs.map} +1 -1
  63. package/dist/{resolve-DhZgtvZe.mjs → resolve-pIvXlZ1h.mjs} +3 -3
  64. package/dist/{resolve-DhZgtvZe.mjs.map → resolve-pIvXlZ1h.mjs.map} +1 -1
  65. package/dist/{rollback-m4Yeym5x.mjs → rollback-ZlsbQOvj.mjs} +3 -3
  66. package/dist/{rollback-m4Yeym5x.mjs.map → rollback-ZlsbQOvj.mjs.map} +1 -1
  67. package/dist/{rollback-BnY7KuG_.cjs → rollback-zdfi6Reg.cjs} +3 -3
  68. package/dist/{rollback-BnY7KuG_.cjs.map → rollback-zdfi6Reg.cjs.map} +1 -1
  69. package/dist/{runtime-BRqFOvPM.d.cts → runtime-B3jNgeP-.d.mts} +2 -2
  70. package/dist/{runtime-BRqFOvPM.d.cts.map → runtime-B3jNgeP-.d.mts.map} +1 -1
  71. package/dist/{runtime-CEk5n4VH.d.mts → runtime-DWThEP-r.d.cts} +2 -2
  72. package/dist/{runtime-CEk5n4VH.d.mts.map → runtime-DWThEP-r.d.cts.map} +1 -1
  73. package/dist/sniffer-BdFeLSmA.mjs.map +1 -1
  74. package/dist/sniffer-D66HIvi9.cjs.map +1 -1
  75. package/dist/{state-DkUStoqJ.mjs → state-Bn5JDMFT.mjs} +247 -7
  76. package/dist/state-Bn5JDMFT.mjs.map +1 -0
  77. package/dist/{state-DgmM4EKq.cjs → state-CHZqCDRC.cjs} +342 -6
  78. package/dist/state-CHZqCDRC.cjs.map +1 -0
  79. package/dist/target/public.cjs +1 -1
  80. package/dist/target/public.d.cts +2 -2
  81. package/dist/target/public.d.mts +2 -2
  82. package/dist/target/public.mjs +1 -1
  83. package/dist/{types-CSw2w69a.d.mts → types-CZdCxUCK.d.cts} +64 -2
  84. package/dist/types-CZdCxUCK.d.cts.map +1 -0
  85. package/dist/{types-D5WIxRDP.d.cts → types-Da0E3Qv7.d.mts} +63 -3
  86. package/dist/types-Da0E3Qv7.d.mts.map +1 -0
  87. package/dist/workspace/index.d.cts +2 -2
  88. package/dist/workspace/index.d.mts +2 -2
  89. package/package.json +13 -13
  90. package/dist/cli-C2Tjbn27.mjs.map +0 -1
  91. package/dist/cli-DR7B2_fX.cjs.map +0 -1
  92. package/dist/compose-5oNHAKNT.cjs.map +0 -1
  93. package/dist/compose-BjToENzG.mjs.map +0 -1
  94. package/dist/deploy-BucRfbvX.cjs.map +0 -1
  95. package/dist/deploy-DRAwTG72.mjs.map +0 -1
  96. package/dist/engine-Cx_dvx9q.cjs.map +0 -1
  97. package/dist/engine-Gs0abjuj.mjs.map +0 -1
  98. package/dist/state-DgmM4EKq.cjs.map +0 -1
  99. package/dist/state-DkUStoqJ.mjs.map +0 -1
  100. package/dist/types-CSw2w69a.d.mts.map +0 -1
  101. package/dist/types-D5WIxRDP.d.cts.map +0 -1
@@ -4,7 +4,7 @@ const require_discover = require("./discover-OEfZ9OkA.cjs");
4
4
  const require_sandbox = require("./sandbox-CL--ZDui.cjs");
5
5
  const require_derive = require("./derive-DAbo49sm.cjs");
6
6
  const require_workspace = require("./workspace-ON-bqiJz.cjs");
7
- const require_state = require("./state-DgmM4EKq.cjs");
7
+ const require_state = require("./state-CHZqCDRC.cjs");
8
8
  const require_sniffer = require("./sniffer-D66HIvi9.cjs");
9
9
  const require_provider = require("./provider-B3Sv_a74.cjs");
10
10
  let node_path = require("node:path");
@@ -507,34 +507,47 @@ const PROVISIONERS = {
507
507
  return { provides: { [(0, _geekmidas_manifest.provideKey)(declaration.id, "url")]: url.toString() } };
508
508
  },
509
509
  /**
510
- * A bucket, as a MinIO stack on the box.
510
+ * A bucket: the stage's own, or — allowed — a MinIO stack on the box.
511
+ *
512
+ * A deployed stage's bucket is an external one — S3, R2, any S3-compatible
513
+ * store — whose URL and key pair the stage's secrets hold. Only with
514
+ * `--allow-dev-services minio` does this target run MinIO for one, and
515
+ * then only for a bucket whose URL the stage did not set.
511
516
  *
512
517
  * Dokploy has first-class primitives for Postgres and Redis and none for
513
- * object storage, so this is the one kind whose infrastructure this target
514
- * *writes* rather than configures — a compose file with one service in it.
518
+ * object storage, so MinIO is the one kind whose infrastructure this
519
+ * target *writes* rather than configures — a compose file with one
520
+ * service in it.
515
521
  *
516
522
  * The service is named `cloudName(...)` like everything else, which is not
517
523
  * cosmetic here: containers on `dokploy-network` resolve each other by
518
524
  * service name, so the name is the address. Calling it `minio` would work
519
525
  * for exactly one project on the box and then collide.
520
526
  *
521
- * `s3://` carries no credentials, deliberately — deployed on AWS the SDK
522
- * reads them from an execution role, so a URL that embedded a key would be
523
- * one more thing to rotate and leak. There is no role here, so the same
524
- * chain reads `AWS_ACCESS_KEY_ID` beside the URL, exactly as it does
525
- * locally.
527
+ * A stage's own bucket URL may carry a key scoped to that bucket
528
+ * (`s3://KEY:SECRET@bucket`), which the client signs with; the shared
529
+ * `AWS_ACCESS_KEY_ID` pair is passed beside it when the stage set one, for
530
+ * a bucket whose URL has none. The MinIO this provisions uses that pair —
531
+ * the stage's, or one derived for it.
526
532
  */
527
533
  objects: async (declaration, context) => {
528
534
  if (declaration.kind !== "objects") throw new WrongKind(declaration.kind);
535
+ const key = (0, _geekmidas_manifest.provideKey)(declaration.id, "url");
536
+ const given = context.supplied?.[key];
537
+ if (given !== void 0) return { provides: {
538
+ [key]: given,
539
+ ...storageKeys(context.supplied)
540
+ } };
529
541
  const backend = context.storage ?? "minio";
530
542
  if (backend !== "minio") throw new UnprovisionableBucket(declaration.id, backend);
543
+ if (!context.devServices?.includes("minio")) throw notConfigured(declaration.id, "objects", context);
531
544
  const service = serviceName({
532
545
  stage: context.stage,
533
546
  app: context.scope ?? context.project
534
547
  }, declaration.id);
535
548
  const bucket = require_state.resourceName(declaration.id, declaration.kind, context.stage);
536
- const user = `${bucket}-root`;
537
- const password = derivedPassword(context, `objects:${declaration.id}`);
549
+ const user = context.supplied?.AWS_ACCESS_KEY_ID ?? `${bucket}-root`;
550
+ const password = context.supplied?.AWS_SECRET_ACCESS_KEY ?? derivedPassword(context, `objects:${declaration.id}`);
538
551
  const { compose } = await context.api.findOrCreateCompose(service, context.projectId, context.environmentId, minioCompose({
539
552
  service,
540
553
  bucket,
@@ -543,33 +556,67 @@ const PROVISIONERS = {
543
556
  }));
544
557
  await context.api.deployCompose(compose.composeId);
545
558
  return { provides: {
546
- [(0, _geekmidas_manifest.provideKey)(declaration.id, "url")]: s3Url(service, bucket),
559
+ [key]: s3Url(service, bucket),
547
560
  AWS_ACCESS_KEY_ID: user,
548
561
  AWS_SECRET_ACCESS_KEY: password,
549
- AWS_REGION: MINIO_REGION
562
+ AWS_REGION: context.supplied?.AWS_REGION ?? MINIO_REGION
550
563
  } };
551
564
  },
552
565
  /**
553
566
  * The address a bucket's objects are served on.
554
567
  *
555
- * Nothing is provisioned: Dokploy runs Traefik, so a second reverse proxy
556
- * behind the first would terminate TLS twice — which is why the local
557
- * target's Caddy has no equivalent here. What this resolves is the address,
558
- * and the `open` prefixes are applied to the bucket rather than to an edge,
559
- * so a policy is what makes them public wherever the bucket lives.
568
+ * The stage's own — a CDN, the bucket's domain — when its secrets hold
569
+ * one, which a bucket that is not MinIO's needs.
560
570
  *
561
- * Until a Traefik rule exists it answers on MinIO directly, path-style,
562
- * which is honest about the shape it has today: the bucket is in the path
563
- * rather than fronted by a host of its own.
571
+ * Over MinIO nothing is provisioned: Dokploy runs Traefik, so a second
572
+ * reverse proxy behind the first would terminate TLS twice — which is why
573
+ * the local target's Caddy has no equivalent here. What this resolves is
574
+ * the address, and the `open` prefixes are applied to the bucket rather
575
+ * than to an edge, so a policy is what makes them public wherever the
576
+ * bucket lives. Until a Traefik rule exists it answers on MinIO directly,
577
+ * path-style, which is honest about the shape it has today: the bucket is
578
+ * in the path rather than fronted by a host of its own.
564
579
  */
565
580
  "file-server": async (declaration, context) => {
566
581
  if (declaration.kind !== "file-server") throw new WrongKind(declaration.kind);
582
+ const key = (0, _geekmidas_manifest.provideKey)(declaration.id, "url");
583
+ const given = context.supplied?.[key];
584
+ if (given !== void 0) return { provides: { [key]: given } };
567
585
  const parentUrl = context.provisioned[declaration.of]?.provides[(0, _geekmidas_manifest.provideKey)(declaration.of, "url")];
568
586
  if (!parentUrl) throw new UnresolvedParent(declaration.id, declaration.of);
569
587
  const endpoint = new URL(parentUrl).searchParams.get("endpoint");
570
588
  const bucket = new URL(parentUrl).hostname;
571
589
  if (!endpoint) throw new UnresolvedParent(declaration.id, declaration.of);
572
- return { provides: { [(0, _geekmidas_manifest.provideKey)(declaration.id, "url")]: `${endpoint}/${bucket}` } };
590
+ return { provides: { [key]: `${endpoint}/${bucket}` } };
591
+ },
592
+ /**
593
+ * Mail: the stage's own SMTP server, or — allowed — Mailpit on the box.
594
+ *
595
+ * Every provider speaks SMTP, so the provider is whatever the stage's
596
+ * `<ID>_URL` names, with the address it sends from beside it. Only with
597
+ * `--allow-dev-services mailpit`, and only where the stage set no URL,
598
+ * does this run Mailpit — which catches every message and delivers none.
599
+ */
600
+ email: async (declaration, context) => {
601
+ if (declaration.kind !== "email") throw new WrongKind(declaration.kind);
602
+ const key = (0, _geekmidas_manifest.provideKey)(declaration.id, "url");
603
+ const from = (0, _geekmidas_manifest.provideKey)(declaration.id, "from");
604
+ const given = context.supplied?.[key];
605
+ if (given !== void 0) return { provides: {
606
+ [key]: given,
607
+ [from]: supplied(declaration.id, from, context)
608
+ } };
609
+ if (!context.devServices?.includes("mailpit")) throw notConfigured(declaration.id, "email", context);
610
+ const service = serviceName({
611
+ stage: context.stage,
612
+ app: context.scope ?? context.project
613
+ }, declaration.id);
614
+ const { compose } = await context.api.findOrCreateCompose(service, context.projectId, context.environmentId, mailpitCompose(service));
615
+ await context.api.deployCompose(compose.composeId);
616
+ return { provides: {
617
+ [key]: `smtp://${service}:1025`,
618
+ [from]: context.supplied?.[from] ?? `noreply@${context.domain ?? "localhost"}`
619
+ } };
573
620
  },
574
621
  /**
575
622
  * A topic, and below it a queue — the same broker either way.
@@ -807,6 +854,56 @@ function minioCompose(options) {
807
854
  ""
808
855
  ].join("\n");
809
856
  }
857
+ /**
858
+ * A one-service compose file for Mailpit, on `dokploy-network` so the apps
859
+ * reach it by its service name. It accepts mail from anything on the network
860
+ * and delivers none of it.
861
+ */
862
+ function mailpitCompose(service) {
863
+ return [
864
+ "services:",
865
+ ` ${service}:`,
866
+ " image: axllent/mailpit:latest",
867
+ " environment:",
868
+ " MP_SMTP_AUTH_ACCEPT_ANY: '1'",
869
+ " MP_SMTP_AUTH_ALLOW_INSECURE: '1'",
870
+ " networks:",
871
+ " - dokploy-network",
872
+ "networks:",
873
+ " dokploy-network:",
874
+ " external: true",
875
+ ""
876
+ ].join("\n");
877
+ }
878
+ /**
879
+ * The S3 client's shared keys the stage set, for a bucket that is its own —
880
+ * none when it set none, since a bucket's URL may carry its own key.
881
+ */
882
+ function storageKeys(values) {
883
+ const keys = {};
884
+ for (const key of [...require_state.STORAGE_KEY_PAIR, "AWS_REGION"]) {
885
+ const value = values?.[key];
886
+ if (value !== void 0) keys[key] = value;
887
+ }
888
+ return keys;
889
+ }
890
+ /**
891
+ * The error for a bucket or mail the stage configured nothing for — what
892
+ * `validate` already refused, should a provisioner be reached without it.
893
+ */
894
+ function notConfigured(id, kind, context) {
895
+ const { missing } = require_state.externalServices({
896
+ stage: context.stage,
897
+ declarations: [{
898
+ id,
899
+ kind
900
+ }],
901
+ supplied: context.supplied ?? {},
902
+ allow: [],
903
+ ...context.domain ? { domain: context.domain } : {}
904
+ });
905
+ return new require_state.ExternalServicesNotConfigured(context.stage, missing);
906
+ }
810
907
  /** Whether anything reads through a reader on this construct. */
811
908
  function readsFrom(manifest, id) {
812
909
  return Object.values(manifest).some((declaration) => declaration.kind === "database-reader" && declaration.of === id);
@@ -995,6 +1092,8 @@ async function provisionDeclared(options) {
995
1092
  cache: require_state.cacheBackendFor(require_state.providerOf(workspace)),
996
1093
  events: require_state.eventsBackendFor(require_state.providerOf(workspace)),
997
1094
  storage: require_state.storageBackendFor(require_state.providerOf(workspace)),
1095
+ ...options.devServices ? { devServices: options.devServices } : {},
1096
+ ...workspace.deploy?.domains?.[options.stage] ? { domain: workspace.deploy.domains[options.stage] } : {},
998
1097
  addresses: surfaceAddresses(manifest, options.appUrls),
999
1098
  seed: options.seed,
1000
1099
  ...options.supplied ? { supplied: options.supplied } : {},
@@ -1986,8 +2085,18 @@ async function validateDokploy(phase) {
1986
2085
  secrets: phase.secrets,
1987
2086
  ctx
1988
2087
  };
2088
+ const stored = await phase.secrets.read();
2089
+ const services = require_state.assertExternalServices({
2090
+ stage,
2091
+ declarations: require_state.manifestServiceDeclarations(phase.manifest),
2092
+ supplied: stored?.custom ?? {},
2093
+ allow: phase.allowDevServices,
2094
+ ...workspace.deploy?.domains?.[stage] ? { domain: workspace.deploy.domains[stage] } : {}
2095
+ });
2096
+ require_state.reportDevServices(phase, require_state.devServicesUsed(services));
1989
2097
  return {
1990
2098
  ...run,
2099
+ allowDevServices: phase.allowDevServices,
1991
2100
  preflight: await preflight(run),
1992
2101
  verify: verifySettings(workspace.deploy.dokploy?.verify),
1993
2102
  atomic: phase.atomic,
@@ -2167,7 +2276,8 @@ async function provision(run) {
2167
2276
  appUrls,
2168
2277
  supplied: stageSecrets.custom,
2169
2278
  seed: stageSecrets.seed,
2170
- manifest
2279
+ manifest,
2280
+ devServices: run.allowDevServices
2171
2281
  });
2172
2282
  declaredEnv = declared.env;
2173
2283
  declaredClusters = declared.clusters;
@@ -3098,4 +3208,4 @@ Object.defineProperty(exports, "verifySettings", {
3098
3208
  }
3099
3209
  });
3100
3210
 
3101
- //# sourceMappingURL=engine-Cx_dvx9q.cjs.map
3211
+ //# sourceMappingURL=engine-BM9Dy_DT.cjs.map