@geekmidas/cli 10.0.0-alpha.183 → 10.0.0-alpha.185
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-BFCqFyEq.cjs → LegacyStateStore-BtN83gfS.cjs} +2 -2
- package/dist/{LegacyStateStore-BFCqFyEq.cjs.map → LegacyStateStore-BtN83gfS.cjs.map} +1 -1
- package/dist/{LegacyStateStore-FOUMZXuF.mjs → LegacyStateStore-DKyEAWGI.mjs} +2 -2
- package/dist/{LegacyStateStore-FOUMZXuF.mjs.map → LegacyStateStore-DKyEAWGI.mjs.map} +1 -1
- package/dist/{LocalStateStore-B5DZh9J2.cjs → LocalStateStore-BFh6rPhX.cjs} +2 -2
- package/dist/{LocalStateStore-B5DZh9J2.cjs.map → LocalStateStore-BFh6rPhX.cjs.map} +1 -1
- package/dist/{LocalStateStore-B7qZNPNd.mjs → LocalStateStore-Dc3aGvQi.mjs} +2 -2
- package/dist/{LocalStateStore-B7qZNPNd.mjs.map → LocalStateStore-Dc3aGvQi.mjs.map} +1 -1
- package/dist/{S3StateStore-BSh1asHJ.cjs → S3StateStore-DZMpqbvD.cjs} +5 -5
- package/dist/{S3StateStore-BSh1asHJ.cjs.map → S3StateStore-DZMpqbvD.cjs.map} +1 -1
- package/dist/{S3StateStore-Dy9-O_Ix.mjs → S3StateStore-p6DyuAFZ.mjs} +4 -4
- package/dist/{S3StateStore-Dy9-O_Ix.mjs.map → S3StateStore-p6DyuAFZ.mjs.map} +1 -1
- package/dist/{SSMStateStore-DQw29x9F.mjs → SSMStateStore-BvH8XX4O.mjs} +2 -2
- package/dist/{SSMStateStore-DQw29x9F.mjs.map → SSMStateStore-BvH8XX4O.mjs.map} +1 -1
- package/dist/{SSMStateStore-Clw-dnjN.cjs → SSMStateStore-sbaLlCmj.cjs} +2 -2
- package/dist/{SSMStateStore-Clw-dnjN.cjs.map → SSMStateStore-sbaLlCmj.cjs.map} +1 -1
- package/dist/{add-BbAyKWsD.cjs → add-CdVGxiKW.cjs} +13 -14
- package/dist/{add-BbAyKWsD.cjs.map → add-CdVGxiKW.cjs.map} +1 -1
- package/dist/{add-BewI_NWg.mjs → add-dOvgsAU6.mjs} +4 -5
- package/dist/{add-BewI_NWg.mjs.map → add-dOvgsAU6.mjs.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-CKKMaAnQ.cjs → bundler-B5ioF-1Q.cjs} +9 -9
- package/dist/{bundler-CKKMaAnQ.cjs.map → bundler-B5ioF-1Q.cjs.map} +1 -1
- package/dist/{bundler-FUhPSv3Y.mjs → bundler-Cvx6Bt3e.mjs} +6 -6
- package/dist/{bundler-FUhPSv3Y.mjs.map → bundler-Cvx6Bt3e.mjs.map} +1 -1
- package/dist/{cli-F4EvxZgK.mjs → cli-BjapgcXG.mjs} +4 -4
- package/dist/{cli-F4EvxZgK.mjs.map → cli-BjapgcXG.mjs.map} +1 -1
- package/dist/{cli-DBdR2Hqf.cjs → cli-PLhqvPOC.cjs} +6 -6
- package/dist/{cli-DBdR2Hqf.cjs.map → cli-PLhqvPOC.cjs.map} +1 -1
- package/dist/{clientTelemetry-BAwj6MOf.d.cts → clientTelemetry-Bzc4KXz5.d.mts} +2 -2
- package/dist/clientTelemetry-Bzc4KXz5.d.mts.map +1 -0
- package/dist/{clientTelemetry-CvamPJj_.d.mts → clientTelemetry-N8NAguGI.d.cts} +2 -2
- package/dist/clientTelemetry-N8NAguGI.d.cts.map +1 -0
- package/dist/{compose-BWqyiF3p.cjs → compose-BEVBxf4w.cjs} +87 -948
- package/dist/compose-BEVBxf4w.cjs.map +1 -0
- package/dist/{compose-FHcdMtju.mjs → compose-Dx_nSZYU.mjs} +23 -842
- package/dist/compose-Dx_nSZYU.mjs.map +1 -0
- package/dist/{config-C3U5HulX.d.cts → config-CTrfNKYd.d.mts} +3 -3
- package/dist/{config-BODxZemw.d.mts.map → config-CTrfNKYd.d.mts.map} +1 -1
- package/dist/{config-BODxZemw.d.mts → config-D9g_nYIu.d.cts} +3 -3
- package/dist/{config-C3U5HulX.d.cts.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-Dx1qWkqA.mjs → credentials-DW5MvS4A.mjs} +1148 -1261
- package/dist/credentials-DW5MvS4A.mjs.map +1 -0
- package/dist/{compose-uWAls-tD.cjs → credentials-Eyx2tM7B.cjs} +1175 -1288
- package/dist/credentials-Eyx2tM7B.cjs.map +1 -0
- package/dist/{dns-zWyF3BB0.cjs → credentials-n2abUWwJ.cjs} +6 -847
- package/dist/credentials-n2abUWwJ.cjs.map +1 -0
- package/dist/{dns-w28G3uDJ.mjs → credentials-ztezRtR4.mjs} +5 -708
- package/dist/credentials-ztezRtR4.mjs.map +1 -0
- package/dist/{dbTunnel-dzS96iTb.cjs → dbTunnel-DVohSZJQ.cjs} +8 -9
- package/dist/{dbTunnel-dzS96iTb.cjs.map → dbTunnel-DVohSZJQ.cjs.map} +1 -1
- package/dist/{dbTunnel-DVgW5GGr.mjs → dbTunnel-bV1CPWUv.mjs} +5 -6
- package/dist/{dbTunnel-DVgW5GGr.mjs.map → dbTunnel-bV1CPWUv.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.mts +5 -5
- package/dist/deploy/public.mjs +10 -11
- package/dist/deploy/public.mjs.map +1 -1
- package/dist/{deploy-B1n2hPbI.cjs → deploy-CDUWcl58.cjs} +72 -62
- package/dist/deploy-CDUWcl58.cjs.map +1 -0
- package/dist/{deploy-SsifvmBB.mjs → deploy-Cpz5sKbh.mjs} +25 -15
- package/dist/deploy-Cpz5sKbh.mjs.map +1 -0
- package/dist/{destroy-CHigTrDO.mjs → destroy-DRlcWJwm.mjs} +9 -9
- package/dist/{destroy-CHigTrDO.mjs.map → destroy-DRlcWJwm.mjs.map} +1 -1
- package/dist/{destroy-Bn6d47rP.cjs → destroy-DzeV0EdY.cjs} +21 -21
- package/dist/{destroy-Bn6d47rP.cjs.map → destroy-DzeV0EdY.cjs.map} +1 -1
- package/dist/{dokploy-CnnrFOBH.cjs → dokploy-BTNfj3Zt.cjs} +2 -2
- package/dist/{dokploy-CnnrFOBH.cjs.map → dokploy-BTNfj3Zt.cjs.map} +1 -1
- package/dist/{dokploy-BzfI7ZE0.mjs → dokploy-BveqiW2h.mjs} +2 -2
- package/dist/{dokploy-BzfI7ZE0.mjs.map → dokploy-BveqiW2h.mjs.map} +1 -1
- package/dist/{eas-CZ3ZuWTs.mjs → eas-BmYTfjY6.mjs} +3 -3
- package/dist/{eas-CZ3ZuWTs.mjs.map → eas-BmYTfjY6.mjs.map} +1 -1
- package/dist/{eas-BTOGceIO.cjs → eas-Dt_vRzb4.cjs} +3 -3
- package/dist/{eas-BTOGceIO.cjs.map → eas-Dt_vRzb4.cjs.map} +1 -1
- package/dist/{encryption-BHGCfu6X.cjs → encryption-BE2wxfyH.cjs} +6 -6
- package/dist/{encryption-BHGCfu6X.cjs.map → encryption-BE2wxfyH.cjs.map} +1 -1
- package/dist/{encryption-CocJ18w4.mjs → encryption-DqoQltP8.mjs} +3 -3
- package/dist/{encryption-CocJ18w4.mjs.map → encryption-DqoQltP8.mjs.map} +1 -1
- package/dist/{engine-B0AwceAI.mjs → engine-B72vyrO8.mjs} +7 -9
- package/dist/{engine-B0AwceAI.mjs.map → engine-B72vyrO8.mjs.map} +1 -1
- package/dist/{engine-3460tLKl.cjs → engine-BevpkNZe.cjs} +100 -102
- package/dist/{engine-3460tLKl.cjs.map → engine-BevpkNZe.cjs.map} +1 -1
- package/dist/{github-DMQSq0Jm.cjs → github-DoHdtsDX.cjs} +18 -18
- package/dist/{github-DMQSq0Jm.cjs.map → github-DoHdtsDX.cjs.map} +1 -1
- package/dist/{github-BqYhgU8Y.mjs → github-hxvid6J3.mjs} +7 -7
- package/dist/{github-BqYhgU8Y.mjs.map → github-hxvid6J3.mjs.map} +1 -1
- package/dist/{googlePlay-DTQ_epbl.cjs → googlePlay-CYney-Of.cjs} +5 -5
- package/dist/{googlePlay-DTQ_epbl.cjs.map → googlePlay-CYney-Of.cjs.map} +1 -1
- package/dist/{googlePlay-y4fWdG2Z.mjs → googlePlay-DsvZTWgP.mjs} +4 -4
- package/dist/{googlePlay-y4fWdG2Z.mjs.map → googlePlay-DsvZTWgP.mjs.map} +1 -1
- package/dist/{iam-BzFyFf7T.mjs → iam-DloEBLXZ.mjs} +2 -2
- package/dist/{iam-BzFyFf7T.mjs.map → iam-DloEBLXZ.mjs.map} +1 -1
- package/dist/{iam-WIoKnLBp.cjs → iam-SxPKYCI_.cjs} +2 -2
- package/dist/{iam-WIoKnLBp.cjs.map → iam-SxPKYCI_.cjs.map} +1 -1
- package/dist/{index-zPzigXh-.d.cts → index-BThTZV8T.d.mts} +2 -2
- package/dist/{index-BKgOlfK2.d.mts.map → index-BThTZV8T.d.mts.map} +1 -1
- package/dist/{index-BKgOlfK2.d.mts → index-Cgd-ouyI.d.cts} +2 -2
- package/dist/{index-zPzigXh-.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-CZbNAWuZ.cjs → local-BuR4fIW6.cjs} +3 -3
- package/dist/{local-CZbNAWuZ.cjs.map → local-BuR4fIW6.cjs.map} +1 -1
- package/dist/{local-DJuonm2r.mjs → local-Cmq75U_o.mjs} +2 -2
- package/dist/{local-DJuonm2r.mjs.map → local-Cmq75U_o.mjs.map} +1 -1
- package/dist/{migrate-DU4G7xbh.mjs → migrate-Bf-EG8Fj.mjs} +5 -5
- package/dist/{migrate-DU4G7xbh.mjs.map → migrate-Bf-EG8Fj.mjs.map} +1 -1
- package/dist/{migrate-CJNgQxYs.cjs → migrate-CDMdrniJ.cjs} +13 -13
- package/dist/{migrate-CJNgQxYs.cjs.map → migrate-CDMdrniJ.cjs.map} +1 -1
- package/dist/{migrate-DXLhzkls.cjs → migrate-CuTQha4s.cjs} +6 -6
- package/dist/{migrate-DXLhzkls.cjs.map → migrate-CuTQha4s.cjs.map} +1 -1
- package/dist/{migrate-D79KnjFu.mjs → migrate-DYJffHOm.mjs} +3 -3
- package/dist/{migrate-D79KnjFu.mjs.map → migrate-DYJffHOm.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-rVF15Mu-.mjs → projectBucket-B5YkuSVr.mjs} +2 -2
- package/dist/{projectBucket-rVF15Mu-.mjs.map → projectBucket-B5YkuSVr.mjs.map} +1 -1
- package/dist/{projectBucket-BoH-BJPI.cjs → projectBucket-NcgqleyH.cjs} +2 -2
- package/dist/{projectBucket-BoH-BJPI.cjs.map → projectBucket-NcgqleyH.cjs.map} +1 -1
- package/dist/{publish-DBDdm5Dz.cjs → publish--EQ4Tw3F.cjs} +2 -2
- package/dist/{publish-DBDdm5Dz.cjs.map → publish--EQ4Tw3F.cjs.map} +1 -1
- package/dist/{publish-EaWW1vhe.mjs → publish-YL8WZHSo.mjs} +2 -2
- package/dist/{publish-EaWW1vhe.mjs.map → publish-YL8WZHSo.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-De0Dw9wI.cjs → resolve-Ced8-gj4.cjs} +4 -4
- package/dist/{resolve-De0Dw9wI.cjs.map → resolve-Ced8-gj4.cjs.map} +1 -1
- package/dist/{resolve-DLUOV7Tt.mjs → resolve-DcG10_JV.mjs} +4 -4
- package/dist/{resolve-DLUOV7Tt.mjs.map → resolve-DcG10_JV.mjs.map} +1 -1
- package/dist/{rollback-bDh-dBGa.mjs → rollback-BxI2p53H.mjs} +7 -6
- package/dist/{rollback-bDh-dBGa.mjs.map → rollback-BxI2p53H.mjs.map} +1 -1
- package/dist/{rollback-61Be6ASD.cjs → rollback-C6bCANv7.cjs} +10 -9
- package/dist/{rollback-61Be6ASD.cjs.map → rollback-C6bCANv7.cjs.map} +1 -1
- package/dist/{runtime-CaejlcZt.d.mts → runtime-BtoiRP5G.d.cts} +2 -2
- package/dist/{runtime-CaejlcZt.d.mts.map → runtime-BtoiRP5G.d.cts.map} +1 -1
- package/dist/{runtime-D3jD4Dvn.d.cts → runtime-Ct41f0tN.d.mts} +2 -2
- package/dist/{runtime-D3jD4Dvn.d.cts.map → runtime-Ct41f0tN.d.mts.map} +1 -1
- package/dist/{s3-CRLJjozN.mjs → s3-BAI0ELtE.mjs} +3 -3
- package/dist/{s3-CRLJjozN.mjs.map → s3-BAI0ELtE.mjs.map} +1 -1
- package/dist/{s3-Bw-Cpb0k.cjs → s3-DucPHZAn.cjs} +3 -3
- package/dist/{s3-Bw-Cpb0k.cjs.map → s3-DucPHZAn.cjs.map} +1 -1
- package/dist/{serverSetup-DkKFG--v.cjs → serverSetup-D3-FE7Dj.cjs} +9 -8
- package/dist/{serverSetup-DkKFG--v.cjs.map → serverSetup-D3-FE7Dj.cjs.map} +1 -1
- package/dist/{serverSetup-9BMKflju.mjs → serverSetup-DS9tW50_.mjs} +7 -6
- package/dist/{serverSetup-9BMKflju.mjs.map → serverSetup-DS9tW50_.mjs.map} +1 -1
- package/dist/{sniffer-PDjJ-6ki.mjs → sniffer-CX8sI8Cu.mjs} +7 -7
- package/dist/{sniffer-PDjJ-6ki.mjs.map → sniffer-CX8sI8Cu.mjs.map} +1 -1
- package/dist/{sniffer-Dss2_3q7.cjs → sniffer-XlvJLrhZ.cjs} +7 -7
- package/dist/{sniffer-Dss2_3q7.cjs.map → sniffer-XlvJLrhZ.cjs.map} +1 -1
- package/dist/{snsSubscriptions-BA4UEQDb.cjs → snsSubscriptions-CJAOhWq9.cjs} +11 -12
- package/dist/{snsSubscriptions-BA4UEQDb.cjs.map → snsSubscriptions-CJAOhWq9.cjs.map} +1 -1
- package/dist/{snsSubscriptions-BwwRq60H.mjs → snsSubscriptions-DDrra9rN.mjs} +3 -4
- package/dist/{snsSubscriptions-BwwRq60H.mjs.map → snsSubscriptions-DDrra9rN.mjs.map} +1 -1
- package/dist/{sst-xWQPl_tB.mjs → sst-CdHflajE.mjs} +6 -6
- package/dist/{sst-xWQPl_tB.mjs.map → sst-CdHflajE.mjs.map} +1 -1
- package/dist/{sst-Dy-LThkf.cjs → sst-CsEjVFtz.cjs} +8 -8
- package/dist/{sst-Dy-LThkf.cjs.map → sst-CsEjVFtz.cjs.map} +1 -1
- package/dist/stack-BYhtz-bE.cjs +11449 -0
- package/dist/stack-BYhtz-bE.cjs.map +1 -0
- package/dist/stack-CLHY-_2m.mjs +10474 -0
- package/dist/stack-CLHY-_2m.mjs.map +1 -0
- package/dist/{stage-BsdW3fQh.cjs → stage-Bc_BtQeG.cjs} +11 -12
- package/dist/stage-Bc_BtQeG.cjs.map +1 -0
- package/dist/{stage-ZBO62mNs.mjs → stage-C7aYyDMr.mjs} +5 -6
- package/dist/stage-C7aYyDMr.mjs.map +1 -0
- package/dist/{stages-DjFKQv08.mjs → stages-DFvE7iEO.mjs} +2 -2
- package/dist/{stages-DjFKQv08.mjs.map → stages-DFvE7iEO.mjs.map} +1 -1
- package/dist/{stages-BeSQQQ4z.cjs → stages-Dk6Lv7DY.cjs} +2 -2
- package/dist/{stages-BeSQQQ4z.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-DUQ0yaZQ.mjs → terminal-BZzK69T9.mjs} +2 -2
- package/dist/{terminal-DUQ0yaZQ.mjs.map → terminal-BZzK69T9.mjs.map} +1 -1
- package/dist/{terminal-DhPb_CKf.cjs → terminal-DXUXlqrO.cjs} +5 -5
- package/dist/{terminal-DhPb_CKf.cjs.map → terminal-DXUXlqrO.cjs.map} +1 -1
- package/dist/{types-CLxsw-QY.d.cts → types-BVDaaLas.d.cts} +26 -7
- package/dist/{types-CLxsw-QY.d.cts.map → types-BVDaaLas.d.cts.map} +1 -1
- package/dist/{types-wLlwkSib.d.mts → types-CJTKWLkK.d.mts} +26 -7
- package/dist/{types-wLlwkSib.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-wTLnc1Ef.cjs → workspace-CTspddnJ.cjs} +62 -22
- package/dist/workspace-CTspddnJ.cjs.map +1 -0
- package/dist/{workspace-DJjhfAGf.mjs → workspace-CdiCMRap.mjs} +62 -22
- package/dist/workspace-CdiCMRap.mjs.map +1 -0
- package/package.json +16 -16
- package/dist/apps-CQqhCjg4.mjs +0 -4650
- package/dist/apps-CQqhCjg4.mjs.map +0 -1
- package/dist/apps-DWq98qHY.cjs +0 -5174
- package/dist/apps-DWq98qHY.cjs.map +0 -1
- package/dist/clientTelemetry-BAwj6MOf.d.cts.map +0 -1
- package/dist/clientTelemetry-CvamPJj_.d.mts.map +0 -1
- package/dist/compose-BWqyiF3p.cjs.map +0 -1
- package/dist/compose-Dx1qWkqA.mjs.map +0 -1
- package/dist/compose-FHcdMtju.mjs.map +0 -1
- package/dist/compose-uWAls-tD.cjs.map +0 -1
- package/dist/deploy-B1n2hPbI.cjs.map +0 -1
- package/dist/deploy-SsifvmBB.mjs.map +0 -1
- package/dist/dns-w28G3uDJ.mjs.map +0 -1
- package/dist/dns-zWyF3BB0.cjs.map +0 -1
- package/dist/docker-DDiEfZox.mjs +0 -1649
- package/dist/docker-DDiEfZox.mjs.map +0 -1
- package/dist/docker-Dox4VZcA.cjs +0 -1798
- package/dist/docker-Dox4VZcA.cjs.map +0 -1
- package/dist/notes-CF_NOgxM.cjs +0 -510
- package/dist/notes-CF_NOgxM.cjs.map +0 -1
- package/dist/notes-Dwc9WLvg.mjs +0 -409
- package/dist/notes-Dwc9WLvg.mjs.map +0 -1
- package/dist/stack-BQKXw0dX.cjs +0 -1887
- package/dist/stack-BQKXw0dX.cjs.map +0 -1
- package/dist/stack-pftB9Sqp.mjs +0 -1777
- package/dist/stack-pftB9Sqp.mjs.map +0 -1
- package/dist/stage-BsdW3fQh.cjs.map +0 -1
- package/dist/stage-ZBO62mNs.mjs.map +0 -1
- package/dist/workspace-DJjhfAGf.mjs.map +0 -1
- package/dist/workspace-wTLnc1Ef.cjs.map +0 -1
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
2
|
import { t as GkmError } from "./errors-C9uIyIDt.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { L as stageTag, M as imageRef, f as initStageSecrets, h as toEmbeddableSecrets } from "./credentials-ztezRtR4.mjs";
|
|
4
|
+
import { Bt as ensureEdge, Cn as applyPolicies, Dt as constructGlobs, En as postgresStatements, Et as backendsOf, Ft as pgClient, G as findRootDomain, Gn as dockerCompose, Gt as writeEdgeSecret, Ht as removeEdgeRoutes, It as assertEdgeHostsFree, K as normalizeDnsConfig, Lt as assertEdgePorts, Mt as LEGACY_LOCAL_LOGIN, Nt as ensurePostgresLogin, Pt as bucketClient, Qn as runOutput, Qt as imageLayout, Rt as edgePorts, Sn as applyNotifications, T as ensureDockerignore, Ut as restartEdge, Vt as readEdgeFile, Wt as writeEdgeRoutes, Z as createComposeState, Zt as fromBuildRoot, _n as backupsRoleStatements, bn as applyBuckets, c as replicaNames, d as withCaddyConfigs, dn as BACKUPS_SERVICE, f as withLogsPort, i as composeStack, jn as stageEnv, kn as envFor, l as stackDir, mn as POSTGRES_SERVICE, n as LOOPBACK_SERVICES, nn as findBuildRoot, r as composeProject, rn as nextPrerenderManifest, s as envFile, t as LOG_ROTATION, tt as recordRelease, vt as appEnvKeys, wn as applyPostgres, wt as workerEnvKeys, xn as applyLifecycles, zt as edgeRef } from "./stack-CLHY-_2m.mjs";
|
|
5
|
+
import { B as LOGS_PORT, Dt as ComposeTlsFileMissing, Ft as SERVER_IPV4_KEY, L as resolveStageTelemetry, Rt as isReservedStageKey } from "./workspace-CdiCMRap.mjs";
|
|
6
6
|
import { t as defineTarget } from "./define-BfrNaY82.mjs";
|
|
7
|
-
import {
|
|
7
|
+
import { C as withRedisPassword, G as usesTelemetry, _t as LogsPortTaken, d as loadLocalCredentials, g as withGeneratedSecrets, gt as LOGS_SERVICE, lt as primaryPortKey, v as REDIS_SERVICE, vt as logsAccess, wt as withLogsLogin, x as runsRedis } from "./credentials-DW5MvS4A.mjs";
|
|
8
8
|
import { o as installedFrom } from "./drivers-BQRb3KsL.mjs";
|
|
9
9
|
import { i as discover } from "./discover-Dfmn6HQ7.mjs";
|
|
10
|
-
import { a as
|
|
11
|
-
import { a as ensureDockerignore } from "./docker-DDiEfZox.mjs";
|
|
12
|
-
import { a as provisionedTopics, c as subscriptionResource, f as isLocalHost, g as serverAddressHint, h as requiredServerAddress, i as confirmPendingSubscriptions, l as topicConnection, n as SUBSCRIPTION_TYPE, o as recordedPushSubscriptions, s as subscriptionKey, t as PushSubscriptionsUnconfirmed, u as HostNotPointingAtServer, v as stackHosts, x as systemLookup, y as stageDns } from "./snsSubscriptions-BwwRq60H.mjs";
|
|
10
|
+
import { a as provisionedTopics, c as subscriptionResource, f as isLocalHost, g as serverAddressHint, h as requiredServerAddress, i as confirmPendingSubscriptions, l as topicConnection, n as SUBSCRIPTION_TYPE, o as recordedPushSubscriptions, s as subscriptionKey, t as PushSubscriptionsUnconfirmed, u as HostNotPointingAtServer, v as stackHosts, x as systemLookup, y as stageDns } from "./snsSubscriptions-DDrra9rN.mjs";
|
|
13
11
|
import { d as dnsResources, f as forgetDnsResource, i as currentActor, n as reportDatabaseRuns, p as recordDnsChanges, r as reportPlannedSeeds, s as DeployJournal, t as DeploySeedsFailed, u as dnsResourceKey } from "./seeds-Ccn0Ru2T.mjs";
|
|
14
12
|
import { f as plannedSeeds, o as SeedFailed, p as seedDatabases, u as migrateDatabases } from "./databases-CV22HzrI.mjs";
|
|
15
13
|
import { dirname, join, relative } from "node:path";
|
|
@@ -21,557 +19,11 @@ import { spawn } from "node:child_process";
|
|
|
21
19
|
import { createConnection, createServer } from "node:net";
|
|
22
20
|
import { createHash } from "node:crypto";
|
|
23
21
|
import { ensureLocalAuthority, ensureLocalCertificate, localCertificateNames, readLocalAuthority } from "@geekmidas/edge/certificates/local";
|
|
24
|
-
import { EDGE_AWS_CREDENTIALS,
|
|
22
|
+
import { EDGE_AWS_CREDENTIALS, EDGE_PROJECT, EDGE_SERVICE } from "@geekmidas/edge/proxy/traefik";
|
|
25
23
|
import { providedKeyFor } from "@geekmidas/manifest";
|
|
26
24
|
import { stringify } from "yaml";
|
|
27
25
|
import { request } from "node:http";
|
|
28
26
|
import { request as request$1 } from "node:https";
|
|
29
|
-
//#region src/compose/docker.ts
|
|
30
|
-
/**
|
|
31
|
-
* The Docker operations `gkm compose` needs, behind an interface.
|
|
32
|
-
*
|
|
33
|
-
* Small on purpose, like reconcile's: the rules about *when* each runs — the
|
|
34
|
-
* registry is asked before anything is pulled, nothing is started for a tag
|
|
35
|
-
* that is missing — are asserted against a fake, and this file is only the
|
|
36
|
-
* wiring to the real CLI.
|
|
37
|
-
*
|
|
38
|
-
* Every call is an argument array. Image refs, tags and paths come from the
|
|
39
|
-
* workspace, and none of them reaches a shell.
|
|
40
|
-
*/
|
|
41
|
-
/** `output` as `spawn` reads it. */
|
|
42
|
-
const STDIO = {
|
|
43
|
-
inherit: "inherit",
|
|
44
|
-
stderr: [
|
|
45
|
-
"ignore",
|
|
46
|
-
2,
|
|
47
|
-
2
|
|
48
|
-
],
|
|
49
|
-
ignore: "ignore"
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* The environment a docker command for `engine` runs with: this process's,
|
|
53
|
-
* with `DOCKER_HOST` pointing at the stack's engine when it is a server's.
|
|
54
|
-
*/
|
|
55
|
-
function engineEnv(engine, extra = {}) {
|
|
56
|
-
if (!engine.host && Object.keys(extra).length === 0) return void 0;
|
|
57
|
-
return {
|
|
58
|
-
...process.env,
|
|
59
|
-
...extra,
|
|
60
|
-
...engine.host ? { DOCKER_HOST: engine.host } : {}
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
/** How a stack's docker commands run: where it is, where output goes. */
|
|
64
|
-
function runOptions(stack, extra) {
|
|
65
|
-
const env = engineEnv(stack, extra);
|
|
66
|
-
return {
|
|
67
|
-
cwd: stack.cwd,
|
|
68
|
-
stdio: STDIO[stack.output ?? "inherit"],
|
|
69
|
-
...env ? { env } : {},
|
|
70
|
-
...stack.signal ? { signal: stack.signal } : {}
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
/** The network compose puts a project's services on. */
|
|
74
|
-
function projectNetwork(project) {
|
|
75
|
-
return `${project}_default`;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* The host ports a `docker ps` Ports column publishes: `0.0.0.0:443->443/tcp,
|
|
79
|
-
* [::]:443->443/tcp, 0.0.0.0:9000-9001->9000-9001/tcp`.
|
|
80
|
-
*/
|
|
81
|
-
function publishedPorts(column) {
|
|
82
|
-
const ports = /* @__PURE__ */ new Set();
|
|
83
|
-
for (const match of column.matchAll(/(?:[\d.]+|\[[^\]]*\]):(\d+)(?:-(\d+))?->/g)) {
|
|
84
|
-
const first = Number(match[1]);
|
|
85
|
-
const last = match[2] ? Number(match[2]) : first;
|
|
86
|
-
for (let port = first; port <= last; port++) ports.add(port);
|
|
87
|
-
}
|
|
88
|
-
return [...ports];
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* The host port a `docker ps` Ports column publishes for `inside`:
|
|
92
|
-
* `127.0.0.1:54321->5432/tcp` is 54321.
|
|
93
|
-
*/
|
|
94
|
-
function publishedPort(column, inside) {
|
|
95
|
-
const match = new RegExp(`(?:[\\d.]+|\\[[^\\]]*\\]):(\\d+)->${inside}/tcp`).exec(column);
|
|
96
|
-
return match ? Number(match[1]) : void 0;
|
|
97
|
-
}
|
|
98
|
-
/** Each line `docker ps` printed, as the containers holding `port`. */
|
|
99
|
-
function portHolders(output, port) {
|
|
100
|
-
return output.split("\n").filter(Boolean).map((line) => line.split(" ")).filter(([, , , column = ""]) => publishedPorts(column).includes(port)).map(([container = "", project, service]) => ({
|
|
101
|
-
container,
|
|
102
|
-
...project ? { project } : {},
|
|
103
|
-
...service ? { service } : {}
|
|
104
|
-
}));
|
|
105
|
-
}
|
|
106
|
-
/** How long a stack has to pass its health checks. */
|
|
107
|
-
const WAIT_TIMEOUT_S = 180;
|
|
108
|
-
/** `docker` itself failed, before it could say anything about a service. */
|
|
109
|
-
var DockerUnreachable = class extends GkmError {
|
|
110
|
-
engine;
|
|
111
|
-
stderr;
|
|
112
|
-
constructor(engine, stderr) {
|
|
113
|
-
super(`Could not ask Docker on ${engine} which ports its services publish (docker said: ${stderr.trim() || "nothing"}). Check that \`DOCKER_HOST=${engine} docker ps\` works from here.`);
|
|
114
|
-
this.engine = engine;
|
|
115
|
-
this.stderr = stderr;
|
|
116
|
-
this.name = "DockerUnreachable";
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
/** `docker compose port` printed nothing a port can be read from. */
|
|
120
|
-
var ServicePortUnknown = class extends GkmError {
|
|
121
|
-
service;
|
|
122
|
-
inside;
|
|
123
|
-
output;
|
|
124
|
-
constructor(service, inside, output) {
|
|
125
|
-
super(`'${service}' publishes no host port for ${inside} (docker said: ${output.trim() || "nothing"}). Is it running? \`docker compose ps\` shows the stack.`);
|
|
126
|
-
this.service = service;
|
|
127
|
-
this.inside = inside;
|
|
128
|
-
this.output = output;
|
|
129
|
-
this.name = "ServicePortUnknown";
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
/**
|
|
133
|
-
* Whether `ref` names a registry on this machine's loopback — which the
|
|
134
|
-
* daemon pulls from and pushes to over plain HTTP by default, and `docker
|
|
135
|
-
* manifest inspect` reaches only when told `--insecure` (without it, a local
|
|
136
|
-
* registry's image is reported as no such manifest).
|
|
137
|
-
*/
|
|
138
|
-
function isLoopbackRegistry(ref) {
|
|
139
|
-
const first = ref.split("/")[0];
|
|
140
|
-
if (!ref.includes("/") || !/[.:]|^localhost$/.test(first)) return false;
|
|
141
|
-
const host = first.replace(/:\d+$/, "");
|
|
142
|
-
return host === "localhost" || /^127(?:\.\d{1,3}){3}$/.test(host);
|
|
143
|
-
}
|
|
144
|
-
/** `docker push` finished without saying what digest the registry stored. */
|
|
145
|
-
var PushDigestUnknown = class extends GkmError {
|
|
146
|
-
ref;
|
|
147
|
-
output;
|
|
148
|
-
constructor(ref, output) {
|
|
149
|
-
super(`Pushed ${ref}, but docker did not say which digest the registry stored (it said: ${output.trim().split("\n").slice(-3).join(" / ") || "nothing"}). Check the push with \`docker buildx imagetools inspect ${ref}\`.`);
|
|
150
|
-
this.ref = ref;
|
|
151
|
-
this.output = output;
|
|
152
|
-
this.name = "PushDigestUnknown";
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
/** The digest `docker push` reports last: `<tag>: digest: sha256:… size: …`. */
|
|
156
|
-
function pushedDigest(output) {
|
|
157
|
-
return [...output.matchAll(/digest: (sha256:[0-9a-f]{64})/g)].at(-1)?.[1];
|
|
158
|
-
}
|
|
159
|
-
function compose(stack, args) {
|
|
160
|
-
return [
|
|
161
|
-
"compose",
|
|
162
|
-
"-p",
|
|
163
|
-
stack.project,
|
|
164
|
-
"-f",
|
|
165
|
-
stack.file,
|
|
166
|
-
...(stack.overrides ?? []).flatMap((file) => ["-f", file]),
|
|
167
|
-
...args
|
|
168
|
-
];
|
|
169
|
-
}
|
|
170
|
-
/** Run a program and keep everything it said, whatever it exits with. */
|
|
171
|
-
function capture(command, args, options = {}) {
|
|
172
|
-
const { timeoutMs = 6e4 } = options;
|
|
173
|
-
return new Promise((resolve, reject) => {
|
|
174
|
-
const child = spawn(command, [...args], {
|
|
175
|
-
stdio: [
|
|
176
|
-
options.input === void 0 ? "ignore" : "pipe",
|
|
177
|
-
"pipe",
|
|
178
|
-
"pipe"
|
|
179
|
-
],
|
|
180
|
-
shell: false,
|
|
181
|
-
...options.env ? { env: options.env } : {}
|
|
182
|
-
});
|
|
183
|
-
if (options.input !== void 0) child.stdin?.end(options.input);
|
|
184
|
-
let stdout = "";
|
|
185
|
-
let stderr = "";
|
|
186
|
-
child.stdout?.on("data", (chunk) => {
|
|
187
|
-
stdout += chunk.toString();
|
|
188
|
-
});
|
|
189
|
-
child.stderr?.on("data", (chunk) => {
|
|
190
|
-
stderr += chunk.toString();
|
|
191
|
-
});
|
|
192
|
-
const timer = setTimeout(() => child.kill("SIGKILL"), timeoutMs);
|
|
193
|
-
timer.unref?.();
|
|
194
|
-
child.on("error", (error) => {
|
|
195
|
-
clearTimeout(timer);
|
|
196
|
-
reject(error);
|
|
197
|
-
});
|
|
198
|
-
child.on("close", (code) => {
|
|
199
|
-
clearTimeout(timer);
|
|
200
|
-
resolve({
|
|
201
|
-
code,
|
|
202
|
-
stdout,
|
|
203
|
-
stderr
|
|
204
|
-
});
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* Whether a failed `docker manifest inspect` means the tag is not there, as
|
|
210
|
-
* opposed to the registry not answering.
|
|
211
|
-
*
|
|
212
|
-
* Read off the message because that is all the CLI gives. Anything not
|
|
213
|
-
* recognisably "no such tag" is treated as the registry being unreachable:
|
|
214
|
-
* a registry that refused credentials must not be reported as a tag that was
|
|
215
|
-
* never pushed, or the fix offered would be the wrong one.
|
|
216
|
-
*/
|
|
217
|
-
function isMissingManifest(output) {
|
|
218
|
-
return /no such manifest|manifest unknown|manifest for .* not found|not found: manifest/i.test(output);
|
|
219
|
-
}
|
|
220
|
-
const dockerCompose = {
|
|
221
|
-
async lookup(ref) {
|
|
222
|
-
const { code, stdout, stderr } = await capture("docker", [
|
|
223
|
-
"manifest",
|
|
224
|
-
"inspect",
|
|
225
|
-
...isLoopbackRegistry(ref) ? ["--insecure"] : [],
|
|
226
|
-
ref
|
|
227
|
-
]);
|
|
228
|
-
if (code === 0) return {
|
|
229
|
-
ref,
|
|
230
|
-
status: "found"
|
|
231
|
-
};
|
|
232
|
-
const output = `${stderr}\n${stdout}`.trim();
|
|
233
|
-
return isMissingManifest(output) ? {
|
|
234
|
-
ref,
|
|
235
|
-
status: "missing"
|
|
236
|
-
} : {
|
|
237
|
-
ref,
|
|
238
|
-
status: "unreachable",
|
|
239
|
-
detail: output
|
|
240
|
-
};
|
|
241
|
-
},
|
|
242
|
-
async build(stack, services) {
|
|
243
|
-
await run("docker", compose(stack, ["build", ...services]), runOptions(stack, {
|
|
244
|
-
...process.env,
|
|
245
|
-
DOCKER_BUILDKIT: "1"
|
|
246
|
-
}));
|
|
247
|
-
},
|
|
248
|
-
async pull(stack, services) {
|
|
249
|
-
await run("docker", compose(stack, ["pull", ...services]), runOptions(stack));
|
|
250
|
-
},
|
|
251
|
-
async up(stack, services) {
|
|
252
|
-
await run("docker", compose(stack, [
|
|
253
|
-
"up",
|
|
254
|
-
"-d",
|
|
255
|
-
"--wait",
|
|
256
|
-
`--wait-timeout=${WAIT_TIMEOUT_S}`,
|
|
257
|
-
...services ? [] : ["--remove-orphans"],
|
|
258
|
-
...services ?? []
|
|
259
|
-
]), runOptions(stack));
|
|
260
|
-
},
|
|
261
|
-
async down(stack, options) {
|
|
262
|
-
const args = ["down", ...options?.volumes ? ["--volumes"] : []];
|
|
263
|
-
await run("docker", existsSync(stack.file) ? compose(stack, args) : [
|
|
264
|
-
"compose",
|
|
265
|
-
"-p",
|
|
266
|
-
stack.project,
|
|
267
|
-
...args
|
|
268
|
-
], runOptions(stack));
|
|
269
|
-
},
|
|
270
|
-
async port(stack, service, inside) {
|
|
271
|
-
const env = engineEnv(stack);
|
|
272
|
-
const output = await runOutput("docker", compose(stack, [
|
|
273
|
-
"port",
|
|
274
|
-
service,
|
|
275
|
-
String(inside)
|
|
276
|
-
]), {
|
|
277
|
-
cwd: stack.cwd,
|
|
278
|
-
...env ? { env } : {},
|
|
279
|
-
...stack.signal ? { signal: stack.signal } : {}
|
|
280
|
-
});
|
|
281
|
-
const port = Number(output.trim().split(":").pop());
|
|
282
|
-
if (!Number.isInteger(port) || port <= 0) throw new ServicePortUnknown(service, inside, output);
|
|
283
|
-
return port;
|
|
284
|
-
},
|
|
285
|
-
async health(stack, service) {
|
|
286
|
-
const env = engineEnv(stack);
|
|
287
|
-
const { code, stdout } = await capture("docker", compose(stack, [
|
|
288
|
-
"ps",
|
|
289
|
-
"--format",
|
|
290
|
-
"{{.Health}}",
|
|
291
|
-
service
|
|
292
|
-
]), env ? { env } : {});
|
|
293
|
-
if (code !== 0) return void 0;
|
|
294
|
-
return stdout.trim().split("\n")[0] || void 0;
|
|
295
|
-
},
|
|
296
|
-
async push(stack, ref) {
|
|
297
|
-
const output = await runOutput("docker", ["push", ref], {
|
|
298
|
-
cwd: stack.cwd,
|
|
299
|
-
...stack.signal ? { signal: stack.signal } : {}
|
|
300
|
-
});
|
|
301
|
-
const digest = pushedDigest(output);
|
|
302
|
-
if (!digest) throw new PushDigestUnknown(ref, output);
|
|
303
|
-
return digest;
|
|
304
|
-
},
|
|
305
|
-
async digest(engine, ref) {
|
|
306
|
-
const env = engineEnv(engine);
|
|
307
|
-
const { code, stdout } = await capture("docker", [
|
|
308
|
-
"image",
|
|
309
|
-
"inspect",
|
|
310
|
-
"--format={{json .RepoDigests}} {{.Id}}",
|
|
311
|
-
ref
|
|
312
|
-
], env ? { env } : {});
|
|
313
|
-
if (code !== 0) return void 0;
|
|
314
|
-
const [json = "[]", id] = stdout.trim().split(" ");
|
|
315
|
-
const repository = ref.split("@")[0].replace(/:[\w][\w.-]*$/, "");
|
|
316
|
-
try {
|
|
317
|
-
const digests = JSON.parse(json);
|
|
318
|
-
const match = Array.isArray(digests) ? digests.find((entry) => typeof entry === "string" && entry.startsWith(`${repository}@`)) : void 0;
|
|
319
|
-
if (match) return match.slice(repository.length + 1);
|
|
320
|
-
} catch {}
|
|
321
|
-
return id || void 0;
|
|
322
|
-
},
|
|
323
|
-
async ensureNetwork(engine, name) {
|
|
324
|
-
const env = engineEnv(engine);
|
|
325
|
-
const options = env ? { env } : {};
|
|
326
|
-
const { code } = await capture("docker", [
|
|
327
|
-
"network",
|
|
328
|
-
"inspect",
|
|
329
|
-
name
|
|
330
|
-
], options);
|
|
331
|
-
if (code === 0) return;
|
|
332
|
-
const created = await capture("docker", [
|
|
333
|
-
"network",
|
|
334
|
-
"create",
|
|
335
|
-
name
|
|
336
|
-
], options);
|
|
337
|
-
if (created.code !== 0 && !/already exists/.test(created.stderr)) throw new NetworkCreateFailed(name, created.stderr);
|
|
338
|
-
},
|
|
339
|
-
async publishers(engine, port) {
|
|
340
|
-
const env = engineEnv(engine);
|
|
341
|
-
const { stdout } = await capture("docker", [
|
|
342
|
-
"ps",
|
|
343
|
-
"--format",
|
|
344
|
-
"{{.Names}} {{.Label \"com.docker.compose.project\"}} {{.Label \"com.docker.compose.service\"}} {{.Ports}}"
|
|
345
|
-
], env ? { env } : {});
|
|
346
|
-
return portHolders(stdout, port);
|
|
347
|
-
},
|
|
348
|
-
async exec(stack, service, command, input) {
|
|
349
|
-
const env = engineEnv(stack);
|
|
350
|
-
const options = env ? { env } : {};
|
|
351
|
-
const { stdout: ids } = await capture("docker", [
|
|
352
|
-
"ps",
|
|
353
|
-
"-q",
|
|
354
|
-
"--filter",
|
|
355
|
-
`label=com.docker.compose.project=${stack.project}`,
|
|
356
|
-
"--filter",
|
|
357
|
-
`label=com.docker.compose.service=${service}`
|
|
358
|
-
], options);
|
|
359
|
-
const container = ids.trim().split("\n")[0];
|
|
360
|
-
if (!container) return {
|
|
361
|
-
code: null,
|
|
362
|
-
stdout: "",
|
|
363
|
-
stderr: `${service} is not running`
|
|
364
|
-
};
|
|
365
|
-
return capture("docker", [
|
|
366
|
-
"exec",
|
|
367
|
-
...input === void 0 ? [] : ["-i"],
|
|
368
|
-
container,
|
|
369
|
-
...command
|
|
370
|
-
], {
|
|
371
|
-
...options,
|
|
372
|
-
...input === void 0 ? {} : { input }
|
|
373
|
-
});
|
|
374
|
-
},
|
|
375
|
-
async container(engine, project, service) {
|
|
376
|
-
const env = engineEnv(engine);
|
|
377
|
-
const { stdout } = await capture("docker", [
|
|
378
|
-
"ps",
|
|
379
|
-
"--filter",
|
|
380
|
-
`label=com.docker.compose.project=${project}`,
|
|
381
|
-
"--filter",
|
|
382
|
-
`label=com.docker.compose.service=${service}`,
|
|
383
|
-
"--format",
|
|
384
|
-
"{{.ID}} {{.Image}}"
|
|
385
|
-
], env ? { env } : {});
|
|
386
|
-
const [id, image] = stdout.trim().split("\n")[0]?.split(" ") ?? [];
|
|
387
|
-
return id && image ? {
|
|
388
|
-
id,
|
|
389
|
-
image
|
|
390
|
-
} : void 0;
|
|
391
|
-
},
|
|
392
|
-
async published(engine, project, service, inside) {
|
|
393
|
-
const env = engineEnv(engine);
|
|
394
|
-
const { code, stdout, stderr } = await capture("docker", [
|
|
395
|
-
"ps",
|
|
396
|
-
"--filter",
|
|
397
|
-
`label=com.docker.compose.project=${project}`,
|
|
398
|
-
"--filter",
|
|
399
|
-
`label=com.docker.compose.service=${service}`,
|
|
400
|
-
"--format",
|
|
401
|
-
"{{.Ports}}"
|
|
402
|
-
], env ? { env } : {});
|
|
403
|
-
if (code !== 0) throw new DockerUnreachable(engine.host ?? "this machine", stderr);
|
|
404
|
-
return publishedPort(stdout, inside);
|
|
405
|
-
},
|
|
406
|
-
async stop(engine, project, keep) {
|
|
407
|
-
const env = engineEnv(engine);
|
|
408
|
-
const options = env ? { env } : {};
|
|
409
|
-
const listed = await capture("docker", [
|
|
410
|
-
"ps",
|
|
411
|
-
"--filter",
|
|
412
|
-
`label=com.docker.compose.project=${project}`,
|
|
413
|
-
"--format",
|
|
414
|
-
"{{.ID}} {{.Label \"com.docker.compose.service\"}}"
|
|
415
|
-
], options);
|
|
416
|
-
if (listed.code !== 0) throw new DockerUnreachable(engine.host ?? "this machine", listed.stderr);
|
|
417
|
-
const ids = listed.stdout.split("\n").filter(Boolean).map((line) => line.split(" ")).filter(([, service = ""]) => !keep.includes(service)).map(([id = ""]) => id).filter(Boolean);
|
|
418
|
-
if (ids.length === 0) return [];
|
|
419
|
-
const stopped = await capture("docker", ["stop", ...ids], {
|
|
420
|
-
...options,
|
|
421
|
-
timeoutMs: 12e4
|
|
422
|
-
});
|
|
423
|
-
if (stopped.code !== 0) throw new ContainersNotStopped(project, ids, stopped.stderr);
|
|
424
|
-
return ids;
|
|
425
|
-
},
|
|
426
|
-
async start(engine, ids) {
|
|
427
|
-
if (ids.length === 0) return;
|
|
428
|
-
const env = engineEnv(engine);
|
|
429
|
-
const started = await capture("docker", ["start", ...ids], {
|
|
430
|
-
...env ? { env } : {},
|
|
431
|
-
timeoutMs: 12e4
|
|
432
|
-
});
|
|
433
|
-
if (started.code !== 0) throw new ContainersNotStarted(ids, started.stderr);
|
|
434
|
-
},
|
|
435
|
-
async remove(engine, project, service) {
|
|
436
|
-
const env = engineEnv(engine);
|
|
437
|
-
const options = env ? { env } : {};
|
|
438
|
-
const listed = await capture("docker", [
|
|
439
|
-
"ps",
|
|
440
|
-
"--all",
|
|
441
|
-
"--filter",
|
|
442
|
-
`label=com.docker.compose.project=${project}`,
|
|
443
|
-
"--filter",
|
|
444
|
-
`label=com.docker.compose.service=${service}`,
|
|
445
|
-
"--format",
|
|
446
|
-
"{{.ID}}"
|
|
447
|
-
], options);
|
|
448
|
-
if (listed.code !== 0) throw new DockerUnreachable(engine.host ?? "this machine", listed.stderr);
|
|
449
|
-
const ids = listed.stdout.split("\n").filter(Boolean);
|
|
450
|
-
if (ids.length === 0) return [];
|
|
451
|
-
const removed = await capture("docker", [
|
|
452
|
-
"rm",
|
|
453
|
-
"--force",
|
|
454
|
-
...ids
|
|
455
|
-
], {
|
|
456
|
-
...options,
|
|
457
|
-
timeoutMs: 12e4
|
|
458
|
-
});
|
|
459
|
-
if (removed.code !== 0) throw new ContainersNotRemoved(project, service, ids, removed.stderr);
|
|
460
|
-
return ids;
|
|
461
|
-
},
|
|
462
|
-
runOnce(engine, options) {
|
|
463
|
-
return dockerExit([
|
|
464
|
-
"run",
|
|
465
|
-
"--rm",
|
|
466
|
-
...options.stdin ? ["-i"] : [],
|
|
467
|
-
"--network",
|
|
468
|
-
options.network,
|
|
469
|
-
...Object.keys(options.env ?? {}).flatMap((name) => ["-e", name]),
|
|
470
|
-
"--entrypoint",
|
|
471
|
-
"",
|
|
472
|
-
options.image,
|
|
473
|
-
...options.command
|
|
474
|
-
], {
|
|
475
|
-
env: engineEnv(engine, { ...options.env }) ?? process.env,
|
|
476
|
-
...options.stdin ? { stdin: options.stdin } : {},
|
|
477
|
-
...options.output ? { output: options.output } : {}
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
};
|
|
481
|
-
/** Spawn `docker`, its output where `output` says; resolve with the exit code. */
|
|
482
|
-
function dockerExit(args, options = {}) {
|
|
483
|
-
const output = STDIO[options.output ?? "inherit"];
|
|
484
|
-
const out = Array.isArray(output) ? output : [
|
|
485
|
-
output,
|
|
486
|
-
output,
|
|
487
|
-
output
|
|
488
|
-
];
|
|
489
|
-
return new Promise((resolve, reject) => {
|
|
490
|
-
const child = spawn("docker", [...args], {
|
|
491
|
-
stdio: [
|
|
492
|
-
options.stdin ? "pipe" : "ignore",
|
|
493
|
-
out[1],
|
|
494
|
-
out[2]
|
|
495
|
-
],
|
|
496
|
-
env: options.env ?? process.env,
|
|
497
|
-
shell: false
|
|
498
|
-
});
|
|
499
|
-
let stdinFailed;
|
|
500
|
-
if (options.stdin && child.stdin) {
|
|
501
|
-
options.stdin.on("error", (error) => {
|
|
502
|
-
stdinFailed = error;
|
|
503
|
-
child.stdin?.destroy(error);
|
|
504
|
-
});
|
|
505
|
-
child.stdin.on("error", () => {});
|
|
506
|
-
options.stdin.pipe(child.stdin);
|
|
507
|
-
}
|
|
508
|
-
child.on("error", reject);
|
|
509
|
-
child.on("close", (code) => {
|
|
510
|
-
if (stdinFailed) reject(new StdinNotDelivered(stdinFailed));
|
|
511
|
-
else resolve(code ?? 1);
|
|
512
|
-
});
|
|
513
|
-
});
|
|
514
|
-
}
|
|
515
|
-
/** What a command run with {@link dockerExit} read from stdin failed partway. */
|
|
516
|
-
var StdinNotDelivered = class extends GkmError {
|
|
517
|
-
reason;
|
|
518
|
-
constructor(reason) {
|
|
519
|
-
super(`The input to docker stopped before its end (${reason.message}), so the command only read part of it. Run it again.`);
|
|
520
|
-
this.reason = reason;
|
|
521
|
-
this.name = "StdinNotDelivered";
|
|
522
|
-
}
|
|
523
|
-
};
|
|
524
|
-
/** `docker stop` failed for some of a project's containers. */
|
|
525
|
-
var ContainersNotStopped = class extends GkmError {
|
|
526
|
-
project;
|
|
527
|
-
ids;
|
|
528
|
-
output;
|
|
529
|
-
constructor(project, ids, output) {
|
|
530
|
-
super(`Could not stop ${project}'s containers ${ids.join(", ")} (docker said: ${output.trim() || "nothing"}). Check \`docker ps\` on the stage's server.`);
|
|
531
|
-
this.project = project;
|
|
532
|
-
this.ids = ids;
|
|
533
|
-
this.output = output;
|
|
534
|
-
this.name = "ContainersNotStopped";
|
|
535
|
-
}
|
|
536
|
-
};
|
|
537
|
-
/** `docker start` failed for containers that were stopped. */
|
|
538
|
-
var ContainersNotStarted = class extends GkmError {
|
|
539
|
-
ids;
|
|
540
|
-
output;
|
|
541
|
-
constructor(ids, output) {
|
|
542
|
-
super(`Could not start the containers ${ids.join(", ")} again (docker said: ${output.trim() || "nothing"}). Start them on the stage's server with \`docker start ${ids.join(" ")}\`, or deploy the stage.`);
|
|
543
|
-
this.ids = ids;
|
|
544
|
-
this.output = output;
|
|
545
|
-
this.name = "ContainersNotStarted";
|
|
546
|
-
}
|
|
547
|
-
};
|
|
548
|
-
/** `docker rm` failed for a service's containers. */
|
|
549
|
-
var ContainersNotRemoved = class extends GkmError {
|
|
550
|
-
project;
|
|
551
|
-
service;
|
|
552
|
-
ids;
|
|
553
|
-
output;
|
|
554
|
-
constructor(project, service, ids, output) {
|
|
555
|
-
super(`Could not remove ${project}'s ${service} containers ${ids.join(", ")} (docker said: ${output.trim() || "nothing"}). Remove them on the stage's server with \`docker rm --force ${ids.join(" ")}\`, and deploy again.`);
|
|
556
|
-
this.project = project;
|
|
557
|
-
this.service = service;
|
|
558
|
-
this.ids = ids;
|
|
559
|
-
this.output = output;
|
|
560
|
-
this.name = "ContainersNotRemoved";
|
|
561
|
-
}
|
|
562
|
-
};
|
|
563
|
-
/** `docker network create` failed. */
|
|
564
|
-
var NetworkCreateFailed = class extends GkmError {
|
|
565
|
-
network;
|
|
566
|
-
output;
|
|
567
|
-
constructor(network, output) {
|
|
568
|
-
super(`Could not create the Docker network '${network}' (docker said: ${output.trim() || "nothing"}). Create it by hand with \`docker network create ${network}\` and run again.`);
|
|
569
|
-
this.network = network;
|
|
570
|
-
this.output = output;
|
|
571
|
-
this.name = "NetworkCreateFailed";
|
|
572
|
-
}
|
|
573
|
-
};
|
|
574
|
-
//#endregion
|
|
575
27
|
//#region src/compose/server.ts
|
|
576
28
|
/**
|
|
577
29
|
* Where a deployed compose stage runs: its server, reached over SSH.
|
|
@@ -763,264 +215,6 @@ const sshAccess = {
|
|
|
763
215
|
}
|
|
764
216
|
};
|
|
765
217
|
//#endregion
|
|
766
|
-
//#region src/compose/edge.ts
|
|
767
|
-
/**
|
|
768
|
-
* The server's shared Traefik edge, in Docker: started when a stack needs it,
|
|
769
|
-
* and each stack's routes written to — and removed from — the directory it
|
|
770
|
-
* watches.
|
|
771
|
-
*
|
|
772
|
-
* Everything goes through the server's Docker engine, never its filesystem:
|
|
773
|
-
* the edge's static configuration is handed to it inline, and the directories
|
|
774
|
-
* it watches are volumes each stack writes into with `docker exec`. So the
|
|
775
|
-
* deploy runs anywhere that reaches the engine — a CI runner over SSH — and
|
|
776
|
-
* nothing it writes depends on a path on that machine.
|
|
777
|
-
*
|
|
778
|
-
* gkm-edge (compose project — `GKM_EDGE_PROJECT` renames it)
|
|
779
|
-
* traefik.yml its static configuration (inline config)
|
|
780
|
-
* dynamic/<project>.yml one per stack: routers, services, middlewares
|
|
781
|
-
* certs/<project>.crt|.key a stack's own certificate, where it has one
|
|
782
|
-
*/
|
|
783
|
-
/** The edge's compose project, as docker is asked about it. */
|
|
784
|
-
function edgeRef(file, options = {}) {
|
|
785
|
-
return {
|
|
786
|
-
project: EDGE_PROJECT,
|
|
787
|
-
file,
|
|
788
|
-
cwd: dirname(file),
|
|
789
|
-
...options
|
|
790
|
-
};
|
|
791
|
-
}
|
|
792
|
-
/** Writing to or removing from the edge's volumes failed. */
|
|
793
|
-
var EdgeWriteFailed = class extends GkmError {
|
|
794
|
-
path;
|
|
795
|
-
output;
|
|
796
|
-
constructor(path, output) {
|
|
797
|
-
super(`Could not write ${path} in the shared edge (${EDGE_PROJECT}): ${output.trim() || "it is not running"}. Check it with \`docker compose -p ${EDGE_PROJECT} ps\` on the server, and run gkm compose again.`);
|
|
798
|
-
this.path = path;
|
|
799
|
-
this.output = output;
|
|
800
|
-
this.name = "EdgeWriteFailed";
|
|
801
|
-
}
|
|
802
|
-
};
|
|
803
|
-
/**
|
|
804
|
-
* Something other than the proxy a stack is set to holds the edge's ports.
|
|
805
|
-
*
|
|
806
|
-
* With `proxy: 'traefik'`, any container but the shared edge and the stack's
|
|
807
|
-
* own Caddy, which the deploy moves (see {@link assertEdgePorts}); with
|
|
808
|
-
* `proxy: 'caddy'`, the shared edge, or another stack's Caddy. Refused before
|
|
809
|
-
* anything is started, so the stack is never left half on one proxy and half
|
|
810
|
-
* on the other.
|
|
811
|
-
*/
|
|
812
|
-
var ComposeProxyClash = class extends GkmError {
|
|
813
|
-
project;
|
|
814
|
-
proxy;
|
|
815
|
-
port;
|
|
816
|
-
holder;
|
|
817
|
-
constructor(project, proxy, port, holder) {
|
|
818
|
-
const by = holder.project ? `${holder.container} (compose project ${holder.project})` : holder.container;
|
|
819
|
-
const fix = proxy === "traefik" ? `The shared edge needs ports 80 and 443. Stop ${holder.container}${holder.project ? ` (docker compose -p ${holder.project} down, or its own gkm compose --down)` : ""}, or move the edge with GKM_COMPOSE_HTTPS_PORT/GKM_COMPOSE_HTTP_PORT.` : holder.project === EDGE_PROJECT ? `That is the server's shared Traefik edge, which other stacks register with. Set deploy.compose.proxy to 'traefik' for this stage so the stack registers with it too, or stop the edge once nothing uses it (docker compose -p ${EDGE_PROJECT} down).` : `Stop ${holder.container}, or publish this stack's Caddy elsewhere with GKM_COMPOSE_HTTPS_PORT/GKM_COMPOSE_HTTP_PORT.`;
|
|
820
|
-
super(`${project} is set to proxy: '${proxy}', and port ${port} is held by ${by}. ${fix}`);
|
|
821
|
-
this.project = project;
|
|
822
|
-
this.proxy = proxy;
|
|
823
|
-
this.port = port;
|
|
824
|
-
this.holder = holder;
|
|
825
|
-
this.name = "ComposeProxyClash";
|
|
826
|
-
}
|
|
827
|
-
};
|
|
828
|
-
/**
|
|
829
|
-
* Refuse a stack whose edge ports are held by anything but its own proxy:
|
|
830
|
-
* the shared edge for `'traefik'`, the stack's own Caddy for `'caddy'`.
|
|
831
|
-
*
|
|
832
|
-
* One holder is not refused: with `'traefik'`, the stack's own Caddy, still
|
|
833
|
-
* running from before the stage was switched. It is this stack's to move and
|
|
834
|
-
* no other's, so it is returned for the deploy to remove just before the edge
|
|
835
|
-
* takes the ports — the moment's downtime the switch costs. Undefined when
|
|
836
|
-
* there is nothing to move.
|
|
837
|
-
*/
|
|
838
|
-
async function assertEdgePorts(docker, options) {
|
|
839
|
-
const { project, proxy, ports } = options;
|
|
840
|
-
const ownCaddy = (holder) => holder.project === project && holder.service === "caddy";
|
|
841
|
-
let move;
|
|
842
|
-
for (const port of [ports.https, ports.http]) for (const holder of await docker.publishers(options.engine, port)) {
|
|
843
|
-
if (proxy === "traefik" && ownCaddy(holder)) {
|
|
844
|
-
move = holder;
|
|
845
|
-
continue;
|
|
846
|
-
}
|
|
847
|
-
if (!(proxy === "traefik" ? holder.project === EDGE_PROJECT : ownCaddy(holder))) throw new ComposeProxyClash(project, proxy, port, holder);
|
|
848
|
-
}
|
|
849
|
-
return move;
|
|
850
|
-
}
|
|
851
|
-
/**
|
|
852
|
-
* Write a file into the edge's running container whole or not at all: a
|
|
853
|
-
* temporary name, then a rename. Not `.yml`: the edge reads only `.yml`,
|
|
854
|
-
* `.yaml` and `.toml` files, so it never sees one half written.
|
|
855
|
-
*/
|
|
856
|
-
async function put(docker, edge, path, content, mode = "644") {
|
|
857
|
-
const result = await docker.exec(edge, EDGE_SERVICE, [
|
|
858
|
-
"sh",
|
|
859
|
-
"-c",
|
|
860
|
-
"set -e; t=\"$1.tmp\"; cat > \"$t\"; chmod \"$2\" \"$t\"; mv \"$t\" \"$1\"",
|
|
861
|
-
"sh",
|
|
862
|
-
path,
|
|
863
|
-
mode
|
|
864
|
-
], content);
|
|
865
|
-
if (result.code !== 0) throw new EdgeWriteFailed(path, `${result.stderr}${result.stdout}`);
|
|
866
|
-
}
|
|
867
|
-
/** Remove files from the edge's container; whether the first was there. */
|
|
868
|
-
async function remove(docker, edge, paths) {
|
|
869
|
-
return (await docker.exec(edge, EDGE_SERVICE, [
|
|
870
|
-
"sh",
|
|
871
|
-
"-c",
|
|
872
|
-
"e=1; [ -f \"$1\" ] && e=0; rm -f \"$@\"; exit $e",
|
|
873
|
-
"sh",
|
|
874
|
-
...paths
|
|
875
|
-
])).code === 0;
|
|
876
|
-
}
|
|
877
|
-
/**
|
|
878
|
-
* The edge, up: its network and its container — started when it is not
|
|
879
|
-
* running, and recreated when its configuration changed. Idempotent: on a
|
|
880
|
-
* server where it already runs as configured, `up` changes nothing. Its
|
|
881
|
-
* compose file is written to `file`, on this machine: compose reads it here.
|
|
882
|
-
*/
|
|
883
|
-
async function ensureEdge(docker, options) {
|
|
884
|
-
const { file, ports } = options;
|
|
885
|
-
const staticConfig = traefikStaticFile(ports);
|
|
886
|
-
const content = edgeComposeFile({
|
|
887
|
-
ports,
|
|
888
|
-
staticConfig,
|
|
889
|
-
logging: options.logging
|
|
890
|
-
});
|
|
891
|
-
await mkdir(dirname(file), { recursive: true });
|
|
892
|
-
if (await readFile(file, "utf-8").catch(() => void 0) !== content) await writeFile(file, content);
|
|
893
|
-
const ref = edgeRef(file, {
|
|
894
|
-
...options.host ? { host: options.host } : {},
|
|
895
|
-
...options.output ? { output: options.output } : {},
|
|
896
|
-
...options.signal ? { signal: options.signal } : {}
|
|
897
|
-
});
|
|
898
|
-
await docker.ensureNetwork(ref, EDGE_NETWORK);
|
|
899
|
-
await docker.up(ref, [EDGE_SERVICE]);
|
|
900
|
-
return [file];
|
|
901
|
-
}
|
|
902
|
-
/** A file inside the edge's running container, or undefined where there is none. */
|
|
903
|
-
async function readEdgeFile(docker, edge, path) {
|
|
904
|
-
const result = await docker.exec(edge, EDGE_SERVICE, ["cat", path]);
|
|
905
|
-
return result.code === 0 ? result.stdout : void 0;
|
|
906
|
-
}
|
|
907
|
-
/** A file written into the edge's running container, whole, readable by it alone. */
|
|
908
|
-
async function writeEdgeSecret(docker, edge, path, content) {
|
|
909
|
-
await put(docker, edge, path, content, "600");
|
|
910
|
-
}
|
|
911
|
-
/**
|
|
912
|
-
* The edge restarted — what it reads once and keeps, a key among them, read
|
|
913
|
-
* again — and waited on until it is healthy. Its own restart policy brings
|
|
914
|
-
* it back; `up` waits for it.
|
|
915
|
-
*/
|
|
916
|
-
async function restartEdge(docker, edge) {
|
|
917
|
-
await docker.exec(edge, EDGE_SERVICE, ["kill", "1"]);
|
|
918
|
-
await docker.up(edge, [EDGE_SERVICE]);
|
|
919
|
-
}
|
|
920
|
-
/** A stack's routes, inside the edge's container. */
|
|
921
|
-
function routesPath(project) {
|
|
922
|
-
return `${EDGE_DYNAMIC_DIR}/${project}.yml`;
|
|
923
|
-
}
|
|
924
|
-
/**
|
|
925
|
-
* A host this stack routes is already routed through the shared edge by
|
|
926
|
-
* another project: two routers for one host, and which stack serves it — and
|
|
927
|
-
* which gets its certificate — would be the edge's choice.
|
|
928
|
-
*/
|
|
929
|
-
var EdgeHostClaimed = class extends GkmError {
|
|
930
|
-
host;
|
|
931
|
-
owner;
|
|
932
|
-
project;
|
|
933
|
-
edge;
|
|
934
|
-
constructor(host, owner, project, edge = EDGE_PROJECT) {
|
|
935
|
-
super(`${project} routes ${host}, and ${owner} already routes it through the shared edge (${edge}) on this server. A host is served by one stack only. Give ${project} another domain, or take ${owner} off the edge first: gkm compose --stage <stage> --down in its workspace (or remove ${routesPath(owner)} from the edge).`);
|
|
936
|
-
this.host = host;
|
|
937
|
-
this.owner = owner;
|
|
938
|
-
this.project = project;
|
|
939
|
-
this.edge = edge;
|
|
940
|
-
this.name = "EdgeHostClaimed";
|
|
941
|
-
}
|
|
942
|
-
};
|
|
943
|
-
/**
|
|
944
|
-
* Every other stack's claims on the edge, by project: each `dynamic/*.yml`
|
|
945
|
-
* but this project's, read through the engine. None where the edge is not
|
|
946
|
-
* running — nothing is routed through it.
|
|
947
|
-
*/
|
|
948
|
-
async function edgeClaimsByProject(docker, edge, project) {
|
|
949
|
-
const claimed = /* @__PURE__ */ new Map();
|
|
950
|
-
const listed = await docker.exec(edge, EDGE_SERVICE, [
|
|
951
|
-
"ls",
|
|
952
|
-
"-1",
|
|
953
|
-
EDGE_DYNAMIC_DIR
|
|
954
|
-
]);
|
|
955
|
-
if (listed.code !== 0) return claimed;
|
|
956
|
-
for (const name of listed.stdout.split("\n").map((line) => line.trim())) {
|
|
957
|
-
if (!name.endsWith(".yml")) continue;
|
|
958
|
-
const owner = name.slice(0, -4);
|
|
959
|
-
if (!owner || owner === project) continue;
|
|
960
|
-
const file = await readEdgeFile(docker, edge, routesPath(owner));
|
|
961
|
-
if (file === void 0) continue;
|
|
962
|
-
const claims = readEdgeClaims(file);
|
|
963
|
-
if (claims.length > 0) claimed.set(owner, claims);
|
|
964
|
-
}
|
|
965
|
-
return claimed;
|
|
966
|
-
}
|
|
967
|
-
/**
|
|
968
|
-
* Refuse a stack's routes when a host in them is routed through the edge by
|
|
969
|
-
* another project — checked before a deploy changes anything, and again
|
|
970
|
-
* before its routes are written. Its own file, from its last deploy, is
|
|
971
|
-
* replaced, never a clash.
|
|
972
|
-
*/
|
|
973
|
-
async function assertEdgeHostsFree(docker, edge, project, routes) {
|
|
974
|
-
const mine = readEdgeClaims(routes);
|
|
975
|
-
if (mine.length === 0) return;
|
|
976
|
-
const others = await edgeClaimsByProject(docker, edge, project);
|
|
977
|
-
for (const [owner, theirs] of [...others].sort(([a], [b]) => a.localeCompare(b))) for (const claim of mine) for (const other of theirs) {
|
|
978
|
-
const host = claimsOverlap(claim, other);
|
|
979
|
-
if (host !== void 0) throw new EdgeHostClaimed(host, owner, project, edge.project);
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
function certificatePaths(project) {
|
|
983
|
-
return [`${EDGE_CERTS_DIR}/${project}.crt`, `${EDGE_CERTS_DIR}/${project}.key`];
|
|
984
|
-
}
|
|
985
|
-
/**
|
|
986
|
-
* Register a stack with the edge — refused, before anything is written, when
|
|
987
|
-
* another project routes one of its hosts: its certificate first, where it has one,
|
|
988
|
-
* so the routes that need it never load without it — then its routes, in one
|
|
989
|
-
* rename the edge picks up whole. The certificate — the stage's own, or the
|
|
990
|
-
* one gkm's local CA issued the local stage — is PEM read on this machine and
|
|
991
|
-
* written through the engine. The paths written, inside the edge.
|
|
992
|
-
*/
|
|
993
|
-
async function writeEdgeRoutes(docker, edge, project, routes, certificate) {
|
|
994
|
-
await assertEdgeHostsFree(docker, edge, project, routes);
|
|
995
|
-
const written = [];
|
|
996
|
-
const [crt, key] = certificatePaths(project);
|
|
997
|
-
if (certificate) {
|
|
998
|
-
await put(docker, edge, crt, certificate.cert);
|
|
999
|
-
await put(docker, edge, key, certificate.key, "600");
|
|
1000
|
-
written.push(crt, key);
|
|
1001
|
-
} else await remove(docker, edge, [crt, key]);
|
|
1002
|
-
await put(docker, edge, routesPath(project), routes);
|
|
1003
|
-
written.push(routesPath(project));
|
|
1004
|
-
return written;
|
|
1005
|
-
}
|
|
1006
|
-
/** What a stack's file holds for the moment between emptying and removal. */
|
|
1007
|
-
const UNREGISTERED = "# Unregistered by gkm compose --down.\n";
|
|
1008
|
-
/**
|
|
1009
|
-
* Unregister a stack: its routes, then its certificate. Whether there was
|
|
1010
|
-
* anything to remove — false, too, when the edge is not running.
|
|
1011
|
-
*/
|
|
1012
|
-
async function removeEdgeRoutes(docker, edge, project) {
|
|
1013
|
-
const file = routesPath(project);
|
|
1014
|
-
if ((await docker.exec(edge, EDGE_SERVICE, [
|
|
1015
|
-
"test",
|
|
1016
|
-
"-f",
|
|
1017
|
-
file
|
|
1018
|
-
])).code !== 0) return false;
|
|
1019
|
-
await put(docker, edge, file, UNREGISTERED);
|
|
1020
|
-
await remove(docker, edge, [file, ...certificatePaths(project)]);
|
|
1021
|
-
return true;
|
|
1022
|
-
}
|
|
1023
|
-
//#endregion
|
|
1024
218
|
//#region src/compose/acmeDns.ts
|
|
1025
219
|
/**
|
|
1026
220
|
* The key the server's shared Traefik edge answers Let's Encrypt's DNS
|
|
@@ -1870,17 +1064,6 @@ var ComposePinNeedsPull = class extends GkmError {
|
|
|
1870
1064
|
this.name = "ComposePinNeedsPull";
|
|
1871
1065
|
}
|
|
1872
1066
|
};
|
|
1873
|
-
/** A port variable that does not hold a port. */
|
|
1874
|
-
var EdgePortInvalid = class extends GkmError {
|
|
1875
|
-
variable;
|
|
1876
|
-
value;
|
|
1877
|
-
constructor(variable, value) {
|
|
1878
|
-
super(`${variable}=${value} is not a port. Set it to a number between 1 and 65535, or unset it for the default.`);
|
|
1879
|
-
this.variable = variable;
|
|
1880
|
-
this.value = value;
|
|
1881
|
-
this.name = "EdgePortInvalid";
|
|
1882
|
-
}
|
|
1883
|
-
};
|
|
1884
1067
|
/**
|
|
1885
1068
|
* A site that pre-renders against its stage (`prerender: 'stage'`) whose
|
|
1886
1069
|
* APIs do not answer, so it is not built: pages built without their data
|
|
@@ -1932,22 +1115,6 @@ async function gitRevision(root) {
|
|
|
1932
1115
|
if (!sha) throw new NoGitRevision(root);
|
|
1933
1116
|
return (await runOutput("git", ["status", "--porcelain"], { cwd: root }).catch(() => "")).trim() ? `${sha}-dirty` : sha;
|
|
1934
1117
|
}
|
|
1935
|
-
/** The edge's ports, from the environment — 443 and 80 when unset. */
|
|
1936
|
-
function edgePorts(env = process.env) {
|
|
1937
|
-
const read = (variable, fallback) => {
|
|
1938
|
-
const value = env[variable];
|
|
1939
|
-
if (value === void 0 || value === "") return fallback;
|
|
1940
|
-
const port = Number(value);
|
|
1941
|
-
if (!Number.isInteger(port) || port < 1 || port > 65535) throw new EdgePortInvalid(variable, value);
|
|
1942
|
-
return port;
|
|
1943
|
-
};
|
|
1944
|
-
const logs = env["GKM_COMPOSE_LOGS_PORT"] ? read(LOGS_PORT_ENV, 0) : void 0;
|
|
1945
|
-
return {
|
|
1946
|
-
https: read(EDGE_PORT_ENV.https, 443),
|
|
1947
|
-
http: read(EDGE_PORT_ENV.http, 80),
|
|
1948
|
-
...logs ? { logs } : {}
|
|
1949
|
-
};
|
|
1950
|
-
}
|
|
1951
1118
|
/**
|
|
1952
1119
|
* The real ones. Each app is asked for three minutes before it counts as
|
|
1953
1120
|
* down: a deployed stage's first ACME certificate can take that long.
|
|
@@ -3337,6 +2504,17 @@ async function writeStack(root, dir, stack) {
|
|
|
3337
2504
|
});
|
|
3338
2505
|
await rm(join(dir, `${BACKUPS_SERVICE}.env`), { force: true });
|
|
3339
2506
|
}
|
|
2507
|
+
const pitr = stack.backups?.pitr;
|
|
2508
|
+
if (pitr) {
|
|
2509
|
+
for (const [name, content] of Object.entries(pitr.postgres.files)) await write(join(dir, POSTGRES_SERVICE, name), content);
|
|
2510
|
+
if (stack.compose.services["postgres"]?.env_file) await write(join(dir, `${POSTGRES_SERVICE}.env`), envFile(pitr.postgres.env), 384);
|
|
2511
|
+
} else {
|
|
2512
|
+
await rm(join(dir, POSTGRES_SERVICE), {
|
|
2513
|
+
recursive: true,
|
|
2514
|
+
force: true
|
|
2515
|
+
});
|
|
2516
|
+
await rm(join(dir, `${POSTGRES_SERVICE}.env`), { force: true });
|
|
2517
|
+
}
|
|
3340
2518
|
for (const entry of await readdir(dir)) if (entry.endsWith(".credentials")) await rm(join(dir, entry));
|
|
3341
2519
|
for (const [path, content] of Object.entries(stack.dockerfiles)) await write(join(root, path), content);
|
|
3342
2520
|
await ensureDockerignore(findBuildRoot(root));
|
|
@@ -3377,7 +2555,10 @@ function printPlan(ctx, run) {
|
|
|
3377
2555
|
for (const worker of stack.workers) ctx.logger.info(` ${worker.name.padEnd(12)} ${`worker ${worker.id} (no route)`.padEnd(40)} ${mode} ${worker.ref}`);
|
|
3378
2556
|
for (const unit of stack.processors) ctx.logger.info(` ${unit.name.padEnd(12)} ${`processors of ${unit.id}`.padEnd(40)} ${mode} ${unit.ref}`);
|
|
3379
2557
|
if (stack.infra.length > 0) ctx.logger.info(` infrastructure: ${stack.infra.join(", ")}`);
|
|
3380
|
-
if (stack.backups)
|
|
2558
|
+
if (stack.backups) {
|
|
2559
|
+
ctx.logger.info(` ${BACKUPS_SERVICE.padEnd(12)} ${stack.backups.databases.map((d) => d.file).join(", ")} — ${stack.backups.backups.describe}, to ${stack.backups.prefix}/`);
|
|
2560
|
+
if (stack.backups.pitr) ctx.logger.info(` ${"".padEnd(12)} ${stack.backups.pitr.pitr.describe}, to ${stack.backups.pitr.prefix}/`);
|
|
2561
|
+
}
|
|
3381
2562
|
ctx.logger.info(`\n📝 Wrote ${files.length} file(s) under ${stackDir(stack.stage)}/`);
|
|
3382
2563
|
}
|
|
3383
2564
|
//#endregion
|
|
@@ -3460,6 +2641,6 @@ function composeTarget(options = {}) {
|
|
|
3460
2641
|
});
|
|
3461
2642
|
}
|
|
3462
2643
|
//#endregion
|
|
3463
|
-
export {
|
|
2644
|
+
export { stackOverrideFile as a, pinnedRef as c, sshAccess as d, sshTarget as f, ComposePushNeedsBuild as i, composeServer as l, compose_exports as n, deployedStackSecrets as o, ComposePinNeedsPull as r, parseDigests as s, composeTarget as t, dockerHost as u };
|
|
3464
2645
|
|
|
3465
|
-
//# sourceMappingURL=compose-
|
|
2646
|
+
//# sourceMappingURL=compose-Dx_nSZYU.mjs.map
|