@geekmidas/cli 10.0.0-alpha.184 → 10.0.0-alpha.186

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 (251) hide show
  1. package/dist/{LegacyStateStore-CTfoMtC2.mjs → LegacyStateStore-BwHw28fJ.mjs} +2 -2
  2. package/dist/{LegacyStateStore-CTfoMtC2.mjs.map → LegacyStateStore-BwHw28fJ.mjs.map} +1 -1
  3. package/dist/{LegacyStateStore-BtDLNkIH.cjs → LegacyStateStore-LpTY3S7z.cjs} +2 -2
  4. package/dist/{LegacyStateStore-BtDLNkIH.cjs.map → LegacyStateStore-LpTY3S7z.cjs.map} +1 -1
  5. package/dist/{LocalStateStore-BKp45OoB.cjs → LocalStateStore-Dpn9kBuK.cjs} +2 -2
  6. package/dist/{LocalStateStore-BKp45OoB.cjs.map → LocalStateStore-Dpn9kBuK.cjs.map} +1 -1
  7. package/dist/{LocalStateStore-C4zDHVM-.mjs → LocalStateStore-DsdNLm0_.mjs} +2 -2
  8. package/dist/{LocalStateStore-C4zDHVM-.mjs.map → LocalStateStore-DsdNLm0_.mjs.map} +1 -1
  9. package/dist/{S3StateStore-S0TXLlMW.mjs → S3StateStore-BIpCLzpk.mjs} +4 -4
  10. package/dist/{S3StateStore-S0TXLlMW.mjs.map → S3StateStore-BIpCLzpk.mjs.map} +1 -1
  11. package/dist/{S3StateStore-B6SjbLxh.cjs → S3StateStore-Bk_EIWLU.cjs} +5 -5
  12. package/dist/{S3StateStore-B6SjbLxh.cjs.map → S3StateStore-Bk_EIWLU.cjs.map} +1 -1
  13. package/dist/{SSMStateStore-6Di_zxwC.cjs → SSMStateStore-A1bgCF1P.cjs} +2 -2
  14. package/dist/{SSMStateStore-6Di_zxwC.cjs.map → SSMStateStore-A1bgCF1P.cjs.map} +1 -1
  15. package/dist/{SSMStateStore-ClPHFhRQ.mjs → SSMStateStore-PiZxPXeX.mjs} +2 -2
  16. package/dist/{SSMStateStore-ClPHFhRQ.mjs.map → SSMStateStore-PiZxPXeX.mjs.map} +1 -1
  17. package/dist/{add-BR8XW4IH.mjs → add-BBhzFpQ7.mjs} +4 -5
  18. package/dist/{add-BR8XW4IH.mjs.map → add-BBhzFpQ7.mjs.map} +1 -1
  19. package/dist/{add-Bd9MDHuU.cjs → add-sU71e0Lp.cjs} +13 -14
  20. package/dist/{add-Bd9MDHuU.cjs.map → add-sU71e0Lp.cjs.map} +1 -1
  21. package/dist/backups/runner.cjs +501 -13
  22. package/dist/backups/runner.cjs.map +1 -1
  23. package/dist/backups/runner.d.cts +87 -2
  24. package/dist/backups/runner.d.cts.map +1 -1
  25. package/dist/backups/runner.d.mts +87 -2
  26. package/dist/backups/runner.d.mts.map +1 -1
  27. package/dist/backups/runner.mjs +493 -15
  28. package/dist/backups/runner.mjs.map +1 -1
  29. package/dist/{bundler-4E-CGdL3.cjs → bundler-BM6lq-36.cjs} +9 -9
  30. package/dist/{bundler-4E-CGdL3.cjs.map → bundler-BM6lq-36.cjs.map} +1 -1
  31. package/dist/{bundler-Cwr4YSpp.mjs → bundler-QKbRwztS.mjs} +6 -6
  32. package/dist/{bundler-Cwr4YSpp.mjs.map → bundler-QKbRwztS.mjs.map} +1 -1
  33. package/dist/{cli-CrPJr29x.cjs → cli-D_iytris.cjs} +6 -6
  34. package/dist/{cli-CrPJr29x.cjs.map → cli-D_iytris.cjs.map} +1 -1
  35. package/dist/{cli-C3mHXsAE.mjs → cli-VCAfR-se.mjs} +4 -4
  36. package/dist/{cli-C3mHXsAE.mjs.map → cli-VCAfR-se.mjs.map} +1 -1
  37. package/dist/{clientTelemetry-Ej1tf1VE.d.cts → clientTelemetry-Bzc4KXz5.d.mts} +2 -2
  38. package/dist/clientTelemetry-Bzc4KXz5.d.mts.map +1 -0
  39. package/dist/{clientTelemetry-crdjgehZ.d.mts → clientTelemetry-N8NAguGI.d.cts} +2 -2
  40. package/dist/clientTelemetry-N8NAguGI.d.cts.map +1 -0
  41. package/dist/{compose-DPXoarGI.mjs → compose-CX2BF3LG.mjs} +58 -1029
  42. package/dist/compose-CX2BF3LG.mjs.map +1 -0
  43. package/dist/{compose-CKBieltT.cjs → compose-D3zc8QN1.cjs} +117 -1130
  44. package/dist/compose-D3zc8QN1.cjs.map +1 -0
  45. package/dist/{config-q4ewzIA_.d.mts → config-CTrfNKYd.d.mts} +3 -3
  46. package/dist/{config-lSOwPbUy.d.cts.map → config-CTrfNKYd.d.mts.map} +1 -1
  47. package/dist/{config-lSOwPbUy.d.cts → config-D9g_nYIu.d.cts} +3 -3
  48. package/dist/{config-q4ewzIA_.d.mts.map → config-D9g_nYIu.d.cts.map} +1 -1
  49. package/dist/config.cjs +1 -1
  50. package/dist/config.d.cts +3 -3
  51. package/dist/config.d.mts +3 -3
  52. package/dist/config.mjs +1 -1
  53. package/dist/{compose-CJznzQc7.mjs → credentials-BMdpNO8R.mjs} +1213 -1258
  54. package/dist/credentials-BMdpNO8R.mjs.map +1 -0
  55. package/dist/{dns-BzYrbB2Y.cjs → credentials-BQ1khM28.cjs} +6 -847
  56. package/dist/credentials-BQ1khM28.cjs.map +1 -0
  57. package/dist/{compose-CvNyjqwL.cjs → credentials-C3uaZ80e.cjs} +1270 -1285
  58. package/dist/credentials-C3uaZ80e.cjs.map +1 -0
  59. package/dist/{dns-C0wbTjVX.mjs → credentials-Ci8nKFw4.mjs} +5 -708
  60. package/dist/credentials-Ci8nKFw4.mjs.map +1 -0
  61. package/dist/{dbTunnel-DSzAG_wy.cjs → dbTunnel-D000s0YK.cjs} +8 -9
  62. package/dist/{dbTunnel-DSzAG_wy.cjs.map → dbTunnel-D000s0YK.cjs.map} +1 -1
  63. package/dist/{dbTunnel-CphoKGyk.mjs → dbTunnel-DqtSAdQK.mjs} +5 -6
  64. package/dist/{dbTunnel-CphoKGyk.mjs.map → dbTunnel-DqtSAdQK.mjs.map} +1 -1
  65. package/dist/deploy/public.cjs +25 -26
  66. package/dist/deploy/public.cjs.map +1 -1
  67. package/dist/deploy/public.d.cts +5 -5
  68. package/dist/deploy/public.d.cts.map +1 -1
  69. package/dist/deploy/public.d.mts +5 -5
  70. package/dist/deploy/public.d.mts.map +1 -1
  71. package/dist/deploy/public.mjs +10 -11
  72. package/dist/deploy/public.mjs.map +1 -1
  73. package/dist/{deploy-BaSYxpny.cjs → deploy-DRH6q_2r.cjs} +72 -62
  74. package/dist/deploy-DRH6q_2r.cjs.map +1 -0
  75. package/dist/{deploy-C_uZBzvS.mjs → deploy-DwtM6VSz.mjs} +25 -15
  76. package/dist/deploy-DwtM6VSz.mjs.map +1 -0
  77. package/dist/{destroy-yTBmL1jf.mjs → destroy-C6QwLj3b.mjs} +9 -9
  78. package/dist/{destroy-yTBmL1jf.mjs.map → destroy-C6QwLj3b.mjs.map} +1 -1
  79. package/dist/{destroy-PvrHxZDu.cjs → destroy-ChTJ_oUq.cjs} +21 -21
  80. package/dist/{destroy-PvrHxZDu.cjs.map → destroy-ChTJ_oUq.cjs.map} +1 -1
  81. package/dist/{dokploy-DqL3jeDu.mjs → dokploy-Dm8-eHtx.mjs} +2 -2
  82. package/dist/{dokploy-DqL3jeDu.mjs.map → dokploy-Dm8-eHtx.mjs.map} +1 -1
  83. package/dist/{dokploy-DYUMx2MY.cjs → dokploy-jeO7mz1R.cjs} +2 -2
  84. package/dist/{dokploy-DYUMx2MY.cjs.map → dokploy-jeO7mz1R.cjs.map} +1 -1
  85. package/dist/{eas-DEM-iWg6.cjs → eas-BAitvB5R.cjs} +3 -3
  86. package/dist/{eas-DEM-iWg6.cjs.map → eas-BAitvB5R.cjs.map} +1 -1
  87. package/dist/{eas-DHDU86PL.mjs → eas-CXYo8hos.mjs} +3 -3
  88. package/dist/{eas-DHDU86PL.mjs.map → eas-CXYo8hos.mjs.map} +1 -1
  89. package/dist/{encryption-CbMprdAb.mjs → encryption-B7IlQ6VO.mjs} +3 -3
  90. package/dist/{encryption-CbMprdAb.mjs.map → encryption-B7IlQ6VO.mjs.map} +1 -1
  91. package/dist/{encryption-BKWmbKkN.cjs → encryption-OPCsewWc.cjs} +6 -6
  92. package/dist/{encryption-BKWmbKkN.cjs.map → encryption-OPCsewWc.cjs.map} +1 -1
  93. package/dist/{engine-3imTFxdN.cjs → engine-BSnhQLaB.cjs} +105 -102
  94. package/dist/engine-BSnhQLaB.cjs.map +1 -0
  95. package/dist/{engine-DaI4iScI.mjs → engine-a6K99WIl.mjs} +12 -9
  96. package/dist/engine-a6K99WIl.mjs.map +1 -0
  97. package/dist/{github-Y6NAwHG1.cjs → github-C3gUSbLn.cjs} +18 -18
  98. package/dist/{github-Y6NAwHG1.cjs.map → github-C3gUSbLn.cjs.map} +1 -1
  99. package/dist/{github-Dijjr__H.mjs → github-D4hThtnt.mjs} +7 -7
  100. package/dist/{github-Dijjr__H.mjs.map → github-D4hThtnt.mjs.map} +1 -1
  101. package/dist/{googlePlay-Dcp3Yycu.cjs → googlePlay-C5Q7Zov3.cjs} +5 -5
  102. package/dist/{googlePlay-Dcp3Yycu.cjs.map → googlePlay-C5Q7Zov3.cjs.map} +1 -1
  103. package/dist/{googlePlay-SDT3j9Kf.mjs → googlePlay-DIS9PeFB.mjs} +4 -4
  104. package/dist/{googlePlay-SDT3j9Kf.mjs.map → googlePlay-DIS9PeFB.mjs.map} +1 -1
  105. package/dist/{iam-CqW9hsd2.mjs → iam-DloEBLXZ.mjs} +2 -2
  106. package/dist/{iam-CqW9hsd2.mjs.map → iam-DloEBLXZ.mjs.map} +1 -1
  107. package/dist/{iam-DeBQcSvw.cjs → iam-SxPKYCI_.cjs} +2 -2
  108. package/dist/{iam-DeBQcSvw.cjs.map → iam-SxPKYCI_.cjs.map} +1 -1
  109. package/dist/{index-DJzVO6Ht.d.cts → index-BThTZV8T.d.mts} +2 -2
  110. package/dist/{index-Ccsgoq3_.d.mts.map → index-BThTZV8T.d.mts.map} +1 -1
  111. package/dist/{index-Ccsgoq3_.d.mts → index-Cgd-ouyI.d.cts} +2 -2
  112. package/dist/{index-DJzVO6Ht.d.cts.map → index-Cgd-ouyI.d.cts.map} +1 -1
  113. package/dist/index.cjs +590 -246
  114. package/dist/index.cjs.map +1 -1
  115. package/dist/index.mjs +443 -99
  116. package/dist/index.mjs.map +1 -1
  117. package/dist/{local-DjaAcHZb.cjs → local-B5R1WWEO.cjs} +3 -3
  118. package/dist/{local-DjaAcHZb.cjs.map → local-B5R1WWEO.cjs.map} +1 -1
  119. package/dist/{local-4gzM52HT.mjs → local-CMA_7b0_.mjs} +2 -2
  120. package/dist/{local-4gzM52HT.mjs.map → local-CMA_7b0_.mjs.map} +1 -1
  121. package/dist/{migrate-0Rfhftef.mjs → migrate-168wMF5m.mjs} +5 -5
  122. package/dist/{migrate-0Rfhftef.mjs.map → migrate-168wMF5m.mjs.map} +1 -1
  123. package/dist/{migrate-DDIc3twm.cjs → migrate-B0041tRF.cjs} +13 -13
  124. package/dist/{migrate-DDIc3twm.cjs.map → migrate-B0041tRF.cjs.map} +1 -1
  125. package/dist/{migrate-CuHGYJL9.cjs → migrate-BZxh_zU5.cjs} +6 -6
  126. package/dist/{migrate-CuHGYJL9.cjs.map → migrate-BZxh_zU5.cjs.map} +1 -1
  127. package/dist/{migrate-BLW4BwLd.mjs → migrate-BhnCtwMX.mjs} +3 -3
  128. package/dist/{migrate-BLW4BwLd.mjs.map → migrate-BhnCtwMX.mjs.map} +1 -1
  129. package/dist/openapi.cjs +1 -1
  130. package/dist/openapi.d.cts +2 -2
  131. package/dist/openapi.d.mts +2 -2
  132. package/dist/openapi.mjs +1 -1
  133. package/dist/{projectBucket-C5Ap5kGw.cjs → projectBucket-DEBaYEbi.cjs} +2 -2
  134. package/dist/{projectBucket-C5Ap5kGw.cjs.map → projectBucket-DEBaYEbi.cjs.map} +1 -1
  135. package/dist/{projectBucket-BhEOVVch.mjs → projectBucket-hF0-tlq9.mjs} +2 -2
  136. package/dist/{projectBucket-BhEOVVch.mjs.map → projectBucket-hF0-tlq9.mjs.map} +1 -1
  137. package/dist/{publish-BELe2FO2.cjs → publish-B-ffSuAX.cjs} +2 -2
  138. package/dist/{publish-BELe2FO2.cjs.map → publish-B-ffSuAX.cjs.map} +1 -1
  139. package/dist/{publish-DiDv40hA.mjs → publish-_lVOoWCy.mjs} +2 -2
  140. package/dist/{publish-DiDv40hA.mjs.map → publish-_lVOoWCy.mjs.map} +1 -1
  141. package/dist/{ready--_hMxbUX.cjs → ready-DCvnFZnJ.cjs} +2 -2
  142. package/dist/{ready--_hMxbUX.cjs.map → ready-DCvnFZnJ.cjs.map} +1 -1
  143. package/dist/{ready-CjIqXFXe.mjs → ready-sSPuiZ7N.mjs} +2 -2
  144. package/dist/{ready-CjIqXFXe.mjs.map → ready-sSPuiZ7N.mjs.map} +1 -1
  145. package/dist/reconcile/public.d.cts +1 -1
  146. package/dist/reconcile/public.d.mts +1 -1
  147. package/dist/{resolve-DIPHwLan.cjs → resolve-Cs38fbaX.cjs} +4 -4
  148. package/dist/{resolve-DIPHwLan.cjs.map → resolve-Cs38fbaX.cjs.map} +1 -1
  149. package/dist/{resolve-N8EZzWqJ.mjs → resolve-UK4b26dm.mjs} +4 -4
  150. package/dist/{resolve-N8EZzWqJ.mjs.map → resolve-UK4b26dm.mjs.map} +1 -1
  151. package/dist/{rollback-DIeA6dba.mjs → rollback-B0eg3M0J.mjs} +7 -6
  152. package/dist/{rollback-DIeA6dba.mjs.map → rollback-B0eg3M0J.mjs.map} +1 -1
  153. package/dist/{rollback-Bp6hepUh.cjs → rollback-DByniS9X.cjs} +10 -9
  154. package/dist/{rollback-Bp6hepUh.cjs.map → rollback-DByniS9X.cjs.map} +1 -1
  155. package/dist/{runtime-D_UphAAH.d.cts → runtime-BtoiRP5G.d.cts} +2 -2
  156. package/dist/{runtime-BZlClwy2.d.mts.map → runtime-BtoiRP5G.d.cts.map} +1 -1
  157. package/dist/{runtime-BZlClwy2.d.mts → runtime-Ct41f0tN.d.mts} +2 -2
  158. package/dist/{runtime-D_UphAAH.d.cts.map → runtime-Ct41f0tN.d.mts.map} +1 -1
  159. package/dist/{s3-Bwd6lhTU.cjs → s3-4rmPI6wv.cjs} +3 -3
  160. package/dist/{s3-Bwd6lhTU.cjs.map → s3-4rmPI6wv.cjs.map} +1 -1
  161. package/dist/{s3-CIEf4puu.mjs → s3-B-IJWFJA.mjs} +3 -3
  162. package/dist/{s3-CIEf4puu.mjs.map → s3-B-IJWFJA.mjs.map} +1 -1
  163. package/dist/{serverSetup-mRCLdZQW.mjs → serverSetup-Cok75j21.mjs} +7 -6
  164. package/dist/{serverSetup-mRCLdZQW.mjs.map → serverSetup-Cok75j21.mjs.map} +1 -1
  165. package/dist/{serverSetup-C9DP30J4.cjs → serverSetup-EY5vppoS.cjs} +9 -8
  166. package/dist/{serverSetup-C9DP30J4.cjs.map → serverSetup-EY5vppoS.cjs.map} +1 -1
  167. package/dist/{sniffer-CkPIytPI.cjs → sniffer-CcLTONfm.cjs} +7 -7
  168. package/dist/{sniffer-CkPIytPI.cjs.map → sniffer-CcLTONfm.cjs.map} +1 -1
  169. package/dist/{sniffer-01tbQFmg.mjs → sniffer-DIyYcOXJ.mjs} +7 -7
  170. package/dist/{sniffer-01tbQFmg.mjs.map → sniffer-DIyYcOXJ.mjs.map} +1 -1
  171. package/dist/{snsSubscriptions-DmKrw7AF.cjs → snsSubscriptions-Bore7t-W.cjs} +11 -12
  172. package/dist/{snsSubscriptions-DmKrw7AF.cjs.map → snsSubscriptions-Bore7t-W.cjs.map} +1 -1
  173. package/dist/{snsSubscriptions-k61hsIRw.mjs → snsSubscriptions-CYEVD7ml.mjs} +3 -4
  174. package/dist/{snsSubscriptions-k61hsIRw.mjs.map → snsSubscriptions-CYEVD7ml.mjs.map} +1 -1
  175. package/dist/{sst-DGsteg5j.cjs → sst-Bsu5O1Lt.cjs} +21 -8
  176. package/dist/sst-Bsu5O1Lt.cjs.map +1 -0
  177. package/dist/{sst-CvOnXAel.mjs → sst-DBH707Na.mjs} +19 -6
  178. package/dist/sst-DBH707Na.mjs.map +1 -0
  179. package/dist/stack-CwSx-6ea.cjs +11725 -0
  180. package/dist/stack-CwSx-6ea.cjs.map +1 -0
  181. package/dist/stack-DU2SunuO.mjs +10744 -0
  182. package/dist/stack-DU2SunuO.mjs.map +1 -0
  183. package/dist/{stage-CXIdtjY2.mjs → stage-BGyx0OjL.mjs} +5 -6
  184. package/dist/stage-BGyx0OjL.mjs.map +1 -0
  185. package/dist/{stage-8KJCtYtl.cjs → stage-BgD-kKY3.cjs} +11 -12
  186. package/dist/stage-BgD-kKY3.cjs.map +1 -0
  187. package/dist/{stages-BNoiMXfL.mjs → stages-DFvE7iEO.mjs} +2 -2
  188. package/dist/{stages-BNoiMXfL.mjs.map → stages-DFvE7iEO.mjs.map} +1 -1
  189. package/dist/{stages-tdJKM9qp.cjs → stages-Dk6Lv7DY.cjs} +2 -2
  190. package/dist/{stages-tdJKM9qp.cjs.map → stages-Dk6Lv7DY.cjs.map} +1 -1
  191. package/dist/target/public.cjs +1 -1
  192. package/dist/target/public.d.cts +2 -2
  193. package/dist/target/public.d.mts +2 -2
  194. package/dist/target/public.mjs +1 -1
  195. package/dist/{terminal-GzAW5lzO.mjs → terminal-BlJ90AIM.mjs} +2 -2
  196. package/dist/{terminal-GzAW5lzO.mjs.map → terminal-BlJ90AIM.mjs.map} +1 -1
  197. package/dist/{terminal-DSQgidon.cjs → terminal-GyXHsRAl.cjs} +5 -5
  198. package/dist/{terminal-DSQgidon.cjs.map → terminal-GyXHsRAl.cjs.map} +1 -1
  199. package/dist/{types-BRnmoWCt.d.cts → types-BVDaaLas.d.cts} +22 -4
  200. package/dist/{types-BRnmoWCt.d.cts.map → types-BVDaaLas.d.cts.map} +1 -1
  201. package/dist/{types-Bg7LSAD2.d.mts → types-CJTKWLkK.d.mts} +22 -4
  202. package/dist/{types-Bg7LSAD2.d.mts.map → types-CJTKWLkK.d.mts.map} +1 -1
  203. package/dist/{utils-D_fxUqvU.mjs → utils-CdKxD8Lt.mjs} +2 -2
  204. package/dist/{utils-D_fxUqvU.mjs.map → utils-CdKxD8Lt.mjs.map} +1 -1
  205. package/dist/{utils-D2Nk1Nv2.cjs → utils-DBqXbB8P.cjs} +2 -2
  206. package/dist/{utils-D2Nk1Nv2.cjs.map → utils-DBqXbB8P.cjs.map} +1 -1
  207. package/dist/vitest.cjs +1 -1
  208. package/dist/vitest.mjs +1 -1
  209. package/dist/workspace/index.cjs +1 -1
  210. package/dist/workspace/index.d.cts +2 -2
  211. package/dist/workspace/index.d.mts +2 -2
  212. package/dist/workspace/index.mjs +1 -1
  213. package/dist/{workspace-fGwzXa5l.cjs → workspace-CTspddnJ.cjs} +55 -16
  214. package/dist/workspace-CTspddnJ.cjs.map +1 -0
  215. package/dist/{workspace-DTX6CJi2.mjs → workspace-CdiCMRap.mjs} +55 -16
  216. package/dist/workspace-CdiCMRap.mjs.map +1 -0
  217. package/package.json +16 -16
  218. package/dist/apps-CXzjaPWR.mjs +0 -4650
  219. package/dist/apps-CXzjaPWR.mjs.map +0 -1
  220. package/dist/apps-vLzb0ZSA.cjs +0 -5174
  221. package/dist/apps-vLzb0ZSA.cjs.map +0 -1
  222. package/dist/clientTelemetry-Ej1tf1VE.d.cts.map +0 -1
  223. package/dist/clientTelemetry-crdjgehZ.d.mts.map +0 -1
  224. package/dist/compose-CJznzQc7.mjs.map +0 -1
  225. package/dist/compose-CKBieltT.cjs.map +0 -1
  226. package/dist/compose-CvNyjqwL.cjs.map +0 -1
  227. package/dist/compose-DPXoarGI.mjs.map +0 -1
  228. package/dist/deploy-BaSYxpny.cjs.map +0 -1
  229. package/dist/deploy-C_uZBzvS.mjs.map +0 -1
  230. package/dist/dns-BzYrbB2Y.cjs.map +0 -1
  231. package/dist/dns-C0wbTjVX.mjs.map +0 -1
  232. package/dist/docker-CPoUMg5X.mjs +0 -1649
  233. package/dist/docker-CPoUMg5X.mjs.map +0 -1
  234. package/dist/docker-CrhpQWnL.cjs +0 -1798
  235. package/dist/docker-CrhpQWnL.cjs.map +0 -1
  236. package/dist/engine-3imTFxdN.cjs.map +0 -1
  237. package/dist/engine-DaI4iScI.mjs.map +0 -1
  238. package/dist/notes-6F8YXU8m.mjs +0 -409
  239. package/dist/notes-6F8YXU8m.mjs.map +0 -1
  240. package/dist/notes-DMOLnNJI.cjs +0 -510
  241. package/dist/notes-DMOLnNJI.cjs.map +0 -1
  242. package/dist/sst-CvOnXAel.mjs.map +0 -1
  243. package/dist/sst-DGsteg5j.cjs.map +0 -1
  244. package/dist/stack-Dd-egttk.mjs +0 -1777
  245. package/dist/stack-Dd-egttk.mjs.map +0 -1
  246. package/dist/stack-vBnc84e8.cjs +0 -1887
  247. package/dist/stack-vBnc84e8.cjs.map +0 -1
  248. package/dist/stage-8KJCtYtl.cjs.map +0 -1
  249. package/dist/stage-CXIdtjY2.mjs.map +0 -1
  250. package/dist/workspace-DTX6CJi2.mjs.map +0 -1
  251. package/dist/workspace-fGwzXa5l.cjs.map +0 -1
@@ -1,15 +1,13 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
2
2
  import { t as GkmError } from "./errors-C9uIyIDt.mjs";
3
- import { M as toEmbeddableSecrets, Y as imageRef, at as runOutput, d as createComposeState, et as stageTag, h as recordRelease, it as run, k as initStageSecrets, n as findRootDomain, r as normalizeDnsConfig } from "./dns-C0wbTjVX.mjs";
4
- import { B as LOGS_PORT, Dt as ComposeTlsFileMissing, Ft as SERVER_IPV4_KEY, L as resolveStageTelemetry, Rt as isReservedStageKey } from "./workspace-DTX6CJi2.mjs";
5
- import { A as imageLayout, K as nextPrerenderManifest, L as findBuildRoot, St as envFor, Tt as stageEnv, at as BACKUPS_SERVICE, b as bucketClient, ct as backupsRoleStatements, d as backendsOf, dt as applyBuckets, f as constructGlobs, ft as applyLifecycles, ht as applyPostgres, k as fromBuildRoot, l as workerEnvKeys, mt as applyPolicies, pt as applyNotifications, t as appEnvKeys, v as LEGACY_LOCAL_LOGIN, x as pgClient, y as ensurePostgresLogin, yt as postgresStatements } from "./apps-CXzjaPWR.mjs";
3
+ import { L as stageTag, M as imageRef, f as initStageSecrets, h as toEmbeddableSecrets } from "./credentials-Ci8nKFw4.mjs";
4
+ import { $n as runOutput, $t as imageLayout, An as envFor, At as backendsOf, Bt as assertEdgeHostsFree, Cn as applyNotifications, Dn as postgresStatements, Gt as removeEdgeRoutes, Ht as edgePorts, It as LEGACY_LOCAL_LOGIN, K as ensureDockerignore, Kn as dockerCompose, Kt as writeEdgeRoutes, Lt as ensurePostgresLogin, Mn as stageEnv, Ot as workerEnvKeys, Qt as fromBuildRoot, Rt as bucketClient, Sn as applyLifecycles, St as appEnvKeys, T as createComposeState, Tn as applyPostgres, Ut as edgeRef, Vt as assertEdgePorts, Wt as ensureEdge, _ as ensureEdgeDnsSecrets, c as replicaNames, d as withCaddyConfigs, f as withLogsPort, fn as BACKUPS_SERVICE, g as ensureEdgeAcmeKey, h as acmeDnsZone, hn as POSTGRES_SERVICE, i as composeStack, in as nextPrerenderManifest, jt as constructGlobs, k as recordRelease, l as stackDir, m as acmeDnsSecrets, n as LOOPBACK_SERVICES, r as composeProject, rn as findBuildRoot, s as envFile, t as LOG_ROTATION, vn as backupsRoleStatements, wn as applyPolicies, xn as applyBuckets, zt as pgClient } from "./stack-DU2SunuO.mjs";
5
+ import { B as LOGS_PORT, Dt as ComposeTlsFileMissing, Ft as SERVER_IPV4_KEY, L as resolveStageTelemetry, Rt as isReservedStageKey } from "./workspace-CdiCMRap.mjs";
6
6
  import { t as defineTarget } from "./define-BfrNaY82.mjs";
7
- import { E as withRedisPassword, R as usesTelemetry, _t as LogsPortTaken, gt as LOGS_SERVICE, m as loadLocalCredentials, ut as primaryPortKey, vt as logsAccess, w as runsRedis, wt as withLogsLogin, x as REDIS_SERVICE, y as withGeneratedSecrets } from "./compose-CJznzQc7.mjs";
7
+ import { C as REDIS_SERVICE, Ct as logsAccess, E as runsRedis, O as withRedisPassword, St as LogsPortTaken, X as usesTelemetry, d as loadLocalCredentials, g as withGeneratedSecrets, kt as withLogsLogin, mt as primaryPortKey, xt as LOGS_SERVICE } from "./credentials-BMdpNO8R.mjs";
8
8
  import { o as installedFrom } from "./drivers-BQRb3KsL.mjs";
9
9
  import { i as discover } from "./discover-Dfmn6HQ7.mjs";
10
- import { a as composeProject, d as stackDir, i as LOOPBACK_SERVICES, l as envFile, m as withLogsPort, n as LOGS_PORT_ENV, o as composeStack, p as withCaddyConfigs, r as LOG_ROTATION, t as EDGE_PORT_ENV, u as replicaNames } from "./stack-Dd-egttk.mjs";
11
- import { a as ensureDockerignore } from "./docker-CPoUMg5X.mjs";
12
- import { a as provisionedTopics, c as subscriptionResource, f as isLocalHost, g as serverAddressHint, h as requiredServerAddress, i as confirmPendingSubscriptions, l as topicConnection, n as SUBSCRIPTION_TYPE, o as recordedPushSubscriptions, s as subscriptionKey, t as PushSubscriptionsUnconfirmed, u as HostNotPointingAtServer, v as stackHosts, x as systemLookup, y as stageDns } from "./snsSubscriptions-k61hsIRw.mjs";
10
+ import { a as provisionedTopics, c as subscriptionResource, f as isLocalHost, g as serverAddressHint, h as requiredServerAddress, i as confirmPendingSubscriptions, l as topicConnection, n as SUBSCRIPTION_TYPE, o as recordedPushSubscriptions, s as subscriptionKey, t as PushSubscriptionsUnconfirmed, u as HostNotPointingAtServer, v as stackHosts, x as systemLookup, y as stageDns } from "./snsSubscriptions-CYEVD7ml.mjs";
13
11
  import { d as dnsResources, f as forgetDnsResource, i as currentActor, n as reportDatabaseRuns, p as recordDnsChanges, r as reportPlannedSeeds, s as DeployJournal, t as DeploySeedsFailed, u as dnsResourceKey } from "./seeds-Ccn0Ru2T.mjs";
14
12
  import { f as plannedSeeds, o as SeedFailed, p as seedDatabases, u as migrateDatabases } from "./databases-CV22HzrI.mjs";
15
13
  import { dirname, join, relative } from "node:path";
@@ -19,559 +17,12 @@ import { chmod, mkdir, readFile, readdir, rm, writeFile } from "node:fs/promises
19
17
  import { hostname, userInfo } from "node:os";
20
18
  import { spawn } from "node:child_process";
21
19
  import { createConnection, createServer } from "node:net";
22
- import { createHash } from "node:crypto";
23
20
  import { ensureLocalAuthority, ensureLocalCertificate, localCertificateNames, readLocalAuthority } from "@geekmidas/edge/certificates/local";
24
- import { EDGE_AWS_CREDENTIALS, EDGE_CERTS_DIR, EDGE_DYNAMIC_DIR, EDGE_NETWORK, EDGE_PROJECT, EDGE_SERVICE, claimsOverlap, edgeComposeFile, readEdgeClaims, traefikStaticFile } from "@geekmidas/edge/proxy/traefik";
21
+ import { EDGE_PROJECT, EDGE_SERVICE } from "@geekmidas/edge/proxy/traefik";
25
22
  import { providedKeyFor } from "@geekmidas/manifest";
26
23
  import { stringify } from "yaml";
27
24
  import { request } from "node:http";
28
25
  import { request as request$1 } from "node:https";
29
- //#region src/compose/docker.ts
30
- /**
31
- * The Docker operations `gkm compose` needs, behind an interface.
32
- *
33
- * Small on purpose, like reconcile's: the rules about *when* each runs — the
34
- * registry is asked before anything is pulled, nothing is started for a tag
35
- * that is missing — are asserted against a fake, and this file is only the
36
- * wiring to the real CLI.
37
- *
38
- * Every call is an argument array. Image refs, tags and paths come from the
39
- * workspace, and none of them reaches a shell.
40
- */
41
- /** `output` as `spawn` reads it. */
42
- const STDIO = {
43
- inherit: "inherit",
44
- stderr: [
45
- "ignore",
46
- 2,
47
- 2
48
- ],
49
- ignore: "ignore"
50
- };
51
- /**
52
- * The environment a docker command for `engine` runs with: this process's,
53
- * with `DOCKER_HOST` pointing at the stack's engine when it is a server's.
54
- */
55
- function engineEnv(engine, extra = {}) {
56
- if (!engine.host && Object.keys(extra).length === 0) return void 0;
57
- return {
58
- ...process.env,
59
- ...extra,
60
- ...engine.host ? { DOCKER_HOST: engine.host } : {}
61
- };
62
- }
63
- /** How a stack's docker commands run: where it is, where output goes. */
64
- function runOptions(stack, extra) {
65
- const env = engineEnv(stack, extra);
66
- return {
67
- cwd: stack.cwd,
68
- stdio: STDIO[stack.output ?? "inherit"],
69
- ...env ? { env } : {},
70
- ...stack.signal ? { signal: stack.signal } : {}
71
- };
72
- }
73
- /** The network compose puts a project's services on. */
74
- function projectNetwork(project) {
75
- return `${project}_default`;
76
- }
77
- /**
78
- * The host ports a `docker ps` Ports column publishes: `0.0.0.0:443->443/tcp,
79
- * [::]:443->443/tcp, 0.0.0.0:9000-9001->9000-9001/tcp`.
80
- */
81
- function publishedPorts(column) {
82
- const ports = /* @__PURE__ */ new Set();
83
- for (const match of column.matchAll(/(?:[\d.]+|\[[^\]]*\]):(\d+)(?:-(\d+))?->/g)) {
84
- const first = Number(match[1]);
85
- const last = match[2] ? Number(match[2]) : first;
86
- for (let port = first; port <= last; port++) ports.add(port);
87
- }
88
- return [...ports];
89
- }
90
- /**
91
- * The host port a `docker ps` Ports column publishes for `inside`:
92
- * `127.0.0.1:54321->5432/tcp` is 54321.
93
- */
94
- function publishedPort(column, inside) {
95
- const match = new RegExp(`(?:[\\d.]+|\\[[^\\]]*\\]):(\\d+)->${inside}/tcp`).exec(column);
96
- return match ? Number(match[1]) : void 0;
97
- }
98
- /** Each line `docker ps` printed, as the containers holding `port`. */
99
- function portHolders(output, port) {
100
- return output.split("\n").filter(Boolean).map((line) => line.split(" ")).filter(([, , , column = ""]) => publishedPorts(column).includes(port)).map(([container = "", project, service]) => ({
101
- container,
102
- ...project ? { project } : {},
103
- ...service ? { service } : {}
104
- }));
105
- }
106
- /** How long a stack has to pass its health checks. */
107
- const WAIT_TIMEOUT_S = 180;
108
- /** `docker` itself failed, before it could say anything about a service. */
109
- var DockerUnreachable = class extends GkmError {
110
- engine;
111
- stderr;
112
- constructor(engine, stderr) {
113
- super(`Could not ask Docker on ${engine} which ports its services publish (docker said: ${stderr.trim() || "nothing"}). Check that \`DOCKER_HOST=${engine} docker ps\` works from here.`);
114
- this.engine = engine;
115
- this.stderr = stderr;
116
- this.name = "DockerUnreachable";
117
- }
118
- };
119
- /** `docker compose port` printed nothing a port can be read from. */
120
- var ServicePortUnknown = class extends GkmError {
121
- service;
122
- inside;
123
- output;
124
- constructor(service, inside, output) {
125
- super(`'${service}' publishes no host port for ${inside} (docker said: ${output.trim() || "nothing"}). Is it running? \`docker compose ps\` shows the stack.`);
126
- this.service = service;
127
- this.inside = inside;
128
- this.output = output;
129
- this.name = "ServicePortUnknown";
130
- }
131
- };
132
- /**
133
- * Whether `ref` names a registry on this machine's loopback — which the
134
- * daemon pulls from and pushes to over plain HTTP by default, and `docker
135
- * manifest inspect` reaches only when told `--insecure` (without it, a local
136
- * registry's image is reported as no such manifest).
137
- */
138
- function isLoopbackRegistry(ref) {
139
- const first = ref.split("/")[0];
140
- if (!ref.includes("/") || !/[.:]|^localhost$/.test(first)) return false;
141
- const host = first.replace(/:\d+$/, "");
142
- return host === "localhost" || /^127(?:\.\d{1,3}){3}$/.test(host);
143
- }
144
- /** `docker push` finished without saying what digest the registry stored. */
145
- var PushDigestUnknown = class extends GkmError {
146
- ref;
147
- output;
148
- constructor(ref, output) {
149
- super(`Pushed ${ref}, but docker did not say which digest the registry stored (it said: ${output.trim().split("\n").slice(-3).join(" / ") || "nothing"}). Check the push with \`docker buildx imagetools inspect ${ref}\`.`);
150
- this.ref = ref;
151
- this.output = output;
152
- this.name = "PushDigestUnknown";
153
- }
154
- };
155
- /** The digest `docker push` reports last: `<tag>: digest: sha256:… size: …`. */
156
- function pushedDigest(output) {
157
- return [...output.matchAll(/digest: (sha256:[0-9a-f]{64})/g)].at(-1)?.[1];
158
- }
159
- function compose(stack, args) {
160
- return [
161
- "compose",
162
- "-p",
163
- stack.project,
164
- "-f",
165
- stack.file,
166
- ...(stack.overrides ?? []).flatMap((file) => ["-f", file]),
167
- ...args
168
- ];
169
- }
170
- /** Run a program and keep everything it said, whatever it exits with. */
171
- function capture(command, args, options = {}) {
172
- const { timeoutMs = 6e4 } = options;
173
- return new Promise((resolve, reject) => {
174
- const child = spawn(command, [...args], {
175
- stdio: [
176
- options.input === void 0 ? "ignore" : "pipe",
177
- "pipe",
178
- "pipe"
179
- ],
180
- shell: false,
181
- ...options.env ? { env: options.env } : {}
182
- });
183
- if (options.input !== void 0) child.stdin?.end(options.input);
184
- let stdout = "";
185
- let stderr = "";
186
- child.stdout?.on("data", (chunk) => {
187
- stdout += chunk.toString();
188
- });
189
- child.stderr?.on("data", (chunk) => {
190
- stderr += chunk.toString();
191
- });
192
- const timer = setTimeout(() => child.kill("SIGKILL"), timeoutMs);
193
- timer.unref?.();
194
- child.on("error", (error) => {
195
- clearTimeout(timer);
196
- reject(error);
197
- });
198
- child.on("close", (code) => {
199
- clearTimeout(timer);
200
- resolve({
201
- code,
202
- stdout,
203
- stderr
204
- });
205
- });
206
- });
207
- }
208
- /**
209
- * Whether a failed `docker manifest inspect` means the tag is not there, as
210
- * opposed to the registry not answering.
211
- *
212
- * Read off the message because that is all the CLI gives. Anything not
213
- * recognisably "no such tag" is treated as the registry being unreachable:
214
- * a registry that refused credentials must not be reported as a tag that was
215
- * never pushed, or the fix offered would be the wrong one.
216
- */
217
- function isMissingManifest(output) {
218
- return /no such manifest|manifest unknown|manifest for .* not found|not found: manifest/i.test(output);
219
- }
220
- const dockerCompose = {
221
- async lookup(ref) {
222
- const { code, stdout, stderr } = await capture("docker", [
223
- "manifest",
224
- "inspect",
225
- ...isLoopbackRegistry(ref) ? ["--insecure"] : [],
226
- ref
227
- ]);
228
- if (code === 0) return {
229
- ref,
230
- status: "found"
231
- };
232
- const output = `${stderr}\n${stdout}`.trim();
233
- return isMissingManifest(output) ? {
234
- ref,
235
- status: "missing"
236
- } : {
237
- ref,
238
- status: "unreachable",
239
- detail: output
240
- };
241
- },
242
- async build(stack, services) {
243
- await run("docker", compose(stack, ["build", ...services]), runOptions(stack, {
244
- ...process.env,
245
- DOCKER_BUILDKIT: "1"
246
- }));
247
- },
248
- async pull(stack, services) {
249
- await run("docker", compose(stack, ["pull", ...services]), runOptions(stack));
250
- },
251
- async up(stack, services) {
252
- await run("docker", compose(stack, [
253
- "up",
254
- "-d",
255
- "--wait",
256
- `--wait-timeout=${WAIT_TIMEOUT_S}`,
257
- ...services ? [] : ["--remove-orphans"],
258
- ...services ?? []
259
- ]), runOptions(stack));
260
- },
261
- async down(stack, options) {
262
- const args = ["down", ...options?.volumes ? ["--volumes"] : []];
263
- await run("docker", existsSync(stack.file) ? compose(stack, args) : [
264
- "compose",
265
- "-p",
266
- stack.project,
267
- ...args
268
- ], runOptions(stack));
269
- },
270
- async port(stack, service, inside) {
271
- const env = engineEnv(stack);
272
- const output = await runOutput("docker", compose(stack, [
273
- "port",
274
- service,
275
- String(inside)
276
- ]), {
277
- cwd: stack.cwd,
278
- ...env ? { env } : {},
279
- ...stack.signal ? { signal: stack.signal } : {}
280
- });
281
- const port = Number(output.trim().split(":").pop());
282
- if (!Number.isInteger(port) || port <= 0) throw new ServicePortUnknown(service, inside, output);
283
- return port;
284
- },
285
- async health(stack, service) {
286
- const env = engineEnv(stack);
287
- const { code, stdout } = await capture("docker", compose(stack, [
288
- "ps",
289
- "--format",
290
- "{{.Health}}",
291
- service
292
- ]), env ? { env } : {});
293
- if (code !== 0) return void 0;
294
- return stdout.trim().split("\n")[0] || void 0;
295
- },
296
- async push(stack, ref) {
297
- const output = await runOutput("docker", ["push", ref], {
298
- cwd: stack.cwd,
299
- ...stack.signal ? { signal: stack.signal } : {}
300
- });
301
- const digest = pushedDigest(output);
302
- if (!digest) throw new PushDigestUnknown(ref, output);
303
- return digest;
304
- },
305
- async digest(engine, ref) {
306
- const env = engineEnv(engine);
307
- const { code, stdout } = await capture("docker", [
308
- "image",
309
- "inspect",
310
- "--format={{json .RepoDigests}} {{.Id}}",
311
- ref
312
- ], env ? { env } : {});
313
- if (code !== 0) return void 0;
314
- const [json = "[]", id] = stdout.trim().split(" ");
315
- const repository = ref.split("@")[0].replace(/:[\w][\w.-]*$/, "");
316
- try {
317
- const digests = JSON.parse(json);
318
- const match = Array.isArray(digests) ? digests.find((entry) => typeof entry === "string" && entry.startsWith(`${repository}@`)) : void 0;
319
- if (match) return match.slice(repository.length + 1);
320
- } catch {}
321
- return id || void 0;
322
- },
323
- async ensureNetwork(engine, name) {
324
- const env = engineEnv(engine);
325
- const options = env ? { env } : {};
326
- const { code } = await capture("docker", [
327
- "network",
328
- "inspect",
329
- name
330
- ], options);
331
- if (code === 0) return;
332
- const created = await capture("docker", [
333
- "network",
334
- "create",
335
- name
336
- ], options);
337
- if (created.code !== 0 && !/already exists/.test(created.stderr)) throw new NetworkCreateFailed(name, created.stderr);
338
- },
339
- async publishers(engine, port) {
340
- const env = engineEnv(engine);
341
- const { stdout } = await capture("docker", [
342
- "ps",
343
- "--format",
344
- "{{.Names}} {{.Label \"com.docker.compose.project\"}} {{.Label \"com.docker.compose.service\"}} {{.Ports}}"
345
- ], env ? { env } : {});
346
- return portHolders(stdout, port);
347
- },
348
- async exec(stack, service, command, input) {
349
- const env = engineEnv(stack);
350
- const options = env ? { env } : {};
351
- const { stdout: ids } = await capture("docker", [
352
- "ps",
353
- "-q",
354
- "--filter",
355
- `label=com.docker.compose.project=${stack.project}`,
356
- "--filter",
357
- `label=com.docker.compose.service=${service}`
358
- ], options);
359
- const container = ids.trim().split("\n")[0];
360
- if (!container) return {
361
- code: null,
362
- stdout: "",
363
- stderr: `${service} is not running`
364
- };
365
- return capture("docker", [
366
- "exec",
367
- ...input === void 0 ? [] : ["-i"],
368
- container,
369
- ...command
370
- ], {
371
- ...options,
372
- ...input === void 0 ? {} : { input }
373
- });
374
- },
375
- async container(engine, project, service) {
376
- const env = engineEnv(engine);
377
- const { stdout } = await capture("docker", [
378
- "ps",
379
- "--filter",
380
- `label=com.docker.compose.project=${project}`,
381
- "--filter",
382
- `label=com.docker.compose.service=${service}`,
383
- "--format",
384
- "{{.ID}} {{.Image}}"
385
- ], env ? { env } : {});
386
- const [id, image] = stdout.trim().split("\n")[0]?.split(" ") ?? [];
387
- return id && image ? {
388
- id,
389
- image
390
- } : void 0;
391
- },
392
- async published(engine, project, service, inside) {
393
- const env = engineEnv(engine);
394
- const { code, stdout, stderr } = await capture("docker", [
395
- "ps",
396
- "--filter",
397
- `label=com.docker.compose.project=${project}`,
398
- "--filter",
399
- `label=com.docker.compose.service=${service}`,
400
- "--format",
401
- "{{.Ports}}"
402
- ], env ? { env } : {});
403
- if (code !== 0) throw new DockerUnreachable(engine.host ?? "this machine", stderr);
404
- return publishedPort(stdout, inside);
405
- },
406
- async stop(engine, project, keep) {
407
- const env = engineEnv(engine);
408
- const options = env ? { env } : {};
409
- const listed = await capture("docker", [
410
- "ps",
411
- "--filter",
412
- `label=com.docker.compose.project=${project}`,
413
- "--format",
414
- "{{.ID}} {{.Label \"com.docker.compose.service\"}}"
415
- ], options);
416
- if (listed.code !== 0) throw new DockerUnreachable(engine.host ?? "this machine", listed.stderr);
417
- const ids = listed.stdout.split("\n").filter(Boolean).map((line) => line.split(" ")).filter(([, service = ""]) => !keep.includes(service)).map(([id = ""]) => id).filter(Boolean);
418
- if (ids.length === 0) return [];
419
- const stopped = await capture("docker", ["stop", ...ids], {
420
- ...options,
421
- timeoutMs: 12e4
422
- });
423
- if (stopped.code !== 0) throw new ContainersNotStopped(project, ids, stopped.stderr);
424
- return ids;
425
- },
426
- async start(engine, ids) {
427
- if (ids.length === 0) return;
428
- const env = engineEnv(engine);
429
- const started = await capture("docker", ["start", ...ids], {
430
- ...env ? { env } : {},
431
- timeoutMs: 12e4
432
- });
433
- if (started.code !== 0) throw new ContainersNotStarted(ids, started.stderr);
434
- },
435
- async remove(engine, project, service) {
436
- const env = engineEnv(engine);
437
- const options = env ? { env } : {};
438
- const listed = await capture("docker", [
439
- "ps",
440
- "--all",
441
- "--filter",
442
- `label=com.docker.compose.project=${project}`,
443
- "--filter",
444
- `label=com.docker.compose.service=${service}`,
445
- "--format",
446
- "{{.ID}}"
447
- ], options);
448
- if (listed.code !== 0) throw new DockerUnreachable(engine.host ?? "this machine", listed.stderr);
449
- const ids = listed.stdout.split("\n").filter(Boolean);
450
- if (ids.length === 0) return [];
451
- const removed = await capture("docker", [
452
- "rm",
453
- "--force",
454
- ...ids
455
- ], {
456
- ...options,
457
- timeoutMs: 12e4
458
- });
459
- if (removed.code !== 0) throw new ContainersNotRemoved(project, service, ids, removed.stderr);
460
- return ids;
461
- },
462
- runOnce(engine, options) {
463
- return dockerExit([
464
- "run",
465
- "--rm",
466
- ...options.stdin ? ["-i"] : [],
467
- "--network",
468
- options.network,
469
- ...Object.keys(options.env ?? {}).flatMap((name) => ["-e", name]),
470
- "--entrypoint",
471
- "",
472
- options.image,
473
- ...options.command
474
- ], {
475
- env: engineEnv(engine, { ...options.env }) ?? process.env,
476
- ...options.stdin ? { stdin: options.stdin } : {},
477
- ...options.output ? { output: options.output } : {}
478
- });
479
- }
480
- };
481
- /** Spawn `docker`, its output where `output` says; resolve with the exit code. */
482
- function dockerExit(args, options = {}) {
483
- const output = STDIO[options.output ?? "inherit"];
484
- const out = Array.isArray(output) ? output : [
485
- output,
486
- output,
487
- output
488
- ];
489
- return new Promise((resolve, reject) => {
490
- const child = spawn("docker", [...args], {
491
- stdio: [
492
- options.stdin ? "pipe" : "ignore",
493
- out[1],
494
- out[2]
495
- ],
496
- env: options.env ?? process.env,
497
- shell: false
498
- });
499
- let stdinFailed;
500
- if (options.stdin && child.stdin) {
501
- options.stdin.on("error", (error) => {
502
- stdinFailed = error;
503
- child.stdin?.destroy(error);
504
- });
505
- child.stdin.on("error", () => {});
506
- options.stdin.pipe(child.stdin);
507
- }
508
- child.on("error", reject);
509
- child.on("close", (code) => {
510
- if (stdinFailed) reject(new StdinNotDelivered(stdinFailed));
511
- else resolve(code ?? 1);
512
- });
513
- });
514
- }
515
- /** What a command run with {@link dockerExit} read from stdin failed partway. */
516
- var StdinNotDelivered = class extends GkmError {
517
- reason;
518
- constructor(reason) {
519
- super(`The input to docker stopped before its end (${reason.message}), so the command only read part of it. Run it again.`);
520
- this.reason = reason;
521
- this.name = "StdinNotDelivered";
522
- }
523
- };
524
- /** `docker stop` failed for some of a project's containers. */
525
- var ContainersNotStopped = class extends GkmError {
526
- project;
527
- ids;
528
- output;
529
- constructor(project, ids, output) {
530
- super(`Could not stop ${project}'s containers ${ids.join(", ")} (docker said: ${output.trim() || "nothing"}). Check \`docker ps\` on the stage's server.`);
531
- this.project = project;
532
- this.ids = ids;
533
- this.output = output;
534
- this.name = "ContainersNotStopped";
535
- }
536
- };
537
- /** `docker start` failed for containers that were stopped. */
538
- var ContainersNotStarted = class extends GkmError {
539
- ids;
540
- output;
541
- constructor(ids, output) {
542
- super(`Could not start the containers ${ids.join(", ")} again (docker said: ${output.trim() || "nothing"}). Start them on the stage's server with \`docker start ${ids.join(" ")}\`, or deploy the stage.`);
543
- this.ids = ids;
544
- this.output = output;
545
- this.name = "ContainersNotStarted";
546
- }
547
- };
548
- /** `docker rm` failed for a service's containers. */
549
- var ContainersNotRemoved = class extends GkmError {
550
- project;
551
- service;
552
- ids;
553
- output;
554
- constructor(project, service, ids, output) {
555
- super(`Could not remove ${project}'s ${service} containers ${ids.join(", ")} (docker said: ${output.trim() || "nothing"}). Remove them on the stage's server with \`docker rm --force ${ids.join(" ")}\`, and deploy again.`);
556
- this.project = project;
557
- this.service = service;
558
- this.ids = ids;
559
- this.output = output;
560
- this.name = "ContainersNotRemoved";
561
- }
562
- };
563
- /** `docker network create` failed. */
564
- var NetworkCreateFailed = class extends GkmError {
565
- network;
566
- output;
567
- constructor(network, output) {
568
- super(`Could not create the Docker network '${network}' (docker said: ${output.trim() || "nothing"}). Create it by hand with \`docker network create ${network}\` and run again.`);
569
- this.network = network;
570
- this.output = output;
571
- this.name = "NetworkCreateFailed";
572
- }
573
- };
574
- //#endregion
575
26
  //#region src/compose/server.ts
576
27
  /**
577
28
  * Where a deployed compose stage runs: its server, reached over SSH.
@@ -763,434 +214,6 @@ const sshAccess = {
763
214
  }
764
215
  };
765
216
  //#endregion
766
- //#region src/compose/edge.ts
767
- /**
768
- * The server's shared Traefik edge, in Docker: started when a stack needs it,
769
- * and each stack's routes written to — and removed from — the directory it
770
- * watches.
771
- *
772
- * Everything goes through the server's Docker engine, never its filesystem:
773
- * the edge's static configuration is handed to it inline, and the directories
774
- * it watches are volumes each stack writes into with `docker exec`. So the
775
- * deploy runs anywhere that reaches the engine — a CI runner over SSH — and
776
- * nothing it writes depends on a path on that machine.
777
- *
778
- * gkm-edge (compose project — `GKM_EDGE_PROJECT` renames it)
779
- * traefik.yml its static configuration (inline config)
780
- * dynamic/<project>.yml one per stack: routers, services, middlewares
781
- * certs/<project>.crt|.key a stack's own certificate, where it has one
782
- */
783
- /** The edge's compose project, as docker is asked about it. */
784
- function edgeRef(file, options = {}) {
785
- return {
786
- project: EDGE_PROJECT,
787
- file,
788
- cwd: dirname(file),
789
- ...options
790
- };
791
- }
792
- /** Writing to or removing from the edge's volumes failed. */
793
- var EdgeWriteFailed = class extends GkmError {
794
- path;
795
- output;
796
- constructor(path, output) {
797
- super(`Could not write ${path} in the shared edge (${EDGE_PROJECT}): ${output.trim() || "it is not running"}. Check it with \`docker compose -p ${EDGE_PROJECT} ps\` on the server, and run gkm compose again.`);
798
- this.path = path;
799
- this.output = output;
800
- this.name = "EdgeWriteFailed";
801
- }
802
- };
803
- /**
804
- * Something other than the proxy a stack is set to holds the edge's ports.
805
- *
806
- * With `proxy: 'traefik'`, any container but the shared edge and the stack's
807
- * own Caddy, which the deploy moves (see {@link assertEdgePorts}); with
808
- * `proxy: 'caddy'`, the shared edge, or another stack's Caddy. Refused before
809
- * anything is started, so the stack is never left half on one proxy and half
810
- * on the other.
811
- */
812
- var ComposeProxyClash = class extends GkmError {
813
- project;
814
- proxy;
815
- port;
816
- holder;
817
- constructor(project, proxy, port, holder) {
818
- const by = holder.project ? `${holder.container} (compose project ${holder.project})` : holder.container;
819
- const fix = proxy === "traefik" ? `The shared edge needs ports 80 and 443. Stop ${holder.container}${holder.project ? ` (docker compose -p ${holder.project} down, or its own gkm compose --down)` : ""}, or move the edge with GKM_COMPOSE_HTTPS_PORT/GKM_COMPOSE_HTTP_PORT.` : holder.project === EDGE_PROJECT ? `That is the server's shared Traefik edge, which other stacks register with. Set deploy.compose.proxy to 'traefik' for this stage so the stack registers with it too, or stop the edge once nothing uses it (docker compose -p ${EDGE_PROJECT} down).` : `Stop ${holder.container}, or publish this stack's Caddy elsewhere with GKM_COMPOSE_HTTPS_PORT/GKM_COMPOSE_HTTP_PORT.`;
820
- super(`${project} is set to proxy: '${proxy}', and port ${port} is held by ${by}. ${fix}`);
821
- this.project = project;
822
- this.proxy = proxy;
823
- this.port = port;
824
- this.holder = holder;
825
- this.name = "ComposeProxyClash";
826
- }
827
- };
828
- /**
829
- * Refuse a stack whose edge ports are held by anything but its own proxy:
830
- * the shared edge for `'traefik'`, the stack's own Caddy for `'caddy'`.
831
- *
832
- * One holder is not refused: with `'traefik'`, the stack's own Caddy, still
833
- * running from before the stage was switched. It is this stack's to move and
834
- * no other's, so it is returned for the deploy to remove just before the edge
835
- * takes the ports — the moment's downtime the switch costs. Undefined when
836
- * there is nothing to move.
837
- */
838
- async function assertEdgePorts(docker, options) {
839
- const { project, proxy, ports } = options;
840
- const ownCaddy = (holder) => holder.project === project && holder.service === "caddy";
841
- let move;
842
- for (const port of [ports.https, ports.http]) for (const holder of await docker.publishers(options.engine, port)) {
843
- if (proxy === "traefik" && ownCaddy(holder)) {
844
- move = holder;
845
- continue;
846
- }
847
- if (!(proxy === "traefik" ? holder.project === EDGE_PROJECT : ownCaddy(holder))) throw new ComposeProxyClash(project, proxy, port, holder);
848
- }
849
- return move;
850
- }
851
- /**
852
- * Write a file into the edge's running container whole or not at all: a
853
- * temporary name, then a rename. Not `.yml`: the edge reads only `.yml`,
854
- * `.yaml` and `.toml` files, so it never sees one half written.
855
- */
856
- async function put(docker, edge, path, content, mode = "644") {
857
- const result = await docker.exec(edge, EDGE_SERVICE, [
858
- "sh",
859
- "-c",
860
- "set -e; t=\"$1.tmp\"; cat > \"$t\"; chmod \"$2\" \"$t\"; mv \"$t\" \"$1\"",
861
- "sh",
862
- path,
863
- mode
864
- ], content);
865
- if (result.code !== 0) throw new EdgeWriteFailed(path, `${result.stderr}${result.stdout}`);
866
- }
867
- /** Remove files from the edge's container; whether the first was there. */
868
- async function remove(docker, edge, paths) {
869
- return (await docker.exec(edge, EDGE_SERVICE, [
870
- "sh",
871
- "-c",
872
- "e=1; [ -f \"$1\" ] && e=0; rm -f \"$@\"; exit $e",
873
- "sh",
874
- ...paths
875
- ])).code === 0;
876
- }
877
- /**
878
- * The edge, up: its network and its container — started when it is not
879
- * running, and recreated when its configuration changed. Idempotent: on a
880
- * server where it already runs as configured, `up` changes nothing. Its
881
- * compose file is written to `file`, on this machine: compose reads it here.
882
- */
883
- async function ensureEdge(docker, options) {
884
- const { file, ports } = options;
885
- const staticConfig = traefikStaticFile(ports);
886
- const content = edgeComposeFile({
887
- ports,
888
- staticConfig,
889
- logging: options.logging
890
- });
891
- await mkdir(dirname(file), { recursive: true });
892
- if (await readFile(file, "utf-8").catch(() => void 0) !== content) await writeFile(file, content);
893
- const ref = edgeRef(file, {
894
- ...options.host ? { host: options.host } : {},
895
- ...options.output ? { output: options.output } : {},
896
- ...options.signal ? { signal: options.signal } : {}
897
- });
898
- await docker.ensureNetwork(ref, EDGE_NETWORK);
899
- await docker.up(ref, [EDGE_SERVICE]);
900
- return [file];
901
- }
902
- /** A file inside the edge's running container, or undefined where there is none. */
903
- async function readEdgeFile(docker, edge, path) {
904
- const result = await docker.exec(edge, EDGE_SERVICE, ["cat", path]);
905
- return result.code === 0 ? result.stdout : void 0;
906
- }
907
- /** A file written into the edge's running container, whole, readable by it alone. */
908
- async function writeEdgeSecret(docker, edge, path, content) {
909
- await put(docker, edge, path, content, "600");
910
- }
911
- /**
912
- * The edge restarted — what it reads once and keeps, a key among them, read
913
- * again — and waited on until it is healthy. Its own restart policy brings
914
- * it back; `up` waits for it.
915
- */
916
- async function restartEdge(docker, edge) {
917
- await docker.exec(edge, EDGE_SERVICE, ["kill", "1"]);
918
- await docker.up(edge, [EDGE_SERVICE]);
919
- }
920
- /** A stack's routes, inside the edge's container. */
921
- function routesPath(project) {
922
- return `${EDGE_DYNAMIC_DIR}/${project}.yml`;
923
- }
924
- /**
925
- * A host this stack routes is already routed through the shared edge by
926
- * another project: two routers for one host, and which stack serves it — and
927
- * which gets its certificate — would be the edge's choice.
928
- */
929
- var EdgeHostClaimed = class extends GkmError {
930
- host;
931
- owner;
932
- project;
933
- edge;
934
- constructor(host, owner, project, edge = EDGE_PROJECT) {
935
- super(`${project} routes ${host}, and ${owner} already routes it through the shared edge (${edge}) on this server. A host is served by one stack only. Give ${project} another domain, or take ${owner} off the edge first: gkm compose --stage <stage> --down in its workspace (or remove ${routesPath(owner)} from the edge).`);
936
- this.host = host;
937
- this.owner = owner;
938
- this.project = project;
939
- this.edge = edge;
940
- this.name = "EdgeHostClaimed";
941
- }
942
- };
943
- /**
944
- * Every other stack's claims on the edge, by project: each `dynamic/*.yml`
945
- * but this project's, read through the engine. None where the edge is not
946
- * running — nothing is routed through it.
947
- */
948
- async function edgeClaimsByProject(docker, edge, project) {
949
- const claimed = /* @__PURE__ */ new Map();
950
- const listed = await docker.exec(edge, EDGE_SERVICE, [
951
- "ls",
952
- "-1",
953
- EDGE_DYNAMIC_DIR
954
- ]);
955
- if (listed.code !== 0) return claimed;
956
- for (const name of listed.stdout.split("\n").map((line) => line.trim())) {
957
- if (!name.endsWith(".yml")) continue;
958
- const owner = name.slice(0, -4);
959
- if (!owner || owner === project) continue;
960
- const file = await readEdgeFile(docker, edge, routesPath(owner));
961
- if (file === void 0) continue;
962
- const claims = readEdgeClaims(file);
963
- if (claims.length > 0) claimed.set(owner, claims);
964
- }
965
- return claimed;
966
- }
967
- /**
968
- * Refuse a stack's routes when a host in them is routed through the edge by
969
- * another project — checked before a deploy changes anything, and again
970
- * before its routes are written. Its own file, from its last deploy, is
971
- * replaced, never a clash.
972
- */
973
- async function assertEdgeHostsFree(docker, edge, project, routes) {
974
- const mine = readEdgeClaims(routes);
975
- if (mine.length === 0) return;
976
- const others = await edgeClaimsByProject(docker, edge, project);
977
- for (const [owner, theirs] of [...others].sort(([a], [b]) => a.localeCompare(b))) for (const claim of mine) for (const other of theirs) {
978
- const host = claimsOverlap(claim, other);
979
- if (host !== void 0) throw new EdgeHostClaimed(host, owner, project, edge.project);
980
- }
981
- }
982
- function certificatePaths(project) {
983
- return [`${EDGE_CERTS_DIR}/${project}.crt`, `${EDGE_CERTS_DIR}/${project}.key`];
984
- }
985
- /**
986
- * Register a stack with the edge — refused, before anything is written, when
987
- * another project routes one of its hosts: its certificate first, where it has one,
988
- * so the routes that need it never load without it — then its routes, in one
989
- * rename the edge picks up whole. The certificate — the stage's own, or the
990
- * one gkm's local CA issued the local stage — is PEM read on this machine and
991
- * written through the engine. The paths written, inside the edge.
992
- */
993
- async function writeEdgeRoutes(docker, edge, project, routes, certificate) {
994
- await assertEdgeHostsFree(docker, edge, project, routes);
995
- const written = [];
996
- const [crt, key] = certificatePaths(project);
997
- if (certificate) {
998
- await put(docker, edge, crt, certificate.cert);
999
- await put(docker, edge, key, certificate.key, "600");
1000
- written.push(crt, key);
1001
- } else await remove(docker, edge, [crt, key]);
1002
- await put(docker, edge, routesPath(project), routes);
1003
- written.push(routesPath(project));
1004
- return written;
1005
- }
1006
- /** What a stack's file holds for the moment between emptying and removal. */
1007
- const UNREGISTERED = "# Unregistered by gkm compose --down.\n";
1008
- /**
1009
- * Unregister a stack: its routes, then its certificate. Whether there was
1010
- * anything to remove — false, too, when the edge is not running.
1011
- */
1012
- async function removeEdgeRoutes(docker, edge, project) {
1013
- const file = routesPath(project);
1014
- if ((await docker.exec(edge, EDGE_SERVICE, [
1015
- "test",
1016
- "-f",
1017
- file
1018
- ])).code !== 0) return false;
1019
- await put(docker, edge, file, UNREGISTERED);
1020
- await remove(docker, edge, [file, ...certificatePaths(project)]);
1021
- return true;
1022
- }
1023
- //#endregion
1024
- //#region src/compose/acmeDns.ts
1025
- /**
1026
- * The key the server's shared Traefik edge answers Let's Encrypt's DNS
1027
- * challenge with, for a stage with a wildcard site.
1028
- *
1029
- * A wildcard certificate is issued only over the DNS challenge: the edge
1030
- * proves it holds `<domain>` by writing a TXT record at
1031
- * `_acme-challenge.<domain>`. So it needs a key that can write that record —
1032
- * and nothing else, because it lives on the server.
1033
- *
1034
- * - **The user**: one per server, under `/gkm/`, tagged with the server it
1035
- * is for. One that exists without that tag is someone else's, and is
1036
- * refused rather than taken over.
1037
- * - **Its policies**: one per stack on the server, named for its compose
1038
- * project, allowing `ChangeResourceRecordSets` on the stage's hosted zone
1039
- * for TXT records named `_acme-challenge.<domain>` alone — plus what
1040
- * finding the zone and waiting for the change take, which read and write
1041
- * nothing. Put back on every deploy.
1042
- * - **Its key**: written into the edge's container, never into the stage's
1043
- * secrets or onto the machine running the deploy. Issued when the edge
1044
- * has none, or holds one IAM no longer knows — and then the edge is
1045
- * restarted, since it keeps the key it first read.
1046
- */
1047
- /** Where gkm's IAM users live. */
1048
- const USER_PATH = "/gkm/";
1049
- /** The tag a server's edge user is found by. */
1050
- const TAG_EDGE = "gkm:edge";
1051
- /** The edge user's name for a server: stable, and safe for IAM. */
1052
- function edgeAcmeUser(server) {
1053
- return `gkm-edge-acme-${createHash("sha256").update(server).digest("hex").slice(0, 12)}`;
1054
- }
1055
- /**
1056
- * What one stage's wildcard certificate needs: its challenge record written
1057
- * in its zone, the change waited on, and the zone found by name — which is
1058
- * how the edge's ACME client finds it.
1059
- */
1060
- function acmeDnsPolicy(zoneId, domain) {
1061
- return JSON.stringify({
1062
- Version: "2012-10-17",
1063
- Statement: [
1064
- {
1065
- Effect: "Allow",
1066
- Action: "route53:ChangeResourceRecordSets",
1067
- Resource: `arn:aws:route53:::hostedzone/${zoneId}`,
1068
- Condition: { "ForAllValues:StringEquals": {
1069
- "route53:ChangeResourceRecordSetsNormalizedRecordNames": [`_acme-challenge.${domain.toLowerCase()}`],
1070
- "route53:ChangeResourceRecordSetsRecordTypes": ["TXT"]
1071
- } }
1072
- },
1073
- {
1074
- Effect: "Allow",
1075
- Action: "route53:ListResourceRecordSets",
1076
- Resource: `arn:aws:route53:::hostedzone/${zoneId}`
1077
- },
1078
- {
1079
- Effect: "Allow",
1080
- Action: "route53:GetChange",
1081
- Resource: "arn:aws:route53:::change/*"
1082
- },
1083
- {
1084
- Effect: "Allow",
1085
- Action: "route53:ListHostedZonesByName",
1086
- Resource: "*"
1087
- }
1088
- ]
1089
- });
1090
- }
1091
- /** An IAM user by the edge user's name that gkm did not create for this server. */
1092
- var EdgeAcmeUserNotOwned = class extends GkmError {
1093
- user;
1094
- server;
1095
- constructor(user, server) {
1096
- 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.`);
1097
- this.user = user;
1098
- this.server = server;
1099
- this.name = "EdgeAcmeUserNotOwned";
1100
- }
1101
- };
1102
- /** A wildcard site's domain with no Route 53 hosted zone to answer it in. */
1103
- var AcmeHostedZoneMissing = class extends GkmError {
1104
- domain;
1105
- constructor(domain) {
1106
- 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.`);
1107
- this.domain = domain;
1108
- this.name = "AcmeHostedZoneMissing";
1109
- }
1110
- };
1111
- /**
1112
- * The edge's key for `domain`'s challenge record: its user, this stack's
1113
- * policy on it, and a key in the edge that IAM knows.
1114
- *
1115
- * @throws {EdgeAcmeUserNotOwned} when the user is someone else's
1116
- * @throws {AcmeHostedZoneMissing} when no hosted zone holds the domain
1117
- */
1118
- async function ensureEdgeAcmeKey(docker, options) {
1119
- const { clients, edge, server, project, domain } = options;
1120
- const log = options.log ?? ((line) => console.log(line));
1121
- const IAM = await import("@aws-sdk/client-iam");
1122
- const user = edgeAcmeUser(server);
1123
- const zoneId = options.hostedZoneId ?? await hostedZoneId(clients.route53, options.zone);
1124
- if (!zoneId) throw new AcmeHostedZoneMissing(domain);
1125
- if (options.dryRun) {
1126
- log(`🔑 Would let ${EDGE_PROJECT} write _acme-challenge.${domain} TXT records in ${zoneId}, as IAM user ${user} (dry run — nothing is written)`);
1127
- return {
1128
- user,
1129
- zoneId,
1130
- issued: false
1131
- };
1132
- }
1133
- if (!(await clients.iam.send(new IAM.GetUserCommand({ UserName: user })).catch((error) => {
1134
- if (error?.name === "NoSuchEntity" || error?.name === "NoSuchEntityException") return;
1135
- throw error;
1136
- }))?.User) await clients.iam.send(new IAM.CreateUserCommand({
1137
- UserName: user,
1138
- Path: USER_PATH,
1139
- Tags: [{
1140
- Key: TAG_EDGE,
1141
- Value: server
1142
- }]
1143
- }));
1144
- else {
1145
- const { Tags = [] } = await clients.iam.send(new IAM.ListUserTagsCommand({ UserName: user }));
1146
- if (!Tags.some((t) => t.Key === "gkm:edge" && t.Value === server)) throw new EdgeAcmeUserNotOwned(user, server);
1147
- }
1148
- await clients.iam.send(new IAM.PutUserPolicyCommand({
1149
- UserName: user,
1150
- PolicyName: project,
1151
- PolicyDocument: acmeDnsPolicy(zoneId, domain)
1152
- }));
1153
- log(`🔑 ${EDGE_PROJECT} may write _acme-challenge.${domain} TXT records in ${zoneId}, and nothing else there, as IAM user ${user}`);
1154
- const written = await readEdgeFile(docker, edge, EDGE_AWS_CREDENTIALS);
1155
- const held = written?.match(/aws_access_key_id\s*=\s*(\S+)/)?.[1];
1156
- const { AccessKeyMetadata = [] } = await clients.iam.send(new IAM.ListAccessKeysCommand({ UserName: user }));
1157
- if (held && AccessKeyMetadata.some((k) => k.AccessKeyId === held)) return {
1158
- user,
1159
- zoneId,
1160
- issued: false
1161
- };
1162
- for (const key of AccessKeyMetadata) {
1163
- if (!key.AccessKeyId) continue;
1164
- await clients.iam.send(new IAM.DeleteAccessKeyCommand({
1165
- UserName: user,
1166
- AccessKeyId: key.AccessKeyId
1167
- }));
1168
- }
1169
- const { AccessKey } = await clients.iam.send(new IAM.CreateAccessKeyCommand({ UserName: user }));
1170
- await writeEdgeSecret(docker, edge, EDGE_AWS_CREDENTIALS, `# Written by gkm compose — the key ${EDGE_PROJECT} answers DNS challenges with.
1171
- [default]
1172
- aws_access_key_id = ${AccessKey?.AccessKeyId}
1173
- aws_secret_access_key = ${AccessKey?.SecretAccessKey}
1174
- `);
1175
- log(`🔑 Wrote a new key for ${user} to ${EDGE_PROJECT} (${EDGE_AWS_CREDENTIALS})`);
1176
- if (written !== void 0) await restartEdge(docker, edge);
1177
- return {
1178
- user,
1179
- zoneId,
1180
- issued: true
1181
- };
1182
- }
1183
- /** The id of the hosted zone named exactly `zone`, if there is one. */
1184
- async function hostedZoneId(route53, zone) {
1185
- const { ListHostedZonesByNameCommand } = await import("@aws-sdk/client-route-53");
1186
- const name = zone.endsWith(".") ? zone : `${zone}.`;
1187
- const { HostedZones = [] } = await route53.send(new ListHostedZonesByNameCommand({
1188
- DNSName: name,
1189
- MaxItems: 1
1190
- }));
1191
- return HostedZones.find((z) => z.Name === name)?.Id?.replace("/hostedzone/", "");
1192
- }
1193
- //#endregion
1194
217
  //#region src/compose/images.ts
1195
218
  /**
1196
219
  * Which image each app runs — and, for a tag, whether every one exists.
@@ -1870,17 +893,6 @@ var ComposePinNeedsPull = class extends GkmError {
1870
893
  this.name = "ComposePinNeedsPull";
1871
894
  }
1872
895
  };
1873
- /** A port variable that does not hold a port. */
1874
- var EdgePortInvalid = class extends GkmError {
1875
- variable;
1876
- value;
1877
- constructor(variable, value) {
1878
- super(`${variable}=${value} is not a port. Set it to a number between 1 and 65535, or unset it for the default.`);
1879
- this.variable = variable;
1880
- this.value = value;
1881
- this.name = "EdgePortInvalid";
1882
- }
1883
- };
1884
896
  /**
1885
897
  * A site that pre-renders against its stage (`prerender: 'stage'`) whose
1886
898
  * APIs do not answer, so it is not built: pages built without their data
@@ -1932,22 +944,6 @@ async function gitRevision(root) {
1932
944
  if (!sha) throw new NoGitRevision(root);
1933
945
  return (await runOutput("git", ["status", "--porcelain"], { cwd: root }).catch(() => "")).trim() ? `${sha}-dirty` : sha;
1934
946
  }
1935
- /** The edge's ports, from the environment — 443 and 80 when unset. */
1936
- function edgePorts(env = process.env) {
1937
- const read = (variable, fallback) => {
1938
- const value = env[variable];
1939
- if (value === void 0 || value === "") return fallback;
1940
- const port = Number(value);
1941
- if (!Number.isInteger(port) || port < 1 || port > 65535) throw new EdgePortInvalid(variable, value);
1942
- return port;
1943
- };
1944
- const logs = env["GKM_COMPOSE_LOGS_PORT"] ? read(LOGS_PORT_ENV, 0) : void 0;
1945
- return {
1946
- https: read(EDGE_PORT_ENV.https, 443),
1947
- http: read(EDGE_PORT_ENV.http, 80),
1948
- ...logs ? { logs } : {}
1949
- };
1950
- }
1951
947
  /**
1952
948
  * The real ones. Each app is asked for three minutes before it counts as
1953
949
  * down: a deployed stage's first ACME certificate can take that long.
@@ -2041,7 +1037,13 @@ async function validateCompose(ctx, deps, options = {}) {
2041
1037
  ctx.secrets.mask(stack.logs.password);
2042
1038
  ctx.secrets.mask(stack.logs.appEnv.OTEL_EXPORTER_OTLP_HEADERS);
2043
1039
  }
2044
- if (!push && !stack.local) requiredServerAddress(stage, workspace.domains?.[stage], secrets?.custom);
1040
+ if (!push && !stack.local) {
1041
+ requiredServerAddress(stage, workspace.domains?.[stage], secrets?.custom);
1042
+ if (stack.proxy === "traefik" && stack.wildcard?.tls === "dns") {
1043
+ const zone = acmeDnsZone(workspace, stage);
1044
+ if (zone) acmeDnsSecrets(zone, stage, secrets?.custom);
1045
+ }
1046
+ }
2045
1047
  const server = push ? void 0 : composeServer({
2046
1048
  stage,
2047
1049
  local: stack.local,
@@ -2425,33 +1427,46 @@ async function planCompose(ctx, run) {
2425
1427
  });
2426
1428
  }
2427
1429
  /**
2428
- * The shared edge's key for the stage's wildcard certificate: the DNS
2429
- * challenge's record, and nothing else, through the stage domain's Route 53
2430
- * entry — before the stack's routes ask for the certificate.
1430
+ * The shared edge's key for the stage's wildcard certificate, through the
1431
+ * DNS provider holding the stage's domain — before the stack's routes ask
1432
+ * for the certificate. Route 53's is issued through IAM, allowed the DNS
1433
+ * challenge's record and nothing else; every other provider's is the
1434
+ * stage's own secrets, written into the edge.
2431
1435
  */
2432
1436
  async function edgeAcmeKey(ctx, run, deps) {
2433
1437
  const { workspace, stage } = ctx;
2434
- const domain = workspace.domains?.[stage];
2435
- const dns = workspace.dns ? normalizeDnsConfig(workspace.dns) : {};
2436
- const zone = domain ? findRootDomain(domain, dns) : null;
2437
- const config = zone ? dns[zone] : void 0;
2438
- if (!domain || !zone || config?.provider !== "route53") return;
2439
- const route53 = config;
1438
+ const zone = acmeDnsZone(workspace, stage);
1439
+ if (!zone) return;
1440
+ const edge = edgeRef(edgeFile(run), {
1441
+ ...run.ref.host ? { host: run.ref.host } : {},
1442
+ ...run.ref.output ? { output: run.ref.output } : {}
1443
+ });
1444
+ const log = (line) => ctx.logger.info(line);
1445
+ if (zone.provider !== "route53") {
1446
+ await ensureEdgeDnsSecrets(deps.docker, {
1447
+ edge,
1448
+ zone,
1449
+ stage,
1450
+ custom: run.secrets?.custom,
1451
+ ...ctx.dryRun ? { dryRun: true } : {},
1452
+ log
1453
+ });
1454
+ return;
1455
+ }
1456
+ const { domain } = zone;
1457
+ const route53 = zone.config;
2440
1458
  const server = requiredServerAddress(stage, domain, run.secrets?.custom)?.ipv4 ?? run.server?.host ?? "local";
2441
1459
  const clients = await (deps.acmeClients ?? defaultAcmeClients)(route53);
2442
1460
  await ensureEdgeAcmeKey(deps.docker, {
2443
1461
  clients,
2444
- edge: edgeRef(edgeFile(run), {
2445
- ...run.ref.host ? { host: run.ref.host } : {},
2446
- ...run.ref.output ? { output: run.ref.output } : {}
2447
- }),
1462
+ edge,
2448
1463
  server,
2449
1464
  project: run.stack.project,
2450
1465
  domain,
2451
- zone,
1466
+ zone: zone.zone,
2452
1467
  ...route53.hostedZoneId ? { hostedZoneId: route53.hostedZoneId } : {},
2453
1468
  ...ctx.dryRun ? { dryRun: true } : {},
2454
- log: (line) => ctx.logger.info(line)
1469
+ log
2455
1470
  });
2456
1471
  }
2457
1472
  /** IAM and Route 53 through the AWS SDK's own chain, or the entry's profile. */
@@ -3337,6 +2352,17 @@ async function writeStack(root, dir, stack) {
3337
2352
  });
3338
2353
  await rm(join(dir, `${BACKUPS_SERVICE}.env`), { force: true });
3339
2354
  }
2355
+ const pitr = stack.backups?.pitr;
2356
+ if (pitr) {
2357
+ for (const [name, content] of Object.entries(pitr.postgres.files)) await write(join(dir, POSTGRES_SERVICE, name), content);
2358
+ if (stack.compose.services["postgres"]?.env_file) await write(join(dir, `${POSTGRES_SERVICE}.env`), envFile(pitr.postgres.env), 384);
2359
+ } else {
2360
+ await rm(join(dir, POSTGRES_SERVICE), {
2361
+ recursive: true,
2362
+ force: true
2363
+ });
2364
+ await rm(join(dir, `${POSTGRES_SERVICE}.env`), { force: true });
2365
+ }
3340
2366
  for (const entry of await readdir(dir)) if (entry.endsWith(".credentials")) await rm(join(dir, entry));
3341
2367
  for (const [path, content] of Object.entries(stack.dockerfiles)) await write(join(root, path), content);
3342
2368
  await ensureDockerignore(findBuildRoot(root));
@@ -3377,7 +2403,10 @@ function printPlan(ctx, run) {
3377
2403
  for (const worker of stack.workers) ctx.logger.info(` ${worker.name.padEnd(12)} ${`worker ${worker.id} (no route)`.padEnd(40)} ${mode} ${worker.ref}`);
3378
2404
  for (const unit of stack.processors) ctx.logger.info(` ${unit.name.padEnd(12)} ${`processors of ${unit.id}`.padEnd(40)} ${mode} ${unit.ref}`);
3379
2405
  if (stack.infra.length > 0) ctx.logger.info(` infrastructure: ${stack.infra.join(", ")}`);
3380
- if (stack.backups) ctx.logger.info(` ${BACKUPS_SERVICE.padEnd(12)} ${stack.backups.databases.map((d) => d.file).join(", ")} — ${stack.backups.backups.describe}, to ${stack.backups.prefix}/`);
2406
+ if (stack.backups) {
2407
+ ctx.logger.info(` ${BACKUPS_SERVICE.padEnd(12)} ${stack.backups.databases.map((d) => d.file).join(", ")} — ${stack.backups.backups.describe}, to ${stack.backups.prefix}/`);
2408
+ if (stack.backups.pitr) ctx.logger.info(` ${"".padEnd(12)} ${stack.backups.pitr.pitr.describe}, to ${stack.backups.pitr.prefix}/`);
2409
+ }
3381
2410
  ctx.logger.info(`\n📝 Wrote ${files.length} file(s) under ${stackDir(stack.stage)}/`);
3382
2411
  }
3383
2412
  //#endregion
@@ -3460,6 +2489,6 @@ function composeTarget(options = {}) {
3460
2489
  });
3461
2490
  }
3462
2491
  //#endregion
3463
- export { ContainersNotStopped as _, edgePorts as a, parseDigests as c, removeEdgeRoutes as d, composeServer as f, ContainersNotStarted as g, sshTarget as h, ComposePushNeedsBuild as i, pinnedRef as l, sshAccess as m, compose_exports as n, stackOverrideFile as o, dockerHost as p, ComposePinNeedsPull as r, deployedStackSecrets as s, composeTarget as t, edgeRef as u, dockerCompose as v, projectNetwork as y };
2492
+ export { stackOverrideFile as a, pinnedRef as c, sshAccess as d, sshTarget as f, ComposePushNeedsBuild as i, composeServer as l, compose_exports as n, deployedStackSecrets as o, ComposePinNeedsPull as r, parseDigests as s, composeTarget as t, dockerHost as u };
3464
2493
 
3465
- //# sourceMappingURL=compose-DPXoarGI.mjs.map
2494
+ //# sourceMappingURL=compose-CX2BF3LG.mjs.map