@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.
- package/dist/{LegacyStateStore-CTfoMtC2.mjs → LegacyStateStore-BwHw28fJ.mjs} +2 -2
- package/dist/{LegacyStateStore-CTfoMtC2.mjs.map → LegacyStateStore-BwHw28fJ.mjs.map} +1 -1
- package/dist/{LegacyStateStore-BtDLNkIH.cjs → LegacyStateStore-LpTY3S7z.cjs} +2 -2
- package/dist/{LegacyStateStore-BtDLNkIH.cjs.map → LegacyStateStore-LpTY3S7z.cjs.map} +1 -1
- package/dist/{LocalStateStore-BKp45OoB.cjs → LocalStateStore-Dpn9kBuK.cjs} +2 -2
- package/dist/{LocalStateStore-BKp45OoB.cjs.map → LocalStateStore-Dpn9kBuK.cjs.map} +1 -1
- package/dist/{LocalStateStore-C4zDHVM-.mjs → LocalStateStore-DsdNLm0_.mjs} +2 -2
- package/dist/{LocalStateStore-C4zDHVM-.mjs.map → LocalStateStore-DsdNLm0_.mjs.map} +1 -1
- package/dist/{S3StateStore-S0TXLlMW.mjs → S3StateStore-BIpCLzpk.mjs} +4 -4
- package/dist/{S3StateStore-S0TXLlMW.mjs.map → S3StateStore-BIpCLzpk.mjs.map} +1 -1
- package/dist/{S3StateStore-B6SjbLxh.cjs → S3StateStore-Bk_EIWLU.cjs} +5 -5
- package/dist/{S3StateStore-B6SjbLxh.cjs.map → S3StateStore-Bk_EIWLU.cjs.map} +1 -1
- package/dist/{SSMStateStore-6Di_zxwC.cjs → SSMStateStore-A1bgCF1P.cjs} +2 -2
- package/dist/{SSMStateStore-6Di_zxwC.cjs.map → SSMStateStore-A1bgCF1P.cjs.map} +1 -1
- package/dist/{SSMStateStore-ClPHFhRQ.mjs → SSMStateStore-PiZxPXeX.mjs} +2 -2
- package/dist/{SSMStateStore-ClPHFhRQ.mjs.map → SSMStateStore-PiZxPXeX.mjs.map} +1 -1
- package/dist/{add-BR8XW4IH.mjs → add-BBhzFpQ7.mjs} +4 -5
- package/dist/{add-BR8XW4IH.mjs.map → add-BBhzFpQ7.mjs.map} +1 -1
- package/dist/{add-Bd9MDHuU.cjs → add-sU71e0Lp.cjs} +13 -14
- package/dist/{add-Bd9MDHuU.cjs.map → add-sU71e0Lp.cjs.map} +1 -1
- package/dist/backups/runner.cjs +501 -13
- package/dist/backups/runner.cjs.map +1 -1
- package/dist/backups/runner.d.cts +87 -2
- package/dist/backups/runner.d.cts.map +1 -1
- package/dist/backups/runner.d.mts +87 -2
- package/dist/backups/runner.d.mts.map +1 -1
- package/dist/backups/runner.mjs +493 -15
- package/dist/backups/runner.mjs.map +1 -1
- package/dist/{bundler-4E-CGdL3.cjs → bundler-BM6lq-36.cjs} +9 -9
- package/dist/{bundler-4E-CGdL3.cjs.map → bundler-BM6lq-36.cjs.map} +1 -1
- package/dist/{bundler-Cwr4YSpp.mjs → bundler-QKbRwztS.mjs} +6 -6
- package/dist/{bundler-Cwr4YSpp.mjs.map → bundler-QKbRwztS.mjs.map} +1 -1
- package/dist/{cli-CrPJr29x.cjs → cli-D_iytris.cjs} +6 -6
- package/dist/{cli-CrPJr29x.cjs.map → cli-D_iytris.cjs.map} +1 -1
- package/dist/{cli-C3mHXsAE.mjs → cli-VCAfR-se.mjs} +4 -4
- package/dist/{cli-C3mHXsAE.mjs.map → cli-VCAfR-se.mjs.map} +1 -1
- package/dist/{clientTelemetry-Ej1tf1VE.d.cts → clientTelemetry-Bzc4KXz5.d.mts} +2 -2
- package/dist/clientTelemetry-Bzc4KXz5.d.mts.map +1 -0
- package/dist/{clientTelemetry-crdjgehZ.d.mts → clientTelemetry-N8NAguGI.d.cts} +2 -2
- package/dist/clientTelemetry-N8NAguGI.d.cts.map +1 -0
- package/dist/{compose-DPXoarGI.mjs → compose-CX2BF3LG.mjs} +58 -1029
- package/dist/compose-CX2BF3LG.mjs.map +1 -0
- package/dist/{compose-CKBieltT.cjs → compose-D3zc8QN1.cjs} +117 -1130
- package/dist/compose-D3zc8QN1.cjs.map +1 -0
- package/dist/{config-q4ewzIA_.d.mts → config-CTrfNKYd.d.mts} +3 -3
- package/dist/{config-lSOwPbUy.d.cts.map → config-CTrfNKYd.d.mts.map} +1 -1
- package/dist/{config-lSOwPbUy.d.cts → config-D9g_nYIu.d.cts} +3 -3
- package/dist/{config-q4ewzIA_.d.mts.map → config-D9g_nYIu.d.cts.map} +1 -1
- package/dist/config.cjs +1 -1
- package/dist/config.d.cts +3 -3
- package/dist/config.d.mts +3 -3
- package/dist/config.mjs +1 -1
- package/dist/{compose-CJznzQc7.mjs → credentials-BMdpNO8R.mjs} +1213 -1258
- package/dist/credentials-BMdpNO8R.mjs.map +1 -0
- package/dist/{dns-BzYrbB2Y.cjs → credentials-BQ1khM28.cjs} +6 -847
- package/dist/credentials-BQ1khM28.cjs.map +1 -0
- package/dist/{compose-CvNyjqwL.cjs → credentials-C3uaZ80e.cjs} +1270 -1285
- package/dist/credentials-C3uaZ80e.cjs.map +1 -0
- package/dist/{dns-C0wbTjVX.mjs → credentials-Ci8nKFw4.mjs} +5 -708
- package/dist/credentials-Ci8nKFw4.mjs.map +1 -0
- package/dist/{dbTunnel-DSzAG_wy.cjs → dbTunnel-D000s0YK.cjs} +8 -9
- package/dist/{dbTunnel-DSzAG_wy.cjs.map → dbTunnel-D000s0YK.cjs.map} +1 -1
- package/dist/{dbTunnel-CphoKGyk.mjs → dbTunnel-DqtSAdQK.mjs} +5 -6
- package/dist/{dbTunnel-CphoKGyk.mjs.map → dbTunnel-DqtSAdQK.mjs.map} +1 -1
- package/dist/deploy/public.cjs +25 -26
- package/dist/deploy/public.cjs.map +1 -1
- package/dist/deploy/public.d.cts +5 -5
- package/dist/deploy/public.d.cts.map +1 -1
- package/dist/deploy/public.d.mts +5 -5
- package/dist/deploy/public.d.mts.map +1 -1
- package/dist/deploy/public.mjs +10 -11
- package/dist/deploy/public.mjs.map +1 -1
- package/dist/{deploy-BaSYxpny.cjs → deploy-DRH6q_2r.cjs} +72 -62
- package/dist/deploy-DRH6q_2r.cjs.map +1 -0
- package/dist/{deploy-C_uZBzvS.mjs → deploy-DwtM6VSz.mjs} +25 -15
- package/dist/deploy-DwtM6VSz.mjs.map +1 -0
- package/dist/{destroy-yTBmL1jf.mjs → destroy-C6QwLj3b.mjs} +9 -9
- package/dist/{destroy-yTBmL1jf.mjs.map → destroy-C6QwLj3b.mjs.map} +1 -1
- package/dist/{destroy-PvrHxZDu.cjs → destroy-ChTJ_oUq.cjs} +21 -21
- package/dist/{destroy-PvrHxZDu.cjs.map → destroy-ChTJ_oUq.cjs.map} +1 -1
- package/dist/{dokploy-DqL3jeDu.mjs → dokploy-Dm8-eHtx.mjs} +2 -2
- package/dist/{dokploy-DqL3jeDu.mjs.map → dokploy-Dm8-eHtx.mjs.map} +1 -1
- package/dist/{dokploy-DYUMx2MY.cjs → dokploy-jeO7mz1R.cjs} +2 -2
- package/dist/{dokploy-DYUMx2MY.cjs.map → dokploy-jeO7mz1R.cjs.map} +1 -1
- package/dist/{eas-DEM-iWg6.cjs → eas-BAitvB5R.cjs} +3 -3
- package/dist/{eas-DEM-iWg6.cjs.map → eas-BAitvB5R.cjs.map} +1 -1
- package/dist/{eas-DHDU86PL.mjs → eas-CXYo8hos.mjs} +3 -3
- package/dist/{eas-DHDU86PL.mjs.map → eas-CXYo8hos.mjs.map} +1 -1
- package/dist/{encryption-CbMprdAb.mjs → encryption-B7IlQ6VO.mjs} +3 -3
- package/dist/{encryption-CbMprdAb.mjs.map → encryption-B7IlQ6VO.mjs.map} +1 -1
- package/dist/{encryption-BKWmbKkN.cjs → encryption-OPCsewWc.cjs} +6 -6
- package/dist/{encryption-BKWmbKkN.cjs.map → encryption-OPCsewWc.cjs.map} +1 -1
- package/dist/{engine-3imTFxdN.cjs → engine-BSnhQLaB.cjs} +105 -102
- package/dist/engine-BSnhQLaB.cjs.map +1 -0
- package/dist/{engine-DaI4iScI.mjs → engine-a6K99WIl.mjs} +12 -9
- package/dist/engine-a6K99WIl.mjs.map +1 -0
- package/dist/{github-Y6NAwHG1.cjs → github-C3gUSbLn.cjs} +18 -18
- package/dist/{github-Y6NAwHG1.cjs.map → github-C3gUSbLn.cjs.map} +1 -1
- package/dist/{github-Dijjr__H.mjs → github-D4hThtnt.mjs} +7 -7
- package/dist/{github-Dijjr__H.mjs.map → github-D4hThtnt.mjs.map} +1 -1
- package/dist/{googlePlay-Dcp3Yycu.cjs → googlePlay-C5Q7Zov3.cjs} +5 -5
- package/dist/{googlePlay-Dcp3Yycu.cjs.map → googlePlay-C5Q7Zov3.cjs.map} +1 -1
- package/dist/{googlePlay-SDT3j9Kf.mjs → googlePlay-DIS9PeFB.mjs} +4 -4
- package/dist/{googlePlay-SDT3j9Kf.mjs.map → googlePlay-DIS9PeFB.mjs.map} +1 -1
- package/dist/{iam-CqW9hsd2.mjs → iam-DloEBLXZ.mjs} +2 -2
- package/dist/{iam-CqW9hsd2.mjs.map → iam-DloEBLXZ.mjs.map} +1 -1
- package/dist/{iam-DeBQcSvw.cjs → iam-SxPKYCI_.cjs} +2 -2
- package/dist/{iam-DeBQcSvw.cjs.map → iam-SxPKYCI_.cjs.map} +1 -1
- package/dist/{index-DJzVO6Ht.d.cts → index-BThTZV8T.d.mts} +2 -2
- package/dist/{index-Ccsgoq3_.d.mts.map → index-BThTZV8T.d.mts.map} +1 -1
- package/dist/{index-Ccsgoq3_.d.mts → index-Cgd-ouyI.d.cts} +2 -2
- package/dist/{index-DJzVO6Ht.d.cts.map → index-Cgd-ouyI.d.cts.map} +1 -1
- package/dist/index.cjs +590 -246
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +443 -99
- package/dist/index.mjs.map +1 -1
- package/dist/{local-DjaAcHZb.cjs → local-B5R1WWEO.cjs} +3 -3
- package/dist/{local-DjaAcHZb.cjs.map → local-B5R1WWEO.cjs.map} +1 -1
- package/dist/{local-4gzM52HT.mjs → local-CMA_7b0_.mjs} +2 -2
- package/dist/{local-4gzM52HT.mjs.map → local-CMA_7b0_.mjs.map} +1 -1
- package/dist/{migrate-0Rfhftef.mjs → migrate-168wMF5m.mjs} +5 -5
- package/dist/{migrate-0Rfhftef.mjs.map → migrate-168wMF5m.mjs.map} +1 -1
- package/dist/{migrate-DDIc3twm.cjs → migrate-B0041tRF.cjs} +13 -13
- package/dist/{migrate-DDIc3twm.cjs.map → migrate-B0041tRF.cjs.map} +1 -1
- package/dist/{migrate-CuHGYJL9.cjs → migrate-BZxh_zU5.cjs} +6 -6
- package/dist/{migrate-CuHGYJL9.cjs.map → migrate-BZxh_zU5.cjs.map} +1 -1
- package/dist/{migrate-BLW4BwLd.mjs → migrate-BhnCtwMX.mjs} +3 -3
- package/dist/{migrate-BLW4BwLd.mjs.map → migrate-BhnCtwMX.mjs.map} +1 -1
- package/dist/openapi.cjs +1 -1
- package/dist/openapi.d.cts +2 -2
- package/dist/openapi.d.mts +2 -2
- package/dist/openapi.mjs +1 -1
- package/dist/{projectBucket-C5Ap5kGw.cjs → projectBucket-DEBaYEbi.cjs} +2 -2
- package/dist/{projectBucket-C5Ap5kGw.cjs.map → projectBucket-DEBaYEbi.cjs.map} +1 -1
- package/dist/{projectBucket-BhEOVVch.mjs → projectBucket-hF0-tlq9.mjs} +2 -2
- package/dist/{projectBucket-BhEOVVch.mjs.map → projectBucket-hF0-tlq9.mjs.map} +1 -1
- package/dist/{publish-BELe2FO2.cjs → publish-B-ffSuAX.cjs} +2 -2
- package/dist/{publish-BELe2FO2.cjs.map → publish-B-ffSuAX.cjs.map} +1 -1
- package/dist/{publish-DiDv40hA.mjs → publish-_lVOoWCy.mjs} +2 -2
- package/dist/{publish-DiDv40hA.mjs.map → publish-_lVOoWCy.mjs.map} +1 -1
- package/dist/{ready--_hMxbUX.cjs → ready-DCvnFZnJ.cjs} +2 -2
- package/dist/{ready--_hMxbUX.cjs.map → ready-DCvnFZnJ.cjs.map} +1 -1
- package/dist/{ready-CjIqXFXe.mjs → ready-sSPuiZ7N.mjs} +2 -2
- package/dist/{ready-CjIqXFXe.mjs.map → ready-sSPuiZ7N.mjs.map} +1 -1
- package/dist/reconcile/public.d.cts +1 -1
- package/dist/reconcile/public.d.mts +1 -1
- package/dist/{resolve-DIPHwLan.cjs → resolve-Cs38fbaX.cjs} +4 -4
- package/dist/{resolve-DIPHwLan.cjs.map → resolve-Cs38fbaX.cjs.map} +1 -1
- package/dist/{resolve-N8EZzWqJ.mjs → resolve-UK4b26dm.mjs} +4 -4
- package/dist/{resolve-N8EZzWqJ.mjs.map → resolve-UK4b26dm.mjs.map} +1 -1
- package/dist/{rollback-DIeA6dba.mjs → rollback-B0eg3M0J.mjs} +7 -6
- package/dist/{rollback-DIeA6dba.mjs.map → rollback-B0eg3M0J.mjs.map} +1 -1
- package/dist/{rollback-Bp6hepUh.cjs → rollback-DByniS9X.cjs} +10 -9
- package/dist/{rollback-Bp6hepUh.cjs.map → rollback-DByniS9X.cjs.map} +1 -1
- package/dist/{runtime-D_UphAAH.d.cts → runtime-BtoiRP5G.d.cts} +2 -2
- package/dist/{runtime-BZlClwy2.d.mts.map → runtime-BtoiRP5G.d.cts.map} +1 -1
- package/dist/{runtime-BZlClwy2.d.mts → runtime-Ct41f0tN.d.mts} +2 -2
- package/dist/{runtime-D_UphAAH.d.cts.map → runtime-Ct41f0tN.d.mts.map} +1 -1
- package/dist/{s3-Bwd6lhTU.cjs → s3-4rmPI6wv.cjs} +3 -3
- package/dist/{s3-Bwd6lhTU.cjs.map → s3-4rmPI6wv.cjs.map} +1 -1
- package/dist/{s3-CIEf4puu.mjs → s3-B-IJWFJA.mjs} +3 -3
- package/dist/{s3-CIEf4puu.mjs.map → s3-B-IJWFJA.mjs.map} +1 -1
- package/dist/{serverSetup-mRCLdZQW.mjs → serverSetup-Cok75j21.mjs} +7 -6
- package/dist/{serverSetup-mRCLdZQW.mjs.map → serverSetup-Cok75j21.mjs.map} +1 -1
- package/dist/{serverSetup-C9DP30J4.cjs → serverSetup-EY5vppoS.cjs} +9 -8
- package/dist/{serverSetup-C9DP30J4.cjs.map → serverSetup-EY5vppoS.cjs.map} +1 -1
- package/dist/{sniffer-CkPIytPI.cjs → sniffer-CcLTONfm.cjs} +7 -7
- package/dist/{sniffer-CkPIytPI.cjs.map → sniffer-CcLTONfm.cjs.map} +1 -1
- package/dist/{sniffer-01tbQFmg.mjs → sniffer-DIyYcOXJ.mjs} +7 -7
- package/dist/{sniffer-01tbQFmg.mjs.map → sniffer-DIyYcOXJ.mjs.map} +1 -1
- package/dist/{snsSubscriptions-DmKrw7AF.cjs → snsSubscriptions-Bore7t-W.cjs} +11 -12
- package/dist/{snsSubscriptions-DmKrw7AF.cjs.map → snsSubscriptions-Bore7t-W.cjs.map} +1 -1
- package/dist/{snsSubscriptions-k61hsIRw.mjs → snsSubscriptions-CYEVD7ml.mjs} +3 -4
- package/dist/{snsSubscriptions-k61hsIRw.mjs.map → snsSubscriptions-CYEVD7ml.mjs.map} +1 -1
- package/dist/{sst-DGsteg5j.cjs → sst-Bsu5O1Lt.cjs} +21 -8
- package/dist/sst-Bsu5O1Lt.cjs.map +1 -0
- package/dist/{sst-CvOnXAel.mjs → sst-DBH707Na.mjs} +19 -6
- package/dist/sst-DBH707Na.mjs.map +1 -0
- package/dist/stack-CwSx-6ea.cjs +11725 -0
- package/dist/stack-CwSx-6ea.cjs.map +1 -0
- package/dist/stack-DU2SunuO.mjs +10744 -0
- package/dist/stack-DU2SunuO.mjs.map +1 -0
- package/dist/{stage-CXIdtjY2.mjs → stage-BGyx0OjL.mjs} +5 -6
- package/dist/stage-BGyx0OjL.mjs.map +1 -0
- package/dist/{stage-8KJCtYtl.cjs → stage-BgD-kKY3.cjs} +11 -12
- package/dist/stage-BgD-kKY3.cjs.map +1 -0
- package/dist/{stages-BNoiMXfL.mjs → stages-DFvE7iEO.mjs} +2 -2
- package/dist/{stages-BNoiMXfL.mjs.map → stages-DFvE7iEO.mjs.map} +1 -1
- package/dist/{stages-tdJKM9qp.cjs → stages-Dk6Lv7DY.cjs} +2 -2
- package/dist/{stages-tdJKM9qp.cjs.map → stages-Dk6Lv7DY.cjs.map} +1 -1
- package/dist/target/public.cjs +1 -1
- package/dist/target/public.d.cts +2 -2
- package/dist/target/public.d.mts +2 -2
- package/dist/target/public.mjs +1 -1
- package/dist/{terminal-GzAW5lzO.mjs → terminal-BlJ90AIM.mjs} +2 -2
- package/dist/{terminal-GzAW5lzO.mjs.map → terminal-BlJ90AIM.mjs.map} +1 -1
- package/dist/{terminal-DSQgidon.cjs → terminal-GyXHsRAl.cjs} +5 -5
- package/dist/{terminal-DSQgidon.cjs.map → terminal-GyXHsRAl.cjs.map} +1 -1
- package/dist/{types-BRnmoWCt.d.cts → types-BVDaaLas.d.cts} +22 -4
- package/dist/{types-BRnmoWCt.d.cts.map → types-BVDaaLas.d.cts.map} +1 -1
- package/dist/{types-Bg7LSAD2.d.mts → types-CJTKWLkK.d.mts} +22 -4
- package/dist/{types-Bg7LSAD2.d.mts.map → types-CJTKWLkK.d.mts.map} +1 -1
- package/dist/{utils-D_fxUqvU.mjs → utils-CdKxD8Lt.mjs} +2 -2
- package/dist/{utils-D_fxUqvU.mjs.map → utils-CdKxD8Lt.mjs.map} +1 -1
- package/dist/{utils-D2Nk1Nv2.cjs → utils-DBqXbB8P.cjs} +2 -2
- package/dist/{utils-D2Nk1Nv2.cjs.map → utils-DBqXbB8P.cjs.map} +1 -1
- package/dist/vitest.cjs +1 -1
- package/dist/vitest.mjs +1 -1
- package/dist/workspace/index.cjs +1 -1
- package/dist/workspace/index.d.cts +2 -2
- package/dist/workspace/index.d.mts +2 -2
- package/dist/workspace/index.mjs +1 -1
- package/dist/{workspace-fGwzXa5l.cjs → workspace-CTspddnJ.cjs} +55 -16
- package/dist/workspace-CTspddnJ.cjs.map +1 -0
- package/dist/{workspace-DTX6CJi2.mjs → workspace-CdiCMRap.mjs} +55 -16
- package/dist/workspace-CdiCMRap.mjs.map +1 -0
- package/package.json +16 -16
- package/dist/apps-CXzjaPWR.mjs +0 -4650
- package/dist/apps-CXzjaPWR.mjs.map +0 -1
- package/dist/apps-vLzb0ZSA.cjs +0 -5174
- package/dist/apps-vLzb0ZSA.cjs.map +0 -1
- package/dist/clientTelemetry-Ej1tf1VE.d.cts.map +0 -1
- package/dist/clientTelemetry-crdjgehZ.d.mts.map +0 -1
- package/dist/compose-CJznzQc7.mjs.map +0 -1
- package/dist/compose-CKBieltT.cjs.map +0 -1
- package/dist/compose-CvNyjqwL.cjs.map +0 -1
- package/dist/compose-DPXoarGI.mjs.map +0 -1
- package/dist/deploy-BaSYxpny.cjs.map +0 -1
- package/dist/deploy-C_uZBzvS.mjs.map +0 -1
- package/dist/dns-BzYrbB2Y.cjs.map +0 -1
- package/dist/dns-C0wbTjVX.mjs.map +0 -1
- package/dist/docker-CPoUMg5X.mjs +0 -1649
- package/dist/docker-CPoUMg5X.mjs.map +0 -1
- package/dist/docker-CrhpQWnL.cjs +0 -1798
- package/dist/docker-CrhpQWnL.cjs.map +0 -1
- package/dist/engine-3imTFxdN.cjs.map +0 -1
- package/dist/engine-DaI4iScI.mjs.map +0 -1
- package/dist/notes-6F8YXU8m.mjs +0 -409
- package/dist/notes-6F8YXU8m.mjs.map +0 -1
- package/dist/notes-DMOLnNJI.cjs +0 -510
- package/dist/notes-DMOLnNJI.cjs.map +0 -1
- package/dist/sst-CvOnXAel.mjs.map +0 -1
- package/dist/sst-DGsteg5j.cjs.map +0 -1
- package/dist/stack-Dd-egttk.mjs +0 -1777
- package/dist/stack-Dd-egttk.mjs.map +0 -1
- package/dist/stack-vBnc84e8.cjs +0 -1887
- package/dist/stack-vBnc84e8.cjs.map +0 -1
- package/dist/stage-8KJCtYtl.cjs.map +0 -1
- package/dist/stage-CXIdtjY2.mjs.map +0 -1
- package/dist/workspace-DTX6CJi2.mjs.map +0 -1
- package/dist/workspace-fGwzXa5l.cjs.map +0 -1
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
|
|
2
2
|
const require_errors = require("./errors-D1x8duqI.cjs");
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
3
|
+
const require_credentials = require("./credentials-BQ1khM28.cjs");
|
|
4
|
+
const require_stack = require("./stack-CwSx-6ea.cjs");
|
|
5
|
+
const require_workspace = require("./workspace-CTspddnJ.cjs");
|
|
6
6
|
const require_define = require("./define-zKgLY65H.cjs");
|
|
7
|
-
const
|
|
7
|
+
const require_credentials$1 = require("./credentials-C3uaZ80e.cjs");
|
|
8
8
|
const require_drivers = require("./drivers-DP7__dJX.cjs");
|
|
9
9
|
const require_discover = require("./discover-OXczlq08.cjs");
|
|
10
|
-
const
|
|
11
|
-
const require_docker = require("./docker-CrhpQWnL.cjs");
|
|
12
|
-
const require_snsSubscriptions = require("./snsSubscriptions-DmKrw7AF.cjs");
|
|
10
|
+
const require_snsSubscriptions = require("./snsSubscriptions-Bore7t-W.cjs");
|
|
13
11
|
const require_seeds = require("./seeds-Bc3niNVb.cjs");
|
|
14
12
|
const require_databases = require("./databases-DwYYH2mX.cjs");
|
|
15
13
|
let node_path = require("node:path");
|
|
@@ -19,559 +17,12 @@ let node_fs_promises = require("node:fs/promises");
|
|
|
19
17
|
let node_os = require("node:os");
|
|
20
18
|
let node_child_process = require("node:child_process");
|
|
21
19
|
let node_net = require("node:net");
|
|
22
|
-
let node_crypto = require("node:crypto");
|
|
23
20
|
let _geekmidas_edge_certificates_local = require("@geekmidas/edge/certificates/local");
|
|
24
21
|
let _geekmidas_edge_proxy_traefik = require("@geekmidas/edge/proxy/traefik");
|
|
25
22
|
let _geekmidas_manifest = require("@geekmidas/manifest");
|
|
26
23
|
let yaml = require("yaml");
|
|
27
24
|
let node_http = require("node:http");
|
|
28
25
|
let node_https = require("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 require_errors.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 require_errors.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 require_errors.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 = (0, node_child_process.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 require_dns.run("docker", compose(stack, ["build", ...services]), runOptions(stack, {
|
|
244
|
-
...process.env,
|
|
245
|
-
DOCKER_BUILDKIT: "1"
|
|
246
|
-
}));
|
|
247
|
-
},
|
|
248
|
-
async pull(stack, services) {
|
|
249
|
-
await require_dns.run("docker", compose(stack, ["pull", ...services]), runOptions(stack));
|
|
250
|
-
},
|
|
251
|
-
async up(stack, services) {
|
|
252
|
-
await require_dns.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 require_dns.run("docker", (0, node_fs.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 require_dns.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 require_dns.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 = (0, node_child_process.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 require_errors.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 require_errors.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 require_errors.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 require_errors.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 require_errors.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: _geekmidas_edge_proxy_traefik.EDGE_PROJECT,
|
|
787
|
-
file,
|
|
788
|
-
cwd: (0, node_path.dirname)(file),
|
|
789
|
-
...options
|
|
790
|
-
};
|
|
791
|
-
}
|
|
792
|
-
/** Writing to or removing from the edge's volumes failed. */
|
|
793
|
-
var EdgeWriteFailed = class extends require_errors.GkmError {
|
|
794
|
-
path;
|
|
795
|
-
output;
|
|
796
|
-
constructor(path, output) {
|
|
797
|
-
super(`Could not write ${path} in the shared edge (${_geekmidas_edge_proxy_traefik.EDGE_PROJECT}): ${output.trim() || "it is not running"}. Check it with \`docker compose -p ${_geekmidas_edge_proxy_traefik.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 require_errors.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 === _geekmidas_edge_proxy_traefik.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 ${_geekmidas_edge_proxy_traefik.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 === _geekmidas_edge_proxy_traefik.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, _geekmidas_edge_proxy_traefik.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, _geekmidas_edge_proxy_traefik.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 = (0, _geekmidas_edge_proxy_traefik.traefikStaticFile)(ports);
|
|
886
|
-
const content = (0, _geekmidas_edge_proxy_traefik.edgeComposeFile)({
|
|
887
|
-
ports,
|
|
888
|
-
staticConfig,
|
|
889
|
-
logging: options.logging
|
|
890
|
-
});
|
|
891
|
-
await (0, node_fs_promises.mkdir)((0, node_path.dirname)(file), { recursive: true });
|
|
892
|
-
if (await (0, node_fs_promises.readFile)(file, "utf-8").catch(() => void 0) !== content) await (0, node_fs_promises.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, _geekmidas_edge_proxy_traefik.EDGE_NETWORK);
|
|
899
|
-
await docker.up(ref, [_geekmidas_edge_proxy_traefik.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, _geekmidas_edge_proxy_traefik.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, _geekmidas_edge_proxy_traefik.EDGE_SERVICE, ["kill", "1"]);
|
|
918
|
-
await docker.up(edge, [_geekmidas_edge_proxy_traefik.EDGE_SERVICE]);
|
|
919
|
-
}
|
|
920
|
-
/** A stack's routes, inside the edge's container. */
|
|
921
|
-
function routesPath(project) {
|
|
922
|
-
return `${_geekmidas_edge_proxy_traefik.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 require_errors.GkmError {
|
|
930
|
-
host;
|
|
931
|
-
owner;
|
|
932
|
-
project;
|
|
933
|
-
edge;
|
|
934
|
-
constructor(host, owner, project, edge = _geekmidas_edge_proxy_traefik.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, _geekmidas_edge_proxy_traefik.EDGE_SERVICE, [
|
|
951
|
-
"ls",
|
|
952
|
-
"-1",
|
|
953
|
-
_geekmidas_edge_proxy_traefik.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 = (0, _geekmidas_edge_proxy_traefik.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 = (0, _geekmidas_edge_proxy_traefik.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 = (0, _geekmidas_edge_proxy_traefik.claimsOverlap)(claim, other);
|
|
979
|
-
if (host !== void 0) throw new EdgeHostClaimed(host, owner, project, edge.project);
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
function certificatePaths(project) {
|
|
983
|
-
return [`${_geekmidas_edge_proxy_traefik.EDGE_CERTS_DIR}/${project}.crt`, `${_geekmidas_edge_proxy_traefik.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, _geekmidas_edge_proxy_traefik.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-${(0, node_crypto.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 require_errors.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 require_errors.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 ${_geekmidas_edge_proxy_traefik.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(`🔑 ${_geekmidas_edge_proxy_traefik.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, _geekmidas_edge_proxy_traefik.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, _geekmidas_edge_proxy_traefik.EDGE_AWS_CREDENTIALS, `# Written by gkm compose — the key ${_geekmidas_edge_proxy_traefik.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 ${_geekmidas_edge_proxy_traefik.EDGE_PROJECT} (${_geekmidas_edge_proxy_traefik.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.
|
|
@@ -1370,7 +393,7 @@ function pinImages(file, digests, images) {
|
|
|
1370
393
|
//#endregion
|
|
1371
394
|
//#region src/compose/secrets.ts
|
|
1372
395
|
function deployedStackSecrets(workspace, stage, stored, manifest) {
|
|
1373
|
-
const withSeed =
|
|
396
|
+
const withSeed = require_credentials$1.withGeneratedSecrets(stored ?? require_credentials.initStageSecrets(stage), manifest);
|
|
1374
397
|
const withLogs = require_workspace.resolveStageTelemetry({
|
|
1375
398
|
...workspace.deploy?.telemetry ? { telemetry: workspace.deploy.telemetry } : {},
|
|
1376
399
|
stage,
|
|
@@ -1378,12 +401,12 @@ function deployedStackSecrets(workspace, stage, stored, manifest) {
|
|
|
1378
401
|
target: "compose",
|
|
1379
402
|
runtime: "server",
|
|
1380
403
|
selfHosted: true,
|
|
1381
|
-
used:
|
|
1382
|
-
})?.provider === "self-hosted" ?
|
|
404
|
+
used: require_credentials$1.usesTelemetry(manifest)
|
|
405
|
+
})?.provider === "self-hosted" ? require_credentials$1.withLogsLogin(withSeed.secrets, workspace.domains?.[stage]) : {
|
|
1383
406
|
secrets: withSeed.secrets,
|
|
1384
407
|
generated: []
|
|
1385
408
|
};
|
|
1386
|
-
const withRedis =
|
|
409
|
+
const withRedis = require_credentials$1.runsRedis(manifest, withLogs.secrets.custom ?? {}) ? require_credentials$1.withRedisPassword(withLogs.secrets) : {
|
|
1387
410
|
secrets: withLogs.secrets,
|
|
1388
411
|
generated: []
|
|
1389
412
|
};
|
|
@@ -1870,17 +893,6 @@ var ComposePinNeedsPull = class extends require_errors.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 require_errors.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
|
|
@@ -1921,7 +933,7 @@ function stackOverrideFile(root, stage) {
|
|
|
1921
933
|
async function gitRevision(root) {
|
|
1922
934
|
let sha;
|
|
1923
935
|
try {
|
|
1924
|
-
sha = (await
|
|
936
|
+
sha = (await require_stack.runOutput("git", [
|
|
1925
937
|
"rev-parse",
|
|
1926
938
|
"--short",
|
|
1927
939
|
"HEAD"
|
|
@@ -1930,34 +942,18 @@ async function gitRevision(root) {
|
|
|
1930
942
|
throw new NoGitRevision(root);
|
|
1931
943
|
}
|
|
1932
944
|
if (!sha) throw new NoGitRevision(root);
|
|
1933
|
-
return (await
|
|
1934
|
-
}
|
|
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(require_stack.LOGS_PORT_ENV, 0) : void 0;
|
|
1945
|
-
return {
|
|
1946
|
-
https: read(require_stack.EDGE_PORT_ENV.https, 443),
|
|
1947
|
-
http: read(require_stack.EDGE_PORT_ENV.http, 80),
|
|
1948
|
-
...logs ? { logs } : {}
|
|
1949
|
-
};
|
|
945
|
+
return (await require_stack.runOutput("git", ["status", "--porcelain"], { cwd: root }).catch(() => "")).trim() ? `${sha}-dirty` : sha;
|
|
1950
946
|
}
|
|
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.
|
|
1954
950
|
*/
|
|
1955
951
|
const defaultDeps = {
|
|
1956
|
-
docker: dockerCompose,
|
|
952
|
+
docker: require_stack.dockerCompose,
|
|
1957
953
|
revision: gitRevision,
|
|
1958
|
-
sql:
|
|
1959
|
-
buckets:
|
|
1960
|
-
logins:
|
|
954
|
+
sql: require_stack.pgClient,
|
|
955
|
+
buckets: require_stack.bucketClient,
|
|
956
|
+
logins: require_stack.ensurePostgresLogin,
|
|
1961
957
|
migrate: require_databases.migrateDatabases,
|
|
1962
958
|
seed: require_databases.seedDatabases,
|
|
1963
959
|
probe: httpsProbe,
|
|
@@ -1981,18 +977,18 @@ async function validateCompose(ctx, deps, options = {}) {
|
|
|
1981
977
|
if (push && mode !== "build") throw new ComposePushNeedsBuild();
|
|
1982
978
|
if (options.pin && mode !== "pull") throw new ComposePinNeedsPull();
|
|
1983
979
|
const registry = workspace.deploy?.registry;
|
|
1984
|
-
if (!registry && (push || mode === "pull")) throw new RegistryRequired(push ? "push" : "pull",
|
|
980
|
+
if (!registry && (push || mode === "pull")) throw new RegistryRequired(push ? "push" : "pull", require_credentials.imageRef(identity, ctx.apps[0] ?? workspace.name, void 0, require_credentials.stageTag(tag, stage)));
|
|
1985
981
|
const background = {};
|
|
1986
982
|
const subscribers = {};
|
|
1987
983
|
const manifest = await require_discover.discover({
|
|
1988
|
-
patterns:
|
|
984
|
+
patterns: require_stack.constructGlobs(workspace),
|
|
1989
985
|
cwd: root,
|
|
1990
986
|
background,
|
|
1991
987
|
subscribers
|
|
1992
988
|
});
|
|
1993
989
|
const { secrets, generated } = await stageSecrets(ctx, manifest);
|
|
1994
990
|
const recorded = push ? void 0 : await ctx.state.read(stage);
|
|
1995
|
-
const layout = mode === "build" ?
|
|
991
|
+
const layout = mode === "build" ? require_stack.imageLayout(workspace) : void 0;
|
|
1996
992
|
const input = {
|
|
1997
993
|
workspace,
|
|
1998
994
|
manifest,
|
|
@@ -2006,9 +1002,9 @@ async function validateCompose(ctx, deps, options = {}) {
|
|
|
2006
1002
|
...registry ? { registry } : {}
|
|
2007
1003
|
},
|
|
2008
1004
|
secrets,
|
|
2009
|
-
...stage === workspace.stages.local ? { localCredentials: (await
|
|
1005
|
+
...stage === workspace.stages.local ? { localCredentials: (await require_credentials$1.loadLocalCredentials(workspace)).credentials } : {},
|
|
2010
1006
|
allowDevServices: ctx.allowDevServices,
|
|
2011
|
-
ports: edgePorts(deps.env),
|
|
1007
|
+
ports: require_stack.edgePorts(deps.env),
|
|
2012
1008
|
...layout ? { layout } : {},
|
|
2013
1009
|
...push ? { buildOnly: true } : {},
|
|
2014
1010
|
...mode === "build" ? { prerenderRun: (/* @__PURE__ */ new Date()).toISOString() } : {}
|
|
@@ -2031,7 +1027,7 @@ async function validateCompose(ctx, deps, options = {}) {
|
|
|
2031
1027
|
const pinned = (unpinned) => options.pin ? withPinnedImages(unpinned, options.pin.file, options.pin.digests) : unpinned;
|
|
2032
1028
|
const stack = pinned(composed);
|
|
2033
1029
|
for (const warning of stack.warnings) ctx.logger.warn(`⚠ ${warning}`);
|
|
2034
|
-
if (mode === "pull" && !ctx.dryRun) await assertImagesExist(deps.docker,
|
|
1030
|
+
if (mode === "pull" && !ctx.dryRun) await assertImagesExist(deps.docker, require_credentials.stageTag(tag, stage), [
|
|
2035
1031
|
...stack.apps,
|
|
2036
1032
|
...stack.workers,
|
|
2037
1033
|
...stack.processors
|
|
@@ -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)
|
|
1040
|
+
if (!push && !stack.local) {
|
|
1041
|
+
require_snsSubscriptions.requiredServerAddress(stage, workspace.domains?.[stage], secrets?.custom);
|
|
1042
|
+
if (stack.proxy === "traefik" && stack.wildcard?.tls === "dns") {
|
|
1043
|
+
const zone = require_stack.acmeDnsZone(workspace, stage);
|
|
1044
|
+
if (zone) require_stack.acmeDnsSecrets(zone, stage, secrets?.custom);
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
2045
1047
|
const server = push ? void 0 : composeServer({
|
|
2046
1048
|
stage,
|
|
2047
1049
|
local: stack.local,
|
|
@@ -2135,7 +1137,7 @@ async function edgeHostsFree(ctx, run, deps) {
|
|
|
2135
1137
|
const { stack, ref } = run;
|
|
2136
1138
|
if (ctx.dryRun || run.push) return;
|
|
2137
1139
|
if (stack.proxy !== "traefik" || !stack.traefik) return;
|
|
2138
|
-
await assertEdgeHostsFree(deps.docker, edgeRef(edgeFile(run), {
|
|
1140
|
+
await require_stack.assertEdgeHostsFree(deps.docker, require_stack.edgeRef(edgeFile(run), {
|
|
2139
1141
|
...ref.host ? { host: ref.host } : {},
|
|
2140
1142
|
...ref.output ? { output: ref.output } : {}
|
|
2141
1143
|
}), stack.project, stack.traefik);
|
|
@@ -2170,10 +1172,10 @@ async function logsPortOnServer(ctx, run, deps) {
|
|
|
2170
1172
|
};
|
|
2171
1173
|
if (logs.portSet) {
|
|
2172
1174
|
const taken = await holder(logs.port);
|
|
2173
|
-
if (taken) throw new
|
|
1175
|
+
if (taken) throw new require_credentials$1.LogsPortTaken(ctx.stage, logs.port, taken, true);
|
|
2174
1176
|
return;
|
|
2175
1177
|
}
|
|
2176
|
-
const kept = await deps.docker.published(engine, project,
|
|
1178
|
+
const kept = await deps.docker.published(engine, project, require_credentials$1.LOGS_SERVICE, require_workspace.LOGS_PORT);
|
|
2177
1179
|
let port = kept;
|
|
2178
1180
|
if (port === void 0) {
|
|
2179
1181
|
let taken;
|
|
@@ -2184,7 +1186,7 @@ async function logsPortOnServer(ctx, run, deps) {
|
|
|
2184
1186
|
break;
|
|
2185
1187
|
}
|
|
2186
1188
|
}
|
|
2187
|
-
if (port === void 0) throw new
|
|
1189
|
+
if (port === void 0) throw new require_credentials$1.LogsPortTaken(ctx.stage, logs.port, taken ?? "", false);
|
|
2188
1190
|
}
|
|
2189
1191
|
if (port !== logs.port) {
|
|
2190
1192
|
ctx.logger.info(kept === void 0 ? `📜 OpenObserve: ${logs.port} is another stack's on this server, so "${ctx.stage}" publishes ${port}` : `📜 OpenObserve: "${ctx.stage}" keeps ${port}, the port it already publishes`);
|
|
@@ -2210,7 +1212,7 @@ function assertRedisClient(workspace, stack, manifest) {
|
|
|
2210
1212
|
if (!stack.plan.resources.some((r) => r.kind === "cache")) return;
|
|
2211
1213
|
const cacheKeys = Object.values(manifest).filter((d) => d.kind === "cache").flatMap((d) => d.provides ?? []);
|
|
2212
1214
|
const reachesCache = (keys) => cacheKeys.some((key) => keys?.has(key));
|
|
2213
|
-
const missing = [.../* @__PURE__ */ new Set([...stack.apps.filter((app) => (app.kind === "rest-api" || app.kind === "websocket-api") && reachesCache(
|
|
1215
|
+
const missing = [.../* @__PURE__ */ new Set([...stack.apps.filter((app) => (app.kind === "rest-api" || app.kind === "websocket-api") && reachesCache(require_stack.appEnvKeys(manifest, app.name))).map((a) => a.name), ...stack.workers.filter((worker) => reachesCache(require_stack.workerEnvKeys(manifest, worker.id))).map((worker) => worker.host)])].filter((name) => {
|
|
2214
1216
|
const app = workspace.apps[name];
|
|
2215
1217
|
return app && !require_drivers.installedFrom((0, node_path.join)(workspace.root, app.path), "ioredis");
|
|
2216
1218
|
}).sort();
|
|
@@ -2271,7 +1273,7 @@ async function stageHostsDns(ctx, deps, hosts, custom, wildcard) {
|
|
|
2271
1273
|
...deps.dnsProviderFor ? { providerFor: deps.dnsProviderFor } : {}
|
|
2272
1274
|
});
|
|
2273
1275
|
if (!ctx.dryRun) {
|
|
2274
|
-
const journal = await require_seeds.DeployJournal.open(ctx.state, stage, () =>
|
|
1276
|
+
const journal = await require_seeds.DeployJournal.open(ctx.state, stage, () => require_stack.createComposeState(stage));
|
|
2275
1277
|
const providers = new Map(result.plan.domains.map((d) => [d.domain, d.provider]));
|
|
2276
1278
|
await require_seeds.recordDnsChanges(journal, result.changes, (domain) => providers.get(domain));
|
|
2277
1279
|
}
|
|
@@ -2298,7 +1300,7 @@ async function stageHostsDns(ctx, deps, hosts, custom, wildcard) {
|
|
|
2298
1300
|
async function pruneStageDns(ctx, run) {
|
|
2299
1301
|
if (!run.pruneDns) return;
|
|
2300
1302
|
const pruned = await run.pruneDns();
|
|
2301
|
-
const journal = await require_seeds.DeployJournal.open(ctx.state, ctx.stage, () =>
|
|
1303
|
+
const journal = await require_seeds.DeployJournal.open(ctx.state, ctx.stage, () => require_stack.createComposeState(ctx.stage));
|
|
2302
1304
|
for (const { record } of pruned) await require_seeds.forgetDnsResource(journal, record);
|
|
2303
1305
|
const deleted = pruned.filter((p) => p.action === "delete").length;
|
|
2304
1306
|
if (deleted > 0) ctx.logger.info(`🌐 ${deleted} record${deleted === 1 ? "" : "s"} deleted`);
|
|
@@ -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
|
|
2429
|
-
*
|
|
2430
|
-
*
|
|
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
|
|
2435
|
-
|
|
2436
|
-
const
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
1438
|
+
const zone = require_stack.acmeDnsZone(workspace, stage);
|
|
1439
|
+
if (!zone) return;
|
|
1440
|
+
const edge = require_stack.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 require_stack.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 = require_snsSubscriptions.requiredServerAddress(stage, domain, run.secrets?.custom)?.ipv4 ?? run.server?.host ?? "local";
|
|
2441
1459
|
const clients = await (deps.acmeClients ?? defaultAcmeClients)(route53);
|
|
2442
|
-
await ensureEdgeAcmeKey(deps.docker, {
|
|
1460
|
+
await require_stack.ensureEdgeAcmeKey(deps.docker, {
|
|
2443
1461
|
clients,
|
|
2444
|
-
edge
|
|
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
|
|
1469
|
+
log
|
|
2455
1470
|
});
|
|
2456
1471
|
}
|
|
2457
1472
|
/** IAM and Route 53 through the AWS SDK's own chain, or the entry's profile. */
|
|
@@ -2482,8 +1497,8 @@ async function provisionCompose(ctx, run, deps) {
|
|
|
2482
1497
|
await ctx.secrets.write(run.secrets);
|
|
2483
1498
|
ctx.logger.info(`🔑 Generated for "${ctx.stage}" (${ctx.secrets.store}): ${run.generated.join(", ")}`);
|
|
2484
1499
|
}
|
|
2485
|
-
const ports = edgePorts(deps.env);
|
|
2486
|
-
const ownCaddy = await assertEdgePorts(deps.docker, {
|
|
1500
|
+
const ports = require_stack.edgePorts(deps.env);
|
|
1501
|
+
const ownCaddy = await require_stack.assertEdgePorts(deps.docker, {
|
|
2487
1502
|
project: run.stack.project,
|
|
2488
1503
|
proxy: run.stack.proxy,
|
|
2489
1504
|
ports,
|
|
@@ -2499,7 +1514,7 @@ async function provisionCompose(ctx, run, deps) {
|
|
|
2499
1514
|
await deps.docker.remove(ref, stack.project, "caddy");
|
|
2500
1515
|
}
|
|
2501
1516
|
ctx.logger.info(`\n🌐 Starting the shared edge (${_geekmidas_edge_proxy_traefik.EDGE_PROJECT})…`);
|
|
2502
|
-
run.files.push(...await ensureEdge(deps.docker, {
|
|
1517
|
+
run.files.push(...await require_stack.ensureEdge(deps.docker, {
|
|
2503
1518
|
file: edgeFile(run),
|
|
2504
1519
|
ports,
|
|
2505
1520
|
...ref.host ? { host: ref.host } : {},
|
|
@@ -2576,10 +1591,10 @@ async function prepareBuckets(ctx, run, deps) {
|
|
|
2576
1591
|
try {
|
|
2577
1592
|
const client = deps.buckets(tunnel.port, storage);
|
|
2578
1593
|
done = [
|
|
2579
|
-
...await
|
|
2580
|
-
...await
|
|
2581
|
-
...await
|
|
2582
|
-
...await
|
|
1594
|
+
...await require_stack.applyBuckets(client, storage.buckets),
|
|
1595
|
+
...await require_stack.applyPolicies(client, storage.policies),
|
|
1596
|
+
...await require_stack.applyLifecycles(client, storage.lifecycles),
|
|
1597
|
+
...await require_stack.applyNotifications(client, storage.objects, new Set(storage.webhooks.map((hook) => hook.bucket)))
|
|
2583
1598
|
];
|
|
2584
1599
|
} finally {
|
|
2585
1600
|
await tunnel.close();
|
|
@@ -2603,7 +1618,7 @@ async function prepareDatabases(ctx, run, deps) {
|
|
|
2603
1618
|
if (!run.stack.infra.includes(service)) continue;
|
|
2604
1619
|
const tunnel = await reach(run, deps, service, inside);
|
|
2605
1620
|
tunnels.push(tunnel);
|
|
2606
|
-
ports[
|
|
1621
|
+
ports[require_credentials$1.primaryPortKey(service)] = tunnel.port;
|
|
2607
1622
|
}
|
|
2608
1623
|
await migrateAndSeed(ctx, run, deps, ports);
|
|
2609
1624
|
} finally {
|
|
@@ -2631,30 +1646,30 @@ async function reach(run, deps, service, inside) {
|
|
|
2631
1646
|
async function migrateAndSeed(ctx, run, deps, ports) {
|
|
2632
1647
|
const { stack } = run;
|
|
2633
1648
|
const workspace = ctx.workspace;
|
|
2634
|
-
const port = ports[
|
|
1649
|
+
const port = ports[require_credentials$1.primaryPortKey("postgres")];
|
|
2635
1650
|
const superuser = stack.credential.containers.postgres;
|
|
2636
1651
|
const login = await deps.logins({
|
|
2637
1652
|
port,
|
|
2638
1653
|
login: superuser,
|
|
2639
1654
|
legacy: [{
|
|
2640
|
-
user:
|
|
1655
|
+
user: require_stack.LEGACY_LOCAL_LOGIN.user,
|
|
2641
1656
|
password: superuser.password
|
|
2642
|
-
}, ...stack.local ? [
|
|
1657
|
+
}, ...stack.local ? [require_stack.LEGACY_LOCAL_LOGIN] : []]
|
|
2643
1658
|
});
|
|
2644
1659
|
if (login.notice) ctx.logger.info(login.notice);
|
|
2645
|
-
const statements = [...
|
|
1660
|
+
const statements = [...require_stack.postgresStatements(stack.plan, workspace.name, stack.credential.seed), ...stack.backups ? require_stack.backupsRoleStatements(stack.backups) : []];
|
|
2646
1661
|
if (statements.length > 0) {
|
|
2647
1662
|
ctx.logger.info("🗄️ Creating databases, roles and grants…");
|
|
2648
|
-
await
|
|
1663
|
+
await require_stack.applyPostgres(deps.sql(port, login.login), statements);
|
|
2649
1664
|
}
|
|
2650
1665
|
const sources = {};
|
|
2651
1666
|
const manifest = await require_discover.discover({
|
|
2652
|
-
patterns:
|
|
1667
|
+
patterns: require_stack.constructGlobs(workspace),
|
|
2653
1668
|
cwd: workspace.root,
|
|
2654
1669
|
sources
|
|
2655
1670
|
});
|
|
2656
1671
|
const custom = run.secrets?.custom ?? {};
|
|
2657
|
-
const resolved =
|
|
1672
|
+
const resolved = require_stack.envFor(stack.plan, {
|
|
2658
1673
|
...stack.resolution,
|
|
2659
1674
|
ports,
|
|
2660
1675
|
credentials: {
|
|
@@ -2662,7 +1677,7 @@ async function migrateAndSeed(ctx, run, deps, ports) {
|
|
|
2662
1677
|
postgres: login.login
|
|
2663
1678
|
}
|
|
2664
1679
|
});
|
|
2665
|
-
const env =
|
|
1680
|
+
const env = require_stack.stageEnv(run.secrets ? require_credentials.toEmbeddableSecrets(run.secrets) : {}, Object.fromEntries(Object.entries(resolved).filter(([key]) => custom[key] === void 0)));
|
|
2666
1681
|
const options = {
|
|
2667
1682
|
root: workspace.root,
|
|
2668
1683
|
manifest,
|
|
@@ -2673,7 +1688,7 @@ async function migrateAndSeed(ctx, run, deps, ports) {
|
|
|
2673
1688
|
const seeds = await deps.seed({
|
|
2674
1689
|
...options,
|
|
2675
1690
|
stage: ctx.stage,
|
|
2676
|
-
backends:
|
|
1691
|
+
backends: require_stack.backendsOf(workspace)
|
|
2677
1692
|
}).catch((error) => {
|
|
2678
1693
|
if (error instanceof require_databases.SeedFailed) throw new require_seeds.DeploySeedsFailed(ctx.stage, error.construct, error.seed, error);
|
|
2679
1694
|
throw error;
|
|
@@ -2713,7 +1728,7 @@ async function buildCompose(ctx, run, deps) {
|
|
|
2713
1728
|
ctx.logger.info("\n🐳 Building images…");
|
|
2714
1729
|
await deps.docker.build(ref, now.map((image) => image.app));
|
|
2715
1730
|
} else {
|
|
2716
|
-
ctx.logger.info(`\n🐳 Pulling ${
|
|
1731
|
+
ctx.logger.info(`\n🐳 Pulling ${require_credentials.stageTag(ctx.tag, ctx.stage)}…`);
|
|
2717
1732
|
await deps.docker.pull(ref, apps);
|
|
2718
1733
|
}
|
|
2719
1734
|
if (run.push) ctx.logger.info("\n📤 Pushing images…");
|
|
@@ -2755,14 +1770,14 @@ async function recordBuilt(ctx, run, deps, images) {
|
|
|
2755
1770
|
async function releaseCompose(ctx, run, deps) {
|
|
2756
1771
|
const { stack, ref } = run;
|
|
2757
1772
|
if (run.push) return;
|
|
2758
|
-
const edge = edgeRef(edgeFile(run), {
|
|
1773
|
+
const edge = require_stack.edgeRef(edgeFile(run), {
|
|
2759
1774
|
...ref.host ? { host: ref.host } : {},
|
|
2760
1775
|
...ref.output ? { output: ref.output } : {}
|
|
2761
1776
|
});
|
|
2762
1777
|
if (stack.proxy === "traefik" && stack.traefik) {
|
|
2763
|
-
const written = await writeEdgeRoutes(deps.docker, edge, stack.project, stack.traefik, await edgeCertificate(run.dir, stack));
|
|
1778
|
+
const written = await require_stack.writeEdgeRoutes(deps.docker, edge, stack.project, stack.traefik, await edgeCertificate(run.dir, stack));
|
|
2764
1779
|
ctx.logger.info(`🌐 Registered ${stack.routes.length} route(s) with ${_geekmidas_edge_proxy_traefik.EDGE_PROJECT}: ${written.at(-1)}`);
|
|
2765
|
-
} else if (!stack.local || (0, node_fs.existsSync)(edgeFile(run))) await removeEdgeRoutes(deps.docker, edge, stack.project);
|
|
1780
|
+
} else if (!stack.local || (0, node_fs.existsSync)(edgeFile(run))) await require_stack.removeEdgeRoutes(deps.docker, edge, stack.project);
|
|
2766
1781
|
const prerendered = prerenderedHere(run);
|
|
2767
1782
|
if (prerendered.length > 0) await buildAgainstStage(ctx, run, deps, prerendered);
|
|
2768
1783
|
ctx.logger.info("\n🚀 Starting the stack…");
|
|
@@ -2859,7 +1874,7 @@ function edgeTarget(run, deps) {
|
|
|
2859
1874
|
if (run.stack.local) return { connectTo: "127.0.0.1" };
|
|
2860
1875
|
if (run.server) return {
|
|
2861
1876
|
connectTo: run.server.host,
|
|
2862
|
-
connectPort: edgePorts(deps.env).https
|
|
1877
|
+
connectPort: require_stack.edgePorts(deps.env).https
|
|
2863
1878
|
};
|
|
2864
1879
|
}
|
|
2865
1880
|
/**
|
|
@@ -2932,7 +1947,7 @@ async function stageAnswers(ctx, run, deps, sites) {
|
|
|
2932
1947
|
* the tag resolved to.
|
|
2933
1948
|
*/
|
|
2934
1949
|
async function recordImages(ctx, run) {
|
|
2935
|
-
const journal = await require_seeds.DeployJournal.open(ctx.state, ctx.stage, () =>
|
|
1950
|
+
const journal = await require_seeds.DeployJournal.open(ctx.state, ctx.stage, () => require_stack.createComposeState(ctx.stage));
|
|
2936
1951
|
const by = require_seeds.currentActor();
|
|
2937
1952
|
for (const app of [
|
|
2938
1953
|
...run.stack.apps,
|
|
@@ -2943,7 +1958,7 @@ async function recordImages(ctx, run) {
|
|
|
2943
1958
|
ref: app.ref,
|
|
2944
1959
|
tag: app.tag
|
|
2945
1960
|
};
|
|
2946
|
-
|
|
1961
|
+
require_stack.recordRelease(journal.state, app.app, image, by);
|
|
2947
1962
|
}
|
|
2948
1963
|
journal.state.identity = ctx.identity.key;
|
|
2949
1964
|
await journal.save();
|
|
@@ -2965,7 +1980,7 @@ async function verifyCompose(ctx, run, deps) {
|
|
|
2965
1980
|
edge
|
|
2966
1981
|
})));
|
|
2967
1982
|
results.push(...await Promise.all([...stack.workers, ...stack.processors].map((worker) => checkContainer(ctx, run, deps, worker.name))));
|
|
2968
|
-
if (stack.logs) results.push(await checkContainer(ctx, run, deps,
|
|
1983
|
+
if (stack.logs) results.push(await checkContainer(ctx, run, deps, require_credentials$1.LOGS_SERVICE));
|
|
2969
1984
|
const down = results.filter((result) => !result.healthy).map(({ app, url, last }) => ({
|
|
2970
1985
|
app,
|
|
2971
1986
|
url,
|
|
@@ -3051,8 +2066,8 @@ async function forceRender(ctx, run, deps, app) {
|
|
|
3051
2066
|
let reason;
|
|
3052
2067
|
try {
|
|
3053
2068
|
const root = ctx.workspace.root;
|
|
3054
|
-
const gkmRoot = (0, node_path.relative)(
|
|
3055
|
-
const lookup = await nextPreviewModeId((command) => deps.docker.exec(run.ref, app.name, command),
|
|
2069
|
+
const gkmRoot = (0, node_path.relative)(require_stack.findBuildRoot(root), root) || ".";
|
|
2070
|
+
const lookup = await nextPreviewModeId((command) => deps.docker.exec(run.ref, app.name, command), require_stack.nextPrerenderManifest(require_stack.fromBuildRoot({ gkmRoot }, app.path)));
|
|
3056
2071
|
if ("id" in lookup) return { [NEXT_REVALIDATE_HEADER]: lookup.id };
|
|
3057
2072
|
reason = lookup.reason;
|
|
3058
2073
|
} catch (error) {
|
|
@@ -3131,7 +2146,7 @@ function basicAuthorization(auth) {
|
|
|
3131
2146
|
}
|
|
3132
2147
|
/** How to open the logs, printed — and as an event, for a headless caller. */
|
|
3133
2148
|
function reportLogs(ctx, logs, local, server) {
|
|
3134
|
-
const lines =
|
|
2149
|
+
const lines = require_credentials$1.logsAccess(logs, {
|
|
3135
2150
|
stage: ctx.stage,
|
|
3136
2151
|
local,
|
|
3137
2152
|
user: server?.user ?? currentUser(),
|
|
@@ -3141,7 +2156,7 @@ function reportLogs(ctx, logs, local, server) {
|
|
|
3141
2156
|
ctx.logger.info(`\n${lines.join("\n")}`);
|
|
3142
2157
|
ctx.emit({
|
|
3143
2158
|
type: "logs.ready",
|
|
3144
|
-
service:
|
|
2159
|
+
service: require_credentials$1.LOGS_SERVICE,
|
|
3145
2160
|
access: logs.public ? "public" : "tunnel",
|
|
3146
2161
|
url: logs.url,
|
|
3147
2162
|
...logs.public ? { allow: [...logs.public.allow] } : { port: logs.port },
|
|
@@ -3233,7 +2248,7 @@ function composeResult(ctx, run) {
|
|
|
3233
2248
|
failedCount: 0,
|
|
3234
2249
|
stage: ctx.stage,
|
|
3235
2250
|
identity: ctx.identity.key,
|
|
3236
|
-
tag:
|
|
2251
|
+
tag: require_credentials.stageTag(ctx.tag, ctx.stage),
|
|
3237
2252
|
dryRun: ctx.dryRun,
|
|
3238
2253
|
environmentId: "",
|
|
3239
2254
|
skipped: [...ctx.skipped],
|
|
@@ -3325,21 +2340,32 @@ async function writeStack(root, dir, stack) {
|
|
|
3325
2340
|
...stack.workers,
|
|
3326
2341
|
...stack.processors
|
|
3327
2342
|
]) if (app.env) await write((0, node_path.join)(dir, `${app.name}.env`), require_stack.envFile(app.env), 384);
|
|
3328
|
-
if (stack.logs && stack.compose.services["openobserve"]?.env_file) await write((0, node_path.join)(dir, `${
|
|
3329
|
-
if (stack.redis && stack.compose.services["redis"]?.env_file) await write((0, node_path.join)(dir, `${
|
|
2343
|
+
if (stack.logs && stack.compose.services["openobserve"]?.env_file) await write((0, node_path.join)(dir, `${require_credentials$1.LOGS_SERVICE}.env`), require_stack.envFile(stack.logs.env), 384);
|
|
2344
|
+
if (stack.redis && stack.compose.services["redis"]?.env_file) await write((0, node_path.join)(dir, `${require_credentials$1.REDIS_SERVICE}.env`), require_stack.envFile(stack.redis.env), 384);
|
|
3330
2345
|
if (stack.backups) {
|
|
3331
|
-
for (const [name, content] of Object.entries(stack.backups.files)) await write((0, node_path.join)(dir,
|
|
3332
|
-
if (stack.compose.services["backups"]?.env_file) await write((0, node_path.join)(dir, `${
|
|
2346
|
+
for (const [name, content] of Object.entries(stack.backups.files)) await write((0, node_path.join)(dir, require_stack.BACKUPS_SERVICE, name), content);
|
|
2347
|
+
if (stack.compose.services["backups"]?.env_file) await write((0, node_path.join)(dir, `${require_stack.BACKUPS_SERVICE}.env`), require_stack.envFile(stack.backups.env), 384);
|
|
3333
2348
|
} else {
|
|
3334
|
-
await (0, node_fs_promises.rm)((0, node_path.join)(dir,
|
|
2349
|
+
await (0, node_fs_promises.rm)((0, node_path.join)(dir, require_stack.BACKUPS_SERVICE), {
|
|
3335
2350
|
recursive: true,
|
|
3336
2351
|
force: true
|
|
3337
2352
|
});
|
|
3338
|
-
await (0, node_fs_promises.rm)((0, node_path.join)(dir, `${
|
|
2353
|
+
await (0, node_fs_promises.rm)((0, node_path.join)(dir, `${require_stack.BACKUPS_SERVICE}.env`), { force: true });
|
|
2354
|
+
}
|
|
2355
|
+
const pitr = stack.backups?.pitr;
|
|
2356
|
+
if (pitr) {
|
|
2357
|
+
for (const [name, content] of Object.entries(pitr.postgres.files)) await write((0, node_path.join)(dir, require_stack.POSTGRES_SERVICE, name), content);
|
|
2358
|
+
if (stack.compose.services["postgres"]?.env_file) await write((0, node_path.join)(dir, `${require_stack.POSTGRES_SERVICE}.env`), require_stack.envFile(pitr.postgres.env), 384);
|
|
2359
|
+
} else {
|
|
2360
|
+
await (0, node_fs_promises.rm)((0, node_path.join)(dir, require_stack.POSTGRES_SERVICE), {
|
|
2361
|
+
recursive: true,
|
|
2362
|
+
force: true
|
|
2363
|
+
});
|
|
2364
|
+
await (0, node_fs_promises.rm)((0, node_path.join)(dir, `${require_stack.POSTGRES_SERVICE}.env`), { force: true });
|
|
3339
2365
|
}
|
|
3340
2366
|
for (const entry of await (0, node_fs_promises.readdir)(dir)) if (entry.endsWith(".credentials")) await (0, node_fs_promises.rm)((0, node_path.join)(dir, entry));
|
|
3341
2367
|
for (const [path, content] of Object.entries(stack.dockerfiles)) await write((0, node_path.join)(root, path), content);
|
|
3342
|
-
await
|
|
2368
|
+
await require_stack.ensureDockerignore(require_stack.findBuildRoot(root));
|
|
3343
2369
|
return files;
|
|
3344
2370
|
}
|
|
3345
2371
|
function composeYaml(stack, compose) {
|
|
@@ -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)
|
|
2406
|
+
if (stack.backups) {
|
|
2407
|
+
ctx.logger.info(` ${require_stack.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 ${require_stack.stackDir(stack.stage)}/`);
|
|
3382
2411
|
}
|
|
3383
2412
|
//#endregion
|
|
@@ -3472,18 +2501,6 @@ Object.defineProperty(exports, "ComposePushNeedsBuild", {
|
|
|
3472
2501
|
return ComposePushNeedsBuild;
|
|
3473
2502
|
}
|
|
3474
2503
|
});
|
|
3475
|
-
Object.defineProperty(exports, "ContainersNotStarted", {
|
|
3476
|
-
enumerable: true,
|
|
3477
|
-
get: function() {
|
|
3478
|
-
return ContainersNotStarted;
|
|
3479
|
-
}
|
|
3480
|
-
});
|
|
3481
|
-
Object.defineProperty(exports, "ContainersNotStopped", {
|
|
3482
|
-
enumerable: true,
|
|
3483
|
-
get: function() {
|
|
3484
|
-
return ContainersNotStopped;
|
|
3485
|
-
}
|
|
3486
|
-
});
|
|
3487
2504
|
Object.defineProperty(exports, "composeServer", {
|
|
3488
2505
|
enumerable: true,
|
|
3489
2506
|
get: function() {
|
|
@@ -3508,30 +2525,12 @@ Object.defineProperty(exports, "deployedStackSecrets", {
|
|
|
3508
2525
|
return deployedStackSecrets;
|
|
3509
2526
|
}
|
|
3510
2527
|
});
|
|
3511
|
-
Object.defineProperty(exports, "dockerCompose", {
|
|
3512
|
-
enumerable: true,
|
|
3513
|
-
get: function() {
|
|
3514
|
-
return dockerCompose;
|
|
3515
|
-
}
|
|
3516
|
-
});
|
|
3517
2528
|
Object.defineProperty(exports, "dockerHost", {
|
|
3518
2529
|
enumerable: true,
|
|
3519
2530
|
get: function() {
|
|
3520
2531
|
return dockerHost;
|
|
3521
2532
|
}
|
|
3522
2533
|
});
|
|
3523
|
-
Object.defineProperty(exports, "edgePorts", {
|
|
3524
|
-
enumerable: true,
|
|
3525
|
-
get: function() {
|
|
3526
|
-
return edgePorts;
|
|
3527
|
-
}
|
|
3528
|
-
});
|
|
3529
|
-
Object.defineProperty(exports, "edgeRef", {
|
|
3530
|
-
enumerable: true,
|
|
3531
|
-
get: function() {
|
|
3532
|
-
return edgeRef;
|
|
3533
|
-
}
|
|
3534
|
-
});
|
|
3535
2534
|
Object.defineProperty(exports, "parseDigests", {
|
|
3536
2535
|
enumerable: true,
|
|
3537
2536
|
get: function() {
|
|
@@ -3544,18 +2543,6 @@ Object.defineProperty(exports, "pinnedRef", {
|
|
|
3544
2543
|
return pinnedRef;
|
|
3545
2544
|
}
|
|
3546
2545
|
});
|
|
3547
|
-
Object.defineProperty(exports, "projectNetwork", {
|
|
3548
|
-
enumerable: true,
|
|
3549
|
-
get: function() {
|
|
3550
|
-
return projectNetwork;
|
|
3551
|
-
}
|
|
3552
|
-
});
|
|
3553
|
-
Object.defineProperty(exports, "removeEdgeRoutes", {
|
|
3554
|
-
enumerable: true,
|
|
3555
|
-
get: function() {
|
|
3556
|
-
return removeEdgeRoutes;
|
|
3557
|
-
}
|
|
3558
|
-
});
|
|
3559
2546
|
Object.defineProperty(exports, "sshAccess", {
|
|
3560
2547
|
enumerable: true,
|
|
3561
2548
|
get: function() {
|
|
@@ -3575,4 +2562,4 @@ Object.defineProperty(exports, "stackOverrideFile", {
|
|
|
3575
2562
|
}
|
|
3576
2563
|
});
|
|
3577
2564
|
|
|
3578
|
-
//# sourceMappingURL=compose-
|
|
2565
|
+
//# sourceMappingURL=compose-D3zc8QN1.cjs.map
|