@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,6 +1,6 @@
|
|
|
1
1
|
const require_errors = require("./errors-D1x8duqI.cjs");
|
|
2
|
-
const
|
|
3
|
-
const require_workspace = require("./workspace-
|
|
2
|
+
const require_credentials = require("./credentials-n2abUWwJ.cjs");
|
|
3
|
+
const require_workspace = require("./workspace-CTspddnJ.cjs");
|
|
4
4
|
const require_drivers = require("./drivers-DP7__dJX.cjs");
|
|
5
5
|
const require_config = require("./config.cjs");
|
|
6
6
|
let node_path = require("node:path");
|
|
@@ -8,11 +8,10 @@ let node_fs = require("node:fs");
|
|
|
8
8
|
let node_fs_promises = require("node:fs/promises");
|
|
9
9
|
let node_net = require("node:net");
|
|
10
10
|
let node_crypto = require("node:crypto");
|
|
11
|
-
let _geekmidas_edge_proxy_caddy = require("@geekmidas/edge/proxy/caddy");
|
|
12
11
|
let _geekmidas_manifest = require("@geekmidas/manifest");
|
|
12
|
+
let yaml = require("yaml");
|
|
13
13
|
let _geekmidas_constructs_encryption = require("@geekmidas/constructs/encryption");
|
|
14
14
|
let dotenv = require("dotenv");
|
|
15
|
-
let yaml = require("yaml");
|
|
16
15
|
//#region src/workspace/rootSite.ts
|
|
17
16
|
/**
|
|
18
17
|
* Which site the base domain points at — deployed and locally alike.
|
|
@@ -541,341 +540,6 @@ function volumeOf(container) {
|
|
|
541
540
|
}[container];
|
|
542
541
|
}
|
|
543
542
|
//#endregion
|
|
544
|
-
//#region src/generators/processorRoute.ts
|
|
545
|
-
/**
|
|
546
|
-
* Where `gkm dev` serves a file server's processors, on the dev server of the
|
|
547
|
-
* app holding them: named after the file server.
|
|
548
|
-
*
|
|
549
|
-
* One definition for both sides — the dev server mounts it, and the local
|
|
550
|
-
* edge rewrites each processor pattern on the file server's host onto it — so
|
|
551
|
-
* the path the edge sends and the path the server answers cannot drift.
|
|
552
|
-
*/
|
|
553
|
-
const PROCESSORS_DEV_PREFIX = "/__gkm/processors/";
|
|
554
|
-
/** The base a file server's processors answer under, in `gkm dev`. */
|
|
555
|
-
function processorsDevRoute(fileServerId) {
|
|
556
|
-
return `${PROCESSORS_DEV_PREFIX}${fileServerId}`;
|
|
557
|
-
}
|
|
558
|
-
//#endregion
|
|
559
|
-
//#region src/reconcile/caddyfile.ts
|
|
560
|
-
/**
|
|
561
|
-
* The Caddy configuration a plan implies.
|
|
562
|
-
*
|
|
563
|
-
* A file server is a *domain that serves a bucket*, and locally it had neither:
|
|
564
|
-
* `UPLOADS_URL` resolved to MinIO's path-style address, which works and
|
|
565
|
-
* is not the deployed shape. MinIO's own virtual-host mode cannot fix that —
|
|
566
|
-
* it reads the leading label *as the bucket name*, so it produces the right
|
|
567
|
-
* shape only when the server's id and the bucket's happen to agree, and never
|
|
568
|
-
* for a server fronting two buckets.
|
|
569
|
-
*
|
|
570
|
-
* So the mapping lives in front of MinIO instead: one host per file server,
|
|
571
|
-
* rewriting the bucket in as a path prefix. That is the whole of it — no
|
|
572
|
-
* caching, because caching is not what is missing locally, and a caching proxy
|
|
573
|
-
* would add an invalidation story a local stack has no use for.
|
|
574
|
-
*
|
|
575
|
-
* What it buys beyond the shape is a certificate: gkm's local authority
|
|
576
|
-
* (`@geekmidas/edge/certificates/local`) issues one for the stage's hosts, which the edge
|
|
577
|
-
* serves the way a deployed edge serves the stage's own, so a local address is
|
|
578
|
-
* `https://` like the deployed one, and
|
|
579
|
-
* everything downstream of that — `Secure` cookies, `SameSite`, a cookie domain
|
|
580
|
-
* with more than one host under it — starts behaving the way it will in
|
|
581
|
-
* production rather than the way `http://localhost` allows.
|
|
582
|
-
*
|
|
583
|
-
* Pure, like `composeFor`: what should exist is data, and rendering it is one
|
|
584
|
-
* line at the edge.
|
|
585
|
-
*/
|
|
586
|
-
/**
|
|
587
|
-
* The kinds the edge serves.
|
|
588
|
-
*
|
|
589
|
-
* Everything that owns a *public address*. Deployed, each of these has a real
|
|
590
|
-
* hostname and a certificate, so this is what makes the local shape the same
|
|
591
|
-
* one rather than a near-enough one — and the application is indifferent
|
|
592
|
-
* either way, because it reads whichever address was injected and never
|
|
593
|
-
* composes one.
|
|
594
|
-
*
|
|
595
|
-
* Adding a kind here is the whole of adding it to the edge.
|
|
596
|
-
*/
|
|
597
|
-
const EDGE_KINDS = {
|
|
598
|
-
"file-server": true,
|
|
599
|
-
"rest-api": true,
|
|
600
|
-
"websocket-api": true,
|
|
601
|
-
site: true
|
|
602
|
-
};
|
|
603
|
-
/**
|
|
604
|
-
* How the edge reaches the host, from inside its container.
|
|
605
|
-
*
|
|
606
|
-
* A surface and a site are served by processes `gkm dev` starts on the host,
|
|
607
|
-
* not by containers — so the edge has to leave Docker's network to reach them.
|
|
608
|
-
* Docker Desktop resolves this name already; on Linux the compose definition
|
|
609
|
-
* maps it to the host gateway.
|
|
610
|
-
*/
|
|
611
|
-
const HOST_GATEWAY$1 = "host.docker.internal";
|
|
612
|
-
/** Where the edge's container reads `.gkm/caddy-sites/` — routes and certificates. */
|
|
613
|
-
const CADDY_SITES_IN_CONTAINER = "/etc/caddy/sites";
|
|
614
|
-
/**
|
|
615
|
-
* The suffix every local host shares.
|
|
616
|
-
*
|
|
617
|
-
* `.localhost` rather than a made-up TLD because it resolves to loopback
|
|
618
|
-
* without touching `/etc/hosts` — macOS and systemd-resolved both answer for
|
|
619
|
-
* subdomains of it.
|
|
620
|
-
*/
|
|
621
|
-
const LOCAL_TLD = "localhost";
|
|
622
|
-
/**
|
|
623
|
-
* The sites a plan implies, one per file server.
|
|
624
|
-
*
|
|
625
|
-
* The leading label is the *server's* stage-scoped name rather than the
|
|
626
|
-
* bucket's, which is the difference that matters: two servers over one bucket
|
|
627
|
-
* are a legitimate arrangement — two cache behaviours, one origin — and naming
|
|
628
|
-
* the host after the bucket would make them collide.
|
|
629
|
-
*/
|
|
630
|
-
function sitesFor(plan, project, addresses = {}, processorAddresses = {}) {
|
|
631
|
-
const byId = new Map(plan.resources.map((r) => [r.id, r]));
|
|
632
|
-
const sites = [];
|
|
633
|
-
for (const resource of plan.resources) {
|
|
634
|
-
if (!EDGE_KINDS[resource.kind]) continue;
|
|
635
|
-
const host = hostFor(resource, project);
|
|
636
|
-
if (resource.kind === "file-server") {
|
|
637
|
-
const origin = resource.of ? byId.get(resource.of) : void 0;
|
|
638
|
-
if (!origin) continue;
|
|
639
|
-
const address = processorAddresses[resource.id];
|
|
640
|
-
const port = address ? portOf(address) : void 0;
|
|
641
|
-
sites.push({
|
|
642
|
-
host,
|
|
643
|
-
upstream: "http://minio:9000",
|
|
644
|
-
rewrite: `/${origin.name}{uri}`,
|
|
645
|
-
...resource.processors?.length && port ? { processors: {
|
|
646
|
-
prefixes: resource.processors,
|
|
647
|
-
upstream: `http://${HOST_GATEWAY$1}:${port}`,
|
|
648
|
-
under: processorsDevRoute(resource.id)
|
|
649
|
-
} } : {}
|
|
650
|
-
});
|
|
651
|
-
continue;
|
|
652
|
-
}
|
|
653
|
-
const address = addresses[resource.id];
|
|
654
|
-
if (!address) continue;
|
|
655
|
-
const port = portOf(address);
|
|
656
|
-
if (!port) continue;
|
|
657
|
-
const upstream = `http://${HOST_GATEWAY$1}:${port}`;
|
|
658
|
-
if (resource.subdomain === _geekmidas_manifest.WILDCARD_SUBDOMAIN) {
|
|
659
|
-
sites.push({
|
|
660
|
-
host,
|
|
661
|
-
upstream,
|
|
662
|
-
tenants: tenantsOf(resource, host, addresses)
|
|
663
|
-
});
|
|
664
|
-
continue;
|
|
665
|
-
}
|
|
666
|
-
const { aliases, redirects } = hostsFor(resource, project);
|
|
667
|
-
sites.push({
|
|
668
|
-
host,
|
|
669
|
-
upstream,
|
|
670
|
-
...aliases.length ? { aliases } : {},
|
|
671
|
-
...redirects.length ? { redirects } : {}
|
|
672
|
-
});
|
|
673
|
-
}
|
|
674
|
-
return sites;
|
|
675
|
-
}
|
|
676
|
-
/**
|
|
677
|
-
* What stands between a wildcard site and a host that is not a tenant.
|
|
678
|
-
*
|
|
679
|
-
* Caddy already prefers a named host to the `*`, so `api.shop.localhost`
|
|
680
|
-
* reaches the API whatever the wildcard says. What it cannot know is the
|
|
681
|
-
* labels nothing is running on: `www`, or an app this stage has not started.
|
|
682
|
-
* Those are refused here, so no slug that a deploy would protect is ever
|
|
683
|
-
* served locally either.
|
|
684
|
-
*
|
|
685
|
-
* The `hosts` route is asked through `forward_auth`, which is a deployed
|
|
686
|
-
* edge's check in miniature: a `2xx` lets the request through, and any other
|
|
687
|
-
* answer — the app's own `404` — is what the browser gets, so a mistyped
|
|
688
|
-
* slug fails here and not first in production. Without an address for the
|
|
689
|
-
* surface serving it there is nothing to ask, and every host is served.
|
|
690
|
-
*/
|
|
691
|
-
function tenantsOf(resource, host, addresses) {
|
|
692
|
-
const domain = host.slice(`${_geekmidas_manifest.WILDCARD_SUBDOMAIN}.`.length);
|
|
693
|
-
const surface = resource.hosts ? addresses[resource.hosts.surface] : void 0;
|
|
694
|
-
const port = surface ? portOf(surface) : void 0;
|
|
695
|
-
return {
|
|
696
|
-
protected: (resource.protectedSubdomains ?? []).map((label) => `${label}.${domain}`),
|
|
697
|
-
...resource.hosts && port ? { hosts: {
|
|
698
|
-
upstream: `http://${HOST_GATEWAY$1}:${port}`,
|
|
699
|
-
uri: `${resource.hosts.path}?domain={host}`
|
|
700
|
-
} } : {}
|
|
701
|
-
};
|
|
702
|
-
}
|
|
703
|
-
/** The port a local address answers on, defaulting by scheme. */
|
|
704
|
-
function portOf(address) {
|
|
705
|
-
try {
|
|
706
|
-
const { port, protocol } = new URL(address);
|
|
707
|
-
return port || (protocol === "https:" ? "443" : "80");
|
|
708
|
-
} catch {
|
|
709
|
-
return;
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
/**
|
|
713
|
-
* Where one file server answers, including the stage its name carries.
|
|
714
|
-
*
|
|
715
|
-
* The project is a label rather than a decoration: it is what keeps two
|
|
716
|
-
* checkouts from answering on one address. Omitted when there is no project to
|
|
717
|
-
* name, because an empty label makes `uploads..localhost` — a host nothing
|
|
718
|
-
* resolves and no certificate can be issued for.
|
|
719
|
-
*/
|
|
720
|
-
function hostFor(resource, project) {
|
|
721
|
-
const label = resource.root && project ? stageOf(resource) : labelOf(resource);
|
|
722
|
-
if (resource.subdomain === _geekmidas_manifest.WILDCARD_SUBDOMAIN) return [
|
|
723
|
-
_geekmidas_manifest.WILDCARD_SUBDOMAIN,
|
|
724
|
-
stageOf(resource),
|
|
725
|
-
project,
|
|
726
|
-
LOCAL_TLD
|
|
727
|
-
].filter(Boolean).join(".");
|
|
728
|
-
return [
|
|
729
|
-
label,
|
|
730
|
-
project,
|
|
731
|
-
LOCAL_TLD
|
|
732
|
-
].filter(Boolean).join(".");
|
|
733
|
-
}
|
|
734
|
-
/**
|
|
735
|
-
* Where a resource answers, every host of it: {@link hostFor}'s, and each
|
|
736
|
-
* alias and redirect label under the project, carrying the stage as its own
|
|
737
|
-
* label does — `www-test.shop.localhost` for `gkm test`.
|
|
738
|
-
*/
|
|
739
|
-
function hostsFor(resource, project) {
|
|
740
|
-
const stage = stageOf(resource);
|
|
741
|
-
const under = (label) => [
|
|
742
|
-
stage ? `${label}-${stage}` : label,
|
|
743
|
-
project,
|
|
744
|
-
LOCAL_TLD
|
|
745
|
-
].filter(Boolean).join(".");
|
|
746
|
-
return {
|
|
747
|
-
host: hostFor(resource, project),
|
|
748
|
-
aliases: (resource.aliases ?? []).map(under),
|
|
749
|
-
redirects: (resource.redirects ?? []).map(under)
|
|
750
|
-
};
|
|
751
|
-
}
|
|
752
|
-
/**
|
|
753
|
-
* A resource's own label: its `subdomain` where it declared one, and a file
|
|
754
|
-
* server's own name — the label a deploy uses too — with the stage it carries
|
|
755
|
-
* kept, so `gkm test` and `gkm dev` still answer on different hosts.
|
|
756
|
-
*/
|
|
757
|
-
function labelOf(resource) {
|
|
758
|
-
const own = resource.kind === "file-server" ? require_workspace.fileServerLabel(resource.id) : resource.subdomain;
|
|
759
|
-
if (!own) return resource.name;
|
|
760
|
-
const stage = stageOf(resource);
|
|
761
|
-
return stage ? `${own}-${stage}` : own;
|
|
762
|
-
}
|
|
763
|
-
/** The stage a resource's name carries, or nothing for the local stage's. */
|
|
764
|
-
function stageOf(resource) {
|
|
765
|
-
const base = resource.id.toLowerCase();
|
|
766
|
-
return resource.name === base ? void 0 : resource.name.slice(base.length + 1);
|
|
767
|
-
}
|
|
768
|
-
/**
|
|
769
|
-
* The static root config, which only ever imports.
|
|
770
|
-
*
|
|
771
|
-
* Written once and identical for every stage, because the *sites* are what
|
|
772
|
-
* differ and they live in their own files. That split is not tidiness: one
|
|
773
|
-
* container serves every stage — the same way one Postgres holds `orders` and
|
|
774
|
-
* `orders_test` — so a single Caddyfile would mean `gkm test` deleting the
|
|
775
|
-
* routes `gkm dev` is serving, and each command silently breaking the other.
|
|
776
|
-
*/
|
|
777
|
-
function caddyfileRoot() {
|
|
778
|
-
return `${GENERATED}
|
|
779
|
-
{
|
|
780
|
-
# No ACME, no public DNS: each stage's certificate is gkm's, beside its
|
|
781
|
-
# routes, and the names are local.
|
|
782
|
-
auto_https disable_redirects
|
|
783
|
-
}
|
|
784
|
-
|
|
785
|
-
# One file per stage, so two stages share this edge the way they already share
|
|
786
|
-
# one Postgres and one MinIO.
|
|
787
|
-
import ${CADDY_SITES_IN_CONTAINER}/*.caddy
|
|
788
|
-
`;
|
|
789
|
-
}
|
|
790
|
-
/**
|
|
791
|
-
* One stage's sites, as the file imported above.
|
|
792
|
-
*
|
|
793
|
-
* `rewrite` rather than a path prefix on the address: the bucket is the
|
|
794
|
-
* origin's business, and the client asks for the key it stored.
|
|
795
|
-
*
|
|
796
|
-
* `header_up Host {upstream_hostport}` matters more than it looks. MinIO routes
|
|
797
|
-
* and signs on the Host header, so forwarding the requested hostname would make
|
|
798
|
-
* it look for a bucket named after the domain.
|
|
799
|
-
*/
|
|
800
|
-
function toCaddyfile(sites, options) {
|
|
801
|
-
if (sites.length === 0) return `${GENERATED}
|
|
802
|
-
# No file server is declared in this stage, so it routes nothing.
|
|
803
|
-
`;
|
|
804
|
-
const port = options.port && options.port !== 443 ? `:${options.port}` : "";
|
|
805
|
-
const blocks = sites.map(({ host, upstream, rewrite, processors, tenants, aliases, redirects }) => {
|
|
806
|
-
const proxy = `reverse_proxy ${upstream} {${rewrite ? `
|
|
807
|
-
rewrite ${rewrite}
|
|
808
|
-
# MinIO routes and signs on the Host header, so forwarding the requested
|
|
809
|
-
# hostname would make it look for a bucket named after the domain.
|
|
810
|
-
header_up Host {upstream_hostport}` : `
|
|
811
|
-
# The application reads whatever address was injected, so it has to see
|
|
812
|
-
# the one a caller used — that is what makes a redirect, a cookie domain
|
|
813
|
-
# and a generated link point back here rather than at the upstream.
|
|
814
|
-
header_up Host {host}
|
|
815
|
-
header_up X-Forwarded-Proto {scheme}`}
|
|
816
|
-
}`;
|
|
817
|
-
const redirectBlocks = (redirects ?? []).map((from) => `
|
|
818
|
-
https://${from} {
|
|
819
|
-
tls ${options.certificate} ${options.certificate}
|
|
820
|
-
|
|
821
|
-
redir https://${host}${port}{uri} permanent
|
|
822
|
-
}`).join("");
|
|
823
|
-
return `
|
|
824
|
-
${[host, ...aliases ?? []].map((name) => `https://${name}`).join(", ")} {
|
|
825
|
-
tls ${options.certificate} ${options.certificate}
|
|
826
|
-
|
|
827
|
-
${(0, _geekmidas_edge_proxy_caddy.clientIpRule)(options.edgeToken)}
|
|
828
|
-
${processors ? `
|
|
829
|
-
# Its processors' patterns, to the dev server holding them — under the
|
|
830
|
-
# route it mounts them on. Answered there, so the bucket below never is.
|
|
831
|
-
@processors path ${processors.prefixes.map((prefix) => `${prefix}*`).join(" ")}
|
|
832
|
-
handle @processors {
|
|
833
|
-
reverse_proxy ${processors.upstream} {
|
|
834
|
-
rewrite ${processors.under}{uri}
|
|
835
|
-
header_up Host {host}
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
` : ""}${tenants ? tenantBlock(tenants, proxy) : ` ${proxy}`}
|
|
839
|
-
}${redirectBlocks}`;
|
|
840
|
-
});
|
|
841
|
-
return `${GENERATED}${blocks.join("\n")}\n`;
|
|
842
|
-
}
|
|
843
|
-
/**
|
|
844
|
-
* A wildcard site's routes: a protected host refused, every other host asked
|
|
845
|
-
* about before it is proxied. `handle` blocks rather than bare directives,
|
|
846
|
-
* because Caddy orders directives itself and would proxy before it refused.
|
|
847
|
-
*/
|
|
848
|
-
function tenantBlock(tenants, proxy) {
|
|
849
|
-
return `${tenants.protected.length ? `
|
|
850
|
-
# Labels an app answers on, or that the workspace protects: never a
|
|
851
|
-
# tenant's, whether or not anything is running on them.
|
|
852
|
-
@protected host ${tenants.protected.join(" ")}
|
|
853
|
-
handle @protected {
|
|
854
|
-
respond 404
|
|
855
|
-
}
|
|
856
|
-
` : ""}
|
|
857
|
-
handle {${tenants.hosts ? `
|
|
858
|
-
# Which hosts are tenants is the app's to say: its \`hosts\` route
|
|
859
|
-
# answers 200 to serve this one, and anything else goes back as is.
|
|
860
|
-
forward_auth ${tenants.hosts.upstream} {
|
|
861
|
-
uri ${tenants.hosts.uri}
|
|
862
|
-
}
|
|
863
|
-
` : ""}
|
|
864
|
-
${proxy.replaceAll("\n", "\n ")}
|
|
865
|
-
}`;
|
|
866
|
-
}
|
|
867
|
-
const GENERATED = `# Generated by gkm from the construct manifest — do not edit.
|
|
868
|
-
#
|
|
869
|
-
# One host per declared file server, in front of the object store that holds its
|
|
870
|
-
# objects. This is the shape a file server has deployed — a domain serving a
|
|
871
|
-
# bucket — which MinIO alone cannot produce: its virtual-host mode reads the
|
|
872
|
-
# leading label as the bucket name.
|
|
873
|
-
#
|
|
874
|
-
# Certificates come from gkm's local CA. "gkm dev" and "gkm test" point Node at
|
|
875
|
-
# its root, so nothing has to be installed to use these URLs from code; a
|
|
876
|
-
# browser needs the root trusted once ("gkm trust").
|
|
877
|
-
`;
|
|
878
|
-
//#endregion
|
|
879
543
|
//#region src/reconcile/emulator.ts
|
|
880
544
|
/**
|
|
881
545
|
* The AWS emulator (floci, LocalStack-compatible) the `sns` backend runs on
|
|
@@ -1137,63 +801,278 @@ function stackTelemetry(manifest) {
|
|
|
1137
801
|
};
|
|
1138
802
|
}
|
|
1139
803
|
//#endregion
|
|
1140
|
-
//#region src/
|
|
804
|
+
//#region src/generators/processorRoute.ts
|
|
1141
805
|
/**
|
|
1142
|
-
*
|
|
1143
|
-
*
|
|
1144
|
-
* Pure. Turning the plan into running containers and provisioned resources is
|
|
1145
|
-
* the applier's job; deciding *what* should exist is this, so the decisions can
|
|
1146
|
-
* be asserted as data rather than by starting Docker.
|
|
806
|
+
* Where `gkm dev` serves a file server's processors, on the dev server of the
|
|
807
|
+
* app holding them: named after the file server.
|
|
1147
808
|
*
|
|
1148
|
-
* One
|
|
1149
|
-
*
|
|
1150
|
-
*
|
|
1151
|
-
* are per-object, so one container and one role pair serve both.
|
|
809
|
+
* One definition for both sides — the dev server mounts it, and the local
|
|
810
|
+
* edge rewrites each processor pattern on the file server's host onto it — so
|
|
811
|
+
* the path the edge sends and the path the server answers cannot drift.
|
|
1152
812
|
*/
|
|
813
|
+
const PROCESSORS_DEV_PREFIX = "/__gkm/processors/";
|
|
814
|
+
/** The base a file server's processors answer under, in `gkm dev`. */
|
|
815
|
+
function processorsDevRoute(fileServerId) {
|
|
816
|
+
return `${PROCESSORS_DEV_PREFIX}${fileServerId}`;
|
|
817
|
+
}
|
|
818
|
+
//#endregion
|
|
819
|
+
//#region src/reconcile/routes.ts
|
|
1153
820
|
/**
|
|
1154
|
-
*
|
|
821
|
+
* The kinds the edge serves.
|
|
1155
822
|
*
|
|
1156
|
-
*
|
|
1157
|
-
*
|
|
1158
|
-
*
|
|
823
|
+
* Everything that owns a *public address*. Deployed, each of these has a real
|
|
824
|
+
* hostname and a certificate, so this is what makes the local shape the same
|
|
825
|
+
* one rather than a near-enough one — and the application is indifferent
|
|
826
|
+
* either way, because it reads whichever address was injected and never
|
|
827
|
+
* composes one.
|
|
828
|
+
*
|
|
829
|
+
* Adding a kind here is the whole of adding it to the edge.
|
|
1159
830
|
*/
|
|
1160
|
-
const
|
|
1161
|
-
|
|
1162
|
-
"
|
|
1163
|
-
"
|
|
1164
|
-
|
|
1165
|
-
"file-server": "caddy",
|
|
1166
|
-
email: "mailpit",
|
|
1167
|
-
inbox: "mailpit",
|
|
1168
|
-
"websocket-api": "redis"
|
|
831
|
+
const EDGE_KINDS = {
|
|
832
|
+
"file-server": true,
|
|
833
|
+
"rest-api": true,
|
|
834
|
+
"websocket-api": true,
|
|
835
|
+
site: true
|
|
1169
836
|
};
|
|
1170
837
|
/**
|
|
1171
|
-
* The
|
|
1172
|
-
*
|
|
1173
|
-
* Each one matches the protocol its deployed form speaks, which is the property
|
|
1174
|
-
* worth having: a cache that behaves differently in the two places is worse than
|
|
1175
|
-
* a slower one.
|
|
838
|
+
* The suffix every local host shares.
|
|
1176
839
|
*
|
|
1177
|
-
* `
|
|
1178
|
-
*
|
|
1179
|
-
*
|
|
1180
|
-
* none.
|
|
840
|
+
* `.localhost` rather than a made-up TLD because it resolves to loopback
|
|
841
|
+
* without touching `/etc/hosts` — macOS and systemd-resolved both answer for
|
|
842
|
+
* subdomains of it.
|
|
1181
843
|
*/
|
|
1182
|
-
const
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
844
|
+
const LOCAL_TLD = "localhost";
|
|
845
|
+
/** MinIO, as a Caddy on this project's network reaches it. */
|
|
846
|
+
const MINIO_UPSTREAM = {
|
|
847
|
+
service: "minio",
|
|
848
|
+
port: 9e3
|
|
1186
849
|
};
|
|
1187
850
|
/**
|
|
1188
|
-
*
|
|
851
|
+
* The routes a plan implies: one per surface and site at an address, and one
|
|
852
|
+
* per file server over its bucket — named as `gkm compose` names the same
|
|
853
|
+
* construct's (`api`, `files-uploads`), on the hosts it gives them.
|
|
1189
854
|
*
|
|
1190
|
-
* A
|
|
1191
|
-
*
|
|
1192
|
-
*
|
|
855
|
+
* A file server's leading label is the *server's* stage-scoped name rather
|
|
856
|
+
* than the bucket's, which is the difference that matters: two servers over
|
|
857
|
+
* one bucket are a legitimate arrangement — two cache behaviours, one origin
|
|
858
|
+
* — and naming the host after the bucket would make them collide.
|
|
1193
859
|
*/
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
860
|
+
function localRoutes(plan, project, options = {}) {
|
|
861
|
+
const { addresses = {}, processorAddresses = {} } = options;
|
|
862
|
+
const objects = options.objects ?? MINIO_UPSTREAM;
|
|
863
|
+
const byId = new Map(plan.resources.map((r) => [r.id, r]));
|
|
864
|
+
const routes = [];
|
|
865
|
+
for (const resource of plan.resources) {
|
|
866
|
+
if (!EDGE_KINDS[resource.kind]) continue;
|
|
867
|
+
const host = hostFor(resource, project);
|
|
868
|
+
if (resource.kind === "file-server") {
|
|
869
|
+
const origin = resource.of ? byId.get(resource.of) : void 0;
|
|
870
|
+
if (!origin) continue;
|
|
871
|
+
const address = processorAddresses[resource.id];
|
|
872
|
+
const port = address ? portOf(address) : void 0;
|
|
873
|
+
routes.push({
|
|
874
|
+
name: `files-${require_workspace.appKey(resource.id)}`,
|
|
875
|
+
host,
|
|
876
|
+
upstreams: [objects],
|
|
877
|
+
streaming: false,
|
|
878
|
+
prefix: `/${origin.name}`,
|
|
879
|
+
...resource.processors?.length && port ? { handlers: [{
|
|
880
|
+
name: "processors",
|
|
881
|
+
prefixes: resource.processors,
|
|
882
|
+
upstreams: [{
|
|
883
|
+
onHost: true,
|
|
884
|
+
port
|
|
885
|
+
}],
|
|
886
|
+
under: processorsDevRoute(resource.id)
|
|
887
|
+
}] } : {}
|
|
888
|
+
});
|
|
889
|
+
continue;
|
|
890
|
+
}
|
|
891
|
+
const address = addresses[resource.id];
|
|
892
|
+
const port = address ? portOf(address) : void 0;
|
|
893
|
+
if (!port) continue;
|
|
894
|
+
const route = {
|
|
895
|
+
name: require_workspace.appKey(resource.id),
|
|
896
|
+
host,
|
|
897
|
+
upstreams: [{
|
|
898
|
+
onHost: true,
|
|
899
|
+
port
|
|
900
|
+
}],
|
|
901
|
+
streaming: true
|
|
902
|
+
};
|
|
903
|
+
if (resource.subdomain === _geekmidas_manifest.WILDCARD_SUBDOMAIN) {
|
|
904
|
+
routes.push({
|
|
905
|
+
...route,
|
|
906
|
+
wildcard: wildcardOf(resource, host, addresses)
|
|
907
|
+
});
|
|
908
|
+
continue;
|
|
909
|
+
}
|
|
910
|
+
const { aliases, redirects } = hostsFor(resource, project);
|
|
911
|
+
const edge = options.port && options.port !== 443 ? `:${options.port}` : "";
|
|
912
|
+
routes.push({
|
|
913
|
+
...route,
|
|
914
|
+
...aliases.length ? { aliases } : {},
|
|
915
|
+
...redirects.length ? { redirects: {
|
|
916
|
+
hosts: redirects,
|
|
917
|
+
to: `https://${host}${edge}`
|
|
918
|
+
} } : {}
|
|
919
|
+
});
|
|
920
|
+
}
|
|
921
|
+
return routes;
|
|
922
|
+
}
|
|
923
|
+
/**
|
|
924
|
+
* What stands between a wildcard site and a host that is not a tenant.
|
|
925
|
+
*
|
|
926
|
+
* A named host wins over the `*` on either proxy, so `api.shop.localhost`
|
|
927
|
+
* reaches the API whatever the wildcard says. What neither can know is the
|
|
928
|
+
* labels nothing is running on: `www`, or an app this stage has not started.
|
|
929
|
+
* Those are refused, so no slug a deploy would protect is ever served locally
|
|
930
|
+
* either.
|
|
931
|
+
*
|
|
932
|
+
* The `hosts` route, where the surface serving it has an address, is a
|
|
933
|
+
* deployed edge's check in miniature: a `2xx` lets the request through, and
|
|
934
|
+
* any other answer — the app's own `404` — is what the browser gets.
|
|
935
|
+
*/
|
|
936
|
+
function wildcardOf(resource, host, addresses) {
|
|
937
|
+
const domain = host.slice(`${_geekmidas_manifest.WILDCARD_SUBDOMAIN}.`.length);
|
|
938
|
+
const surface = resource.hosts ? addresses[resource.hosts.surface] : void 0;
|
|
939
|
+
const port = surface ? portOf(surface) : void 0;
|
|
940
|
+
return {
|
|
941
|
+
domain,
|
|
942
|
+
except: [...resource.protectedSubdomains ?? []],
|
|
943
|
+
tls: { kind: "stage" },
|
|
944
|
+
...resource.hosts && port ? { hosts: {
|
|
945
|
+
upstream: {
|
|
946
|
+
onHost: true,
|
|
947
|
+
port
|
|
948
|
+
},
|
|
949
|
+
path: resource.hosts.path
|
|
950
|
+
} } : {}
|
|
951
|
+
};
|
|
952
|
+
}
|
|
953
|
+
/** The port a local address answers on, defaulting by scheme. */
|
|
954
|
+
function portOf(address) {
|
|
955
|
+
try {
|
|
956
|
+
const { port, protocol } = new URL(address);
|
|
957
|
+
return Number(port || (protocol === "https:" ? 443 : 80));
|
|
958
|
+
} catch {
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
/**
|
|
963
|
+
* Where one file server answers, including the stage its name carries.
|
|
964
|
+
*
|
|
965
|
+
* The project is a label rather than a decoration: it is what keeps two
|
|
966
|
+
* checkouts from answering on one address. Omitted when there is no project to
|
|
967
|
+
* name, because an empty label makes `uploads..localhost` — a host nothing
|
|
968
|
+
* resolves and no certificate can be issued for.
|
|
969
|
+
*/
|
|
970
|
+
function hostFor(resource, project) {
|
|
971
|
+
const label = resource.root && project ? stageOf(resource) : labelOf(resource);
|
|
972
|
+
if (resource.subdomain === _geekmidas_manifest.WILDCARD_SUBDOMAIN) return [
|
|
973
|
+
_geekmidas_manifest.WILDCARD_SUBDOMAIN,
|
|
974
|
+
stageOf(resource),
|
|
975
|
+
project,
|
|
976
|
+
LOCAL_TLD
|
|
977
|
+
].filter(Boolean).join(".");
|
|
978
|
+
return [
|
|
979
|
+
label,
|
|
980
|
+
project,
|
|
981
|
+
LOCAL_TLD
|
|
982
|
+
].filter(Boolean).join(".");
|
|
983
|
+
}
|
|
984
|
+
/**
|
|
985
|
+
* Where a resource answers, every host of it: {@link hostFor}'s, and each
|
|
986
|
+
* alias and redirect label under the project, carrying the stage as its own
|
|
987
|
+
* label does — `www-test.shop.localhost` for `gkm test`.
|
|
988
|
+
*/
|
|
989
|
+
function hostsFor(resource, project) {
|
|
990
|
+
const stage = stageOf(resource);
|
|
991
|
+
const under = (label) => [
|
|
992
|
+
stage ? `${label}-${stage}` : label,
|
|
993
|
+
project,
|
|
994
|
+
LOCAL_TLD
|
|
995
|
+
].filter(Boolean).join(".");
|
|
996
|
+
return {
|
|
997
|
+
host: hostFor(resource, project),
|
|
998
|
+
aliases: (resource.aliases ?? []).map(under),
|
|
999
|
+
redirects: (resource.redirects ?? []).map(under)
|
|
1000
|
+
};
|
|
1001
|
+
}
|
|
1002
|
+
/**
|
|
1003
|
+
* A resource's own label: its `subdomain` where it declared one, and a file
|
|
1004
|
+
* server's own name — the label a deploy uses too — with the stage it carries
|
|
1005
|
+
* kept, so `gkm test` and `gkm dev` still answer on different hosts.
|
|
1006
|
+
*/
|
|
1007
|
+
function labelOf(resource) {
|
|
1008
|
+
const own = resource.kind === "file-server" ? require_workspace.fileServerLabel(resource.id) : resource.subdomain;
|
|
1009
|
+
if (!own) return resource.name;
|
|
1010
|
+
const stage = stageOf(resource);
|
|
1011
|
+
return stage ? `${own}-${stage}` : own;
|
|
1012
|
+
}
|
|
1013
|
+
/** The stage a resource's name carries, or nothing for the local stage's. */
|
|
1014
|
+
function stageOf(resource) {
|
|
1015
|
+
const base = resource.id.toLowerCase();
|
|
1016
|
+
return resource.name === base ? void 0 : resource.name.slice(base.length + 1);
|
|
1017
|
+
}
|
|
1018
|
+
//#endregion
|
|
1019
|
+
//#region src/reconcile/plan.ts
|
|
1020
|
+
/**
|
|
1021
|
+
* The reconcile plan — what a manifest wants to exist, for one stage.
|
|
1022
|
+
*
|
|
1023
|
+
* Pure. Turning the plan into running containers and provisioned resources is
|
|
1024
|
+
* the applier's job; deciding *what* should exist is this, so the decisions can
|
|
1025
|
+
* be asserted as data rather than by starting Docker.
|
|
1026
|
+
*
|
|
1027
|
+
* One plan serves every stage. `gkm dev` reconciles `development` and `gkm test`
|
|
1028
|
+
* reconciles `test`; they differ only in what the resources are called, never in
|
|
1029
|
+
* what infrastructure exists. Roles are cluster-scoped in Postgres while grants
|
|
1030
|
+
* are per-object, so one container and one role pair serve both.
|
|
1031
|
+
*/
|
|
1032
|
+
/**
|
|
1033
|
+
* Which container serves a kind.
|
|
1034
|
+
*
|
|
1035
|
+
* Derived kinds map to the same container as their parent — a schema tenant
|
|
1036
|
+
* lives in its parent's Postgres — so the set is deduplicated rather than
|
|
1037
|
+
* counted.
|
|
1038
|
+
*/
|
|
1039
|
+
const CONTAINERS = {
|
|
1040
|
+
database: "postgres",
|
|
1041
|
+
"database-reader": "postgres",
|
|
1042
|
+
"database-schema": "postgres",
|
|
1043
|
+
objects: "minio",
|
|
1044
|
+
"file-server": "caddy",
|
|
1045
|
+
email: "mailpit",
|
|
1046
|
+
inbox: "mailpit",
|
|
1047
|
+
"websocket-api": "redis"
|
|
1048
|
+
};
|
|
1049
|
+
/**
|
|
1050
|
+
* The container a cache backend needs locally.
|
|
1051
|
+
*
|
|
1052
|
+
* Each one matches the protocol its deployed form speaks, which is the property
|
|
1053
|
+
* worth having: a cache that behaves differently in the two places is worse than
|
|
1054
|
+
* a slower one.
|
|
1055
|
+
*
|
|
1056
|
+
* `db` is deliberately absent, the same way `pgboss` is absent from
|
|
1057
|
+
* `EVENT_CONTAINERS`: the cache is a table in a database the manifest already
|
|
1058
|
+
* declares, so mapping it here would start a container for a project that needs
|
|
1059
|
+
* none.
|
|
1060
|
+
*/
|
|
1061
|
+
const CACHE_CONTAINERS = {
|
|
1062
|
+
upstash: "redis-http",
|
|
1063
|
+
elasticache: "redis",
|
|
1064
|
+
redis: "redis"
|
|
1065
|
+
};
|
|
1066
|
+
/**
|
|
1067
|
+
* Kinds that resolve a value without anything running.
|
|
1068
|
+
*
|
|
1069
|
+
* A secret is the case: it has no address, so there is nothing to start and
|
|
1070
|
+
* nothing to connect to — but it still appears in the plan, because the target
|
|
1071
|
+
* still has to resolve it.
|
|
1072
|
+
*/
|
|
1073
|
+
const CONTAINERLESS = {
|
|
1074
|
+
secret: true,
|
|
1075
|
+
credential: true,
|
|
1197
1076
|
encryption: true,
|
|
1198
1077
|
"rest-api": true,
|
|
1199
1078
|
site: true,
|
|
@@ -1295,9 +1174,9 @@ function resourceName(id, kind, stage, localStage) {
|
|
|
1295
1174
|
* broker the project selected, which is why the backend is an argument here
|
|
1296
1175
|
* rather than a second pass that adds containers after the fact.
|
|
1297
1176
|
*/
|
|
1298
|
-
function containerFor(kind, events = DEFAULT_EVENTS, cache = require_drivers.DEFAULT_CACHE.aws, derived = false,
|
|
1177
|
+
function containerFor(kind, events = DEFAULT_EVENTS, cache = require_drivers.DEFAULT_CACHE.aws, derived = false, caddy = true) {
|
|
1299
1178
|
if (EVENT_KINDS[kind]) return EVENT_CONTAINERS[events] ?? CONTAINERS.database;
|
|
1300
|
-
if (kind === "file-server") return
|
|
1179
|
+
if (kind === "file-server") return caddy ? "caddy" : CONTAINERS.objects;
|
|
1301
1180
|
if (kind === "cache") {
|
|
1302
1181
|
if (derived && !require_drivers.holdsEveryCache(cache)) return CONTAINERS.database;
|
|
1303
1182
|
return CACHE_CONTAINERS[cache] ?? CONTAINERS.database;
|
|
@@ -1317,6 +1196,7 @@ function planFor(manifest, stage, order, options = {}) {
|
|
|
1317
1196
|
const fakes = {};
|
|
1318
1197
|
const events = options.events ?? "pgboss";
|
|
1319
1198
|
const cache = options.cache ?? require_drivers.DEFAULT_CACHE.aws;
|
|
1199
|
+
const edge = options.edge === false ? void 0 : options.edge ?? { proxy: "caddy" };
|
|
1320
1200
|
for (const id of order) {
|
|
1321
1201
|
const declaration = manifest[id];
|
|
1322
1202
|
if (!declaration) continue;
|
|
@@ -1333,7 +1213,7 @@ function planFor(manifest, stage, order, options = {}) {
|
|
|
1333
1213
|
} : {}
|
|
1334
1214
|
};
|
|
1335
1215
|
const detached = declaration.kind === "cache" && require_drivers.holdsEveryCache(cache);
|
|
1336
|
-
const container = fake?.image ? fake.key : declaration.kind === "telemetry" ? usesTelemetry(manifest) ? TELEMETRY_CONTAINER : void 0 : containerFor(declaration.kind, events, cache, "of" in declaration && typeof declaration.of === "string",
|
|
1216
|
+
const container = fake?.image ? fake.key : declaration.kind === "telemetry" ? usesTelemetry(manifest) ? TELEMETRY_CONTAINER : void 0 : containerFor(declaration.kind, events, cache, "of" in declaration && typeof declaration.of === "string", edge?.proxy === "caddy");
|
|
1337
1217
|
if (!container && !CONTAINERLESS[declaration.kind]) continue;
|
|
1338
1218
|
if (container) {
|
|
1339
1219
|
containers.add(container);
|
|
@@ -1389,7 +1269,8 @@ function planFor(manifest, stage, order, options = {}) {
|
|
|
1389
1269
|
..."table" in declaration && declaration.table && !detached ? { table: declaration.table } : {}
|
|
1390
1270
|
});
|
|
1391
1271
|
}
|
|
1392
|
-
|
|
1272
|
+
const served = edge !== void 0 && resources.some((r) => EDGE_KINDS[r.kind] === true);
|
|
1273
|
+
if (served && edge.proxy === "caddy") containers.add("caddy");
|
|
1393
1274
|
for (const extra of options.extraContainers ?? []) containers.add(extra);
|
|
1394
1275
|
if (events === "pgboss" && resources.some((r) => EVENT_KINDS[r.kind]) && !resources.some((r) => r.kind === "database")) throw new PgBossNeedsDatabase(resources.filter((r) => EVENT_KINDS[r.kind]).map((r) => r.id));
|
|
1395
1276
|
if (cache === "db") {
|
|
@@ -1419,7 +1300,8 @@ function planFor(manifest, stage, order, options = {}) {
|
|
|
1419
1300
|
containers: [...containers],
|
|
1420
1301
|
resources,
|
|
1421
1302
|
...Object.keys(fakes).length ? { fakes } : {},
|
|
1422
|
-
...workerBroker ? { workerBroker: true } : {}
|
|
1303
|
+
...workerBroker ? { workerBroker: true } : {},
|
|
1304
|
+
...served ? { edge } : {}
|
|
1423
1305
|
};
|
|
1424
1306
|
}
|
|
1425
1307
|
/**
|
|
@@ -1467,974 +1349,973 @@ var PgBossNeedsDatabase = class extends require_errors.GkmError {
|
|
|
1467
1349
|
}
|
|
1468
1350
|
};
|
|
1469
1351
|
//#endregion
|
|
1470
|
-
//#region src/compose
|
|
1352
|
+
//#region src/reconcile/compose.ts
|
|
1471
1353
|
/**
|
|
1472
|
-
* The
|
|
1473
|
-
* as a `gkm compose` stack, on the local stage and on a deployed one alike.
|
|
1354
|
+
* The compose document a plan implies.
|
|
1474
1355
|
*
|
|
1475
|
-
*
|
|
1476
|
-
*
|
|
1477
|
-
*
|
|
1478
|
-
*
|
|
1479
|
-
* (an append-only file on a named volume, kept by `--down`) and password
|
|
1480
|
-
* protected — the stage's own password, generated once like its seed.
|
|
1356
|
+
* The third declaration of the same containers disappears here: today a
|
|
1357
|
+
* `services: ['postgres','minio']` block is kept in step with the code by hand,
|
|
1358
|
+
* which is the triplication this design exists to remove, in the one place you
|
|
1359
|
+
* touch every day. A `database` implies Postgres; the list is derived.
|
|
1481
1360
|
*
|
|
1482
|
-
*
|
|
1483
|
-
*
|
|
1361
|
+
* Returns an object rather than a string for the same reason `plan` is pure —
|
|
1362
|
+
* what should exist is asserted as data, and turning it into YAML is one line at
|
|
1363
|
+
* the edge.
|
|
1484
1364
|
*
|
|
1485
|
-
*
|
|
1365
|
+
* What stays config is unchanged: images and versions are pinned explicitly, and
|
|
1366
|
+
* a container no construct implies is still declared by hand. Neutral facts come
|
|
1367
|
+
* from the declaration, provider detail from config.
|
|
1486
1368
|
*/
|
|
1369
|
+
/** The database every connection opens first: every cluster has it. */
|
|
1370
|
+
const CLUSTER_DATABASE = "postgres";
|
|
1487
1371
|
/**
|
|
1488
|
-
* Where
|
|
1489
|
-
*
|
|
1490
|
-
* the apps is cheaper for a cache than a table in the database they share.
|
|
1372
|
+
* Where Postgres's volume is mounted: the parent of its data directory, not
|
|
1373
|
+
* the directory itself — see the service's definition.
|
|
1491
1374
|
*/
|
|
1492
|
-
const
|
|
1493
|
-
/** Its compose service name — the host every cache URL points at. */
|
|
1494
|
-
const REDIS_SERVICE = "redis";
|
|
1495
|
-
/** The port it answers on, inside the network. */
|
|
1496
|
-
const REDIS_PORT = 6379;
|
|
1497
|
-
/** Reconcile's pin, so `gkm dev` and the stack run one Redis. */
|
|
1498
|
-
const REDIS_IMAGE = DEFAULT_IMAGES.redis;
|
|
1375
|
+
const POSTGRES_MOUNT = "/var/lib/postgresql";
|
|
1499
1376
|
/**
|
|
1500
|
-
*
|
|
1501
|
-
*
|
|
1502
|
-
*
|
|
1503
|
-
*
|
|
1377
|
+
* Build the compose document for a plan.
|
|
1378
|
+
*
|
|
1379
|
+
* Every container is published on its assigned port, never on the image's
|
|
1380
|
+
* default: the point of allocation is that two projects can run at once, and
|
|
1381
|
+
* one container publishing 5432 puts that back.
|
|
1504
1382
|
*/
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
const
|
|
1508
|
-
|
|
1509
|
-
const
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1383
|
+
function composeFor(plan, options) {
|
|
1384
|
+
const services = {};
|
|
1385
|
+
const volumes = {};
|
|
1386
|
+
for (const container of [...plan.containers].sort()) {
|
|
1387
|
+
const declared = container === "postgres" ? plan.resources.find((r) => r.version)?.version : void 0;
|
|
1388
|
+
const named = container === "postgres" ? declaredPostgresImage(plan) : container === "openobserve" ? declaredTelemetryImage(plan) : void 0;
|
|
1389
|
+
const fake = plan.fakes?.[container];
|
|
1390
|
+
const image = named ?? (declared ? postgresImage(declared) : fake?.image ?? DEFAULT_IMAGES[container]);
|
|
1391
|
+
if (!image) throw new UnknownContainer(container);
|
|
1392
|
+
const published = publish(container, options.ports, plan.fakes);
|
|
1393
|
+
services[container] = fake ? {
|
|
1394
|
+
image,
|
|
1395
|
+
restart: "unless-stopped",
|
|
1396
|
+
ports: published
|
|
1397
|
+
} : define(container, image, published, options.credentials);
|
|
1398
|
+
const volume = volumeOf(container);
|
|
1399
|
+
if (volume) volumes[volume] = {};
|
|
1517
1400
|
}
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
}
|
|
1533
|
-
/**
|
|
1534
|
-
* The stage's secrets with a generated Redis password, where it has none.
|
|
1535
|
-
* Pure, like `withGeneratedSecrets`: the caller keeps the result once the run
|
|
1536
|
-
* goes ahead.
|
|
1537
|
-
*/
|
|
1538
|
-
function withRedisPassword(secrets) {
|
|
1539
|
-
if (secrets.custom?.["REDIS_PASSWORD"]) return {
|
|
1540
|
-
secrets,
|
|
1541
|
-
generated: []
|
|
1542
|
-
};
|
|
1543
|
-
return {
|
|
1544
|
-
secrets: {
|
|
1545
|
-
...secrets,
|
|
1546
|
-
custom: {
|
|
1547
|
-
...secrets.custom,
|
|
1548
|
-
[REDIS_PASSWORD_KEY]: generateRedisPassword()
|
|
1549
|
-
},
|
|
1550
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1551
|
-
},
|
|
1552
|
-
generated: [REDIS_PASSWORD_KEY]
|
|
1553
|
-
};
|
|
1554
|
-
}
|
|
1555
|
-
/**
|
|
1556
|
-
* The stack's Redis for one stage, or nothing where no cache needs it.
|
|
1557
|
-
*
|
|
1558
|
-
* Each cache it holds gets a logical database of its own, by the order of
|
|
1559
|
-
* their ids, so two caches never read each other's keys.
|
|
1560
|
-
*/
|
|
1561
|
-
function stackRedis(options) {
|
|
1562
|
-
const { plan, stage, local, custom } = options;
|
|
1563
|
-
const caches = plan.resources.filter((r) => r.kind === "cache" && custom[r.envKey] === void 0).sort((a, b) => a.id.localeCompare(b.id));
|
|
1564
|
-
const publishers = plan.resources.filter((r) => r.kind === "websocket-api").map((r) => (0, _geekmidas_manifest.providedKeyFor)(r.id, r.kind, "publisherConnectionString")).filter((key) => custom[key] === void 0);
|
|
1565
|
-
if (caches.length === 0 && publishers.length === 0) return void 0;
|
|
1566
|
-
const set = custom[REDIS_PASSWORD_KEY];
|
|
1567
|
-
const password = set ?? (local ? options.localPassword : void 0);
|
|
1568
|
-
if (!password) throw new RedisPasswordMissing(stage);
|
|
1569
|
-
const auth = encodeURIComponent(password);
|
|
1570
|
-
return {
|
|
1571
|
-
password,
|
|
1572
|
-
passwordFromSecrets: Boolean(set),
|
|
1573
|
-
urls: Object.fromEntries([...caches.map((cache, index) => [cache.envKey, `redis://:${auth}@${REDIS_SERVICE}:${REDIS_PORT}/${index}`]), ...publishers.map((key) => [key, `redis://:${auth}@${REDIS_SERVICE}:${REDIS_PORT}`])]),
|
|
1574
|
-
env: {
|
|
1575
|
-
[REDIS_PASSWORD_KEY]: password,
|
|
1576
|
-
REDISCLI_AUTH: password
|
|
1577
|
-
},
|
|
1578
|
-
databases: Math.max(REDIS_DATABASES, caches.length)
|
|
1579
|
-
};
|
|
1580
|
-
}
|
|
1581
|
-
/**
|
|
1582
|
-
* Redis's service: bounded, persisted and password protected, on the
|
|
1583
|
-
* network alone.
|
|
1584
|
-
*
|
|
1585
|
-
* The command runs the image's own entrypoint with `redis-server` first, so
|
|
1586
|
-
* it still drops to the `redis` user and owns `/data`; the password is read
|
|
1587
|
-
* from the env file by the shell (`$$` is compose's escape for `$`), so
|
|
1588
|
-
* neither the compose file nor the container's command holds it.
|
|
1589
|
-
*/
|
|
1590
|
-
function redisService(redis) {
|
|
1591
|
-
const flags = [
|
|
1592
|
-
`--requirepass "$$${REDIS_PASSWORD_KEY}"`,
|
|
1593
|
-
`--maxmemory ${REDIS_MAXMEMORY}`,
|
|
1594
|
-
"--maxmemory-policy allkeys-lru",
|
|
1595
|
-
"--appendonly yes",
|
|
1596
|
-
...redis.databases > REDIS_DATABASES ? [`--databases ${redis.databases}`] : []
|
|
1597
|
-
];
|
|
1598
|
-
return {
|
|
1599
|
-
image: REDIS_IMAGE,
|
|
1600
|
-
restart: "unless-stopped",
|
|
1601
|
-
command: [
|
|
1602
|
-
"sh",
|
|
1603
|
-
"-c",
|
|
1604
|
-
`exec docker-entrypoint.sh redis-server ${flags.join(" ")}`
|
|
1605
|
-
],
|
|
1606
|
-
env_file: [{
|
|
1607
|
-
path: `./${REDIS_SERVICE}.env`,
|
|
1608
|
-
format: "raw"
|
|
1609
|
-
}],
|
|
1610
|
-
volumes: ["redis-data:/data"],
|
|
1611
|
-
healthcheck: {
|
|
1612
|
-
test: ["CMD-SHELL", "redis-cli ping | grep -q PONG"],
|
|
1613
|
-
interval: "5s",
|
|
1614
|
-
timeout: "3s",
|
|
1615
|
-
retries: 10
|
|
1616
|
-
}
|
|
1617
|
-
};
|
|
1618
|
-
}
|
|
1619
|
-
//#endregion
|
|
1620
|
-
//#region src/deploy/generated.ts
|
|
1621
|
-
/**
|
|
1622
|
-
* The values a deployed stage generates once and keeps: what nothing can
|
|
1623
|
-
* provision and nobody else issues.
|
|
1624
|
-
*
|
|
1625
|
-
* - **A seed**, which salts every password a deploy derives — a database's
|
|
1626
|
-
* master and roles, a bucket's root user. Derived from repo facts alone
|
|
1627
|
-
* (project, stage, construct id), those passwords were computable by anyone
|
|
1628
|
-
* who could read the repo.
|
|
1629
|
-
* - **Each `secret` construct's value** — an auth server's signing secret, a
|
|
1630
|
-
* `RandomPassword` — random, rather than derived, in its declared format.
|
|
1631
|
-
* - **Each `encryption` construct's keyring** — one random key and an index
|
|
1632
|
-
* key. Later keys are added by `gkm encryption:rotate`, never by a deploy.
|
|
1633
|
-
*
|
|
1634
|
-
* Both are generated on the first deploy that needs them and written to the
|
|
1635
|
-
* stage's store, so every later deploy reads the same values: sessions survive
|
|
1636
|
-
* a redeploy, and a role's password does not move. A value set by hand with
|
|
1637
|
-
* `gkm secrets:set` is kept, never replaced.
|
|
1638
|
-
*/
|
|
1639
|
-
/**
|
|
1640
|
-
* The stage's secrets with its seed and every declared `secret`'s value
|
|
1641
|
-
* present, generating what is missing. Pure: the caller writes the result
|
|
1642
|
-
* back to the stage's store when `generated` is not empty.
|
|
1643
|
-
*/
|
|
1644
|
-
function withGeneratedSecrets(secrets, manifest) {
|
|
1645
|
-
const generated = [];
|
|
1646
|
-
const custom = { ...secrets.custom };
|
|
1647
|
-
for (const declaration of Object.values(manifest)) {
|
|
1648
|
-
if (declaration?.kind !== "secret" && declaration?.kind !== "encryption") continue;
|
|
1649
|
-
const key = declaration.provides?.[0];
|
|
1650
|
-
if (!key || custom[key]) continue;
|
|
1651
|
-
custom[key] = declaration.kind === "encryption" ? (0, _geekmidas_constructs_encryption.generateKeyring)() : (0, _geekmidas_manifest.drawSecret)(node_crypto.randomInt, declaration);
|
|
1652
|
-
generated.push(key);
|
|
1401
|
+
const minio = services.minio;
|
|
1402
|
+
if (minio && options.objectWebhooks?.length) {
|
|
1403
|
+
minio.environment = {
|
|
1404
|
+
...minio.environment,
|
|
1405
|
+
...minioWebhookEnv(options.objectWebhooks)
|
|
1406
|
+
};
|
|
1407
|
+
if (options.objectWebhooks.some((hook) => hook.endpoint.includes(`//host.docker.internal:`))) minio.extra_hosts = [`${HOST_GATEWAY}:host-gateway`];
|
|
1408
|
+
}
|
|
1409
|
+
const mailpit = services.mailpit;
|
|
1410
|
+
if (mailpit && options.inboxRelay) {
|
|
1411
|
+
mailpit.environment = {
|
|
1412
|
+
...mailpit.environment,
|
|
1413
|
+
MP_WEBHOOK_URL: options.inboxRelay
|
|
1414
|
+
};
|
|
1415
|
+
if (options.inboxRelay.includes(`//host.docker.internal:`)) mailpit.extra_hosts = [`${HOST_GATEWAY}:host-gateway`];
|
|
1653
1416
|
}
|
|
1654
|
-
const seed = secrets.seed ?? generateSeed();
|
|
1655
|
-
if (!secrets.seed) generated.push("seed");
|
|
1656
1417
|
return {
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
} :
|
|
1663
|
-
generated
|
|
1418
|
+
name: options.project,
|
|
1419
|
+
services: {
|
|
1420
|
+
...services,
|
|
1421
|
+
...options.apps
|
|
1422
|
+
},
|
|
1423
|
+
...Object.keys(volumes).length ? { volumes } : {}
|
|
1664
1424
|
};
|
|
1665
1425
|
}
|
|
1666
|
-
/**
|
|
1667
|
-
function
|
|
1668
|
-
return
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
* The Postgres superuser for a workspace: its name as an identifier, with
|
|
1680
|
-
* `_admin` — never the bare name, which a database construct of the same
|
|
1681
|
-
* name would claim as its runtime role.
|
|
1682
|
-
*/
|
|
1683
|
-
function postgresSuperuser(project) {
|
|
1684
|
-
return `${postgresRoleSlug(project)}_admin`;
|
|
1426
|
+
/** Render a compose document as the file it becomes. */
|
|
1427
|
+
function toYaml(file) {
|
|
1428
|
+
return `# Generated by gkm from the construct manifest — do not edit.
|
|
1429
|
+
# Containers are derived from what the app declares. Image pins and anything
|
|
1430
|
+
# no construct implies go in your own docker-compose.yml, which is merged over
|
|
1431
|
+
# this file and wins:
|
|
1432
|
+
#
|
|
1433
|
+
# docker compose -f docker-compose.constructs.yml -f docker-compose.yml …
|
|
1434
|
+
#
|
|
1435
|
+
# "gkm dev" and "gkm test" start the containers. The apps sit behind the
|
|
1436
|
+
# "apps" profile: run "gkm setup", then
|
|
1437
|
+
# docker compose -f docker-compose.constructs.yml --profile apps up --build
|
|
1438
|
+
${(0, yaml.stringify)(file, { lineWidth: 0 })}`;
|
|
1685
1439
|
}
|
|
1440
|
+
/** A container with no image, from config or from the defaults. */
|
|
1686
1441
|
/**
|
|
1687
|
-
* The
|
|
1688
|
-
*
|
|
1442
|
+
* The image the databases in the plan named for the shared local cluster, if
|
|
1443
|
+
* any did.
|
|
1689
1444
|
*/
|
|
1690
|
-
function
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
}
|
|
1697
|
-
|
|
1698
|
-
function alphanumeric(length) {
|
|
1699
|
-
const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1700
|
-
let out = "";
|
|
1701
|
-
for (let i = 0; i < length; i++) out += alphabet[(0, node_crypto.randomInt)(62)];
|
|
1702
|
-
return out;
|
|
1703
|
-
}
|
|
1704
|
-
/** A fresh set of local logins for a workspace. */
|
|
1705
|
-
function generateLocalCredentials(project) {
|
|
1706
|
-
return {
|
|
1707
|
-
seed: generateSeed(),
|
|
1708
|
-
postgres: {
|
|
1709
|
-
user: postgresSuperuser(project),
|
|
1710
|
-
password: token()
|
|
1711
|
-
},
|
|
1712
|
-
minio: {
|
|
1713
|
-
user: LOCAL_MINIO_USER,
|
|
1714
|
-
password: alphanumeric(32)
|
|
1715
|
-
},
|
|
1716
|
-
rabbitmq: {
|
|
1717
|
-
user: LOCAL_RABBITMQ_USER,
|
|
1718
|
-
password: token()
|
|
1719
|
-
},
|
|
1720
|
-
redis: { password: generateRedisPassword() },
|
|
1721
|
-
cacheToken: token(),
|
|
1722
|
-
emulator: {
|
|
1723
|
-
accessKeyId: EMULATOR_ACCESS_KEY_ID,
|
|
1724
|
-
secretAccessKey: alphanumeric(40)
|
|
1725
|
-
},
|
|
1726
|
-
logs: {
|
|
1727
|
-
email: LOCAL_LOGS_EMAIL,
|
|
1728
|
-
password: generateLogsPassword()
|
|
1729
|
-
}
|
|
1730
|
-
};
|
|
1445
|
+
function declaredPostgresImage(plan) {
|
|
1446
|
+
const named = plan.resources.filter((r) => r.kind === "database" && Boolean(r.image));
|
|
1447
|
+
const images = [...new Set(named.map((r) => r.image))];
|
|
1448
|
+
if (images.length > 1) throw new ConflictingPostgresImages(named.map((r) => ({
|
|
1449
|
+
id: r.id,
|
|
1450
|
+
image: r.image
|
|
1451
|
+
})));
|
|
1452
|
+
return images[0];
|
|
1731
1453
|
}
|
|
1732
1454
|
/**
|
|
1733
|
-
* The
|
|
1734
|
-
*
|
|
1735
|
-
* when `generated` is not empty.
|
|
1455
|
+
* The image a `Telemetry` node named for OpenObserve, if one did — the same
|
|
1456
|
+
* one the stack runs (`stackTelemetry` refuses two that disagree).
|
|
1736
1457
|
*/
|
|
1737
|
-
function
|
|
1738
|
-
|
|
1739
|
-
const generated = Object.keys(fresh).filter((key) => stored?.[key] === void 0);
|
|
1740
|
-
return {
|
|
1741
|
-
credentials: {
|
|
1742
|
-
...fresh,
|
|
1743
|
-
...stored
|
|
1744
|
-
},
|
|
1745
|
-
generated
|
|
1746
|
-
};
|
|
1747
|
-
}
|
|
1748
|
-
/** Where a workspace's local logins are kept on this machine. */
|
|
1749
|
-
function localCredentialsPath(project) {
|
|
1750
|
-
const keys = require_dns.getKeystoreDir(project);
|
|
1751
|
-
const name = keys.split(/[\\/]/).at(-1);
|
|
1752
|
-
const namespace = keys.split(/[\\/]/).at(-2);
|
|
1753
|
-
return (0, node_path.join)(project.home ?? require_dns.gkmHome(), "local", namespace, `${name}.json`);
|
|
1458
|
+
function declaredTelemetryImage(plan) {
|
|
1459
|
+
return plan.resources.filter((r) => r.kind === "telemetry" && r.image).sort((a, b) => a.id.localeCompare(b.id))[0]?.image;
|
|
1754
1460
|
}
|
|
1755
|
-
/**
|
|
1756
|
-
var
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
this.
|
|
1762
|
-
this.stage = stage;
|
|
1763
|
-
this.name = "LocalCredentialsKeyMissing";
|
|
1461
|
+
/** Two databases on the one local cluster named different images for it. */
|
|
1462
|
+
var ConflictingPostgresImages = class extends Error {
|
|
1463
|
+
databases;
|
|
1464
|
+
constructor(databases) {
|
|
1465
|
+
super(`Locally every database runs in one Postgres container, and these name different images for it: ${databases.map((d) => `${d.id} (${d.image})`).join(", ")}. Give them the same image — one that ships every extension they declare.`);
|
|
1466
|
+
this.databases = databases;
|
|
1467
|
+
this.name = "ConflictingPostgresImages";
|
|
1764
1468
|
}
|
|
1765
1469
|
};
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
this
|
|
1470
|
+
var UnknownContainer = class extends Error {
|
|
1471
|
+
/** The container that could not be resolved. */
|
|
1472
|
+
container;
|
|
1473
|
+
/** The containers that have a default, so the caller can see the set. */
|
|
1474
|
+
known = Object.keys(DEFAULT_IMAGES).sort();
|
|
1475
|
+
constructor(container) {
|
|
1476
|
+
super("No image is known for this container; pin one in config");
|
|
1477
|
+
this.name = "UnknownContainer";
|
|
1478
|
+
this.container = container;
|
|
1773
1479
|
}
|
|
1774
1480
|
};
|
|
1775
|
-
/**
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1481
|
+
/** One container's definition, published on the port it was assigned. */
|
|
1482
|
+
function define(container, image, published, credentials) {
|
|
1483
|
+
switch (container) {
|
|
1484
|
+
case "postgres": return {
|
|
1485
|
+
image,
|
|
1486
|
+
restart: "unless-stopped",
|
|
1487
|
+
ports: published,
|
|
1488
|
+
environment: {
|
|
1489
|
+
POSTGRES_USER: credentials.postgres.user,
|
|
1490
|
+
POSTGRES_PASSWORD: credentials.postgres.password,
|
|
1491
|
+
POSTGRES_DB: CLUSTER_DATABASE
|
|
1492
|
+
},
|
|
1493
|
+
volumes: [`postgres-data:${POSTGRES_MOUNT}`],
|
|
1494
|
+
healthcheck: {
|
|
1495
|
+
test: ["CMD-SHELL", `pg_isready -U ${credentials.postgres.user} -d ${CLUSTER_DATABASE}`],
|
|
1496
|
+
interval: "5s",
|
|
1497
|
+
timeout: "3s",
|
|
1498
|
+
retries: 10,
|
|
1499
|
+
start_period: "10s"
|
|
1500
|
+
}
|
|
1501
|
+
};
|
|
1502
|
+
case "minio": return {
|
|
1503
|
+
image,
|
|
1504
|
+
restart: "unless-stopped",
|
|
1505
|
+
ports: published,
|
|
1506
|
+
environment: {
|
|
1507
|
+
MINIO_ROOT_USER: credentials.minio.user,
|
|
1508
|
+
MINIO_ROOT_PASSWORD: credentials.minio.password
|
|
1509
|
+
},
|
|
1510
|
+
command: "server --console-address \":9001\" /data",
|
|
1511
|
+
volumes: ["minio-data:/data"],
|
|
1512
|
+
healthcheck: {
|
|
1513
|
+
test: [
|
|
1514
|
+
"CMD",
|
|
1515
|
+
"mc",
|
|
1516
|
+
"ready",
|
|
1517
|
+
"local"
|
|
1518
|
+
],
|
|
1519
|
+
interval: "10s",
|
|
1520
|
+
timeout: "5s",
|
|
1521
|
+
retries: 5,
|
|
1522
|
+
start_period: "10s"
|
|
1523
|
+
}
|
|
1524
|
+
};
|
|
1525
|
+
case "caddy": return {
|
|
1526
|
+
image,
|
|
1527
|
+
restart: "unless-stopped",
|
|
1528
|
+
ports: published,
|
|
1529
|
+
volumes: [
|
|
1530
|
+
"./.gkm/Caddyfile:/etc/caddy/Caddyfile:ro",
|
|
1531
|
+
"./.gkm/caddy-sites:/etc/caddy/sites:ro",
|
|
1532
|
+
"caddy-data:/data"
|
|
1533
|
+
],
|
|
1534
|
+
extra_hosts: ["host.docker.internal:host-gateway"],
|
|
1535
|
+
healthcheck: {
|
|
1536
|
+
test: [
|
|
1537
|
+
"CMD",
|
|
1538
|
+
"caddy",
|
|
1539
|
+
"version"
|
|
1540
|
+
],
|
|
1541
|
+
interval: "10s",
|
|
1542
|
+
timeout: "5s",
|
|
1543
|
+
retries: 5
|
|
1544
|
+
}
|
|
1545
|
+
};
|
|
1546
|
+
case "mailpit": return {
|
|
1547
|
+
image,
|
|
1548
|
+
restart: "unless-stopped",
|
|
1549
|
+
ports: published,
|
|
1550
|
+
environment: {
|
|
1551
|
+
MP_SMTP_AUTH_ACCEPT_ANY: "1",
|
|
1552
|
+
MP_SMTP_AUTH_ALLOW_INSECURE: "1"
|
|
1553
|
+
},
|
|
1554
|
+
healthcheck: {
|
|
1555
|
+
test: [
|
|
1556
|
+
"CMD",
|
|
1557
|
+
"wget",
|
|
1558
|
+
"-q",
|
|
1559
|
+
"--spider",
|
|
1560
|
+
"http://localhost:8025"
|
|
1561
|
+
],
|
|
1562
|
+
interval: "10s",
|
|
1563
|
+
timeout: "5s",
|
|
1564
|
+
retries: 5
|
|
1565
|
+
}
|
|
1566
|
+
};
|
|
1567
|
+
case "redis": return {
|
|
1568
|
+
image,
|
|
1569
|
+
restart: "unless-stopped",
|
|
1570
|
+
ports: published,
|
|
1571
|
+
command: "sh -c 'exec docker-entrypoint.sh redis-server --requirepass \"$$REDIS_PASSWORD\"'",
|
|
1572
|
+
environment: {
|
|
1573
|
+
REDIS_PASSWORD: credentials.redis.password,
|
|
1574
|
+
REDISCLI_AUTH: credentials.redis.password
|
|
1575
|
+
},
|
|
1576
|
+
volumes: ["redis-data:/data"],
|
|
1577
|
+
healthcheck: {
|
|
1578
|
+
test: ["CMD-SHELL", "redis-cli ping | grep -q PONG"],
|
|
1579
|
+
interval: "5s",
|
|
1580
|
+
timeout: "3s",
|
|
1581
|
+
retries: 5
|
|
1582
|
+
}
|
|
1583
|
+
};
|
|
1584
|
+
case "redis-http": return {
|
|
1585
|
+
image,
|
|
1586
|
+
restart: "unless-stopped",
|
|
1587
|
+
ports: published,
|
|
1588
|
+
environment: {
|
|
1589
|
+
SRH_MODE: "env",
|
|
1590
|
+
SRH_TOKEN: credentials.cacheToken,
|
|
1591
|
+
SRH_CONNECTION_STRING: `redis://:${encodeURIComponent(credentials.redis.password)}@redis:6379`
|
|
1592
|
+
},
|
|
1593
|
+
depends_on: ["redis"],
|
|
1594
|
+
healthcheck: {
|
|
1595
|
+
test: [
|
|
1596
|
+
"CMD",
|
|
1597
|
+
"wget",
|
|
1598
|
+
"-q",
|
|
1599
|
+
"-O",
|
|
1600
|
+
"/dev/null",
|
|
1601
|
+
"http://127.0.0.1:80/"
|
|
1602
|
+
],
|
|
1603
|
+
interval: "5s",
|
|
1604
|
+
timeout: "3s",
|
|
1605
|
+
retries: 10
|
|
1606
|
+
}
|
|
1607
|
+
};
|
|
1608
|
+
case "rabbitmq": return {
|
|
1609
|
+
image,
|
|
1610
|
+
restart: "unless-stopped",
|
|
1611
|
+
ports: published,
|
|
1612
|
+
environment: {
|
|
1613
|
+
RABBITMQ_DEFAULT_USER: credentials.rabbitmq.user,
|
|
1614
|
+
RABBITMQ_DEFAULT_PASS: credentials.rabbitmq.password
|
|
1615
|
+
},
|
|
1616
|
+
volumes: ["rabbitmq-data:/var/lib/rabbitmq"],
|
|
1617
|
+
healthcheck: {
|
|
1618
|
+
test: [
|
|
1619
|
+
"CMD",
|
|
1620
|
+
"rabbitmq-diagnostics",
|
|
1621
|
+
"-q",
|
|
1622
|
+
"ping"
|
|
1623
|
+
],
|
|
1624
|
+
interval: "10s",
|
|
1625
|
+
timeout: "5s",
|
|
1626
|
+
retries: 5
|
|
1627
|
+
}
|
|
1628
|
+
};
|
|
1629
|
+
case "localstack": return {
|
|
1630
|
+
image,
|
|
1631
|
+
restart: "unless-stopped",
|
|
1632
|
+
ports: published,
|
|
1633
|
+
extra_hosts: ["host.docker.internal:host-gateway"],
|
|
1634
|
+
environment: {
|
|
1635
|
+
AWS_DEFAULT_REGION: EMULATOR_REGION,
|
|
1636
|
+
AWS_ACCESS_KEY_ID: credentials.emulator.accessKeyId,
|
|
1637
|
+
AWS_SECRET_ACCESS_KEY: credentials.emulator.secretAccessKey
|
|
1638
|
+
},
|
|
1639
|
+
volumes: ["localstack-data:/var/lib/localstack"],
|
|
1640
|
+
healthcheck: {
|
|
1641
|
+
test: [
|
|
1642
|
+
"CMD",
|
|
1643
|
+
"bash",
|
|
1644
|
+
"-c",
|
|
1645
|
+
"exec 3<>/dev/tcp/localhost/4566"
|
|
1646
|
+
],
|
|
1647
|
+
interval: "10s",
|
|
1648
|
+
timeout: "5s",
|
|
1649
|
+
retries: 5,
|
|
1650
|
+
start_period: "10s"
|
|
1651
|
+
}
|
|
1652
|
+
};
|
|
1653
|
+
case "openobserve": {
|
|
1654
|
+
const login = credentials.logs;
|
|
1655
|
+
return {
|
|
1656
|
+
image,
|
|
1657
|
+
restart: "unless-stopped",
|
|
1658
|
+
ports: published,
|
|
1659
|
+
environment: {
|
|
1660
|
+
[LOGS_EMAIL_KEY]: login.email,
|
|
1661
|
+
[LOGS_PASSWORD_KEY]: login.password,
|
|
1662
|
+
ZO_DATA_DIR: "/data",
|
|
1663
|
+
ZO_COMPACT_DATA_RETENTION_DAYS: String(30),
|
|
1664
|
+
ZO_TELEMETRY: "false"
|
|
1665
|
+
},
|
|
1666
|
+
volumes: ["openobserve-data:/data"],
|
|
1667
|
+
healthcheck: {
|
|
1668
|
+
test: [
|
|
1669
|
+
"CMD",
|
|
1670
|
+
"/openobserve",
|
|
1671
|
+
"node",
|
|
1672
|
+
"status"
|
|
1673
|
+
],
|
|
1674
|
+
interval: "10s",
|
|
1675
|
+
timeout: "5s",
|
|
1676
|
+
retries: 12,
|
|
1677
|
+
start_period: "20s"
|
|
1678
|
+
}
|
|
1679
|
+
};
|
|
1680
|
+
}
|
|
1681
|
+
default: throw new UnknownContainer(container);
|
|
1682
|
+
}
|
|
1796
1683
|
}
|
|
1797
1684
|
/**
|
|
1798
|
-
* The
|
|
1799
|
-
* time anything needs them.
|
|
1685
|
+
* The published port mappings for a container.
|
|
1800
1686
|
*
|
|
1801
|
-
*
|
|
1802
|
-
*
|
|
1687
|
+
* Every port is looked up by its own key rather than being derived as an offset
|
|
1688
|
+
* from the container's first, so MinIO's console cannot land on whatever was
|
|
1689
|
+
* allocated to the next container.
|
|
1803
1690
|
*/
|
|
1804
|
-
|
|
1805
|
-
return
|
|
1806
|
-
const
|
|
1807
|
-
if (
|
|
1808
|
-
return
|
|
1691
|
+
function publish(container, ports, fakes) {
|
|
1692
|
+
return portsOf(container, fakes).map((port) => {
|
|
1693
|
+
const assigned = ports[port.key];
|
|
1694
|
+
if (assigned === void 0) throw new UnassignedPort(port.key);
|
|
1695
|
+
return `${assigned}:${port.inside}`;
|
|
1809
1696
|
});
|
|
1810
1697
|
}
|
|
1811
|
-
/**
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
for (;;) try {
|
|
1820
|
-
await (0, node_fs_promises.mkdir)(lock);
|
|
1821
|
-
break;
|
|
1822
|
-
} catch (error) {
|
|
1823
|
-
if (error.code !== "EEXIST") throw error;
|
|
1824
|
-
if (await (0, node_fs_promises.stat)(lock).then((s) => Date.now() - s.mtimeMs).catch(() => 0) > LOCK_TIMEOUT_MS) {
|
|
1825
|
-
await (0, node_fs_promises.rm)(lock, {
|
|
1826
|
-
recursive: true,
|
|
1827
|
-
force: true
|
|
1828
|
-
});
|
|
1829
|
-
continue;
|
|
1830
|
-
}
|
|
1831
|
-
if (Date.now() - started > LOCK_TIMEOUT_MS) throw new LocalCredentialsLocked(lock);
|
|
1832
|
-
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
1833
|
-
}
|
|
1834
|
-
try {
|
|
1835
|
-
return await body();
|
|
1836
|
-
} finally {
|
|
1837
|
-
await (0, node_fs_promises.rm)(lock, {
|
|
1838
|
-
recursive: true,
|
|
1839
|
-
force: true
|
|
1840
|
-
});
|
|
1698
|
+
/** A planned port that allocation never assigned. */
|
|
1699
|
+
var UnassignedPort = class extends Error {
|
|
1700
|
+
/** The port key that went unassigned, e.g. `minio-console`. */
|
|
1701
|
+
key;
|
|
1702
|
+
constructor(key) {
|
|
1703
|
+
super("No port was assigned for this container port");
|
|
1704
|
+
this.name = "UnassignedPort";
|
|
1705
|
+
this.key = key;
|
|
1841
1706
|
}
|
|
1842
|
-
}
|
|
1707
|
+
};
|
|
1843
1708
|
//#endregion
|
|
1844
|
-
//#region src/
|
|
1845
|
-
const logger = console;
|
|
1709
|
+
//#region src/compose/redis.ts
|
|
1846
1710
|
/**
|
|
1847
|
-
*
|
|
1848
|
-
*
|
|
1711
|
+
* The stack's Redis: what every declared cache lives in when a workspace runs
|
|
1712
|
+
* as a `gkm compose` stack, on the local stage and on a deployed one alike.
|
|
1713
|
+
*
|
|
1714
|
+
* A cache is the one store whose contents can always be rebuilt, so unlike
|
|
1715
|
+
* Mailpit and MinIO it is a production service, not a dev stand-in: it runs
|
|
1716
|
+
* for every stage, on the compose network only, with nothing published. It
|
|
1717
|
+
* is bounded (`maxmemory`, evicting the least recently used key), persisted
|
|
1718
|
+
* (an append-only file on a named volume, kept by `--down`) and password
|
|
1719
|
+
* protected — the stage's own password, generated once like its seed.
|
|
1720
|
+
*
|
|
1721
|
+
* A stage that sets a cache's URL in its secrets — a managed Redis — keeps
|
|
1722
|
+
* it, and a stack whose every cache is set that way runs no Redis at all.
|
|
1723
|
+
*
|
|
1724
|
+
* Pure: the stack decides it, and the phases keep the password.
|
|
1849
1725
|
*/
|
|
1850
|
-
function loadEnvFiles(envConfig, cwd = process.cwd()) {
|
|
1851
|
-
const loaded = [];
|
|
1852
|
-
const missing = [];
|
|
1853
|
-
const envFiles = envConfig ? Array.isArray(envConfig) ? envConfig : [envConfig] : [".env"];
|
|
1854
|
-
for (const envFile of envFiles) {
|
|
1855
|
-
const envPath = (0, node_path.resolve)(cwd, envFile);
|
|
1856
|
-
if ((0, node_fs.existsSync)(envPath)) {
|
|
1857
|
-
(0, dotenv.config)({
|
|
1858
|
-
path: envPath,
|
|
1859
|
-
override: true,
|
|
1860
|
-
quiet: true
|
|
1861
|
-
});
|
|
1862
|
-
loaded.push(envFile);
|
|
1863
|
-
} else if (envConfig) missing.push(envFile);
|
|
1864
|
-
}
|
|
1865
|
-
return {
|
|
1866
|
-
loaded,
|
|
1867
|
-
missing
|
|
1868
|
-
};
|
|
1869
|
-
}
|
|
1870
1726
|
/**
|
|
1871
|
-
*
|
|
1872
|
-
*
|
|
1727
|
+
* Where a stack's caches live: its own Redis, whatever the deploy target's
|
|
1728
|
+
* default is. A stack is one machine running containers, and a Redis beside
|
|
1729
|
+
* the apps is cheaper for a cache than a table in the database they share.
|
|
1873
1730
|
*/
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
server.once("listening", () => {
|
|
1882
|
-
server.close();
|
|
1883
|
-
resolve(true);
|
|
1884
|
-
});
|
|
1885
|
-
server.listen(port);
|
|
1886
|
-
});
|
|
1887
|
-
}
|
|
1731
|
+
const STACK_CACHE = "redis";
|
|
1732
|
+
/** Its compose service name — the host every cache URL points at. */
|
|
1733
|
+
const REDIS_SERVICE = "redis";
|
|
1734
|
+
/** The port it answers on, inside the network. */
|
|
1735
|
+
const REDIS_PORT = 6379;
|
|
1736
|
+
/** Reconcile's pin, so `gkm dev` and the stack run one Redis. */
|
|
1737
|
+
const REDIS_IMAGE = DEFAULT_IMAGES.redis;
|
|
1888
1738
|
/**
|
|
1889
|
-
*
|
|
1890
|
-
*
|
|
1739
|
+
* How much it may hold before it evicts. A cache that grows until the box
|
|
1740
|
+
* runs out of memory takes the apps with it; 256 MB is a lot of sessions and
|
|
1741
|
+
* little of a small server. A project's `docker-compose.<stage>.yml` can
|
|
1742
|
+
* replace the command to change it.
|
|
1891
1743
|
*/
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1744
|
+
const REDIS_MAXMEMORY = "256mb";
|
|
1745
|
+
/** The stage secret holding its password. */
|
|
1746
|
+
const REDIS_PASSWORD_KEY = "REDIS_PASSWORD";
|
|
1747
|
+
/** Redis's own count of logical databases, before `--databases` raises it. */
|
|
1748
|
+
const REDIS_DATABASES = 16;
|
|
1749
|
+
/** A deployed stage that runs the stack's Redis and has no password yet. */
|
|
1750
|
+
var RedisPasswordMissing = class extends require_errors.GkmError {
|
|
1751
|
+
stage;
|
|
1752
|
+
constructor(stage) {
|
|
1753
|
+
super(`The stage '${stage}' runs the stack's Redis and has no ${REDIS_PASSWORD_KEY} in its secrets. Run gkm compose --stage ${stage} without --dry-run once to generate it, or set one: gkm secrets:set ${REDIS_PASSWORD_KEY} '…' --stage ${stage}`);
|
|
1754
|
+
this.stage = stage;
|
|
1755
|
+
this.name = "RedisPasswordMissing";
|
|
1897
1756
|
}
|
|
1898
|
-
|
|
1899
|
-
}
|
|
1900
|
-
const PORT_STATE_PATH = ".gkm/ports.json";
|
|
1757
|
+
};
|
|
1901
1758
|
/**
|
|
1902
|
-
*
|
|
1903
|
-
*
|
|
1759
|
+
* Whether a stage's stack runs Redis: a cache or a WebSocket surface is
|
|
1760
|
+
* declared and the stage's secrets do not set the URL of every one.
|
|
1904
1761
|
*/
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
return
|
|
1909
|
-
}
|
|
1910
|
-
return {};
|
|
1911
|
-
}
|
|
1762
|
+
function runsRedis(manifest, custom) {
|
|
1763
|
+
return Object.values(manifest).some((declaration) => {
|
|
1764
|
+
if (declaration?.kind === "cache") return (declaration.provides ?? []).some((key) => custom[key] === void 0);
|
|
1765
|
+
return declaration?.kind === "websocket-api" && custom[(0, _geekmidas_manifest.providedKeyFor)(declaration.id, declaration.kind, "publisherConnectionString")] === void 0;
|
|
1766
|
+
});
|
|
1912
1767
|
}
|
|
1913
|
-
/**
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
*/
|
|
1917
|
-
async function savePortState(workspaceRoot, ports) {
|
|
1918
|
-
const dir = (0, node_path.join)(workspaceRoot, ".gkm");
|
|
1919
|
-
await (0, node_fs_promises.mkdir)(dir, { recursive: true });
|
|
1920
|
-
await (0, node_fs_promises.writeFile)((0, node_path.join)(workspaceRoot, PORT_STATE_PATH), `${JSON.stringify(ports, null, 2)}\n`);
|
|
1768
|
+
/** A password: 256 random bits, URL-safe, so it sits in a URL unescaped. */
|
|
1769
|
+
function generateRedisPassword() {
|
|
1770
|
+
return (0, node_crypto.randomBytes)(32).toString("base64url");
|
|
1921
1771
|
}
|
|
1922
1772
|
/**
|
|
1923
|
-
*
|
|
1924
|
-
*
|
|
1925
|
-
*
|
|
1926
|
-
* construct's key, derived by reconcile, and never a stored per-app value
|
|
1927
|
-
* mapped onto `DATABASE_URL`.
|
|
1928
|
-
* @internal Exported for testing
|
|
1773
|
+
* The stage's secrets with a generated Redis password, where it has none.
|
|
1774
|
+
* Pure, like `withGeneratedSecrets`: the caller keeps the result once the run
|
|
1775
|
+
* goes ahead.
|
|
1929
1776
|
*/
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1777
|
+
function withRedisPassword(secrets) {
|
|
1778
|
+
if (secrets.custom?.["REDIS_PASSWORD"]) return {
|
|
1779
|
+
secrets,
|
|
1780
|
+
generated: []
|
|
1781
|
+
};
|
|
1782
|
+
return {
|
|
1783
|
+
secrets: {
|
|
1784
|
+
...secrets,
|
|
1785
|
+
custom: {
|
|
1786
|
+
...secrets.custom,
|
|
1787
|
+
[REDIS_PASSWORD_KEY]: generateRedisPassword()
|
|
1788
|
+
},
|
|
1789
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1790
|
+
},
|
|
1791
|
+
generated: [REDIS_PASSWORD_KEY]
|
|
1792
|
+
};
|
|
1935
1793
|
}
|
|
1936
1794
|
/**
|
|
1937
|
-
*
|
|
1938
|
-
*
|
|
1795
|
+
* The stack's Redis for one stage, or nothing where no cache needs it.
|
|
1796
|
+
*
|
|
1797
|
+
* Each cache it holds gets a logical database of its own, by the order of
|
|
1798
|
+
* their ids, so two caches never read each other's keys.
|
|
1939
1799
|
*/
|
|
1940
|
-
function
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1800
|
+
function stackRedis(options) {
|
|
1801
|
+
const { plan, stage, local, custom } = options;
|
|
1802
|
+
const caches = plan.resources.filter((r) => r.kind === "cache" && custom[r.envKey] === void 0).sort((a, b) => a.id.localeCompare(b.id));
|
|
1803
|
+
const publishers = plan.resources.filter((r) => r.kind === "websocket-api").map((r) => (0, _geekmidas_manifest.providedKeyFor)(r.id, r.kind, "publisherConnectionString")).filter((key) => custom[key] === void 0);
|
|
1804
|
+
if (caches.length === 0 && publishers.length === 0) return void 0;
|
|
1805
|
+
const set = custom[REDIS_PASSWORD_KEY];
|
|
1806
|
+
const password = set ?? (local ? options.localPassword : void 0);
|
|
1807
|
+
if (!password) throw new RedisPasswordMissing(stage);
|
|
1808
|
+
const auth = encodeURIComponent(password);
|
|
1809
|
+
return {
|
|
1810
|
+
password,
|
|
1811
|
+
passwordFromSecrets: Boolean(set),
|
|
1812
|
+
urls: Object.fromEntries([...caches.map((cache, index) => [cache.envKey, `redis://:${auth}@${REDIS_SERVICE}:${REDIS_PORT}/${index}`]), ...publishers.map((key) => [key, `redis://:${auth}@${REDIS_SERVICE}:${REDIS_PORT}`])]),
|
|
1813
|
+
env: {
|
|
1814
|
+
[REDIS_PASSWORD_KEY]: password,
|
|
1815
|
+
REDISCLI_AUTH: password
|
|
1816
|
+
},
|
|
1817
|
+
databases: Math.max(REDIS_DATABASES, caches.length)
|
|
1818
|
+
};
|
|
1949
1819
|
}
|
|
1950
1820
|
/**
|
|
1951
|
-
*
|
|
1952
|
-
*
|
|
1953
|
-
*
|
|
1821
|
+
* Redis's service: bounded, persisted and password protected, on the
|
|
1822
|
+
* network alone.
|
|
1823
|
+
*
|
|
1824
|
+
* The command runs the image's own entrypoint with `redis-server` first, so
|
|
1825
|
+
* it still drops to the `redis` user and owns `/data`; the password is read
|
|
1826
|
+
* from the env file by the shell (`$$` is compose's escape for `$`), so
|
|
1827
|
+
* neither the compose file nor the container's command holds it.
|
|
1954
1828
|
*/
|
|
1955
|
-
function
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
const secrets = JSON.parse(readFileSync(secretsPath, 'utf-8'));
|
|
1964
|
-
globalThis.__gkm_credentials__ = secrets;
|
|
1965
|
-
Object.assign(process.env, secrets);
|
|
1966
|
-
}
|
|
1967
|
-
`;
|
|
1968
|
-
}
|
|
1969
|
-
/**
|
|
1970
|
-
* Create a preload script that injects secrets into Credentials.
|
|
1971
|
-
* Used by `gkm exec` to inject secrets before running any command.
|
|
1972
|
-
* @internal Exported for testing
|
|
1973
|
-
*/
|
|
1974
|
-
async function createCredentialsPreload(preloadPath, secretsJsonPath) {
|
|
1975
|
-
const content = `/**
|
|
1976
|
-
* Credentials preload generated by 'gkm exec'
|
|
1977
|
-
* This file is loaded via NODE_OPTIONS="--import <path>"
|
|
1978
|
-
*/
|
|
1979
|
-
${generateCredentialsInjection(secretsJsonPath)}`;
|
|
1980
|
-
await (0, node_fs_promises.writeFile)(preloadPath, content);
|
|
1981
|
-
}
|
|
1982
|
-
/**
|
|
1983
|
-
* Create a wrapper script that injects secrets before importing the entry file.
|
|
1984
|
-
* @internal Exported for testing
|
|
1985
|
-
*/
|
|
1986
|
-
async function createEntryWrapper(wrapperPath, entryPath, secretsJsonPath) {
|
|
1987
|
-
const content = `#!/usr/bin/env node
|
|
1988
|
-
/**
|
|
1989
|
-
* Entry wrapper generated by 'gkm dev --entry'
|
|
1990
|
-
*/
|
|
1991
|
-
${secretsJsonPath ? `${generateCredentialsInjection(secretsJsonPath)}
|
|
1992
|
-
` : ""}// Import and run the user's entry file (dynamic import ensures secrets load first)
|
|
1993
|
-
await import('${entryPath}');
|
|
1994
|
-
`;
|
|
1995
|
-
await (0, node_fs_promises.writeFile)(wrapperPath, content);
|
|
1996
|
-
}
|
|
1997
|
-
/**
|
|
1998
|
-
* Prepare credentials for dev/exec/test modes.
|
|
1999
|
-
* Loads workspace config, secrets, resolves Docker ports, rewrites URLs,
|
|
2000
|
-
* injects PORT, dependency URLs, and writes credentials JSON.
|
|
2001
|
-
*
|
|
2002
|
-
* @param options.stage - The stage whose secrets to load. Default: the project's `stages.local`.
|
|
2003
|
-
* @param options.startDocker - Start Docker Compose services after port resolution. Default: false.
|
|
2004
|
-
* @param options.secretsFileName - Custom secrets JSON filename. Default: 'dev-secrets-{appName}.json' or 'dev-secrets.json'.
|
|
2005
|
-
* @internal Exported for testing
|
|
2006
|
-
*/
|
|
2007
|
-
async function prepareEntryCredentials(options) {
|
|
2008
|
-
const cwd = options.cwd ?? process.cwd();
|
|
2009
|
-
let workspaceAppPort;
|
|
2010
|
-
let secretsRoot = cwd;
|
|
2011
|
-
let appName;
|
|
2012
|
-
let appInfo;
|
|
2013
|
-
let workspace;
|
|
2014
|
-
try {
|
|
2015
|
-
appInfo = await require_config.loadWorkspaceAppInfo(cwd);
|
|
2016
|
-
workspace = appInfo.workspace;
|
|
2017
|
-
workspaceAppPort = appInfo.app.port;
|
|
2018
|
-
secretsRoot = appInfo.workspaceRoot;
|
|
2019
|
-
appName = appInfo.appName;
|
|
2020
|
-
} catch (error) {
|
|
2021
|
-
if (!(error instanceof require_config.NotInAnApp || error instanceof require_config.ConfigNotFound)) throw error;
|
|
2022
|
-
workspace = await require_config.loadWorkspaceConfig(cwd).then((loaded) => loaded.workspace).catch(() => void 0);
|
|
2023
|
-
secretsRoot = workspace?.root ?? findSecretsRoot(cwd);
|
|
2024
|
-
}
|
|
2025
|
-
if (appName && workspace && options.explicitPort === void 0) {
|
|
2026
|
-
const { assignAppPorts, describeMove, holderOf, withAppPorts } = await Promise.resolve().then(() => require("./appPorts-IW-OZmRi.cjs")).then((n) => n.appPorts_exports);
|
|
2027
|
-
const assigned = await assignAppPorts(workspace, [appName], {
|
|
2028
|
-
free: isPortAvailable,
|
|
2029
|
-
holder: holderOf
|
|
2030
|
-
});
|
|
2031
|
-
for (const move of assigned.moved) logger.log(describeMove(move));
|
|
2032
|
-
workspace = withAppPorts(workspace, assigned.ports);
|
|
2033
|
-
workspaceAppPort = assigned.ports[appName] ?? workspaceAppPort;
|
|
2034
|
-
}
|
|
2035
|
-
if (appName) {
|
|
2036
|
-
const { APP_TAG_ENV, appTag } = await Promise.resolve().then(() => require("./appPorts-IW-OZmRi.cjs")).then((n) => n.appPorts_exports);
|
|
2037
|
-
process.env[APP_TAG_ENV] = appTag(secretsRoot, appName);
|
|
2038
|
-
}
|
|
2039
|
-
const resolvedPort = options.explicitPort ?? workspaceAppPort ?? 3e3;
|
|
2040
|
-
const stage = options.stage ?? workspace?.stages.local;
|
|
2041
|
-
const store = stage ? workspace ? await require_dns.secretsStoreFor(workspace, stage) : new require_dns.FileSecretsStore(secretsRoot) : void 0;
|
|
2042
|
-
const credentials = store && stage ? await loadSecretsForApp(store, stage) : {};
|
|
2043
|
-
credentials.PORT = String(resolvedPort);
|
|
2044
|
-
if (appInfo?.app.type === "mobile") credentials.RCT_METRO_PORT = String(resolvedPort);
|
|
2045
|
-
const declaredKeys = [];
|
|
2046
|
-
let reconciled;
|
|
2047
|
-
if (workspace) {
|
|
2048
|
-
const { reconcileWorkspace } = await Promise.resolve().then(() => require("./apps-DWq98qHY.cjs")).then((n) => n.workspace_exports);
|
|
2049
|
-
const result = await reconcileWorkspace(workspace, {
|
|
2050
|
-
stage: options.reconcileStage ?? workspace.stages.local,
|
|
2051
|
-
start: options.startDocker ?? false
|
|
2052
|
-
});
|
|
2053
|
-
reconciled = result;
|
|
2054
|
-
if (options.scoped && appName) {
|
|
2055
|
-
const { appProcess, processEnv } = await Promise.resolve().then(() => require("./apps-DWq98qHY.cjs")).then((n) => n.apps_exports);
|
|
2056
|
-
const own = processEnv(result.manifest, appProcess(workspace, result.manifest, result.background, appName), { ...credentials }, result.env);
|
|
2057
|
-
for (const key of Object.keys(credentials)) delete credentials[key];
|
|
2058
|
-
Object.assign(credentials, own);
|
|
2059
|
-
} else Object.assign(credentials, reconciled.env);
|
|
2060
|
-
declaredKeys.push(...Object.keys(reconciled.env).filter((key) => key in credentials));
|
|
2061
|
-
if (Object.keys(reconciled.env).length > 0) logger.log(`🔌 Resolved ${Object.keys(reconciled.env).length} declared URL(s)`);
|
|
2062
|
-
}
|
|
2063
|
-
const secretsDir = (0, node_path.join)(secretsRoot, ".gkm");
|
|
2064
|
-
await (0, node_fs_promises.mkdir)(secretsDir, { recursive: true });
|
|
2065
|
-
const secretsFileName = options.secretsFileName ?? (appName ? `dev-secrets-${appName}.json` : "dev-secrets.json");
|
|
2066
|
-
const secretsJsonPath = (0, node_path.join)(secretsDir, secretsFileName);
|
|
2067
|
-
await (0, node_fs_promises.writeFile)(secretsJsonPath, JSON.stringify(credentials, null, 2));
|
|
1829
|
+
function redisService(redis) {
|
|
1830
|
+
const flags = [
|
|
1831
|
+
`--requirepass "$$${REDIS_PASSWORD_KEY}"`,
|
|
1832
|
+
`--maxmemory ${REDIS_MAXMEMORY}`,
|
|
1833
|
+
"--maxmemory-policy allkeys-lru",
|
|
1834
|
+
"--appendonly yes",
|
|
1835
|
+
...redis.databases > REDIS_DATABASES ? [`--databases ${redis.databases}`] : []
|
|
1836
|
+
];
|
|
2068
1837
|
return {
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
1838
|
+
image: REDIS_IMAGE,
|
|
1839
|
+
restart: "unless-stopped",
|
|
1840
|
+
command: [
|
|
1841
|
+
"sh",
|
|
1842
|
+
"-c",
|
|
1843
|
+
`exec docker-entrypoint.sh redis-server ${flags.join(" ")}`
|
|
1844
|
+
],
|
|
1845
|
+
env_file: [{
|
|
1846
|
+
path: `./${REDIS_SERVICE}.env`,
|
|
1847
|
+
format: "raw"
|
|
1848
|
+
}],
|
|
1849
|
+
volumes: ["redis-data:/data"],
|
|
1850
|
+
healthcheck: {
|
|
1851
|
+
test: ["CMD-SHELL", "redis-cli ping | grep -q PONG"],
|
|
1852
|
+
interval: "5s",
|
|
1853
|
+
timeout: "3s",
|
|
1854
|
+
retries: 10
|
|
1855
|
+
}
|
|
2077
1856
|
};
|
|
2078
1857
|
}
|
|
2079
1858
|
//#endregion
|
|
2080
|
-
//#region src/
|
|
1859
|
+
//#region src/deploy/generated.ts
|
|
2081
1860
|
/**
|
|
2082
|
-
* The
|
|
2083
|
-
*
|
|
2084
|
-
* The third declaration of the same containers disappears here: today a
|
|
2085
|
-
* `services: ['postgres','minio']` block is kept in step with the code by hand,
|
|
2086
|
-
* which is the triplication this design exists to remove, in the one place you
|
|
2087
|
-
* touch every day. A `database` implies Postgres; the list is derived.
|
|
1861
|
+
* The values a deployed stage generates once and keeps: what nothing can
|
|
1862
|
+
* provision and nobody else issues.
|
|
2088
1863
|
*
|
|
2089
|
-
*
|
|
2090
|
-
*
|
|
2091
|
-
*
|
|
1864
|
+
* - **A seed**, which salts every password a deploy derives — a database's
|
|
1865
|
+
* master and roles, a bucket's root user. Derived from repo facts alone
|
|
1866
|
+
* (project, stage, construct id), those passwords were computable by anyone
|
|
1867
|
+
* who could read the repo.
|
|
1868
|
+
* - **Each `secret` construct's value** — an auth server's signing secret, a
|
|
1869
|
+
* `RandomPassword` — random, rather than derived, in its declared format.
|
|
1870
|
+
* - **Each `encryption` construct's keyring** — one random key and an index
|
|
1871
|
+
* key. Later keys are added by `gkm encryption:rotate`, never by a deploy.
|
|
2092
1872
|
*
|
|
2093
|
-
*
|
|
2094
|
-
*
|
|
2095
|
-
*
|
|
1873
|
+
* Both are generated on the first deploy that needs them and written to the
|
|
1874
|
+
* stage's store, so every later deploy reads the same values: sessions survive
|
|
1875
|
+
* a redeploy, and a role's password does not move. A value set by hand with
|
|
1876
|
+
* `gkm secrets:set` is kept, never replaced.
|
|
2096
1877
|
*/
|
|
2097
|
-
/** The database every connection opens first: every cluster has it. */
|
|
2098
|
-
const CLUSTER_DATABASE = "postgres";
|
|
2099
1878
|
/**
|
|
2100
|
-
*
|
|
2101
|
-
*
|
|
2102
|
-
*
|
|
2103
|
-
* default: the point of allocation is that two projects can run at once, and
|
|
2104
|
-
* one container publishing 5432 puts that back.
|
|
1879
|
+
* The stage's secrets with its seed and every declared `secret`'s value
|
|
1880
|
+
* present, generating what is missing. Pure: the caller writes the result
|
|
1881
|
+
* back to the stage's store when `generated` is not empty.
|
|
2105
1882
|
*/
|
|
2106
|
-
function
|
|
2107
|
-
const
|
|
2108
|
-
const
|
|
2109
|
-
for (const
|
|
2110
|
-
|
|
2111
|
-
const
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
const published = publish(container, options.ports, plan.fakes);
|
|
2116
|
-
services[container] = fake ? {
|
|
2117
|
-
image,
|
|
2118
|
-
restart: "unless-stopped",
|
|
2119
|
-
ports: published
|
|
2120
|
-
} : define(container, image, published, options.credentials);
|
|
2121
|
-
const volume = volumeOf(container);
|
|
2122
|
-
if (volume) volumes[volume] = {};
|
|
2123
|
-
}
|
|
2124
|
-
const minio = services.minio;
|
|
2125
|
-
if (minio && options.objectWebhooks?.length) {
|
|
2126
|
-
minio.environment = {
|
|
2127
|
-
...minio.environment,
|
|
2128
|
-
...minioWebhookEnv(options.objectWebhooks)
|
|
2129
|
-
};
|
|
2130
|
-
if (options.objectWebhooks.some((hook) => hook.endpoint.includes(`//host.docker.internal:`))) minio.extra_hosts = [`${HOST_GATEWAY}:host-gateway`];
|
|
2131
|
-
}
|
|
2132
|
-
const mailpit = services.mailpit;
|
|
2133
|
-
if (mailpit && options.inboxRelay) {
|
|
2134
|
-
mailpit.environment = {
|
|
2135
|
-
...mailpit.environment,
|
|
2136
|
-
MP_WEBHOOK_URL: options.inboxRelay
|
|
2137
|
-
};
|
|
2138
|
-
if (options.inboxRelay.includes(`//host.docker.internal:`)) mailpit.extra_hosts = [`${HOST_GATEWAY}:host-gateway`];
|
|
1883
|
+
function withGeneratedSecrets(secrets, manifest) {
|
|
1884
|
+
const generated = [];
|
|
1885
|
+
const custom = { ...secrets.custom };
|
|
1886
|
+
for (const declaration of Object.values(manifest)) {
|
|
1887
|
+
if (declaration?.kind !== "secret" && declaration?.kind !== "encryption") continue;
|
|
1888
|
+
const key = declaration.provides?.[0];
|
|
1889
|
+
if (!key || custom[key]) continue;
|
|
1890
|
+
custom[key] = declaration.kind === "encryption" ? (0, _geekmidas_constructs_encryption.generateKeyring)() : (0, _geekmidas_manifest.drawSecret)(node_crypto.randomInt, declaration);
|
|
1891
|
+
generated.push(key);
|
|
2139
1892
|
}
|
|
1893
|
+
const seed = secrets.seed ?? generateSeed();
|
|
1894
|
+
if (!secrets.seed) generated.push("seed");
|
|
2140
1895
|
return {
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
1896
|
+
secrets: generated.length ? {
|
|
1897
|
+
...secrets,
|
|
1898
|
+
seed,
|
|
1899
|
+
custom,
|
|
1900
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1901
|
+
} : secrets,
|
|
1902
|
+
generated
|
|
2147
1903
|
};
|
|
2148
1904
|
}
|
|
2149
|
-
/**
|
|
2150
|
-
function
|
|
2151
|
-
return
|
|
2152
|
-
# Containers are derived from what the app declares. Image pins and anything
|
|
2153
|
-
# no construct implies go in your own docker-compose.yml, which is merged over
|
|
2154
|
-
# this file and wins:
|
|
2155
|
-
#
|
|
2156
|
-
# docker compose -f docker-compose.constructs.yml -f docker-compose.yml …
|
|
2157
|
-
#
|
|
2158
|
-
# "gkm dev" and "gkm test" start the containers. The apps sit behind the
|
|
2159
|
-
# "apps" profile: run "gkm setup", then
|
|
2160
|
-
# docker compose -f docker-compose.constructs.yml --profile apps up --build
|
|
2161
|
-
${(0, yaml.stringify)(file, { lineWidth: 0 })}`;
|
|
1905
|
+
/** A stage's seed: 256 random bits, URL-safe. */
|
|
1906
|
+
function generateSeed() {
|
|
1907
|
+
return random();
|
|
2162
1908
|
}
|
|
2163
|
-
/**
|
|
1909
|
+
/** 256 bits, URL-safe. */
|
|
1910
|
+
function random() {
|
|
1911
|
+
return (0, node_crypto.randomBytes)(32).toString("base64url");
|
|
1912
|
+
}
|
|
1913
|
+
/** MinIO's root user, the same for every workspace: it is not a secret. */
|
|
1914
|
+
const LOCAL_MINIO_USER = "minio";
|
|
1915
|
+
/** RabbitMQ's administrator, the same way. */
|
|
1916
|
+
const LOCAL_RABBITMQ_USER = "rabbitmq";
|
|
2164
1917
|
/**
|
|
2165
|
-
* The
|
|
2166
|
-
*
|
|
1918
|
+
* The Postgres superuser for a workspace: its name as an identifier, with
|
|
1919
|
+
* `_admin` — never the bare name, which a database construct of the same
|
|
1920
|
+
* name would claim as its runtime role.
|
|
2167
1921
|
*/
|
|
2168
|
-
function
|
|
2169
|
-
|
|
2170
|
-
const images = [...new Set(named.map((r) => r.image))];
|
|
2171
|
-
if (images.length > 1) throw new ConflictingPostgresImages(named.map((r) => ({
|
|
2172
|
-
id: r.id,
|
|
2173
|
-
image: r.image
|
|
2174
|
-
})));
|
|
2175
|
-
return images[0];
|
|
1922
|
+
function postgresSuperuser(project) {
|
|
1923
|
+
return `${postgresRoleSlug(project)}_admin`;
|
|
2176
1924
|
}
|
|
2177
1925
|
/**
|
|
2178
|
-
* The
|
|
2179
|
-
*
|
|
1926
|
+
* The project as the start of a role's name: lowercase, `_` for anything
|
|
1927
|
+
* else, never starting with a digit — `gkm` when nothing is left.
|
|
2180
1928
|
*/
|
|
2181
|
-
function
|
|
2182
|
-
return
|
|
1929
|
+
function postgresRoleSlug(project) {
|
|
1930
|
+
return project.toLowerCase().replace(/^@[^/]+\//, "").replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "").replace(/^(\d)/, "_$1") || "gkm";
|
|
2183
1931
|
}
|
|
2184
|
-
/**
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
1932
|
+
/** 256 random bits, URL-safe. */
|
|
1933
|
+
function token() {
|
|
1934
|
+
return (0, node_crypto.randomBytes)(32).toString("base64url");
|
|
1935
|
+
}
|
|
1936
|
+
/** `length` characters of letters and digits, which every client takes as is. */
|
|
1937
|
+
function alphanumeric(length) {
|
|
1938
|
+
const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
1939
|
+
let out = "";
|
|
1940
|
+
for (let i = 0; i < length; i++) out += alphabet[(0, node_crypto.randomInt)(62)];
|
|
1941
|
+
return out;
|
|
1942
|
+
}
|
|
1943
|
+
/** A fresh set of local logins for a workspace. */
|
|
1944
|
+
function generateLocalCredentials(project) {
|
|
1945
|
+
return {
|
|
1946
|
+
seed: generateSeed(),
|
|
1947
|
+
postgres: {
|
|
1948
|
+
user: postgresSuperuser(project),
|
|
1949
|
+
password: token()
|
|
1950
|
+
},
|
|
1951
|
+
minio: {
|
|
1952
|
+
user: LOCAL_MINIO_USER,
|
|
1953
|
+
password: alphanumeric(32)
|
|
1954
|
+
},
|
|
1955
|
+
rabbitmq: {
|
|
1956
|
+
user: LOCAL_RABBITMQ_USER,
|
|
1957
|
+
password: token()
|
|
1958
|
+
},
|
|
1959
|
+
redis: { password: generateRedisPassword() },
|
|
1960
|
+
cacheToken: token(),
|
|
1961
|
+
emulator: {
|
|
1962
|
+
accessKeyId: EMULATOR_ACCESS_KEY_ID,
|
|
1963
|
+
secretAccessKey: alphanumeric(40)
|
|
1964
|
+
},
|
|
1965
|
+
logs: {
|
|
1966
|
+
email: LOCAL_LOGS_EMAIL,
|
|
1967
|
+
password: generateLogsPassword()
|
|
1968
|
+
}
|
|
1969
|
+
};
|
|
1970
|
+
}
|
|
1971
|
+
/**
|
|
1972
|
+
* The stored logins with anything missing generated — a file an older gkm
|
|
1973
|
+
* wrote before a service existed. Pure: the caller writes the result back
|
|
1974
|
+
* when `generated` is not empty.
|
|
1975
|
+
*/
|
|
1976
|
+
function withLocalCredentials(stored, project) {
|
|
1977
|
+
const fresh = generateLocalCredentials(project);
|
|
1978
|
+
const generated = Object.keys(fresh).filter((key) => stored?.[key] === void 0);
|
|
1979
|
+
return {
|
|
1980
|
+
credentials: {
|
|
1981
|
+
...fresh,
|
|
1982
|
+
...stored
|
|
1983
|
+
},
|
|
1984
|
+
generated
|
|
1985
|
+
};
|
|
1986
|
+
}
|
|
1987
|
+
/** Where a workspace's local logins are kept on this machine. */
|
|
1988
|
+
function localCredentialsPath(project) {
|
|
1989
|
+
const keys = require_credentials.getKeystoreDir(project);
|
|
1990
|
+
const name = keys.split(/[\\/]/).at(-1);
|
|
1991
|
+
const namespace = keys.split(/[\\/]/).at(-2);
|
|
1992
|
+
return (0, node_path.join)(project.home ?? require_credentials.gkmHome(), "local", namespace, `${name}.json`);
|
|
1993
|
+
}
|
|
1994
|
+
/** The local stage's logins file is there, and its key is not. */
|
|
1995
|
+
var LocalCredentialsKeyMissing = class extends require_errors.GkmError {
|
|
1996
|
+
path;
|
|
1997
|
+
stage;
|
|
1998
|
+
constructor(path, stage) {
|
|
1999
|
+
super(`The local logins at ${path} are encrypted with the '${stage}' stage's key, and this machine has none. Remove the file to generate new ones — the containers' volumes are rotated to them on the next gkm dev.`);
|
|
2000
|
+
this.path = path;
|
|
2001
|
+
this.stage = stage;
|
|
2002
|
+
this.name = "LocalCredentialsKeyMissing";
|
|
2191
2003
|
}
|
|
2192
2004
|
};
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
this.name = "UnknownContainer";
|
|
2201
|
-
this.container = container;
|
|
2005
|
+
/** Another gkm held the logins file's lock for longer than any write takes. */
|
|
2006
|
+
var LocalCredentialsLocked = class extends require_errors.GkmError {
|
|
2007
|
+
lock;
|
|
2008
|
+
constructor(lock) {
|
|
2009
|
+
super(`Another gkm has been writing the local logins for over ${LOCK_TIMEOUT_MS / 1e3}s. If none is running, remove ${lock} and run the command again.`);
|
|
2010
|
+
this.lock = lock;
|
|
2011
|
+
this.name = "LocalCredentialsLocked";
|
|
2202
2012
|
}
|
|
2203
2013
|
};
|
|
2204
|
-
/**
|
|
2205
|
-
function
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
test: [
|
|
2260
|
-
"CMD",
|
|
2261
|
-
"caddy",
|
|
2262
|
-
"version"
|
|
2263
|
-
],
|
|
2264
|
-
interval: "10s",
|
|
2265
|
-
timeout: "5s",
|
|
2266
|
-
retries: 5
|
|
2267
|
-
}
|
|
2268
|
-
};
|
|
2269
|
-
case "mailpit": return {
|
|
2270
|
-
image,
|
|
2271
|
-
restart: "unless-stopped",
|
|
2272
|
-
ports: published,
|
|
2273
|
-
environment: {
|
|
2274
|
-
MP_SMTP_AUTH_ACCEPT_ANY: "1",
|
|
2275
|
-
MP_SMTP_AUTH_ALLOW_INSECURE: "1"
|
|
2276
|
-
},
|
|
2277
|
-
healthcheck: {
|
|
2278
|
-
test: [
|
|
2279
|
-
"CMD",
|
|
2280
|
-
"wget",
|
|
2281
|
-
"-q",
|
|
2282
|
-
"--spider",
|
|
2283
|
-
"http://localhost:8025"
|
|
2284
|
-
],
|
|
2285
|
-
interval: "10s",
|
|
2286
|
-
timeout: "5s",
|
|
2287
|
-
retries: 5
|
|
2288
|
-
}
|
|
2289
|
-
};
|
|
2290
|
-
case "redis": return {
|
|
2291
|
-
image,
|
|
2292
|
-
restart: "unless-stopped",
|
|
2293
|
-
ports: published,
|
|
2294
|
-
command: "sh -c 'exec docker-entrypoint.sh redis-server --requirepass \"$$REDIS_PASSWORD\"'",
|
|
2295
|
-
environment: {
|
|
2296
|
-
REDIS_PASSWORD: credentials.redis.password,
|
|
2297
|
-
REDISCLI_AUTH: credentials.redis.password
|
|
2298
|
-
},
|
|
2299
|
-
volumes: ["redis-data:/data"],
|
|
2300
|
-
healthcheck: {
|
|
2301
|
-
test: ["CMD-SHELL", "redis-cli ping | grep -q PONG"],
|
|
2302
|
-
interval: "5s",
|
|
2303
|
-
timeout: "3s",
|
|
2304
|
-
retries: 5
|
|
2305
|
-
}
|
|
2306
|
-
};
|
|
2307
|
-
case "redis-http": return {
|
|
2308
|
-
image,
|
|
2309
|
-
restart: "unless-stopped",
|
|
2310
|
-
ports: published,
|
|
2311
|
-
environment: {
|
|
2312
|
-
SRH_MODE: "env",
|
|
2313
|
-
SRH_TOKEN: credentials.cacheToken,
|
|
2314
|
-
SRH_CONNECTION_STRING: `redis://:${encodeURIComponent(credentials.redis.password)}@redis:6379`
|
|
2315
|
-
},
|
|
2316
|
-
depends_on: ["redis"],
|
|
2317
|
-
healthcheck: {
|
|
2318
|
-
test: [
|
|
2319
|
-
"CMD",
|
|
2320
|
-
"wget",
|
|
2321
|
-
"-q",
|
|
2322
|
-
"-O",
|
|
2323
|
-
"/dev/null",
|
|
2324
|
-
"http://127.0.0.1:80/"
|
|
2325
|
-
],
|
|
2326
|
-
interval: "5s",
|
|
2327
|
-
timeout: "3s",
|
|
2328
|
-
retries: 10
|
|
2329
|
-
}
|
|
2330
|
-
};
|
|
2331
|
-
case "rabbitmq": return {
|
|
2332
|
-
image,
|
|
2333
|
-
restart: "unless-stopped",
|
|
2334
|
-
ports: published,
|
|
2335
|
-
environment: {
|
|
2336
|
-
RABBITMQ_DEFAULT_USER: credentials.rabbitmq.user,
|
|
2337
|
-
RABBITMQ_DEFAULT_PASS: credentials.rabbitmq.password
|
|
2338
|
-
},
|
|
2339
|
-
volumes: ["rabbitmq-data:/var/lib/rabbitmq"],
|
|
2340
|
-
healthcheck: {
|
|
2341
|
-
test: [
|
|
2342
|
-
"CMD",
|
|
2343
|
-
"rabbitmq-diagnostics",
|
|
2344
|
-
"-q",
|
|
2345
|
-
"ping"
|
|
2346
|
-
],
|
|
2347
|
-
interval: "10s",
|
|
2348
|
-
timeout: "5s",
|
|
2349
|
-
retries: 5
|
|
2350
|
-
}
|
|
2351
|
-
};
|
|
2352
|
-
case "localstack": return {
|
|
2353
|
-
image,
|
|
2354
|
-
restart: "unless-stopped",
|
|
2355
|
-
ports: published,
|
|
2356
|
-
extra_hosts: ["host.docker.internal:host-gateway"],
|
|
2357
|
-
environment: {
|
|
2358
|
-
AWS_DEFAULT_REGION: EMULATOR_REGION,
|
|
2359
|
-
AWS_ACCESS_KEY_ID: credentials.emulator.accessKeyId,
|
|
2360
|
-
AWS_SECRET_ACCESS_KEY: credentials.emulator.secretAccessKey
|
|
2361
|
-
},
|
|
2362
|
-
volumes: ["localstack-data:/var/lib/localstack"],
|
|
2363
|
-
healthcheck: {
|
|
2364
|
-
test: [
|
|
2365
|
-
"CMD",
|
|
2366
|
-
"bash",
|
|
2367
|
-
"-c",
|
|
2368
|
-
"exec 3<>/dev/tcp/localhost/4566"
|
|
2369
|
-
],
|
|
2370
|
-
interval: "10s",
|
|
2371
|
-
timeout: "5s",
|
|
2372
|
-
retries: 5,
|
|
2373
|
-
start_period: "10s"
|
|
2374
|
-
}
|
|
2375
|
-
};
|
|
2376
|
-
case "openobserve": {
|
|
2377
|
-
const login = credentials.logs;
|
|
2378
|
-
return {
|
|
2379
|
-
image,
|
|
2380
|
-
restart: "unless-stopped",
|
|
2381
|
-
ports: published,
|
|
2382
|
-
environment: {
|
|
2383
|
-
[LOGS_EMAIL_KEY]: login.email,
|
|
2384
|
-
[LOGS_PASSWORD_KEY]: login.password,
|
|
2385
|
-
ZO_DATA_DIR: "/data",
|
|
2386
|
-
ZO_COMPACT_DATA_RETENTION_DAYS: String(30),
|
|
2387
|
-
ZO_TELEMETRY: "false"
|
|
2388
|
-
},
|
|
2389
|
-
volumes: ["openobserve-data:/data"],
|
|
2390
|
-
healthcheck: {
|
|
2391
|
-
test: [
|
|
2392
|
-
"CMD",
|
|
2393
|
-
"/openobserve",
|
|
2394
|
-
"node",
|
|
2395
|
-
"status"
|
|
2396
|
-
],
|
|
2397
|
-
interval: "10s",
|
|
2398
|
-
timeout: "5s",
|
|
2399
|
-
retries: 12,
|
|
2400
|
-
start_period: "20s"
|
|
2401
|
-
}
|
|
2402
|
-
};
|
|
2014
|
+
/** Read the stored logins, or `null` where none were generated yet. */
|
|
2015
|
+
async function readLocalCredentials(workspace, home) {
|
|
2016
|
+
const project = require_credentials.keystoreProject(workspace, home);
|
|
2017
|
+
const path = localCredentialsPath(project);
|
|
2018
|
+
if (!(0, node_fs.existsSync)(path)) return null;
|
|
2019
|
+
const stage = workspace.stages.local;
|
|
2020
|
+
const key = await require_credentials.readKey(stage, project);
|
|
2021
|
+
if (!key) throw new LocalCredentialsKeyMissing(path, stage);
|
|
2022
|
+
const file = JSON.parse(await (0, node_fs_promises.readFile)(path, "utf-8"));
|
|
2023
|
+
return require_credentials.decrypt(file, key);
|
|
2024
|
+
}
|
|
2025
|
+
/** Write the logins, encrypted with the local stage's key, owner-only. */
|
|
2026
|
+
async function saveLocalCredentials(workspace, credentials, home) {
|
|
2027
|
+
const project = require_credentials.keystoreProject(workspace, home);
|
|
2028
|
+
const path = localCredentialsPath(project);
|
|
2029
|
+
const key = await require_credentials.getOrCreateKey(workspace.stages.local, project);
|
|
2030
|
+
await (0, node_fs_promises.mkdir)((0, node_path.dirname)(path), {
|
|
2031
|
+
recursive: true,
|
|
2032
|
+
mode: 448
|
|
2033
|
+
});
|
|
2034
|
+
await (0, node_fs_promises.writeFile)(path, JSON.stringify(require_credentials.encrypt(credentials, key), null, 2), { mode: 384 });
|
|
2035
|
+
}
|
|
2036
|
+
/**
|
|
2037
|
+
* The workspace's local logins: read back, or generated and kept the first
|
|
2038
|
+
* time anything needs them.
|
|
2039
|
+
*
|
|
2040
|
+
* Under a lock, because a workspace's `gkm dev` starts one per app and the
|
|
2041
|
+
* first run of each would otherwise generate — and keep — its own.
|
|
2042
|
+
*/
|
|
2043
|
+
async function loadLocalCredentials(workspace, home) {
|
|
2044
|
+
return withLock(`${localCredentialsPath(require_credentials.keystoreProject(workspace, home))}.lock`, async () => {
|
|
2045
|
+
const result = withLocalCredentials(await readLocalCredentials(workspace, home), workspace.name);
|
|
2046
|
+
if (result.generated.length > 0) await saveLocalCredentials(workspace, result.credentials, home);
|
|
2047
|
+
return result;
|
|
2048
|
+
});
|
|
2049
|
+
}
|
|
2050
|
+
/** How long a lock may be held before it is someone else's problem. */
|
|
2051
|
+
const LOCK_TIMEOUT_MS = 15e3;
|
|
2052
|
+
async function withLock(lock, body) {
|
|
2053
|
+
await (0, node_fs_promises.mkdir)((0, node_path.dirname)(lock), {
|
|
2054
|
+
recursive: true,
|
|
2055
|
+
mode: 448
|
|
2056
|
+
});
|
|
2057
|
+
const started = Date.now();
|
|
2058
|
+
for (;;) try {
|
|
2059
|
+
await (0, node_fs_promises.mkdir)(lock);
|
|
2060
|
+
break;
|
|
2061
|
+
} catch (error) {
|
|
2062
|
+
if (error.code !== "EEXIST") throw error;
|
|
2063
|
+
if (await (0, node_fs_promises.stat)(lock).then((s) => Date.now() - s.mtimeMs).catch(() => 0) > LOCK_TIMEOUT_MS) {
|
|
2064
|
+
await (0, node_fs_promises.rm)(lock, {
|
|
2065
|
+
recursive: true,
|
|
2066
|
+
force: true
|
|
2067
|
+
});
|
|
2068
|
+
continue;
|
|
2403
2069
|
}
|
|
2404
|
-
|
|
2070
|
+
if (Date.now() - started > LOCK_TIMEOUT_MS) throw new LocalCredentialsLocked(lock);
|
|
2071
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
2072
|
+
}
|
|
2073
|
+
try {
|
|
2074
|
+
return await body();
|
|
2075
|
+
} finally {
|
|
2076
|
+
await (0, node_fs_promises.rm)(lock, {
|
|
2077
|
+
recursive: true,
|
|
2078
|
+
force: true
|
|
2079
|
+
});
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
//#endregion
|
|
2083
|
+
//#region src/credentials/index.ts
|
|
2084
|
+
const logger = console;
|
|
2085
|
+
/**
|
|
2086
|
+
* Load environment files
|
|
2087
|
+
* @internal Exported for testing
|
|
2088
|
+
*/
|
|
2089
|
+
function loadEnvFiles(envConfig, cwd = process.cwd()) {
|
|
2090
|
+
const loaded = [];
|
|
2091
|
+
const missing = [];
|
|
2092
|
+
const envFiles = envConfig ? Array.isArray(envConfig) ? envConfig : [envConfig] : [".env"];
|
|
2093
|
+
for (const envFile of envFiles) {
|
|
2094
|
+
const envPath = (0, node_path.resolve)(cwd, envFile);
|
|
2095
|
+
if ((0, node_fs.existsSync)(envPath)) {
|
|
2096
|
+
(0, dotenv.config)({
|
|
2097
|
+
path: envPath,
|
|
2098
|
+
override: true,
|
|
2099
|
+
quiet: true
|
|
2100
|
+
});
|
|
2101
|
+
loaded.push(envFile);
|
|
2102
|
+
} else if (envConfig) missing.push(envFile);
|
|
2405
2103
|
}
|
|
2104
|
+
return {
|
|
2105
|
+
loaded,
|
|
2106
|
+
missing
|
|
2107
|
+
};
|
|
2406
2108
|
}
|
|
2407
2109
|
/**
|
|
2408
|
-
*
|
|
2409
|
-
*
|
|
2410
|
-
* Every port is looked up by its own key rather than being derived as an offset
|
|
2411
|
-
* from the container's first, so MinIO's console cannot land on whatever was
|
|
2412
|
-
* allocated to the next container.
|
|
2110
|
+
* Check if a port is available
|
|
2111
|
+
* @internal Exported for testing
|
|
2413
2112
|
*/
|
|
2414
|
-
function
|
|
2415
|
-
return
|
|
2416
|
-
const
|
|
2417
|
-
|
|
2418
|
-
|
|
2113
|
+
async function isPortAvailable(port) {
|
|
2114
|
+
return new Promise((resolve) => {
|
|
2115
|
+
const server = (0, node_net.createServer)();
|
|
2116
|
+
server.once("error", (err) => {
|
|
2117
|
+
if (err.code === "EADDRINUSE") resolve(false);
|
|
2118
|
+
else resolve(false);
|
|
2119
|
+
});
|
|
2120
|
+
server.once("listening", () => {
|
|
2121
|
+
server.close();
|
|
2122
|
+
resolve(true);
|
|
2123
|
+
});
|
|
2124
|
+
server.listen(port);
|
|
2419
2125
|
});
|
|
2420
2126
|
}
|
|
2421
|
-
/**
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2127
|
+
/**
|
|
2128
|
+
* Find an available port starting from the preferred port
|
|
2129
|
+
* @internal Exported for testing
|
|
2130
|
+
*/
|
|
2131
|
+
async function findAvailablePort(preferredPort, maxAttempts = 10) {
|
|
2132
|
+
for (let i = 0; i < maxAttempts; i++) {
|
|
2133
|
+
const port = preferredPort + i;
|
|
2134
|
+
if (await isPortAvailable(port)) return port;
|
|
2135
|
+
logger.log(`⚠️ Port ${port} is in use, trying ${port + 1}...`);
|
|
2429
2136
|
}
|
|
2430
|
-
};
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2137
|
+
throw new Error(`Could not find an available port after trying ${maxAttempts} ports starting from ${preferredPort}`);
|
|
2138
|
+
}
|
|
2139
|
+
const PORT_STATE_PATH = ".gkm/ports.json";
|
|
2140
|
+
/**
|
|
2141
|
+
* Load saved port state from .gkm/ports.json.
|
|
2142
|
+
* @internal Exported for testing
|
|
2143
|
+
*/
|
|
2144
|
+
async function loadPortState(workspaceRoot) {
|
|
2145
|
+
try {
|
|
2146
|
+
const raw = await (0, node_fs_promises.readFile)((0, node_path.join)(workspaceRoot, PORT_STATE_PATH), "utf-8");
|
|
2147
|
+
return JSON.parse(raw);
|
|
2148
|
+
} catch {
|
|
2149
|
+
return {};
|
|
2436
2150
|
}
|
|
2437
|
-
}
|
|
2151
|
+
}
|
|
2152
|
+
/**
|
|
2153
|
+
* Save port state to .gkm/ports.json.
|
|
2154
|
+
* @internal Exported for testing
|
|
2155
|
+
*/
|
|
2156
|
+
async function savePortState(workspaceRoot, ports) {
|
|
2157
|
+
const dir = (0, node_path.join)(workspaceRoot, ".gkm");
|
|
2158
|
+
await (0, node_fs_promises.mkdir)(dir, { recursive: true });
|
|
2159
|
+
await (0, node_fs_promises.writeFile)((0, node_path.join)(workspaceRoot, PORT_STATE_PATH), `${JSON.stringify(ports, null, 2)}\n`);
|
|
2160
|
+
}
|
|
2161
|
+
/**
|
|
2162
|
+
* Load and flatten a stage's secrets from its store.
|
|
2163
|
+
*
|
|
2164
|
+
* Every key as stored — nothing renamed. An app's database URL is its
|
|
2165
|
+
* construct's key, derived by reconcile, and never a stored per-app value
|
|
2166
|
+
* mapped onto `DATABASE_URL`.
|
|
2167
|
+
* @internal Exported for testing
|
|
2168
|
+
*/
|
|
2169
|
+
async function loadSecretsForApp(store, stage) {
|
|
2170
|
+
const stageSecrets = await store.read(stage);
|
|
2171
|
+
if (!stageSecrets) return {};
|
|
2172
|
+
logger.log(`🔐 Loading secrets from stage: ${stage}`);
|
|
2173
|
+
return require_credentials.toEmbeddableSecrets(stageSecrets);
|
|
2174
|
+
}
|
|
2175
|
+
/**
|
|
2176
|
+
* Walk up the directory tree to find the root containing .gkm/secrets/.
|
|
2177
|
+
* @internal Exported for testing
|
|
2178
|
+
*/
|
|
2179
|
+
function findSecretsRoot(startDir) {
|
|
2180
|
+
let dir = startDir;
|
|
2181
|
+
while (dir !== "/") {
|
|
2182
|
+
if ((0, node_fs.existsSync)((0, node_path.join)(dir, ".gkm", "secrets"))) return dir;
|
|
2183
|
+
const parent = (0, node_path.dirname)(dir);
|
|
2184
|
+
if (parent === dir) break;
|
|
2185
|
+
dir = parent;
|
|
2186
|
+
}
|
|
2187
|
+
return startDir;
|
|
2188
|
+
}
|
|
2189
|
+
/**
|
|
2190
|
+
* Generate the credentials injection code snippet.
|
|
2191
|
+
* This is the common logic used by both entry wrapper and exec preload.
|
|
2192
|
+
* @internal
|
|
2193
|
+
*/
|
|
2194
|
+
function generateCredentialsInjection(secretsJsonPath) {
|
|
2195
|
+
return `import { existsSync, readFileSync } from 'node:fs';
|
|
2196
|
+
|
|
2197
|
+
// Inject dev secrets via globalThis and process.env
|
|
2198
|
+
// Using globalThis.__gkm_credentials__ avoids CJS/ESM interop issues where
|
|
2199
|
+
// Object.assign on the Credentials export only mutates one module copy.
|
|
2200
|
+
const secretsPath = '${secretsJsonPath}';
|
|
2201
|
+
if (existsSync(secretsPath)) {
|
|
2202
|
+
const secrets = JSON.parse(readFileSync(secretsPath, 'utf-8'));
|
|
2203
|
+
globalThis.__gkm_credentials__ = secrets;
|
|
2204
|
+
Object.assign(process.env, secrets);
|
|
2205
|
+
}
|
|
2206
|
+
`;
|
|
2207
|
+
}
|
|
2208
|
+
/**
|
|
2209
|
+
* Create a preload script that injects secrets into Credentials.
|
|
2210
|
+
* Used by `gkm exec` to inject secrets before running any command.
|
|
2211
|
+
* @internal Exported for testing
|
|
2212
|
+
*/
|
|
2213
|
+
async function createCredentialsPreload(preloadPath, secretsJsonPath) {
|
|
2214
|
+
const content = `/**
|
|
2215
|
+
* Credentials preload generated by 'gkm exec'
|
|
2216
|
+
* This file is loaded via NODE_OPTIONS="--import <path>"
|
|
2217
|
+
*/
|
|
2218
|
+
${generateCredentialsInjection(secretsJsonPath)}`;
|
|
2219
|
+
await (0, node_fs_promises.writeFile)(preloadPath, content);
|
|
2220
|
+
}
|
|
2221
|
+
/**
|
|
2222
|
+
* Create a wrapper script that injects secrets before importing the entry file.
|
|
2223
|
+
* @internal Exported for testing
|
|
2224
|
+
*/
|
|
2225
|
+
async function createEntryWrapper(wrapperPath, entryPath, secretsJsonPath) {
|
|
2226
|
+
const content = `#!/usr/bin/env node
|
|
2227
|
+
/**
|
|
2228
|
+
* Entry wrapper generated by 'gkm dev --entry'
|
|
2229
|
+
*/
|
|
2230
|
+
${secretsJsonPath ? `${generateCredentialsInjection(secretsJsonPath)}
|
|
2231
|
+
` : ""}// Import and run the user's entry file (dynamic import ensures secrets load first)
|
|
2232
|
+
await import('${entryPath}');
|
|
2233
|
+
`;
|
|
2234
|
+
await (0, node_fs_promises.writeFile)(wrapperPath, content);
|
|
2235
|
+
}
|
|
2236
|
+
/**
|
|
2237
|
+
* Prepare credentials for dev/exec/test modes.
|
|
2238
|
+
* Loads workspace config, secrets, resolves Docker ports, rewrites URLs,
|
|
2239
|
+
* injects PORT, dependency URLs, and writes credentials JSON.
|
|
2240
|
+
*
|
|
2241
|
+
* @param options.stage - The stage whose secrets to load. Default: the project's `stages.local`.
|
|
2242
|
+
* @param options.startDocker - Start Docker Compose services after port resolution. Default: false.
|
|
2243
|
+
* @param options.secretsFileName - Custom secrets JSON filename. Default: 'dev-secrets-{appName}.json' or 'dev-secrets.json'.
|
|
2244
|
+
* @internal Exported for testing
|
|
2245
|
+
*/
|
|
2246
|
+
async function prepareEntryCredentials(options) {
|
|
2247
|
+
const cwd = options.cwd ?? process.cwd();
|
|
2248
|
+
let workspaceAppPort;
|
|
2249
|
+
let secretsRoot = cwd;
|
|
2250
|
+
let appName;
|
|
2251
|
+
let appInfo;
|
|
2252
|
+
let workspace;
|
|
2253
|
+
try {
|
|
2254
|
+
appInfo = await require_config.loadWorkspaceAppInfo(cwd);
|
|
2255
|
+
workspace = appInfo.workspace;
|
|
2256
|
+
workspaceAppPort = appInfo.app.port;
|
|
2257
|
+
secretsRoot = appInfo.workspaceRoot;
|
|
2258
|
+
appName = appInfo.appName;
|
|
2259
|
+
} catch (error) {
|
|
2260
|
+
if (!(error instanceof require_config.NotInAnApp || error instanceof require_config.ConfigNotFound)) throw error;
|
|
2261
|
+
workspace = await require_config.loadWorkspaceConfig(cwd).then((loaded) => loaded.workspace).catch(() => void 0);
|
|
2262
|
+
secretsRoot = workspace?.root ?? findSecretsRoot(cwd);
|
|
2263
|
+
}
|
|
2264
|
+
if (appName && workspace && options.explicitPort === void 0) {
|
|
2265
|
+
const { assignAppPorts, describeMove, holderOf, withAppPorts } = await Promise.resolve().then(() => require("./appPorts-IW-OZmRi.cjs")).then((n) => n.appPorts_exports);
|
|
2266
|
+
const assigned = await assignAppPorts(workspace, [appName], {
|
|
2267
|
+
free: isPortAvailable,
|
|
2268
|
+
holder: holderOf
|
|
2269
|
+
});
|
|
2270
|
+
for (const move of assigned.moved) logger.log(describeMove(move));
|
|
2271
|
+
workspace = withAppPorts(workspace, assigned.ports);
|
|
2272
|
+
workspaceAppPort = assigned.ports[appName] ?? workspaceAppPort;
|
|
2273
|
+
}
|
|
2274
|
+
if (appName) {
|
|
2275
|
+
const { APP_TAG_ENV, appTag } = await Promise.resolve().then(() => require("./appPorts-IW-OZmRi.cjs")).then((n) => n.appPorts_exports);
|
|
2276
|
+
process.env[APP_TAG_ENV] = appTag(secretsRoot, appName);
|
|
2277
|
+
}
|
|
2278
|
+
const resolvedPort = options.explicitPort ?? workspaceAppPort ?? 3e3;
|
|
2279
|
+
const stage = options.stage ?? workspace?.stages.local;
|
|
2280
|
+
const store = stage ? workspace ? await require_credentials.secretsStoreFor(workspace, stage) : new require_credentials.FileSecretsStore(secretsRoot) : void 0;
|
|
2281
|
+
const credentials = store && stage ? await loadSecretsForApp(store, stage) : {};
|
|
2282
|
+
credentials.PORT = String(resolvedPort);
|
|
2283
|
+
if (appInfo?.app.type === "mobile") credentials.RCT_METRO_PORT = String(resolvedPort);
|
|
2284
|
+
const declaredKeys = [];
|
|
2285
|
+
let reconciled;
|
|
2286
|
+
if (workspace) {
|
|
2287
|
+
const { reconcileWorkspace } = await Promise.resolve().then(() => require("./stack-BYhtz-bE.cjs")).then((n) => n.workspace_exports);
|
|
2288
|
+
const result = await reconcileWorkspace(workspace, {
|
|
2289
|
+
stage: options.reconcileStage ?? workspace.stages.local,
|
|
2290
|
+
start: options.startDocker ?? false
|
|
2291
|
+
});
|
|
2292
|
+
reconciled = result;
|
|
2293
|
+
if (options.scoped && appName) {
|
|
2294
|
+
const { appProcess, processEnv } = await Promise.resolve().then(() => require("./stack-BYhtz-bE.cjs")).then((n) => n.apps_exports);
|
|
2295
|
+
const own = processEnv(result.manifest, appProcess(workspace, result.manifest, result.background, appName), { ...credentials }, result.env);
|
|
2296
|
+
for (const key of Object.keys(credentials)) delete credentials[key];
|
|
2297
|
+
Object.assign(credentials, own);
|
|
2298
|
+
} else Object.assign(credentials, reconciled.env);
|
|
2299
|
+
declaredKeys.push(...Object.keys(reconciled.env).filter((key) => key in credentials));
|
|
2300
|
+
if (Object.keys(reconciled.env).length > 0) logger.log(`🔌 Resolved ${Object.keys(reconciled.env).length} declared URL(s)`);
|
|
2301
|
+
}
|
|
2302
|
+
const secretsDir = (0, node_path.join)(secretsRoot, ".gkm");
|
|
2303
|
+
await (0, node_fs_promises.mkdir)(secretsDir, { recursive: true });
|
|
2304
|
+
const secretsFileName = options.secretsFileName ?? (appName ? `dev-secrets-${appName}.json` : "dev-secrets.json");
|
|
2305
|
+
const secretsJsonPath = (0, node_path.join)(secretsDir, secretsFileName);
|
|
2306
|
+
await (0, node_fs_promises.writeFile)(secretsJsonPath, JSON.stringify(credentials, null, 2));
|
|
2307
|
+
return {
|
|
2308
|
+
credentials,
|
|
2309
|
+
resolvedPort,
|
|
2310
|
+
secretsJsonPath,
|
|
2311
|
+
appName,
|
|
2312
|
+
secretsRoot,
|
|
2313
|
+
appInfo,
|
|
2314
|
+
declaredKeys,
|
|
2315
|
+
...reconciled ? { reconciled } : {}
|
|
2316
|
+
};
|
|
2317
|
+
}
|
|
2318
|
+
//#endregion
|
|
2438
2319
|
Object.defineProperty(exports, "CLUSTER_DATABASE", {
|
|
2439
2320
|
enumerable: true,
|
|
2440
2321
|
get: function() {
|
|
@@ -2525,6 +2406,12 @@ Object.defineProperty(exports, "NoDomainForStage", {
|
|
|
2525
2406
|
return NoDomainForStage;
|
|
2526
2407
|
}
|
|
2527
2408
|
});
|
|
2409
|
+
Object.defineProperty(exports, "POSTGRES_MOUNT", {
|
|
2410
|
+
enumerable: true,
|
|
2411
|
+
get: function() {
|
|
2412
|
+
return POSTGRES_MOUNT;
|
|
2413
|
+
}
|
|
2414
|
+
});
|
|
2528
2415
|
Object.defineProperty(exports, "PROCESSORS_DEV_PREFIX", {
|
|
2529
2416
|
enumerable: true,
|
|
2530
2417
|
get: function() {
|
|
@@ -2567,12 +2454,6 @@ Object.defineProperty(exports, "appTelemetry", {
|
|
|
2567
2454
|
return appTelemetry;
|
|
2568
2455
|
}
|
|
2569
2456
|
});
|
|
2570
|
-
Object.defineProperty(exports, "caddyfileRoot", {
|
|
2571
|
-
enumerable: true,
|
|
2572
|
-
get: function() {
|
|
2573
|
-
return caddyfileRoot;
|
|
2574
|
-
}
|
|
2575
|
-
});
|
|
2576
2457
|
Object.defineProperty(exports, "composeFor", {
|
|
2577
2458
|
enumerable: true,
|
|
2578
2459
|
get: function() {
|
|
@@ -2591,6 +2472,12 @@ Object.defineProperty(exports, "createEntryWrapper", {
|
|
|
2591
2472
|
return createEntryWrapper;
|
|
2592
2473
|
}
|
|
2593
2474
|
});
|
|
2475
|
+
Object.defineProperty(exports, "declaredPostgresImage", {
|
|
2476
|
+
enumerable: true,
|
|
2477
|
+
get: function() {
|
|
2478
|
+
return declaredPostgresImage;
|
|
2479
|
+
}
|
|
2480
|
+
});
|
|
2594
2481
|
Object.defineProperty(exports, "describeServices", {
|
|
2595
2482
|
enumerable: true,
|
|
2596
2483
|
get: function() {
|
|
@@ -2687,6 +2574,12 @@ Object.defineProperty(exports, "loadSecretsForApp", {
|
|
|
2687
2574
|
return loadSecretsForApp;
|
|
2688
2575
|
}
|
|
2689
2576
|
});
|
|
2577
|
+
Object.defineProperty(exports, "localRoutes", {
|
|
2578
|
+
enumerable: true,
|
|
2579
|
+
get: function() {
|
|
2580
|
+
return localRoutes;
|
|
2581
|
+
}
|
|
2582
|
+
});
|
|
2690
2583
|
Object.defineProperty(exports, "logsAccess", {
|
|
2691
2584
|
enumerable: true,
|
|
2692
2585
|
get: function() {
|
|
@@ -2843,12 +2736,6 @@ Object.defineProperty(exports, "siteClientTelemetry", {
|
|
|
2843
2736
|
return siteClientTelemetry;
|
|
2844
2737
|
}
|
|
2845
2738
|
});
|
|
2846
|
-
Object.defineProperty(exports, "sitesFor", {
|
|
2847
|
-
enumerable: true,
|
|
2848
|
-
get: function() {
|
|
2849
|
-
return sitesFor;
|
|
2850
|
-
}
|
|
2851
|
-
});
|
|
2852
2739
|
Object.defineProperty(exports, "stackLogs", {
|
|
2853
2740
|
enumerable: true,
|
|
2854
2741
|
get: function() {
|
|
@@ -2879,12 +2766,6 @@ Object.defineProperty(exports, "telemetryOf", {
|
|
|
2879
2766
|
return telemetryOf;
|
|
2880
2767
|
}
|
|
2881
2768
|
});
|
|
2882
|
-
Object.defineProperty(exports, "toCaddyfile", {
|
|
2883
|
-
enumerable: true,
|
|
2884
|
-
get: function() {
|
|
2885
|
-
return toCaddyfile;
|
|
2886
|
-
}
|
|
2887
|
-
});
|
|
2888
2769
|
Object.defineProperty(exports, "toYaml", {
|
|
2889
2770
|
enumerable: true,
|
|
2890
2771
|
get: function() {
|
|
@@ -2897,6 +2778,12 @@ Object.defineProperty(exports, "usesTelemetry", {
|
|
|
2897
2778
|
return usesTelemetry;
|
|
2898
2779
|
}
|
|
2899
2780
|
});
|
|
2781
|
+
Object.defineProperty(exports, "volumeOf", {
|
|
2782
|
+
enumerable: true,
|
|
2783
|
+
get: function() {
|
|
2784
|
+
return volumeOf;
|
|
2785
|
+
}
|
|
2786
|
+
});
|
|
2900
2787
|
Object.defineProperty(exports, "watchedBuckets", {
|
|
2901
2788
|
enumerable: true,
|
|
2902
2789
|
get: function() {
|
|
@@ -2922,4 +2809,4 @@ Object.defineProperty(exports, "withRedisPassword", {
|
|
|
2922
2809
|
}
|
|
2923
2810
|
});
|
|
2924
2811
|
|
|
2925
|
-
//# sourceMappingURL=
|
|
2812
|
+
//# sourceMappingURL=credentials-Eyx2tM7B.cjs.map
|