@geekmidas/cli 10.0.0-alpha.135 → 10.0.0-alpha.136

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 (123) hide show
  1. package/dist/{GoDaddyProvider-DZWg8Ssf.cjs → GoDaddyProvider-BZJtRv5p.cjs} +2 -2
  2. package/dist/{GoDaddyProvider-DZWg8Ssf.cjs.map → GoDaddyProvider-BZJtRv5p.cjs.map} +1 -1
  3. package/dist/{GoDaddyProvider-DPiJ5exO.mjs → GoDaddyProvider-CDTSKt1k.mjs} +2 -2
  4. package/dist/{GoDaddyProvider-DPiJ5exO.mjs.map → GoDaddyProvider-CDTSKt1k.mjs.map} +1 -1
  5. package/dist/{LegacyStateStore-D4h5bkrb.mjs → LegacyStateStore-CfhOur9W.mjs} +3 -3
  6. package/dist/{LegacyStateStore-D4h5bkrb.mjs.map → LegacyStateStore-CfhOur9W.mjs.map} +1 -1
  7. package/dist/{LegacyStateStore-B9bnnATg.cjs → LegacyStateStore-CmQbzQGC.cjs} +3 -3
  8. package/dist/{LegacyStateStore-B9bnnATg.cjs.map → LegacyStateStore-CmQbzQGC.cjs.map} +1 -1
  9. package/dist/{LocalStateStore-DolIqU2y.cjs → LocalStateStore-3ZT4-yUX.cjs} +2 -2
  10. package/dist/{LocalStateStore-DolIqU2y.cjs.map → LocalStateStore-3ZT4-yUX.cjs.map} +1 -1
  11. package/dist/{LocalStateStore-BtUPqLVd.mjs → LocalStateStore-k3i8wp2q.mjs} +2 -2
  12. package/dist/{LocalStateStore-BtUPqLVd.mjs.map → LocalStateStore-k3i8wp2q.mjs.map} +1 -1
  13. package/dist/{Route53Provider-QXxjkZO1.mjs → Route53Provider-Di_SD9CF.mjs} +2 -2
  14. package/dist/Route53Provider-Di_SD9CF.mjs.map +1 -0
  15. package/dist/{Route53Provider-Bllus2NR.cjs → Route53Provider-emLuQHVw.cjs} +2 -2
  16. package/dist/Route53Provider-emLuQHVw.cjs.map +1 -0
  17. package/dist/{S3StateStore-CK8U4ICM.cjs → S3StateStore-Cf2DoRBZ.cjs} +2 -2
  18. package/dist/{S3StateStore-CK8U4ICM.cjs.map → S3StateStore-Cf2DoRBZ.cjs.map} +1 -1
  19. package/dist/{S3StateStore-CDT_DkGE.mjs → S3StateStore-D71GhBoc.mjs} +2 -2
  20. package/dist/{S3StateStore-CDT_DkGE.mjs.map → S3StateStore-D71GhBoc.mjs.map} +1 -1
  21. package/dist/{SSMStateStore-BtPIF4Qk.mjs → SSMStateStore-B40DvAuy.mjs} +2 -2
  22. package/dist/{SSMStateStore-BtPIF4Qk.mjs.map → SSMStateStore-B40DvAuy.mjs.map} +1 -1
  23. package/dist/{SSMStateStore-DmZawuR5.cjs → SSMStateStore-agvlAonC.cjs} +2 -2
  24. package/dist/{SSMStateStore-DmZawuR5.cjs.map → SSMStateStore-agvlAonC.cjs.map} +1 -1
  25. package/dist/{add-fXw-yJvm.cjs → add-BpJ40b1f.cjs} +3 -3
  26. package/dist/{add-fXw-yJvm.cjs.map → add-BpJ40b1f.cjs.map} +1 -1
  27. package/dist/{add-9t0pfwcy.mjs → add-Cj6yp560.mjs} +3 -3
  28. package/dist/{add-9t0pfwcy.mjs.map → add-Cj6yp560.mjs.map} +1 -1
  29. package/dist/{bundler-DP84yfVd.mjs → bundler-BjIag8nr.mjs} +5 -5
  30. package/dist/{bundler-DP84yfVd.mjs.map → bundler-BjIag8nr.mjs.map} +1 -1
  31. package/dist/{bundler-Bj4FgDuH.cjs → bundler-D0YmORqs.cjs} +5 -5
  32. package/dist/{bundler-Bj4FgDuH.cjs.map → bundler-D0YmORqs.cjs.map} +1 -1
  33. package/dist/{cli-Mmy5wBuy.mjs → cli-CJwPXzWW.mjs} +2 -2
  34. package/dist/{cli-Mmy5wBuy.mjs.map → cli-CJwPXzWW.mjs.map} +1 -1
  35. package/dist/{cli-D47RSzQn.cjs → cli-ffQmsXua.cjs} +2 -2
  36. package/dist/{cli-D47RSzQn.cjs.map → cli-ffQmsXua.cjs.map} +1 -1
  37. package/dist/{compose-CEikJR9c.mjs → compose-D6L79YLV.mjs} +402 -26
  38. package/dist/compose-D6L79YLV.mjs.map +1 -0
  39. package/dist/{compose-ht0TCG2X.cjs → compose-Diz_QC7m.cjs} +401 -25
  40. package/dist/compose-Diz_QC7m.cjs.map +1 -0
  41. package/dist/deploy/public.cjs +6 -6
  42. package/dist/deploy/public.mjs +6 -6
  43. package/dist/{deploy-CdL9_-qw.cjs → deploy-CZHTReh1.cjs} +5 -5
  44. package/dist/{deploy-CdL9_-qw.cjs.map → deploy-CZHTReh1.cjs.map} +1 -1
  45. package/dist/{deploy-C0TpTD1d.mjs → deploy-D6wCG-OQ.mjs} +5 -5
  46. package/dist/{deploy-C0TpTD1d.mjs.map → deploy-D6wCG-OQ.mjs.map} +1 -1
  47. package/dist/{dokploy-BueAJuoo.cjs → dokploy-BeqMm-aL.cjs} +2 -2
  48. package/dist/{dokploy-BueAJuoo.cjs.map → dokploy-BeqMm-aL.cjs.map} +1 -1
  49. package/dist/{dokploy-DpvTEQV9.mjs → dokploy-Dad-f6mO.mjs} +2 -2
  50. package/dist/{dokploy-DpvTEQV9.mjs.map → dokploy-Dad-f6mO.mjs.map} +1 -1
  51. package/dist/{eas-J_D0eeql.mjs → eas-CamaGWDL.mjs} +2 -2
  52. package/dist/{eas-J_D0eeql.mjs.map → eas-CamaGWDL.mjs.map} +1 -1
  53. package/dist/{eas-BPDzq2YJ.cjs → eas-DWYhlJCr.cjs} +2 -2
  54. package/dist/{eas-BPDzq2YJ.cjs.map → eas-DWYhlJCr.cjs.map} +1 -1
  55. package/dist/{encryption-D-02Ns4D.mjs → encryption-DmDnVYe4.mjs} +2 -2
  56. package/dist/{encryption-D-02Ns4D.mjs.map → encryption-DmDnVYe4.mjs.map} +1 -1
  57. package/dist/{encryption-DkVOPJHl.cjs → encryption-UjD4kDRB.cjs} +2 -2
  58. package/dist/{encryption-DkVOPJHl.cjs.map → encryption-UjD4kDRB.cjs.map} +1 -1
  59. package/dist/{engine-hYFSWxve.cjs → engine-BaRuSjJf.cjs} +3 -3
  60. package/dist/{engine-hYFSWxve.cjs.map → engine-BaRuSjJf.cjs.map} +1 -1
  61. package/dist/{engine-CEg989YU.mjs → engine-BxHQrByl.mjs} +3 -3
  62. package/dist/{engine-CEg989YU.mjs.map → engine-BxHQrByl.mjs.map} +1 -1
  63. package/dist/{github-Btdbg8z3.cjs → github-BO-bu8kf.cjs} +4 -4
  64. package/dist/{github-Btdbg8z3.cjs.map → github-BO-bu8kf.cjs.map} +1 -1
  65. package/dist/{github-MwKWG3rQ.mjs → github-Fvg_6wTt.mjs} +4 -4
  66. package/dist/{github-MwKWG3rQ.mjs.map → github-Fvg_6wTt.mjs.map} +1 -1
  67. package/dist/{googlePlay-BJPkSlE7.mjs → googlePlay-C5TgJQcS.mjs} +3 -3
  68. package/dist/{googlePlay-BJPkSlE7.mjs.map → googlePlay-C5TgJQcS.mjs.map} +1 -1
  69. package/dist/{googlePlay-Bq3krrnh.cjs → googlePlay-Dnlvz3rE.cjs} +3 -3
  70. package/dist/{googlePlay-Bq3krrnh.cjs.map → googlePlay-Dnlvz3rE.cjs.map} +1 -1
  71. package/dist/index.cjs +52 -52
  72. package/dist/index.cjs.map +1 -1
  73. package/dist/index.mjs +52 -52
  74. package/dist/index.mjs.map +1 -1
  75. package/dist/{migrate-ZP_zGDPZ.cjs → migrate-BYvhE1Ek.cjs} +2 -2
  76. package/dist/{migrate-ZP_zGDPZ.cjs.map → migrate-BYvhE1Ek.cjs.map} +1 -1
  77. package/dist/{migrate-Bz8Y9FuF.cjs → migrate-DYncKsiF.cjs} +2 -2
  78. package/dist/{migrate-Bz8Y9FuF.cjs.map → migrate-DYncKsiF.cjs.map} +1 -1
  79. package/dist/{migrate-SmLqnkna.mjs → migrate-Qe7kNf7P.mjs} +2 -2
  80. package/dist/{migrate-SmLqnkna.mjs.map → migrate-Qe7kNf7P.mjs.map} +1 -1
  81. package/dist/{migrate-CXOGn5NC.mjs → migrate-SLRDSOkN.mjs} +2 -2
  82. package/dist/{migrate-CXOGn5NC.mjs.map → migrate-SLRDSOkN.mjs.map} +1 -1
  83. package/dist/{publish-BGPtiswJ.mjs → publish-CZ7650El.mjs} +2 -2
  84. package/dist/{publish-BGPtiswJ.mjs.map → publish-CZ7650El.mjs.map} +1 -1
  85. package/dist/{publish-CuvbP2bc.cjs → publish-CdgAuHGF.cjs} +2 -2
  86. package/dist/{publish-CuvbP2bc.cjs.map → publish-CdgAuHGF.cjs.map} +1 -1
  87. package/dist/{resolve-hyZMb2z7.mjs → resolve-MoZFp8BC.mjs} +3 -3
  88. package/dist/{resolve-hyZMb2z7.mjs.map → resolve-MoZFp8BC.mjs.map} +1 -1
  89. package/dist/{resolve-BQ_oAZSX.cjs → resolve-jB0LX21y.cjs} +3 -3
  90. package/dist/{resolve-BQ_oAZSX.cjs.map → resolve-jB0LX21y.cjs.map} +1 -1
  91. package/dist/{rollback-ODQR4lLz.mjs → rollback-BpM_ekEG.mjs} +4 -4
  92. package/dist/{rollback-ODQR4lLz.mjs.map → rollback-BpM_ekEG.mjs.map} +1 -1
  93. package/dist/{rollback-BQufMCac.cjs → rollback-CTkBmEzm.cjs} +4 -4
  94. package/dist/{rollback-BQufMCac.cjs.map → rollback-CTkBmEzm.cjs.map} +1 -1
  95. package/dist/{seeds-BeXHiiuz.cjs → seeds-6IhH9esB.cjs} +79 -79
  96. package/dist/{seeds-BeXHiiuz.cjs.map → seeds-6IhH9esB.cjs.map} +1 -1
  97. package/dist/{seeds-CNrAW2NR.mjs → seeds-D4qjzFDF.mjs} +80 -80
  98. package/dist/{seeds-CNrAW2NR.mjs.map → seeds-D4qjzFDF.mjs.map} +1 -1
  99. package/dist/{serverSetup-CqaeTq8J.mjs → serverSetup-23Jmihhj.mjs} +5 -5
  100. package/dist/{serverSetup-CqaeTq8J.mjs.map → serverSetup-23Jmihhj.mjs.map} +1 -1
  101. package/dist/{serverSetup-ChdSMUmE.cjs → serverSetup-CRJvE-KF.cjs} +5 -5
  102. package/dist/{serverSetup-ChdSMUmE.cjs.map → serverSetup-CRJvE-KF.cjs.map} +1 -1
  103. package/dist/{sniffer-DW4uTBXp.mjs → sniffer-DbGKPWFo.mjs} +6 -6
  104. package/dist/{sniffer-DW4uTBXp.mjs.map → sniffer-DbGKPWFo.mjs.map} +1 -1
  105. package/dist/{sniffer-CMMqjWyj.cjs → sniffer-Ve5oNbHX.cjs} +6 -6
  106. package/dist/{sniffer-CMMqjWyj.cjs.map → sniffer-Ve5oNbHX.cjs.map} +1 -1
  107. package/dist/{snsSubscriptions-ChIUluUY.mjs → snsSubscriptions-CUi0Wtto.mjs} +20 -10
  108. package/dist/snsSubscriptions-CUi0Wtto.mjs.map +1 -0
  109. package/dist/{snsSubscriptions-CLWW_I6o.cjs → snsSubscriptions-Cr6pcIgx.cjs} +20 -10
  110. package/dist/snsSubscriptions-Cr6pcIgx.cjs.map +1 -0
  111. package/dist/{stage-C1oR_hgI.cjs → stage-BiLP7bXI.cjs} +4 -4
  112. package/dist/{stage-C1oR_hgI.cjs.map → stage-BiLP7bXI.cjs.map} +1 -1
  113. package/dist/{stage-DGj-LIZd.mjs → stage-DrHKRHLN.mjs} +4 -4
  114. package/dist/{stage-DGj-LIZd.mjs.map → stage-DrHKRHLN.mjs.map} +1 -1
  115. package/dist/target/public.cjs +1 -1
  116. package/dist/target/public.mjs +1 -1
  117. package/package.json +15 -15
  118. package/dist/Route53Provider-Bllus2NR.cjs.map +0 -1
  119. package/dist/Route53Provider-QXxjkZO1.mjs.map +0 -1
  120. package/dist/compose-CEikJR9c.mjs.map +0 -1
  121. package/dist/compose-ht0TCG2X.cjs.map +0 -1
  122. package/dist/snsSubscriptions-CLWW_I6o.cjs.map +0 -1
  123. package/dist/snsSubscriptions-ChIUluUY.mjs.map +0 -1
@@ -2,9 +2,9 @@ const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
2
2
  const require_errors = require("./errors-DMC4Umsb.cjs");
3
3
  const require_credentials = require("./credentials-D7XJypNd.cjs");
4
4
  const require_workspace = require("./workspace-secxwA6K.cjs");
5
- const require_snsSubscriptions = require("./snsSubscriptions-CLWW_I6o.cjs");
5
+ const require_snsSubscriptions = require("./snsSubscriptions-Cr6pcIgx.cjs");
6
6
  const require_define = require("./define-crmMcXFS.cjs");
7
- const require_seeds = require("./seeds-BeXHiiuz.cjs");
7
+ const require_seeds = require("./seeds-6IhH9esB.cjs");
8
8
  const require_derive = require("./derive-ClMgyPzp.cjs");
9
9
  const require_drivers = require("./drivers-C47nm-wB.cjs");
10
10
  const require_identity = require("./identity-CbLfgQNT.cjs");
@@ -701,20 +701,28 @@ function address({ service, port }) {
701
701
  /** The Caddyfile for a stack's edge. */
702
702
  function edgeCaddyfile(routes, options) {
703
703
  const { tls } = options;
704
+ const ask = routes.find((route) => route.wildcard?.tls.kind === "on-demand")?.wildcard?.tls;
705
+ const onDemand = ask?.kind === "on-demand" ? `
706
+ on_demand_tls {
707
+ ask ${ask.ask}
708
+ }` : "";
704
709
  const global = tls.kind === "internal" ? `{
705
710
  # No ACME and no public DNS: the CA is Caddy's own and the names resolve
706
711
  # to this machine.
707
712
  local_certs
708
713
  auto_https disable_redirects
709
- }` : options.email ? `{
710
- email ${options.email}
714
+ }` : options.email || onDemand ? `{${options.email ? `\n\temail ${options.email}` : ""}${onDemand}
711
715
  }` : "";
712
716
  const certificate = tls.kind === "internal" ? `
713
717
  tls internal
714
718
  ` : tls.kind === "files" ? `
715
719
  tls ${tls.certFile} ${tls.keyFile}
716
720
  ` : "";
717
- const blocks = routes.map((route) => siteBlock(route, certificate));
721
+ const blocks = [...routes.filter((route) => !route.wildcard), ...routes.filter((route) => route.wildcard)].map((route) => siteBlock(route, route.wildcard?.tls.kind === "on-demand" ? `
722
+ tls {
723
+ on_demand
724
+ }
725
+ ` : certificate));
718
726
  return `${HEADER}${global ? `${global}\n\n` : ""}${blocks.join("\n\n")}\n`;
719
727
  }
720
728
  /** One route's site block. */
@@ -722,7 +730,12 @@ function siteBlock(route, certificate) {
722
730
  assertRouteRenderable(route);
723
731
  const { host, allow, auth, paths, prefixes, requireHeader, handlers } = route;
724
732
  const allowed = [...paths ?? [], ...(prefixes ?? []).map((prefix) => `${prefix}*`)];
725
- const checks = `${allow ? `
733
+ const except = route.wildcard?.except ?? [];
734
+ const checks = `${except.length ? `
735
+ # Labels no tenant may take, although nothing in this stack answers them.
736
+ @protected host ${except.map((label) => `${label}.${route.wildcard?.domain}`).join(" ")}
737
+ respond @protected 404
738
+ ` : ""}${allow ? `
726
739
  # Only these addresses — the peer Caddy sees, never a header a client
727
740
  # could set. Everything else is refused before it reaches the upstream.
728
741
  @denied not remote_ip ${allow.join(" ")}
@@ -970,6 +983,18 @@ const EDGE_DYNAMIC_DIR = "/etc/gkm-edge/dynamic";
970
983
  const EDGE_CERTS_DIR = "/etc/gkm-edge/certs";
971
984
  /** The certificate resolver every deployed route without its own certificate uses. */
972
985
  const ACME_RESOLVER = "letsencrypt";
986
+ /**
987
+ * The resolver a wildcard site's `*.<domain>` certificate comes from: Let's
988
+ * Encrypt issues a wildcard only over the DNS challenge, which the edge
989
+ * answers by writing an `_acme-challenge` TXT record through Route 53.
990
+ */
991
+ const ACME_DNS_RESOLVER = "letsencrypt-dns";
992
+ /**
993
+ * The key the edge writes those records with, inside its container: written
994
+ * by the deploy of a stage with a wildcard site, and allowed nothing but
995
+ * each such stage's `_acme-challenge` record (see `acmeDns.ts`).
996
+ */
997
+ const EDGE_AWS_CREDENTIALS = `${EDGE_CERTS_DIR}/aws-credentials`;
973
998
  /** The internal entrypoint the edge's health check asks; never published. */
974
999
  const PING_PORT = 8082;
975
1000
  /** A stack's service, as the edge — and the stack itself — reach it. */
@@ -1011,10 +1036,19 @@ function traefikStatic(ports) {
1011
1036
  directory: EDGE_DYNAMIC_DIR,
1012
1037
  watch: true
1013
1038
  } },
1014
- certificatesResolvers: { [ACME_RESOLVER]: { acme: {
1015
- storage: "/acme/acme.json",
1016
- httpChallenge: { entryPoint: "web" }
1017
- } } },
1039
+ certificatesResolvers: {
1040
+ [ACME_RESOLVER]: { acme: {
1041
+ storage: "/acme/acme.json",
1042
+ httpChallenge: { entryPoint: "web" }
1043
+ } },
1044
+ [ACME_DNS_RESOLVER]: { acme: {
1045
+ storage: "/acme/acme-dns.json",
1046
+ dnsChallenge: {
1047
+ provider: "route53",
1048
+ resolvers: ["1.1.1.1:53", "8.8.8.8:53"]
1049
+ }
1050
+ } }
1051
+ },
1018
1052
  log: { level: "INFO" }
1019
1053
  };
1020
1054
  }
@@ -1037,6 +1071,10 @@ function edgeCompose(options) {
1037
1071
  "acme:/acme"
1038
1072
  ],
1039
1073
  labels: { "dev.geekmidas.edge.config": (0, node_crypto.createHash)("sha256").update(options.staticConfig).digest("hex").slice(0, 16) },
1074
+ environment: {
1075
+ AWS_SHARED_CREDENTIALS_FILE: EDGE_AWS_CREDENTIALS,
1076
+ AWS_REGION: "us-east-1"
1077
+ },
1040
1078
  networks: ["edge"],
1041
1079
  ...EDGE_LIMITS,
1042
1080
  healthcheck: {
@@ -1092,6 +1130,10 @@ function traefikDynamic(routes, options) {
1092
1130
  const allowed = [...(route.paths ?? []).map((path) => `Path(\`${path}\`)`), ...(route.prefixes ?? []).map((prefix) => `PathPrefix(\`${prefix}\`)`)];
1093
1131
  const paths = allowed.length ? ` && (${allowed.join(" || ")})` : "";
1094
1132
  const header = route.requireHeader ? ` && Header(\`${route.requireHeader.name}\`, \`${route.requireHeader.value}\`)` : "";
1133
+ const certificate = () => route.wildcard?.tls.kind === "dns" ? {
1134
+ certResolver: ACME_DNS_RESOLVER,
1135
+ domains: [{ main: `*.${route.wildcard.domain}` }]
1136
+ } : tls.kind === "acme" ? { certResolver: ACME_RESOLVER } : {};
1095
1137
  for (const handler of route.handlers ?? []) {
1096
1138
  const handlerName = name(route, handler.name);
1097
1139
  routers[handlerName] = {
@@ -1100,16 +1142,17 @@ function traefikDynamic(routes, options) {
1100
1142
  entryPoints: ["websecure"],
1101
1143
  service: handlerName,
1102
1144
  middlewares: [strip],
1103
- tls: tls.kind === "acme" ? { certResolver: ACME_RESOLVER } : {}
1145
+ tls: certificate()
1104
1146
  };
1105
1147
  services[handlerName] = { loadBalancer: { servers: handler.upstreams.map((upstream) => ({ url: url(upstream) })) } };
1106
1148
  }
1107
1149
  routers[name(route)] = {
1108
- rule: `Host(\`${route.host}\`)${paths}${header}`,
1150
+ rule: `${hostRule(route)}${paths}${header}`,
1151
+ ...route.wildcard ? { priority: 1 } : {},
1109
1152
  entryPoints: ["websecure"],
1110
1153
  service: name(route),
1111
1154
  middlewares: chain,
1112
- tls: tls.kind === "acme" ? { certResolver: ACME_RESOLVER } : {}
1155
+ tls: certificate()
1113
1156
  };
1114
1157
  services[name(route)] = { loadBalancer: {
1115
1158
  servers: route.upstreams.map((upstream) => ({ url: url(upstream) })),
@@ -1134,6 +1177,17 @@ function traefikDynamic(routes, options) {
1134
1177
  }] } } : {}
1135
1178
  };
1136
1179
  }
1180
+ /**
1181
+ * The hosts a route answers, as a Traefik rule: its own, or — for a wildcard
1182
+ * site — exactly one label under its domain, but the ones it never takes.
1183
+ * One label, as a wildcard certificate covers: a stage at
1184
+ * `staging.example.com` is never reached through `example.com`'s wildcard.
1185
+ */
1186
+ function hostRule(route) {
1187
+ if (!route.wildcard) return `Host(\`${route.host}\`)`;
1188
+ const { domain, except } = route.wildcard;
1189
+ return [`HostRegexp(\`${`^[a-z0-9-]+\\.${domain.replace(/\./g, "\\.")}$`}\`)`, ...except.map((label) => `!Host(\`${label}.${domain}\`)`)].join(" && ");
1190
+ }
1137
1191
  /** A stack's dynamic configuration file, as written to the edge's directory. */
1138
1192
  function traefikDynamicFile(routes, options) {
1139
1193
  return `# Generated by gkm compose for ${options.project} — do not edit.
@@ -1423,9 +1477,10 @@ function probe(port, path) {
1423
1477
  * Redis.
1424
1478
  */
1425
1479
  function stackPlan(workspace, manifest, stage) {
1480
+ const protectedSubdomains = [...workspace.protectedSubdomains ?? [], ...nestedStageLabels(workspace.domains, stage)];
1426
1481
  return require_seeds.planFor(manifest, stage, (0, _geekmidas_manifest.provisionOrder)(manifest), {
1427
1482
  localStage: workspace.stages.local,
1428
- ...workspace.protectedSubdomains ? { protectedSubdomains: workspace.protectedSubdomains } : {},
1483
+ ...protectedSubdomains.length > 0 ? { protectedSubdomains } : {},
1429
1484
  events: require_drivers.DEFAULT_EVENTS.server,
1430
1485
  cache: require_seeds.STACK_CACHE,
1431
1486
  edge: false
@@ -1834,10 +1889,20 @@ function composeStack(input) {
1834
1889
  const key = require_snsSubscriptions.sitePasswordKey(manifest, site, stage);
1835
1890
  if (key) app.auth = require_snsSubscriptions.siteAuth(stage, key, custom);
1836
1891
  }
1892
+ const wildcard = local ? void 0 : stackWildcard(apps, {
1893
+ manifest,
1894
+ byId,
1895
+ workspace,
1896
+ stage,
1897
+ proxy,
1898
+ certificate: certificate !== void 0,
1899
+ hostOf
1900
+ });
1837
1901
  const routes = [
1838
1902
  ...apps.map((app) => ({
1839
1903
  name: app.name,
1840
1904
  host: app.host,
1905
+ ...wildcard?.site === app.id ? { wildcard: wildcard.edge } : {},
1841
1906
  upstreams: replicaNames(app).map((service) => ({
1842
1907
  service,
1843
1908
  port: app.port
@@ -1939,6 +2004,11 @@ function composeStack(input) {
1939
2004
  compose,
1940
2005
  proxy,
1941
2006
  routes,
2007
+ ...wildcard ? { wildcard: {
2008
+ site: wildcard.site,
2009
+ host: `*.${wildcard.edge.domain}`,
2010
+ tls: wildcard.edge.tls.kind
2011
+ } } : {},
1942
2012
  ...proxy === "caddy" ? { caddyfile: edgeCaddyfile(routes, { tls }) } : { traefik: traefikDynamicFile(routes, {
1943
2013
  project,
1944
2014
  tls: deployedTls
@@ -1977,7 +2047,6 @@ function stackApps(workspace, manifest, plan, options) {
1977
2047
  const app = workspace.apps[name];
1978
2048
  const resource = resources.get(id);
1979
2049
  if (!app || !resource || !app.port) continue;
1980
- if (!options.local && (0, _geekmidas_manifest.isWildcardSite)(declaration)) throw new WildcardSiteNotDeployable(id, options.stage);
1981
2050
  const host = hostOf(name, app, workspace, resource, options);
1982
2051
  const tag = declaration.kind === "site" ? siteTag(options.images.tag, options.stage) : options.images.tag;
1983
2052
  const ref = require_seeds.validateImageRef(require_identity.imageRef(options.identity, name, options.images.registry, tag));
@@ -2054,19 +2123,85 @@ function recordedSubscriptions(worker, push, recorded = {}) {
2054
2123
  return JSON.stringify(arns);
2055
2124
  }
2056
2125
  /**
2057
- * A wildcard site on a deployed compose stage, whose edge cannot yet route,
2058
- * certify or point DNS at every subdomain.
2126
+ * A wildcard site on a deployed stage with nowhere to get a certificate for
2127
+ * its tenants' hosts from. Let's Encrypt issues a wildcard certificate only
2128
+ * over the DNS challenge, so the stage either brings its own or gives the
2129
+ * proxy a way to get one.
2059
2130
  */
2060
- var WildcardSiteNotDeployable = class extends require_errors.GkmError {
2131
+ var WildcardSiteCertificateMissing = class extends require_errors.GkmError {
2061
2132
  site;
2062
2133
  stage;
2063
- constructor(site, stage) {
2064
- super(`'${site}' answers on every subdomain, and gkm compose cannot yet route, certify and point DNS at every subdomain of '${stage}'. Run it locally with gkm dev, or give it a subdomain of its own to deploy it.`);
2134
+ proxy;
2135
+ domain;
2136
+ constructor(site, stage, proxy, domain) {
2137
+ super(proxy === "traefik" ? `'${site}' answers on every subdomain of ${domain}, and '${stage}' has no certificate for them. Set deploy.compose.tls for '${stage}' to a *.${domain} certificate, or manage ${domain} with dns: { '<root domain>': { provider: 'route53' } } so the shared edge gets one over the DNS challenge.` : `'${site}' answers on every subdomain of ${domain}, and '${stage}' has no certificate for them. Set deploy.compose.tls for '${stage}' to a *.${domain} certificate, or give the site \`hosts\` so Caddy gets one per tenant, on demand.`);
2065
2138
  this.site = site;
2066
2139
  this.stage = stage;
2067
- this.name = "WildcardSiteNotDeployable";
2140
+ this.proxy = proxy;
2141
+ this.domain = domain;
2142
+ this.name = "WildcardSiteCertificateMissing";
2068
2143
  }
2069
2144
  };
2145
+ /**
2146
+ * A deployed stage's wildcard site, as its edge serves it: the labels it
2147
+ * never takes, and its certificate — the stage's own (`deploy.compose.tls`)
2148
+ * first; then, on the shared Traefik edge, a `*.<domain>` one over the DNS
2149
+ * challenge when Route 53 manages the domain; on the stack's own Caddy, one
2150
+ * per host on demand, asked of the site's `hosts` route.
2151
+ *
2152
+ * @throws {WildcardSiteCertificateMissing} when neither applies
2153
+ */
2154
+ function stackWildcard(apps, options) {
2155
+ const { manifest, workspace, stage, proxy } = options;
2156
+ const app = apps.find((a) => (0, _geekmidas_manifest.isWildcardSite)(manifest[a.id]));
2157
+ if (!app) return void 0;
2158
+ const declaration = manifest[app.id];
2159
+ if (!(0, _geekmidas_manifest.isWildcardSite)(declaration)) return void 0;
2160
+ const domain = workspace.domains?.[stage];
2161
+ if (!domain) throw new require_seeds.NoDomainForStage(stage);
2162
+ const except = options.byId.get(app.id)?.protectedSubdomains ?? [];
2163
+ const tls = (() => {
2164
+ if (options.certificate) return { kind: "stage" };
2165
+ if (proxy === "traefik") {
2166
+ const dns = workspace.dns ? require_seeds.normalizeDnsConfig(workspace.dns) : {};
2167
+ const root = require_seeds.findRootDomain(domain, dns);
2168
+ if (root && dns[root]?.provider === "route53") return { kind: "dns" };
2169
+ } else if (declaration.hosts) {
2170
+ const surface = apps.find((a) => a.id === declaration.hosts?.surface);
2171
+ if (surface) return {
2172
+ kind: "on-demand",
2173
+ ask: `http://${options.hostOf(surface.name)}:${surface.port}${declaration.hosts.path}`
2174
+ };
2175
+ }
2176
+ throw new WildcardSiteCertificateMissing(app.id, stage, proxy, domain);
2177
+ })();
2178
+ return {
2179
+ site: app.id,
2180
+ edge: {
2181
+ domain,
2182
+ except,
2183
+ tls
2184
+ }
2185
+ };
2186
+ }
2187
+ /**
2188
+ * The first label under `stage`'s domain of every other stage's domain that
2189
+ * sits beneath it — `staging` for `staging.example.com` (or
2190
+ * `a.staging.example.com`) under `example.com`.
2191
+ */
2192
+ function nestedStageLabels(domains, stage) {
2193
+ const own = domains?.[stage]?.toLowerCase();
2194
+ if (!own) return [];
2195
+ const labels = /* @__PURE__ */ new Set();
2196
+ for (const [other, domain] of Object.entries(domains ?? {})) {
2197
+ if (other === stage || !domain) continue;
2198
+ const lower = domain.toLowerCase();
2199
+ if (!lower.endsWith(`.${own}`)) continue;
2200
+ const rest = lower.slice(0, -(own.length + 1)).split(".");
2201
+ labels.add(rest.at(-1));
2202
+ }
2203
+ return [...labels].sort();
2204
+ }
2070
2205
  /** Two constructs the edge would answer on one host. */
2071
2206
  var EdgeHostTaken = class extends require_errors.GkmError {
2072
2207
  host;
@@ -2128,6 +2263,11 @@ function stackWorkers(units, options) {
2128
2263
  */
2129
2264
  function hostOf(name, app, workspace, resource, options) {
2130
2265
  if (options.local) return require_seeds.hostFor(resource, workspace.name);
2266
+ if (resource.subdomain === _geekmidas_manifest.WILDCARD_SUBDOMAIN) {
2267
+ const domain = workspace.domains?.[options.stage];
2268
+ if (!domain) throw new require_seeds.NoDomainForStage(options.stage);
2269
+ return `${_geekmidas_manifest.WILDCARD_SUBDOMAIN}.${domain}`;
2270
+ }
2131
2271
  return require_seeds.resolveHost(name, app, options.stage, workspace.domains, require_seeds.isMainFrontendApp(name, app, workspace.apps));
2132
2272
  }
2133
2273
  /** An app's compose services, one per replica: `api`, `api-2`, `api-3`. */
@@ -2405,6 +2545,24 @@ async function ensureEdge(docker, options) {
2405
2545
  await docker.up(ref, [EDGE_SERVICE]);
2406
2546
  return [file];
2407
2547
  }
2548
+ /** A file inside the edge's running container, or undefined where there is none. */
2549
+ async function readEdgeFile(docker, edge, path) {
2550
+ const result = await docker.exec(edge, EDGE_SERVICE, ["cat", path]);
2551
+ return result.code === 0 ? result.stdout : void 0;
2552
+ }
2553
+ /** A file written into the edge's running container, whole, readable by it alone. */
2554
+ async function writeEdgeSecret(docker, edge, path, content) {
2555
+ await put(docker, edge, path, content, "600");
2556
+ }
2557
+ /**
2558
+ * The edge restarted — what it reads once and keeps, a key among them, read
2559
+ * again — and waited on until it is healthy. Its own restart policy brings
2560
+ * it back; `up` waits for it.
2561
+ */
2562
+ async function restartEdge(docker, edge) {
2563
+ await docker.exec(edge, EDGE_SERVICE, ["kill", "1"]);
2564
+ await docker.up(edge, [EDGE_SERVICE]);
2565
+ }
2408
2566
  /** A stack's routes, inside the edge's container. */
2409
2567
  function routesPath(project) {
2410
2568
  return `${EDGE_DYNAMIC_DIR}/${project}.yml`;
@@ -2448,6 +2606,176 @@ async function removeEdgeRoutes(docker, edge, project) {
2448
2606
  return true;
2449
2607
  }
2450
2608
  //#endregion
2609
+ //#region src/compose/acmeDns.ts
2610
+ /**
2611
+ * The key the server's shared Traefik edge answers Let's Encrypt's DNS
2612
+ * challenge with, for a stage with a wildcard site.
2613
+ *
2614
+ * A wildcard certificate is issued only over the DNS challenge: the edge
2615
+ * proves it holds `<domain>` by writing a TXT record at
2616
+ * `_acme-challenge.<domain>`. So it needs a key that can write that record —
2617
+ * and nothing else, because it lives on the server.
2618
+ *
2619
+ * - **The user**: one per server, under `/gkm/`, tagged with the server it
2620
+ * is for. One that exists without that tag is someone else's, and is
2621
+ * refused rather than taken over.
2622
+ * - **Its policies**: one per stack on the server, named for its compose
2623
+ * project, allowing `ChangeResourceRecordSets` on the stage's hosted zone
2624
+ * for TXT records named `_acme-challenge.<domain>` alone — plus what
2625
+ * finding the zone and waiting for the change take, which read and write
2626
+ * nothing. Put back on every deploy.
2627
+ * - **Its key**: written into the edge's container, never into the stage's
2628
+ * secrets or onto the machine running the deploy. Issued when the edge
2629
+ * has none, or holds one IAM no longer knows — and then the edge is
2630
+ * restarted, since it keeps the key it first read.
2631
+ */
2632
+ /** Where gkm's IAM users live. */
2633
+ const USER_PATH = "/gkm/";
2634
+ /** The tag a server's edge user is found by. */
2635
+ const TAG_EDGE = "gkm:edge";
2636
+ /** The edge user's name for a server: stable, and safe for IAM. */
2637
+ function edgeAcmeUser(server) {
2638
+ return `gkm-edge-acme-${(0, node_crypto.createHash)("sha256").update(server).digest("hex").slice(0, 12)}`;
2639
+ }
2640
+ /**
2641
+ * What one stage's wildcard certificate needs: its challenge record written
2642
+ * in its zone, the change waited on, and the zone found by name — which is
2643
+ * how the edge's ACME client finds it.
2644
+ */
2645
+ function acmeDnsPolicy(zoneId, domain) {
2646
+ return JSON.stringify({
2647
+ Version: "2012-10-17",
2648
+ Statement: [
2649
+ {
2650
+ Effect: "Allow",
2651
+ Action: "route53:ChangeResourceRecordSets",
2652
+ Resource: `arn:aws:route53:::hostedzone/${zoneId}`,
2653
+ Condition: { "ForAllValues:StringEquals": {
2654
+ "route53:ChangeResourceRecordSetsNormalizedRecordNames": [`_acme-challenge.${domain.toLowerCase()}`],
2655
+ "route53:ChangeResourceRecordSetsRecordTypes": ["TXT"]
2656
+ } }
2657
+ },
2658
+ {
2659
+ Effect: "Allow",
2660
+ Action: "route53:ListResourceRecordSets",
2661
+ Resource: `arn:aws:route53:::hostedzone/${zoneId}`
2662
+ },
2663
+ {
2664
+ Effect: "Allow",
2665
+ Action: "route53:GetChange",
2666
+ Resource: "arn:aws:route53:::change/*"
2667
+ },
2668
+ {
2669
+ Effect: "Allow",
2670
+ Action: "route53:ListHostedZonesByName",
2671
+ Resource: "*"
2672
+ }
2673
+ ]
2674
+ });
2675
+ }
2676
+ /** An IAM user by the edge user's name that gkm did not create for this server. */
2677
+ var EdgeAcmeUserNotOwned = class extends require_errors.GkmError {
2678
+ user;
2679
+ server;
2680
+ constructor(user, server) {
2681
+ super(`The IAM user ${user} exists but is not tagged ${TAG_EDGE}=${server}, so gkm will not take it over to write the shared edge's DNS challenge records. Delete it, or tag it ${TAG_EDGE}=${server} if it is the one gkm created for this server.`);
2682
+ this.user = user;
2683
+ this.server = server;
2684
+ this.name = "EdgeAcmeUserNotOwned";
2685
+ }
2686
+ };
2687
+ /** A wildcard site's domain with no Route 53 hosted zone to answer it in. */
2688
+ var AcmeHostedZoneMissing = class extends require_errors.GkmError {
2689
+ domain;
2690
+ constructor(domain) {
2691
+ super(`No Route 53 hosted zone holds ${domain}, so the shared edge cannot answer the DNS challenge for its wildcard certificate. Create the zone, or set hostedZoneId in its dns entry.`);
2692
+ this.domain = domain;
2693
+ this.name = "AcmeHostedZoneMissing";
2694
+ }
2695
+ };
2696
+ /**
2697
+ * The edge's key for `domain`'s challenge record: its user, this stack's
2698
+ * policy on it, and a key in the edge that IAM knows.
2699
+ *
2700
+ * @throws {EdgeAcmeUserNotOwned} when the user is someone else's
2701
+ * @throws {AcmeHostedZoneMissing} when no hosted zone holds the domain
2702
+ */
2703
+ async function ensureEdgeAcmeKey(docker, options) {
2704
+ const { clients, edge, server, project, domain } = options;
2705
+ const log = options.log ?? ((line) => console.log(line));
2706
+ const IAM = await import("@aws-sdk/client-iam");
2707
+ const user = edgeAcmeUser(server);
2708
+ const zoneId = options.hostedZoneId ?? await hostedZoneId(clients.route53, options.zone);
2709
+ if (!zoneId) throw new AcmeHostedZoneMissing(domain);
2710
+ if (options.dryRun) {
2711
+ log(`🔑 Would let ${EDGE_PROJECT} write _acme-challenge.${domain} TXT records in ${zoneId}, as IAM user ${user} (dry run — nothing is written)`);
2712
+ return {
2713
+ user,
2714
+ zoneId,
2715
+ issued: false
2716
+ };
2717
+ }
2718
+ if (!(await clients.iam.send(new IAM.GetUserCommand({ UserName: user })).catch((error) => {
2719
+ if (error?.name === "NoSuchEntity" || error?.name === "NoSuchEntityException") return;
2720
+ throw error;
2721
+ }))?.User) await clients.iam.send(new IAM.CreateUserCommand({
2722
+ UserName: user,
2723
+ Path: USER_PATH,
2724
+ Tags: [{
2725
+ Key: TAG_EDGE,
2726
+ Value: server
2727
+ }]
2728
+ }));
2729
+ else {
2730
+ const { Tags = [] } = await clients.iam.send(new IAM.ListUserTagsCommand({ UserName: user }));
2731
+ if (!Tags.some((t) => t.Key === "gkm:edge" && t.Value === server)) throw new EdgeAcmeUserNotOwned(user, server);
2732
+ }
2733
+ await clients.iam.send(new IAM.PutUserPolicyCommand({
2734
+ UserName: user,
2735
+ PolicyName: project,
2736
+ PolicyDocument: acmeDnsPolicy(zoneId, domain)
2737
+ }));
2738
+ log(`🔑 ${EDGE_PROJECT} may write _acme-challenge.${domain} TXT records in ${zoneId}, and nothing else there, as IAM user ${user}`);
2739
+ const written = await readEdgeFile(docker, edge, EDGE_AWS_CREDENTIALS);
2740
+ const held = written?.match(/aws_access_key_id\s*=\s*(\S+)/)?.[1];
2741
+ const { AccessKeyMetadata = [] } = await clients.iam.send(new IAM.ListAccessKeysCommand({ UserName: user }));
2742
+ if (held && AccessKeyMetadata.some((k) => k.AccessKeyId === held)) return {
2743
+ user,
2744
+ zoneId,
2745
+ issued: false
2746
+ };
2747
+ for (const key of AccessKeyMetadata) {
2748
+ if (!key.AccessKeyId) continue;
2749
+ await clients.iam.send(new IAM.DeleteAccessKeyCommand({
2750
+ UserName: user,
2751
+ AccessKeyId: key.AccessKeyId
2752
+ }));
2753
+ }
2754
+ const { AccessKey } = await clients.iam.send(new IAM.CreateAccessKeyCommand({ UserName: user }));
2755
+ await writeEdgeSecret(docker, edge, EDGE_AWS_CREDENTIALS, `# Written by gkm compose — the key ${EDGE_PROJECT} answers DNS challenges with.
2756
+ [default]
2757
+ aws_access_key_id = ${AccessKey?.AccessKeyId}
2758
+ aws_secret_access_key = ${AccessKey?.SecretAccessKey}
2759
+ `);
2760
+ log(`🔑 Wrote a new key for ${user} to ${EDGE_PROJECT} (${EDGE_AWS_CREDENTIALS})`);
2761
+ if (written !== void 0) await restartEdge(docker, edge);
2762
+ return {
2763
+ user,
2764
+ zoneId,
2765
+ issued: true
2766
+ };
2767
+ }
2768
+ /** The id of the hosted zone named exactly `zone`, if there is one. */
2769
+ async function hostedZoneId(route53, zone) {
2770
+ const { ListHostedZonesByNameCommand } = await import("@aws-sdk/client-route-53");
2771
+ const name = zone.endsWith(".") ? zone : `${zone}.`;
2772
+ const { HostedZones = [] } = await route53.send(new ListHostedZonesByNameCommand({
2773
+ DNSName: name,
2774
+ MaxItems: 1
2775
+ }));
2776
+ return HostedZones.find((z) => z.Name === name)?.Id?.replace("/hostedzone/", "");
2777
+ }
2778
+ //#endregion
2451
2779
  //#region src/compose/secrets.ts
2452
2780
  function deployedStackSecrets(workspace, stage, stored, manifest) {
2453
2781
  const withSeed = require_seeds.withGeneratedSecrets(stored ?? require_seeds.initStageSecrets(stage), manifest);
@@ -2927,7 +3255,7 @@ async function readyCompose(ctx, run, deps) {
2927
3255
  }
2928
3256
  if (stack.local) return;
2929
3257
  if (run.server && !ctx.dryRun && !run.push) await deps.server.check(run.server);
2930
- const prune = await stageHostsDns(ctx, deps, require_snsSubscriptions.stackHosts(stack).filter((host) => !require_snsSubscriptions.isLocalHost(host)), run.secrets?.custom);
3258
+ const prune = await stageHostsDns(ctx, deps, require_snsSubscriptions.stackHosts(stack).filter((host) => !require_snsSubscriptions.isLocalHost(host)), run.secrets?.custom, stack.wildcard?.host);
2931
3259
  if (prune) run.pruneDns = prune;
2932
3260
  }
2933
3261
  /** A stack whose caches are in Redis, built for an app that has no client. */
@@ -2968,7 +3296,7 @@ function assertRedisClient(workspace, stack, manifest, runnables) {
2968
3296
  * @throws {ServerAddressInvalid} for a value that is not an address
2969
3297
  * @throws {HostNotPointingAtServer} when a host is not the server
2970
3298
  */
2971
- async function stageHostsDns(ctx, deps, hosts, custom) {
3299
+ async function stageHostsDns(ctx, deps, hosts, custom, wildcard) {
2972
3300
  const { workspace, stage } = ctx;
2973
3301
  const server = require_snsSubscriptions.requiredServerAddress(stage, workspace.domains?.[stage], custom);
2974
3302
  if (hosts.length === 0) return;
@@ -2990,6 +3318,7 @@ async function stageHostsDns(ctx, deps, hosts, custom) {
2990
3318
  server,
2991
3319
  dns: workspace.dns,
2992
3320
  recorded: require_seeds.dnsResources(stored?.resources ?? {}),
3321
+ ...wildcard ? { wildcard } : {},
2993
3322
  credentials: ctx.credentials,
2994
3323
  log,
2995
3324
  lookup: deps.lookup ?? require_snsSubscriptions.systemLookup,
@@ -3151,6 +3480,52 @@ async function planCompose(ctx, run) {
3151
3480
  });
3152
3481
  }
3153
3482
  /**
3483
+ * The shared edge's key for the stage's wildcard certificate: the DNS
3484
+ * challenge's record, and nothing else, through the stage domain's Route 53
3485
+ * entry — before the stack's routes ask for the certificate.
3486
+ */
3487
+ async function edgeAcmeKey(ctx, run, deps) {
3488
+ const { workspace, stage } = ctx;
3489
+ const domain = workspace.domains?.[stage];
3490
+ const dns = workspace.dns ? require_seeds.normalizeDnsConfig(workspace.dns) : {};
3491
+ const zone = domain ? require_seeds.findRootDomain(domain, dns) : null;
3492
+ const config = zone ? dns[zone] : void 0;
3493
+ if (!domain || !zone || config?.provider !== "route53") return;
3494
+ const route53 = config;
3495
+ const server = require_snsSubscriptions.requiredServerAddress(stage, domain, run.secrets?.custom)?.ipv4 ?? run.server?.host ?? "local";
3496
+ const clients = await (deps.acmeClients ?? defaultAcmeClients)(route53);
3497
+ await ensureEdgeAcmeKey(deps.docker, {
3498
+ clients,
3499
+ edge: edgeRef(edgeFile(run), {
3500
+ ...run.ref.host ? { host: run.ref.host } : {},
3501
+ ...run.ref.output ? { output: run.ref.output } : {}
3502
+ }),
3503
+ server,
3504
+ project: run.stack.project,
3505
+ domain,
3506
+ zone,
3507
+ ...route53.hostedZoneId ? { hostedZoneId: route53.hostedZoneId } : {},
3508
+ ...ctx.dryRun ? { dryRun: true } : {},
3509
+ log: (line) => ctx.logger.info(line)
3510
+ });
3511
+ }
3512
+ /** IAM and Route 53 through the AWS SDK's own chain, or the entry's profile. */
3513
+ async function defaultAcmeClients(config) {
3514
+ const [{ IAMClient }, { Route53Client }, { fromIni }] = await Promise.all([
3515
+ import("@aws-sdk/client-iam"),
3516
+ import("@aws-sdk/client-route-53"),
3517
+ import("@aws-sdk/credential-providers")
3518
+ ]);
3519
+ const options = {
3520
+ region: config.region ?? "us-east-1",
3521
+ ...config.profile ? { credentials: fromIni({ profile: config.profile }) } : {}
3522
+ };
3523
+ return {
3524
+ iam: new IAMClient(options),
3525
+ route53: new Route53Client(options)
3526
+ };
3527
+ }
3528
+ /**
3154
3529
  * What the apps run on: the stage's generated secrets kept, the stack's files
3155
3530
  * written, its infrastructure started, and its databases, roles, grants and
3156
3531
  * migrations applied.
@@ -3193,6 +3568,7 @@ async function provisionCompose(ctx, run, deps) {
3193
3568
  id: `${EDGE_PROJECT}/${EDGE_SERVICE}`,
3194
3569
  via: "found"
3195
3570
  });
3571
+ if (stack.wildcard?.tls === "dns") await edgeAcmeKey(ctx, run, deps);
3196
3572
  }
3197
3573
  if (stack.infra.length > 0) {
3198
3574
  ctx.logger.info(`\n🗄️ Starting ${stack.infra.join(", ")}…`);
@@ -3483,7 +3859,7 @@ async function verifyCompose(ctx, run, deps) {
3483
3859
  connectTo: run.server.host,
3484
3860
  connectPort: edgePorts(deps.env).https
3485
3861
  } : void 0;
3486
- const results = await Promise.all(stack.apps.map((app) => checkApp(ctx, app, deps, {
3862
+ const results = await Promise.all(stack.apps.map((app) => app.id === stack.wildcard?.site ? checkContainer(ctx, run, deps, app.name) : checkApp(ctx, app, deps, {
3487
3863
  ca,
3488
3864
  edge
3489
3865
  })));
@@ -3990,4 +4366,4 @@ Object.defineProperty(exports, "stackPlan", {
3990
4366
  }
3991
4367
  });
3992
4368
 
3993
- //# sourceMappingURL=compose-ht0TCG2X.cjs.map
4369
+ //# sourceMappingURL=compose-Diz_QC7m.cjs.map