@geekmidas/cli 10.0.0-alpha.140 → 10.0.0-alpha.142
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/{EndpointGenerator-BMRL04ic.mjs → EndpointGenerator-CusLH-9S.mjs} +2 -2
- package/dist/{EndpointGenerator-BMRL04ic.mjs.map → EndpointGenerator-CusLH-9S.mjs.map} +1 -1
- package/dist/{EndpointGenerator-ePscnbwB.cjs → EndpointGenerator-DyLMYClE.cjs} +2 -2
- package/dist/{EndpointGenerator-ePscnbwB.cjs.map → EndpointGenerator-DyLMYClE.cjs.map} +1 -1
- package/dist/{GoDaddyProvider-BgY6mqoH.mjs → GoDaddyProvider-BIibcRG4.mjs} +2 -3
- package/dist/{GoDaddyProvider-BgY6mqoH.mjs.map → GoDaddyProvider-BIibcRG4.mjs.map} +1 -1
- package/dist/{GoDaddyProvider-C-rs22Zv.cjs → GoDaddyProvider-C7Zt4dVy.cjs} +5 -6
- package/dist/{GoDaddyProvider-C-rs22Zv.cjs.map → GoDaddyProvider-C7Zt4dVy.cjs.map} +1 -1
- package/dist/{HostingerProvider-DEqpvoiD.cjs → HostingerProvider-BVhFhzCW.cjs} +2 -2
- package/dist/{HostingerProvider-DEqpvoiD.cjs.map → HostingerProvider-BVhFhzCW.cjs.map} +1 -1
- package/dist/{HostingerProvider-CgMuKgO_.mjs → HostingerProvider-DSHpNBim.mjs} +2 -2
- package/dist/{HostingerProvider-CgMuKgO_.mjs.map → HostingerProvider-DSHpNBim.mjs.map} +1 -1
- package/dist/{LegacyStateStore-Dx65SWE9.mjs → LegacyStateStore-Bd2I3zz7.mjs} +3 -3
- package/dist/{LegacyStateStore-Dx65SWE9.mjs.map → LegacyStateStore-Bd2I3zz7.mjs.map} +1 -1
- package/dist/{LegacyStateStore-6xskEtld.cjs → LegacyStateStore-DzRGMFhs.cjs} +3 -3
- package/dist/{LegacyStateStore-6xskEtld.cjs.map → LegacyStateStore-DzRGMFhs.cjs.map} +1 -1
- package/dist/{LocalStateStore-DFtTtHty.cjs → LocalStateStore-Ci_tzIfp.cjs} +2 -2
- package/dist/{LocalStateStore-DFtTtHty.cjs.map → LocalStateStore-Ci_tzIfp.cjs.map} +1 -1
- package/dist/{LocalStateStore-Dto39TCx.mjs → LocalStateStore-CzNrVQd2.mjs} +2 -2
- package/dist/{LocalStateStore-Dto39TCx.mjs.map → LocalStateStore-CzNrVQd2.mjs.map} +1 -1
- package/dist/{OpenApiTsGenerator-B-PQLx8X.mjs → OpenApiTsGenerator-BTMuu1WS.mjs} +2 -2
- package/dist/{OpenApiTsGenerator-B-PQLx8X.mjs.map → OpenApiTsGenerator-BTMuu1WS.mjs.map} +1 -1
- package/dist/{OpenApiTsGenerator-BvacdbiG.cjs → OpenApiTsGenerator-CI-tceXV.cjs} +2 -2
- package/dist/{OpenApiTsGenerator-BvacdbiG.cjs.map → OpenApiTsGenerator-CI-tceXV.cjs.map} +1 -1
- package/dist/{S3StateStore-C01zMOYm.mjs → S3StateStore-DVtcCMEc.mjs} +4 -4
- package/dist/{S3StateStore-C01zMOYm.mjs.map → S3StateStore-DVtcCMEc.mjs.map} +1 -1
- package/dist/{S3StateStore-B-9ea-sX.cjs → S3StateStore-LrKb9lH7.cjs} +5 -5
- package/dist/{S3StateStore-B-9ea-sX.cjs.map → S3StateStore-LrKb9lH7.cjs.map} +1 -1
- package/dist/{SSMStateStore-k-4XM7mb.mjs → SSMStateStore-CNHYH6g7.mjs} +2 -2
- package/dist/{SSMStateStore-k-4XM7mb.mjs.map → SSMStateStore-CNHYH6g7.mjs.map} +1 -1
- package/dist/{SSMStateStore-CKArcPUh.cjs → SSMStateStore-CpkvL95K.cjs} +2 -2
- package/dist/{SSMStateStore-CKArcPUh.cjs.map → SSMStateStore-CpkvL95K.cjs.map} +1 -1
- package/dist/{SubscriberGenerator-DR4Y7ihK.cjs → SubscriberGenerator-BNJyPmXJ.cjs} +3 -3
- package/dist/{SubscriberGenerator-DR4Y7ihK.cjs.map → SubscriberGenerator-BNJyPmXJ.cjs.map} +1 -1
- package/dist/{SubscriberGenerator-DLPH-ynS.mjs → SubscriberGenerator-CzPrixYu.mjs} +3 -3
- package/dist/{SubscriberGenerator-DLPH-ynS.mjs.map → SubscriberGenerator-CzPrixYu.mjs.map} +1 -1
- package/dist/{add-BgzsYxUq.cjs → add-AlV6_ljM.cjs} +18 -17
- package/dist/{add-BgzsYxUq.cjs.map → add-AlV6_ljM.cjs.map} +1 -1
- package/dist/{add-CiIrpOb9.mjs → add-B51nMuUd.mjs} +8 -7
- package/dist/{add-CiIrpOb9.mjs.map → add-B51nMuUd.mjs.map} +1 -1
- package/dist/apps-C1KiJqth.mjs +4593 -0
- package/dist/apps-C1KiJqth.mjs.map +1 -0
- package/dist/apps-CPdR2pYw.cjs +5002 -0
- package/dist/apps-CPdR2pYw.cjs.map +1 -0
- package/dist/{bundler-DKxuDoVL.cjs → bundler-B-hw8rJi.cjs} +33 -9
- package/dist/bundler-B-hw8rJi.cjs.map +1 -0
- package/dist/{bundler-C4uMSy8e.mjs → bundler-DbIt3a6I.mjs} +34 -10
- package/dist/bundler-DbIt3a6I.mjs.map +1 -0
- package/dist/{cli-na0npMhC.cjs → cli-6eYxU_Q2.cjs} +4 -4
- package/dist/{cli-na0npMhC.cjs.map → cli-6eYxU_Q2.cjs.map} +1 -1
- package/dist/{cli-Bm2is6R_.mjs → cli-CmmrPCM_.mjs} +4 -4
- package/dist/{cli-Bm2is6R_.mjs.map → cli-CmmrPCM_.mjs.map} +1 -1
- package/dist/compose-B2dCLbrc.cjs +1895 -0
- package/dist/compose-B2dCLbrc.cjs.map +1 -0
- package/dist/{compose-CVatM7Cl.mjs → compose-DVARqEeR.mjs} +16 -1830
- package/dist/compose-DVARqEeR.mjs.map +1 -0
- package/dist/{compose-D8U9ygdm.cjs → compose-D_fNsrkx.cjs} +101 -1969
- package/dist/compose-D_fNsrkx.cjs.map +1 -0
- package/dist/compose-kOpW9Pa1.mjs +1554 -0
- package/dist/compose-kOpW9Pa1.mjs.map +1 -0
- package/dist/config-BKpzKP6W.mjs +659 -0
- package/dist/config-BKpzKP6W.mjs.map +1 -0
- package/dist/config-QAqAEgb0.cjs +772 -0
- package/dist/config-QAqAEgb0.cjs.map +1 -0
- package/dist/config.cjs +16 -419
- package/dist/config.mjs +2 -405
- package/dist/{credentialSchemas-DZ2Nh5li.cjs → credentialSchemas-BAklWDna.cjs} +4 -5
- package/dist/{credentialSchemas-DZ2Nh5li.cjs.map → credentialSchemas-BAklWDna.cjs.map} +1 -1
- package/dist/{credentialSchemas-DUCSYl9a.mjs → credentialSchemas-mz9QZTYh.mjs} +2 -3
- package/dist/{credentialSchemas-DUCSYl9a.mjs.map → credentialSchemas-mz9QZTYh.mjs.map} +1 -1
- package/dist/credentials-CIpa4Hgs.cjs +2336 -0
- package/dist/credentials-CIpa4Hgs.cjs.map +1 -0
- package/dist/credentials-CWa7hRXd.mjs +1851 -0
- package/dist/credentials-CWa7hRXd.mjs.map +1 -0
- package/dist/{databases-P824RTnx.cjs → databases-DawSdqBI.cjs} +2 -2
- package/dist/{databases-P824RTnx.cjs.map → databases-DawSdqBI.cjs.map} +1 -1
- package/dist/{databases-Db48ZIXL.mjs → databases-mzSUFBTw.mjs} +2 -2
- package/dist/{databases-Db48ZIXL.mjs.map → databases-mzSUFBTw.mjs.map} +1 -1
- package/dist/deploy/public.cjs +24 -24
- package/dist/deploy/public.cjs.map +1 -1
- package/dist/deploy/public.d.cts.map +1 -1
- package/dist/deploy/public.d.mts.map +1 -1
- package/dist/deploy/public.mjs +13 -13
- package/dist/{deploy-DrQB7ytj.cjs → deploy-CjJ447kd.cjs} +73 -72
- package/dist/{deploy-DrQB7ytj.cjs.map → deploy-CjJ447kd.cjs.map} +1 -1
- package/dist/{deploy-CDcO08Xz.mjs → deploy-DqJiCwI9.mjs} +16 -15
- package/dist/{deploy-CDcO08Xz.mjs.map → deploy-DqJiCwI9.mjs.map} +1 -1
- package/dist/{discover-yqeJ2Bx7.cjs → discover-CRywE7yc.cjs} +157 -6
- package/dist/discover-CRywE7yc.cjs.map +1 -0
- package/dist/{discover-B2m8ytyq.mjs → discover-DbDrCQ8h.mjs} +117 -8
- package/dist/discover-DbDrCQ8h.mjs.map +1 -0
- package/dist/docker-CCzFCus7.mjs +1407 -0
- package/dist/docker-CCzFCus7.mjs.map +1 -0
- package/dist/docker-DK4rmb0u.cjs +1514 -0
- package/dist/docker-DK4rmb0u.cjs.map +1 -0
- package/dist/{dokploy-k4_ZN8zN.mjs → dokploy-B5_Y5wf0.mjs} +2 -2
- package/dist/{dokploy-k4_ZN8zN.mjs.map → dokploy-B5_Y5wf0.mjs.map} +1 -1
- package/dist/{dokploy-BKjPDvSN.cjs → dokploy-EJKX2T7M.cjs} +2 -2
- package/dist/{dokploy-BKjPDvSN.cjs.map → dokploy-EJKX2T7M.cjs.map} +1 -1
- package/dist/{drivers-C47nm-wB.cjs → drivers-aM87NQJi.cjs} +4 -91
- package/dist/drivers-aM87NQJi.cjs.map +1 -0
- package/dist/{drivers-CDjpjakg.mjs → drivers-uxLBq3e3.mjs} +3 -60
- package/dist/drivers-uxLBq3e3.mjs.map +1 -0
- package/dist/{eas-Bg4dI6n2.cjs → eas-AqSay-vE.cjs} +6 -6
- package/dist/{eas-Bg4dI6n2.cjs.map → eas-AqSay-vE.cjs.map} +1 -1
- package/dist/{eas-B1wBvwPH.mjs → eas-BQlD6Z-u.mjs} +3 -3
- package/dist/{eas-B1wBvwPH.mjs.map → eas-BQlD6Z-u.mjs.map} +1 -1
- package/dist/{encryption-DL_y8t6V.cjs → encryption-B6_aL5d-.cjs} +6 -6
- package/dist/{encryption-DL_y8t6V.cjs.map → encryption-B6_aL5d-.cjs.map} +1 -1
- package/dist/{encryption-Bve0PVOo.mjs → encryption-Dlh5mcE1.mjs} +3 -3
- package/dist/{encryption-Bve0PVOo.mjs.map → encryption-Dlh5mcE1.mjs.map} +1 -1
- package/dist/{engine-BhR5lt_V.cjs → engine-BAkmPI2z.cjs} +99 -97
- package/dist/{engine-BhR5lt_V.cjs.map → engine-BAkmPI2z.cjs.map} +1 -1
- package/dist/{engine-HMLf20iZ.mjs → engine-D3P2P6RK.mjs} +12 -10
- package/dist/{engine-HMLf20iZ.mjs.map → engine-D3P2P6RK.mjs.map} +1 -1
- package/dist/{github-B2hJVl-n.cjs → github-DokGIXT-.cjs} +18 -17
- package/dist/{github-B2hJVl-n.cjs.map → github-DokGIXT-.cjs.map} +1 -1
- package/dist/{github-DKn9ACi2.mjs → github-STWxD6cu.mjs} +9 -8
- package/dist/{github-DKn9ACi2.mjs.map → github-STWxD6cu.mjs.map} +1 -1
- package/dist/{googlePlay-DtuN0-7D.cjs → googlePlay-DL0htRJD.cjs} +5 -5
- package/dist/{googlePlay-DtuN0-7D.cjs.map → googlePlay-DL0htRJD.cjs.map} +1 -1
- package/dist/{googlePlay-CWq7ND_X.mjs → googlePlay-uAyXzxlu.mjs} +5 -5
- package/dist/{googlePlay-CWq7ND_X.mjs.map → googlePlay-uAyXzxlu.mjs.map} +1 -1
- package/dist/index.cjs +196 -192
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +70 -66
- package/dist/index.mjs.map +1 -1
- package/dist/{local-OPC9BCZt.cjs → local-C6ndR_Wx.cjs} +6 -6
- package/dist/{local-OPC9BCZt.cjs.map → local-C6ndR_Wx.cjs.map} +1 -1
- package/dist/{local-B7Zv1NoA.mjs → local-CC7rdmgg.mjs} +3 -3
- package/dist/{local-B7Zv1NoA.mjs.map → local-CC7rdmgg.mjs.map} +1 -1
- package/dist/{migrate-BLVZqHtN.cjs → migrate-BbJUJ4CY.cjs} +6 -6
- package/dist/{migrate-BLVZqHtN.cjs.map → migrate-BbJUJ4CY.cjs.map} +1 -1
- package/dist/{migrate-iUui7B4q.cjs → migrate-CMurhHuj.cjs} +15 -13
- package/dist/{migrate-iUui7B4q.cjs.map → migrate-CMurhHuj.cjs.map} +1 -1
- package/dist/{migrate-W0ruUNb9.mjs → migrate-D079sADO.mjs} +3 -3
- package/dist/{migrate-W0ruUNb9.mjs.map → migrate-D079sADO.mjs.map} +1 -1
- package/dist/{migrate-DCvD4RJW.mjs → migrate-D27h4H79.mjs} +7 -5
- package/dist/{migrate-DCvD4RJW.mjs.map → migrate-D27h4H79.mjs.map} +1 -1
- package/dist/notes-B655tUny.cjs +500 -0
- package/dist/notes-B655tUny.cjs.map +1 -0
- package/dist/notes-wPJlNUj7.mjs +399 -0
- package/dist/notes-wPJlNUj7.mjs.map +1 -0
- package/dist/openapi.cjs +4 -5
- package/dist/openapi.cjs.map +1 -1
- package/dist/openapi.mjs +3 -4
- package/dist/openapi.mjs.map +1 -1
- package/dist/{projectBucket-BBbQ1lHF.cjs → projectBucket-Bs8ftcgB.cjs} +2 -2
- package/dist/{projectBucket-BBbQ1lHF.cjs.map → projectBucket-Bs8ftcgB.cjs.map} +1 -1
- package/dist/{projectBucket-C_DN4WzF.mjs → projectBucket-XVxyvW1y.mjs} +2 -2
- package/dist/{projectBucket-C_DN4WzF.mjs.map → projectBucket-XVxyvW1y.mjs.map} +1 -1
- package/dist/{publish-CxIBBD3b.mjs → publish-B9BNIaf2.mjs} +2 -2
- package/dist/{publish-CxIBBD3b.mjs.map → publish-B9BNIaf2.mjs.map} +1 -1
- package/dist/{publish-CqvDA5ry.cjs → publish-Bwgb-1JN.cjs} +2 -2
- package/dist/{publish-CqvDA5ry.cjs.map → publish-Bwgb-1JN.cjs.map} +1 -1
- package/dist/{ready-DuU0FXSj.cjs → ready-BNh3zsSn.cjs} +6 -6
- package/dist/{ready-DuU0FXSj.cjs.map → ready-BNh3zsSn.cjs.map} +1 -1
- package/dist/{ready-CGqJ74Kt.mjs → ready-g25dcGzK.mjs} +6 -6
- package/dist/{ready-CGqJ74Kt.mjs.map → ready-g25dcGzK.mjs.map} +1 -1
- package/dist/reconcile/public.cjs +1 -1
- package/dist/reconcile/public.mjs +1 -1
- package/dist/{resolve-CMC0MI0Z.mjs → resolve-DheFxtmy.mjs} +4 -4
- package/dist/{resolve-CMC0MI0Z.mjs.map → resolve-DheFxtmy.mjs.map} +1 -1
- package/dist/{resolve-BEVVvi13.cjs → resolve-Dir9EjMu.cjs} +4 -4
- package/dist/{resolve-BEVVvi13.cjs.map → resolve-Dir9EjMu.cjs.map} +1 -1
- package/dist/{rollback-CZiQkukY.mjs → rollback-BWAB77F9.mjs} +8 -8
- package/dist/{rollback-CZiQkukY.mjs.map → rollback-BWAB77F9.mjs.map} +1 -1
- package/dist/{rollback-e0zGkaBx.cjs → rollback-CrtuUKqe.cjs} +11 -11
- package/dist/{rollback-e0zGkaBx.cjs.map → rollback-CrtuUKqe.cjs.map} +1 -1
- package/dist/{s3-BKnL6YGQ.cjs → s3-DKJfDHUQ.cjs} +2 -2
- package/dist/{s3-BKnL6YGQ.cjs.map → s3-DKJfDHUQ.cjs.map} +1 -1
- package/dist/{s3-DW7SLsb8.mjs → s3-DNp8U0Ea.mjs} +2 -2
- package/dist/{s3-DW7SLsb8.mjs.map → s3-DNp8U0Ea.mjs.map} +1 -1
- package/dist/sandbox/credentials-worker.cjs +3 -4
- package/dist/sandbox/credentials-worker.cjs.map +1 -1
- package/dist/sandbox/credentials-worker.mjs +2 -3
- package/dist/sandbox/credentials-worker.mjs.map +1 -1
- package/dist/sandbox/discover-worker.cjs +1 -1
- package/dist/sandbox/discover-worker.mjs +1 -1
- package/dist/sandbox/migrate-worker.cjs +3 -4
- package/dist/sandbox/migrate-worker.cjs.map +1 -1
- package/dist/sandbox/migrate-worker.mjs +2 -3
- package/dist/sandbox/migrate-worker.mjs.map +1 -1
- package/dist/seeds-B3xvUAQf.cjs +363 -0
- package/dist/seeds-B3xvUAQf.cjs.map +1 -0
- package/dist/seeds-BCC8vAXR.mjs +298 -0
- package/dist/seeds-BCC8vAXR.mjs.map +1 -0
- package/dist/{serverSetup-D2Xzsp2t.cjs → serverSetup-BVL9HhNE.cjs} +9 -8
- package/dist/{serverSetup-D2Xzsp2t.cjs.map → serverSetup-BVL9HhNE.cjs.map} +1 -1
- package/dist/{serverSetup-C3Tt9X1R.mjs → serverSetup-D---hcyW.mjs} +7 -6
- package/dist/{serverSetup-C3Tt9X1R.mjs.map → serverSetup-D---hcyW.mjs.map} +1 -1
- package/dist/{sniffer-BWgXPFAt.cjs → sniffer-BjHnOaCe.cjs} +9 -10
- package/dist/{sniffer-BWgXPFAt.cjs.map → sniffer-BjHnOaCe.cjs.map} +1 -1
- package/dist/{sniffer-eEF_fIId.mjs → sniffer-DOyzfgPF.mjs} +8 -9
- package/dist/{sniffer-eEF_fIId.mjs.map → sniffer-DOyzfgPF.mjs.map} +1 -1
- package/dist/{snsSubscriptions-BSoqUgsq.mjs → snsSubscriptions-Cf5DZfO5.mjs} +4 -453
- package/dist/snsSubscriptions-Cf5DZfO5.mjs.map +1 -0
- package/dist/{snsSubscriptions-Y9declDd.cjs → snsSubscriptions-DB0iRByH.cjs} +12 -559
- package/dist/snsSubscriptions-DB0iRByH.cjs.map +1 -0
- package/dist/{sst-Bz2HJlqc.mjs → sst-3V-rcKcw.mjs} +27 -5
- package/dist/sst-3V-rcKcw.mjs.map +1 -0
- package/dist/{sst-lvCHdYsY.cjs → sst-DuU7Ju0c.cjs} +29 -7
- package/dist/sst-DuU7Ju0c.cjs.map +1 -0
- package/dist/stack-BRKZ69bf.mjs +2307 -0
- package/dist/stack-BRKZ69bf.mjs.map +1 -0
- package/dist/stack-CmHjkg7D.cjs +2536 -0
- package/dist/stack-CmHjkg7D.cjs.map +1 -0
- package/dist/{stage-DhcbcAar.mjs → stage-CTq3Gjsx.mjs} +7 -7
- package/dist/{stage-DhcbcAar.mjs.map → stage-CTq3Gjsx.mjs.map} +1 -1
- package/dist/{stage-BEcxppsu.cjs → stage-s_8HOsH0.cjs} +13 -13
- package/dist/{stage-BEcxppsu.cjs.map → stage-s_8HOsH0.cjs.map} +1 -1
- package/dist/{stages--icWbhPy.cjs → stages-CFI0OiLj.cjs} +2 -2
- package/dist/{stages--icWbhPy.cjs.map → stages-CFI0OiLj.cjs.map} +1 -1
- package/dist/{stages-CUwSy39f.mjs → stages-DoYa81kN.mjs} +2 -2
- package/dist/{stages-CUwSy39f.mjs.map → stages-DoYa81kN.mjs.map} +1 -1
- package/dist/target/public.cjs +1 -1
- package/dist/target/public.mjs +1 -1
- package/dist/{terminal-DURcYlVX.cjs → terminal-ChxtuTYJ.cjs} +3 -3
- package/dist/{terminal-DURcYlVX.cjs.map → terminal-ChxtuTYJ.cjs.map} +1 -1
- package/dist/{terminal-yOZ7kKF9.mjs → terminal-oHKnZHkT.mjs} +3 -3
- package/dist/{terminal-yOZ7kKF9.mjs.map → terminal-oHKnZHkT.mjs.map} +1 -1
- package/dist/types-Bl_CwZC9.cjs +90 -0
- package/dist/types-Bl_CwZC9.cjs.map +1 -0
- package/dist/types-Y1NfWlyG.mjs +61 -0
- package/dist/types-Y1NfWlyG.mjs.map +1 -0
- package/dist/vitest.cjs +1 -1
- package/dist/vitest.mjs +1 -1
- package/package.json +15 -15
- package/dist/bundler-C4uMSy8e.mjs.map +0 -1
- package/dist/bundler-DKxuDoVL.cjs.map +0 -1
- package/dist/compose-CVatM7Cl.mjs.map +0 -1
- package/dist/compose-D8U9ygdm.cjs.map +0 -1
- package/dist/config.cjs.map +0 -1
- package/dist/config.mjs.map +0 -1
- package/dist/credentials-D7XJypNd.cjs +0 -520
- package/dist/credentials-D7XJypNd.cjs.map +0 -1
- package/dist/credentials-DpfnUvIR.mjs +0 -395
- package/dist/credentials-DpfnUvIR.mjs.map +0 -1
- package/dist/derive-Cd7Hl3r2.mjs +0 -259
- package/dist/derive-Cd7Hl3r2.mjs.map +0 -1
- package/dist/derive-CgZfoBU2.cjs +0 -282
- package/dist/derive-CgZfoBU2.cjs.map +0 -1
- package/dist/discover-B2m8ytyq.mjs.map +0 -1
- package/dist/discover-yqeJ2Bx7.cjs.map +0 -1
- package/dist/drivers-C47nm-wB.cjs.map +0 -1
- package/dist/drivers-CDjpjakg.mjs.map +0 -1
- package/dist/identity-CBXr4wNi.mjs +0 -129
- package/dist/identity-CBXr4wNi.mjs.map +0 -1
- package/dist/identity-CbLfgQNT.cjs +0 -182
- package/dist/identity-CbLfgQNT.cjs.map +0 -1
- package/dist/sandbox-CHv3OYXg.cjs +0 -165
- package/dist/sandbox-CHv3OYXg.cjs.map +0 -1
- package/dist/sandbox-CbVB7uOD.mjs +0 -118
- package/dist/sandbox-CbVB7uOD.mjs.map +0 -1
- package/dist/seeds-BR_7hJTw.cjs +0 -10541
- package/dist/seeds-BR_7hJTw.cjs.map +0 -1
- package/dist/seeds-nCxxlP5h.mjs +0 -9418
- package/dist/seeds-nCxxlP5h.mjs.map +0 -1
- package/dist/snsSubscriptions-BSoqUgsq.mjs.map +0 -1
- package/dist/snsSubscriptions-Y9declDd.cjs.map +0 -1
- package/dist/sst-Bz2HJlqc.mjs.map +0 -1
- package/dist/sst-lvCHdYsY.cjs.map +0 -1
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
|
|
2
2
|
const require_errors = require("./errors-DMC4Umsb.cjs");
|
|
3
|
-
const require_credentials = require("./credentials-
|
|
3
|
+
const require_credentials = require("./credentials-CIpa4Hgs.cjs");
|
|
4
4
|
const require_workspace = require("./workspace-Dkm3HL9e.cjs");
|
|
5
|
-
const
|
|
5
|
+
const require_stack = require("./stack-CmHjkg7D.cjs");
|
|
6
6
|
const require_define = require("./define-crmMcXFS.cjs");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
7
|
+
const require_compose = require("./compose-B2dCLbrc.cjs");
|
|
8
|
+
const require_apps = require("./apps-CPdR2pYw.cjs");
|
|
9
|
+
const require_discover = require("./discover-CRywE7yc.cjs");
|
|
10
|
+
const require_docker = require("./docker-DK4rmb0u.cjs");
|
|
11
|
+
const require_snsSubscriptions = require("./snsSubscriptions-DB0iRByH.cjs");
|
|
12
|
+
const require_drivers = require("./drivers-aM87NQJi.cjs");
|
|
13
|
+
const require_seeds = require("./seeds-B3xvUAQf.cjs");
|
|
14
|
+
const require_databases = require("./databases-DawSdqBI.cjs");
|
|
14
15
|
let node_path = require("node:path");
|
|
15
16
|
let node_fs = require("node:fs");
|
|
16
17
|
let node_fs_promises = require("node:fs/promises");
|
|
@@ -649,1822 +650,6 @@ const sshAccess = {
|
|
|
649
650
|
}
|
|
650
651
|
};
|
|
651
652
|
//#endregion
|
|
652
|
-
//#region src/compose/routes.ts
|
|
653
|
-
/** A route with handlers and a check that would have to hold for each of them. */
|
|
654
|
-
var EdgeRouteConflict = class extends Error {
|
|
655
|
-
route;
|
|
656
|
-
constructor(route) {
|
|
657
|
-
super(`The edge route '${route}' sends some paths to other upstreams and also restricts who or what it answers. The two are not combined: give the restricted paths a host of their own.`);
|
|
658
|
-
this.route = route;
|
|
659
|
-
this.name = "EdgeRouteConflict";
|
|
660
|
-
}
|
|
661
|
-
};
|
|
662
|
-
/** @throws {EdgeRouteConflict} */
|
|
663
|
-
function assertRouteRenderable(route) {
|
|
664
|
-
if (route.handlers?.length && (route.allow || route.paths || route.prefixes || route.requireHeader)) throw new EdgeRouteConflict(route.name);
|
|
665
|
-
}
|
|
666
|
-
/** File descriptors a process holding sockets may open. */
|
|
667
|
-
const NOFILE = {
|
|
668
|
-
soft: 1048576,
|
|
669
|
-
hard: 1048576
|
|
670
|
-
};
|
|
671
|
-
/**
|
|
672
|
-
* What the edge runs with: a descriptor per socket, twice — the client's and
|
|
673
|
-
* the upstream's — and every local port for those upstream connections. One
|
|
674
|
-
* edge address to one upstream has only the ephemeral range to open
|
|
675
|
-
* connections from, ~28k by Linux's default; widened, ~64k per replica.
|
|
676
|
-
*/
|
|
677
|
-
const EDGE_LIMITS = {
|
|
678
|
-
sysctls: { "net.ipv4.ip_local_port_range": "1024 65535" },
|
|
679
|
-
ulimits: { nofile: NOFILE }
|
|
680
|
-
};
|
|
681
|
-
//#endregion
|
|
682
|
-
//#region src/compose/caddyfile.ts
|
|
683
|
-
/**
|
|
684
|
-
* The stack's own edge, rendered for Caddy: one site block per route.
|
|
685
|
-
*
|
|
686
|
-
* Deployed, each host is the stage's real domain and Caddy gets it a
|
|
687
|
-
* certificate from Let's Encrypt on first request — the same automatic HTTPS
|
|
688
|
-
* it does anywhere, with nothing to configure but the name — or serves the
|
|
689
|
-
* stage's own certificate (`deploy.compose.tls`). Locally the hosts are
|
|
690
|
-
* `*.localhost` and the certificates come from Caddy's own CA, as the `gkm
|
|
691
|
-
* dev` edge does, so a local stack is `https://` like a deployed one.
|
|
692
|
-
*
|
|
693
|
-
* Pure: the routes are data (`routes.ts`), and rendering them is one string.
|
|
694
|
-
*/
|
|
695
|
-
/** Where Caddy reads a stage's own certificate, inside its container. */
|
|
696
|
-
const CADDY_TLS_DIR = "/etc/caddy/tls";
|
|
697
|
-
/** An upstream on the stack's own network: its service name. */
|
|
698
|
-
function address({ service, port }) {
|
|
699
|
-
return `${service}:${port}`;
|
|
700
|
-
}
|
|
701
|
-
/** The Caddyfile for a stack's edge. */
|
|
702
|
-
function edgeCaddyfile(routes, options) {
|
|
703
|
-
const { tls } = options;
|
|
704
|
-
const ask = routes.find((route) => route.wildcard?.tls.kind === "on-demand")?.wildcard?.tls;
|
|
705
|
-
const onDemand = ask?.kind === "on-demand" ? `
|
|
706
|
-
on_demand_tls {
|
|
707
|
-
ask ${ask.ask}
|
|
708
|
-
}` : "";
|
|
709
|
-
const global = tls.kind === "internal" ? `{
|
|
710
|
-
# No ACME and no public DNS: the CA is Caddy's own and the names resolve
|
|
711
|
-
# to this machine.
|
|
712
|
-
local_certs
|
|
713
|
-
auto_https disable_redirects
|
|
714
|
-
}` : options.email || onDemand ? `{${options.email ? `\n\temail ${options.email}` : ""}${onDemand}
|
|
715
|
-
}` : "";
|
|
716
|
-
const certificate = tls.kind === "internal" ? `
|
|
717
|
-
tls internal
|
|
718
|
-
` : tls.kind === "files" ? `
|
|
719
|
-
tls ${tls.certFile} ${tls.keyFile}
|
|
720
|
-
` : "";
|
|
721
|
-
const blocks = [...routes.filter((route) => !route.wildcard), ...routes.filter((route) => route.wildcard)].map((route) => siteBlock(route, route.wildcard?.tls.kind === "on-demand" ? `
|
|
722
|
-
tls {
|
|
723
|
-
on_demand
|
|
724
|
-
}
|
|
725
|
-
` : certificate));
|
|
726
|
-
return `${HEADER}${global ? `${global}\n\n` : ""}${blocks.join("\n\n")}\n`;
|
|
727
|
-
}
|
|
728
|
-
/** One route's site block. */
|
|
729
|
-
function siteBlock(route, certificate) {
|
|
730
|
-
assertRouteRenderable(route);
|
|
731
|
-
const { host, allow, auth, paths, prefixes, requireHeader, handlers } = route;
|
|
732
|
-
const allowed = [...paths ?? [], ...(prefixes ?? []).map((prefix) => `${prefix}*`)];
|
|
733
|
-
const except = route.wildcard?.except ?? [];
|
|
734
|
-
const checks = `${except.length ? `
|
|
735
|
-
# Labels no tenant may take, although nothing in this stack answers them.
|
|
736
|
-
@protected host ${except.map((label) => `${label}.${route.wildcard?.domain}`).join(" ")}
|
|
737
|
-
respond @protected 404
|
|
738
|
-
` : ""}${allow ? `
|
|
739
|
-
# Only these addresses — the peer Caddy sees, never a header a client
|
|
740
|
-
# could set. Everything else is refused before it reaches the upstream.
|
|
741
|
-
@denied not remote_ip ${allow.join(" ")}
|
|
742
|
-
respond @denied 403
|
|
743
|
-
` : ""}${requireHeader ? `
|
|
744
|
-
# Only what the CDN sends: it adds this header to every request, and this
|
|
745
|
-
# host would be reached around the CDN otherwise.
|
|
746
|
-
@forged not header ${requireHeader.name} "${requireHeader.value}"
|
|
747
|
-
respond @forged 403
|
|
748
|
-
` : ""}${auth ? `
|
|
749
|
-
# The stage's login, asked for before anything reaches the upstream.
|
|
750
|
-
basic_auth {
|
|
751
|
-
${auth.user} ${auth.hash}
|
|
752
|
-
}
|
|
753
|
-
` : ""}${allowed.length ? `
|
|
754
|
-
# Only these paths answer. Everything else on this host is refused before
|
|
755
|
-
# it reaches the upstream.
|
|
756
|
-
@elsewhere not path ${allowed.join(" ")}
|
|
757
|
-
respond @elsewhere 404
|
|
758
|
-
` : ""}`;
|
|
759
|
-
const proxy = proxyBlock(route);
|
|
760
|
-
const body = handlers?.length ? `${handlers.map((handler, index) => `
|
|
761
|
-
# Answered by another service: ${handler.name}.
|
|
762
|
-
@handler${index} path ${handler.prefixes.map((prefix) => `${prefix}*`).join(" ")}
|
|
763
|
-
handle @handler${index} {
|
|
764
|
-
reverse_proxy ${handler.upstreams.map(address).join(" ")}
|
|
765
|
-
}
|
|
766
|
-
`).join("")}
|
|
767
|
-
handle {${proxy.replace(/\n/g, "\n ")}
|
|
768
|
-
}` : proxy;
|
|
769
|
-
return `https://${host} {${certificate}
|
|
770
|
-
# gkm's own header, which only a service of this stack may send: the auth
|
|
771
|
-
# server rate-limits by the client address it carries.
|
|
772
|
-
request_header -${_geekmidas_manifest.CLIENT_IP_HEADER}
|
|
773
|
-
${checks}${body}
|
|
774
|
-
}`;
|
|
775
|
-
}
|
|
776
|
-
/** Where a route's requests go, when no handler took them. */
|
|
777
|
-
function proxyBlock({ upstreams, prefix, streaming }) {
|
|
778
|
-
return prefix ? `
|
|
779
|
-
# A bucket, served at a host of its own: the bucket is a prefix on MinIO,
|
|
780
|
-
# which routes and signs on the Host header — so it is sent the upstream's.
|
|
781
|
-
reverse_proxy ${upstreams.map(address).join(" ")} {
|
|
782
|
-
rewrite ${prefix}{uri}
|
|
783
|
-
header_up Host {upstream_hostport}
|
|
784
|
-
}` : `
|
|
785
|
-
# Host and X-Forwarded-* are passed through as Caddy does by default, so
|
|
786
|
-
# an app builds redirects, cookies and links on the address a caller used.
|
|
787
|
-
reverse_proxy ${upstreams.map(address).join(" ")}${streaming ? ` {
|
|
788
|
-
# Never buffer: a streamed response — server-sent events, a Next.js
|
|
789
|
-
# RSC payload — reaches the client as each chunk is written.
|
|
790
|
-
flush_interval -1
|
|
791
|
-
}` : ""}`;
|
|
792
|
-
}
|
|
793
|
-
const HEADER = `# Generated by gkm compose from the construct manifest — do not edit.
|
|
794
|
-
#
|
|
795
|
-
# One host per API and site, each in front of its own container, one per
|
|
796
|
-
# file server in front of the stack's MinIO — its processors' paths sent to
|
|
797
|
-
# their own service — one per worker SNS pushes to and per processor unit a
|
|
798
|
-
# CDN reaches, answering only those paths, and — when its logs are served
|
|
799
|
-
# publicly — one for OpenObserve, to the addresses it allows. A site the
|
|
800
|
-
# stage puts behind a password asks for its login first.
|
|
801
|
-
`;
|
|
802
|
-
//#endregion
|
|
803
|
-
//#region src/compose/images.ts
|
|
804
|
-
/**
|
|
805
|
-
* Which image each app runs — and, for a tag, whether every one exists.
|
|
806
|
-
*
|
|
807
|
-
* A tag is a release's identity: `--tag=v1.4.0` means the images CI pushed as
|
|
808
|
-
* v1.4.0, and nothing else. So a stack is never half rolled out: every app's
|
|
809
|
-
* image is asked of the registry before anything is pulled or the running
|
|
810
|
-
* stack is touched, and one missing image stops the whole run naming every
|
|
811
|
-
* one that is missing. Nor is a missing image quietly built instead — a build
|
|
812
|
-
* of whatever is checked out here is not the release the tag names.
|
|
813
|
-
*/
|
|
814
|
-
/**
|
|
815
|
-
* The tag a site's image carries for a release.
|
|
816
|
-
*
|
|
817
|
-
* A site's public URLs are inlined when it is built, so one bundle serves one
|
|
818
|
-
* stage: `v1.4.0-production` and `v1.4.0-staging` are two images of the same
|
|
819
|
-
* commit. A backend reads its URLs at runtime, so one image serves every stage
|
|
820
|
-
* and its tag is the release's alone.
|
|
821
|
-
*/
|
|
822
|
-
function siteTag(tag, stage) {
|
|
823
|
-
return `${tag}-${stage}`;
|
|
824
|
-
}
|
|
825
|
-
/** Images a tag names that the registry does not have. */
|
|
826
|
-
var ImageTagNotFound = class extends require_errors.GkmError {
|
|
827
|
-
tag;
|
|
828
|
-
refs;
|
|
829
|
-
constructor(tag, refs) {
|
|
830
|
-
super(`The registry has no image for ${refs.length === 1 ? "this app" : `${refs.length} apps`} at '${tag}':\n` + refs.map((ref) => ` - ${ref}`).join("\n") + `\nNothing was pulled or started. Push '${tag}' for every app from CI, pick a tag that exists, or run without --tag to build from this checkout.`);
|
|
831
|
-
this.tag = tag;
|
|
832
|
-
this.refs = refs;
|
|
833
|
-
this.name = "ImageTagNotFound";
|
|
834
|
-
}
|
|
835
|
-
};
|
|
836
|
-
/** The registry did not answer, or did not let this machine in. */
|
|
837
|
-
var RegistryUnreachable = class extends require_errors.GkmError {
|
|
838
|
-
ref;
|
|
839
|
-
detail;
|
|
840
|
-
constructor(ref, detail) {
|
|
841
|
-
super(`Could not ask the registry about ${ref}: ${detail || "no answer"}\nNothing was pulled or started. Check the registry is reachable and that this machine is logged in to it (\`docker login <registry>\`).`);
|
|
842
|
-
this.ref = ref;
|
|
843
|
-
this.detail = detail;
|
|
844
|
-
this.name = "RegistryUnreachable";
|
|
845
|
-
}
|
|
846
|
-
};
|
|
847
|
-
/**
|
|
848
|
-
* Assert every image exists, before anything else happens.
|
|
849
|
-
*
|
|
850
|
-
* Asked all at once and reported all at once: a release missing two images is
|
|
851
|
-
* one problem with two names, and finding the second only after fixing the
|
|
852
|
-
* first is a slower way to learn the same thing.
|
|
853
|
-
*
|
|
854
|
-
* @throws {RegistryUnreachable} when the registry cannot say
|
|
855
|
-
* @throws {ImageTagNotFound} listing every missing image
|
|
856
|
-
*/
|
|
857
|
-
async function assertImagesExist(docker, tag, images) {
|
|
858
|
-
const lookups = await Promise.all(images.map((image) => docker.lookup(image.ref)));
|
|
859
|
-
const unreachable = lookups.find((lookup) => lookup.status === "unreachable");
|
|
860
|
-
if (unreachable?.status === "unreachable") throw new RegistryUnreachable(unreachable.ref, unreachable.detail);
|
|
861
|
-
const missing = lookups.filter((lookup) => lookup.status === "missing").map((lookup) => lookup.ref);
|
|
862
|
-
if (missing.length > 0) throw new ImageTagNotFound(tag, missing);
|
|
863
|
-
}
|
|
864
|
-
/**
|
|
865
|
-
* A push or a pull with no `deploy.registry` to push to or pull from.
|
|
866
|
-
*
|
|
867
|
-
* Without one an image is named `<namespace>/<project>-<app>:<tag>`, which
|
|
868
|
-
* Docker resolves to Docker Hub — so a release would be pushed to, or pulled
|
|
869
|
-
* from, somebody else's account. It is never a fallback.
|
|
870
|
-
*/
|
|
871
|
-
var RegistryRequired = class extends require_errors.GkmError {
|
|
872
|
-
operation;
|
|
873
|
-
ref;
|
|
874
|
-
constructor(operation, ref) {
|
|
875
|
-
super(`${operation === "push" ? "Pushing" : "Pulling"} images needs a registry, and gkm.config.ts sets no deploy.registry: '${ref}' would be ${operation === "push" ? "pushed to" : "pulled from"} Docker Hub. Set deploy.registry (e.g. registry: 'ghcr.io/acme') in gkm.config.ts.` + (operation === "pull" ? " To run images built here instead, pass --build." : ""));
|
|
876
|
-
this.operation = operation;
|
|
877
|
-
this.ref = ref;
|
|
878
|
-
this.name = "RegistryRequired";
|
|
879
|
-
}
|
|
880
|
-
};
|
|
881
|
-
/** An image pinned to its digest: `<ref>@sha256:…`. */
|
|
882
|
-
function pinnedRef(ref, digest) {
|
|
883
|
-
return `${ref.split("@")[0]}@${digest}`;
|
|
884
|
-
}
|
|
885
|
-
/** A digests file with no entry for an app the stack runs. */
|
|
886
|
-
var ImageDigestMissing = class extends require_errors.GkmError {
|
|
887
|
-
file;
|
|
888
|
-
apps;
|
|
889
|
-
constructor(file, apps) {
|
|
890
|
-
super(`${file} pins no digest for ${apps.join(", ")}. Use the file the same release's \`gkm compose --build --push --digests-file\` wrote, or run without --digests-file to pull by tag.`);
|
|
891
|
-
this.file = file;
|
|
892
|
-
this.apps = apps;
|
|
893
|
-
this.name = "ImageDigestMissing";
|
|
894
|
-
}
|
|
895
|
-
};
|
|
896
|
-
/** A digests file entry that is not this app's image. */
|
|
897
|
-
var ImageDigestMismatch = class extends require_errors.GkmError {
|
|
898
|
-
app;
|
|
899
|
-
expected;
|
|
900
|
-
found;
|
|
901
|
-
constructor(app, expected, found) {
|
|
902
|
-
super(`The digests file pins '${app}' to ${found}, but this release runs ${expected}. It was written for another registry, project, stage or tag; use the file this stage's push of this tag wrote.`);
|
|
903
|
-
this.app = app;
|
|
904
|
-
this.expected = expected;
|
|
905
|
-
this.found = found;
|
|
906
|
-
this.name = "ImageDigestMismatch";
|
|
907
|
-
}
|
|
908
|
-
};
|
|
909
|
-
/** A digests file that is not a JSON object of app to pinned ref. */
|
|
910
|
-
var ImageDigestsInvalid = class extends require_errors.GkmError {
|
|
911
|
-
file;
|
|
912
|
-
detail;
|
|
913
|
-
constructor(file, detail) {
|
|
914
|
-
super(`${file} is not a digests file (${detail}). It should be the JSON object \`gkm compose --build --push --digests-file\` writes: { "api": "<registry>/<image>:<tag>@sha256:…" }.`);
|
|
915
|
-
this.file = file;
|
|
916
|
-
this.detail = detail;
|
|
917
|
-
this.name = "ImageDigestsInvalid";
|
|
918
|
-
}
|
|
919
|
-
};
|
|
920
|
-
/** Parse a digests file's content, checking its shape. */
|
|
921
|
-
function parseDigests(file, content) {
|
|
922
|
-
let parsed;
|
|
923
|
-
try {
|
|
924
|
-
parsed = JSON.parse(content);
|
|
925
|
-
} catch (error) {
|
|
926
|
-
throw new ImageDigestsInvalid(file, error instanceof Error ? error.message : String(error));
|
|
927
|
-
}
|
|
928
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new ImageDigestsInvalid(file, "not a JSON object");
|
|
929
|
-
for (const [app, value] of Object.entries(parsed)) if (typeof value !== "string" || !/@sha256:[0-9a-f]{64}$/.test(value)) throw new ImageDigestsInvalid(file, `'${app}' is not an <image>:<tag>@sha256:… ref`);
|
|
930
|
-
return parsed;
|
|
931
|
-
}
|
|
932
|
-
/**
|
|
933
|
-
* Each image pinned to the digest the file names for it.
|
|
934
|
-
*
|
|
935
|
-
* @throws {ImageDigestMissing} naming every app the file has no entry for
|
|
936
|
-
* @throws {ImageDigestMismatch} when an entry is another image or tag
|
|
937
|
-
*/
|
|
938
|
-
function pinImages(file, digests, images) {
|
|
939
|
-
const missing = images.filter((image) => !digests[image.app]).map((image) => image.app);
|
|
940
|
-
if (missing.length > 0) throw new ImageDigestMissing(file, missing);
|
|
941
|
-
return images.map((image) => {
|
|
942
|
-
const pinned = digests[image.app];
|
|
943
|
-
if (pinned.split("@")[0] !== image.ref) throw new ImageDigestMismatch(image.app, image.ref, pinned);
|
|
944
|
-
return {
|
|
945
|
-
...image,
|
|
946
|
-
ref: pinned
|
|
947
|
-
};
|
|
948
|
-
});
|
|
949
|
-
}
|
|
950
|
-
//#endregion
|
|
951
|
-
//#region src/compose/traefik.ts
|
|
952
|
-
/**
|
|
953
|
-
* The server's shared edge, rendered for Traefik: what the edge itself runs
|
|
954
|
-
* with, and what one stack registers with it.
|
|
955
|
-
*
|
|
956
|
-
* One Traefik per server owns 80 and 443, the ACME state and the redirect to
|
|
957
|
-
* HTTPS. It is configured through its file provider alone: each stack writes
|
|
958
|
-
* one file — its routers, services and middlewares, every name prefixed with
|
|
959
|
-
* its compose project — into a directory the edge watches, and removes it
|
|
960
|
-
* when it stops. There is no Docker socket: the edge never learns what runs
|
|
961
|
-
* on the server except from those files.
|
|
962
|
-
*
|
|
963
|
-
* The edge and the stacks meet on one external Docker network. Only a
|
|
964
|
-
* stack's public services join it, each under an alias prefixed with its
|
|
965
|
-
* project (`<project>-api`), because the network is shared: a bare service
|
|
966
|
-
* name there would be answered by every stack's `api`.
|
|
967
|
-
*
|
|
968
|
-
* Pure: the documents are data, and the edge's side effects are `edge.ts`'s.
|
|
969
|
-
*/
|
|
970
|
-
/**
|
|
971
|
-
* The image, pinned: the edge is every stack's way in, so a new version is a
|
|
972
|
-
* change to this line, not whatever `latest` is on the day a server starts.
|
|
973
|
-
*/
|
|
974
|
-
const TRAEFIK_IMAGE = "traefik:v3.7.13";
|
|
975
|
-
/** The edge's compose project, one per server. */
|
|
976
|
-
const EDGE_PROJECT = "gkm-edge";
|
|
977
|
-
/** The external network the edge and every stack's public services share. */
|
|
978
|
-
const EDGE_NETWORK = "gkm-edge";
|
|
979
|
-
/** The edge's compose service. */
|
|
980
|
-
const EDGE_SERVICE = "traefik";
|
|
981
|
-
/** Inside the edge's container: what it watches, and where certificates are. */
|
|
982
|
-
const EDGE_DYNAMIC_DIR = "/etc/gkm-edge/dynamic";
|
|
983
|
-
const EDGE_CERTS_DIR = "/etc/gkm-edge/certs";
|
|
984
|
-
/** The certificate resolver every deployed route without its own certificate uses. */
|
|
985
|
-
const ACME_RESOLVER = "letsencrypt";
|
|
986
|
-
/**
|
|
987
|
-
* The resolver a wildcard site's `*.<domain>` certificate comes from: Let's
|
|
988
|
-
* Encrypt issues a wildcard only over the DNS challenge, which the edge
|
|
989
|
-
* answers by writing an `_acme-challenge` TXT record through Route 53.
|
|
990
|
-
*/
|
|
991
|
-
const ACME_DNS_RESOLVER = "letsencrypt-dns";
|
|
992
|
-
/**
|
|
993
|
-
* The key the edge writes those records with, inside its container: written
|
|
994
|
-
* by the deploy of a stage with a wildcard site, and allowed nothing but
|
|
995
|
-
* each such stage's `_acme-challenge` record (see `acmeDns.ts`).
|
|
996
|
-
*/
|
|
997
|
-
const EDGE_AWS_CREDENTIALS = `${EDGE_CERTS_DIR}/aws-credentials`;
|
|
998
|
-
/** The internal entrypoint the edge's health check asks; never published. */
|
|
999
|
-
const PING_PORT = 8082;
|
|
1000
|
-
/** A stack's service, as the edge — and the stack itself — reach it. */
|
|
1001
|
-
function edgeAlias(project, service) {
|
|
1002
|
-
return `${project}-${service}`;
|
|
1003
|
-
}
|
|
1004
|
-
/** A stack's certificate, as the edge's container reads it. */
|
|
1005
|
-
function edgeCertificatePaths(project) {
|
|
1006
|
-
return {
|
|
1007
|
-
certFile: `${EDGE_CERTS_DIR}/${project}.crt`,
|
|
1008
|
-
keyFile: `${EDGE_CERTS_DIR}/${project}.key`
|
|
1009
|
-
};
|
|
1010
|
-
}
|
|
1011
|
-
/**
|
|
1012
|
-
* The edge's static configuration: the entrypoints, the redirect, ACME, and
|
|
1013
|
-
* the directory it watches. No API and no dashboard — nothing about the edge
|
|
1014
|
-
* is reachable but the routes stacks register.
|
|
1015
|
-
*/
|
|
1016
|
-
function traefikStatic(ports) {
|
|
1017
|
-
return {
|
|
1018
|
-
global: {
|
|
1019
|
-
checkNewVersion: false,
|
|
1020
|
-
sendAnonymousUsage: false
|
|
1021
|
-
},
|
|
1022
|
-
entryPoints: {
|
|
1023
|
-
web: {
|
|
1024
|
-
address: ":80",
|
|
1025
|
-
http: { redirections: { entryPoint: {
|
|
1026
|
-
to: ports.https === 443 ? "websecure" : `:${ports.https}`,
|
|
1027
|
-
scheme: "https",
|
|
1028
|
-
permanent: true
|
|
1029
|
-
} } }
|
|
1030
|
-
},
|
|
1031
|
-
websecure: { address: ":443" },
|
|
1032
|
-
ping: { address: `:${PING_PORT}` }
|
|
1033
|
-
},
|
|
1034
|
-
ping: { entryPoint: "ping" },
|
|
1035
|
-
providers: { file: {
|
|
1036
|
-
directory: EDGE_DYNAMIC_DIR,
|
|
1037
|
-
watch: true
|
|
1038
|
-
} },
|
|
1039
|
-
certificatesResolvers: {
|
|
1040
|
-
[ACME_RESOLVER]: { acme: {
|
|
1041
|
-
storage: "/acme/acme.json",
|
|
1042
|
-
httpChallenge: { entryPoint: "web" }
|
|
1043
|
-
} },
|
|
1044
|
-
[ACME_DNS_RESOLVER]: { acme: {
|
|
1045
|
-
storage: "/acme/acme-dns.json",
|
|
1046
|
-
dnsChallenge: {
|
|
1047
|
-
provider: "route53",
|
|
1048
|
-
resolvers: ["1.1.1.1:53", "8.8.8.8:53"]
|
|
1049
|
-
}
|
|
1050
|
-
} }
|
|
1051
|
-
},
|
|
1052
|
-
log: { level: "INFO" }
|
|
1053
|
-
};
|
|
1054
|
-
}
|
|
1055
|
-
/** The edge's compose document. */
|
|
1056
|
-
function edgeCompose(options) {
|
|
1057
|
-
const { ports } = options;
|
|
1058
|
-
return {
|
|
1059
|
-
name: EDGE_PROJECT,
|
|
1060
|
-
services: { [EDGE_SERVICE]: {
|
|
1061
|
-
image: TRAEFIK_IMAGE,
|
|
1062
|
-
restart: "unless-stopped",
|
|
1063
|
-
ports: [`${ports.https}:443`, `${ports.http}:80`],
|
|
1064
|
-
configs: [{
|
|
1065
|
-
source: "traefik",
|
|
1066
|
-
target: "/etc/traefik/traefik.yml"
|
|
1067
|
-
}],
|
|
1068
|
-
volumes: [
|
|
1069
|
-
`dynamic:${EDGE_DYNAMIC_DIR}`,
|
|
1070
|
-
`certs:${EDGE_CERTS_DIR}`,
|
|
1071
|
-
"acme:/acme"
|
|
1072
|
-
],
|
|
1073
|
-
labels: { "dev.geekmidas.edge.config": (0, node_crypto.createHash)("sha256").update(options.staticConfig).digest("hex").slice(0, 16) },
|
|
1074
|
-
environment: {
|
|
1075
|
-
AWS_SHARED_CREDENTIALS_FILE: EDGE_AWS_CREDENTIALS,
|
|
1076
|
-
AWS_REGION: "us-east-1"
|
|
1077
|
-
},
|
|
1078
|
-
networks: ["edge"],
|
|
1079
|
-
...EDGE_LIMITS,
|
|
1080
|
-
healthcheck: {
|
|
1081
|
-
test: [
|
|
1082
|
-
"CMD",
|
|
1083
|
-
"traefik",
|
|
1084
|
-
"healthcheck",
|
|
1085
|
-
"--ping"
|
|
1086
|
-
],
|
|
1087
|
-
interval: "10s",
|
|
1088
|
-
timeout: "5s",
|
|
1089
|
-
retries: 5
|
|
1090
|
-
},
|
|
1091
|
-
logging: options.logging
|
|
1092
|
-
} },
|
|
1093
|
-
configs: { traefik: { content: options.staticConfig } },
|
|
1094
|
-
volumes: {
|
|
1095
|
-
acme: {},
|
|
1096
|
-
dynamic: {},
|
|
1097
|
-
certs: {}
|
|
1098
|
-
},
|
|
1099
|
-
networks: { edge: {
|
|
1100
|
-
name: EDGE_NETWORK,
|
|
1101
|
-
external: true
|
|
1102
|
-
} }
|
|
1103
|
-
};
|
|
1104
|
-
}
|
|
1105
|
-
/** A stack's dynamic configuration, as an object. */
|
|
1106
|
-
function traefikDynamic(routes, options) {
|
|
1107
|
-
const { project, tls } = options;
|
|
1108
|
-
const name = (route, suffix) => `${project}-${route.name}${suffix ? `-${suffix}` : ""}`;
|
|
1109
|
-
const url = ({ service, port }) => `http://${edgeAlias(project, service)}:${port}`;
|
|
1110
|
-
const routers = {};
|
|
1111
|
-
const services = {};
|
|
1112
|
-
const middlewares = {};
|
|
1113
|
-
const strip = `${project}-strip-gkm-headers`;
|
|
1114
|
-
if (routes.length > 0) middlewares[strip] = { headers: { customRequestHeaders: { [_geekmidas_manifest.CLIENT_IP_HEADER]: "" } } };
|
|
1115
|
-
for (const route of routes) {
|
|
1116
|
-
const chain = [strip];
|
|
1117
|
-
if (route.allow) {
|
|
1118
|
-
middlewares[name(route, "allow")] = { ipAllowList: { sourceRange: [...route.allow] } };
|
|
1119
|
-
chain.push(name(route, "allow"));
|
|
1120
|
-
}
|
|
1121
|
-
if (route.auth) {
|
|
1122
|
-
middlewares[name(route, "auth")] = { basicAuth: { users: [`${route.auth.user}:${route.auth.hash}`] } };
|
|
1123
|
-
chain.push(name(route, "auth"));
|
|
1124
|
-
}
|
|
1125
|
-
if (route.prefix) {
|
|
1126
|
-
middlewares[name(route, "prefix")] = { addPrefix: { prefix: route.prefix } };
|
|
1127
|
-
chain.push(name(route, "prefix"));
|
|
1128
|
-
}
|
|
1129
|
-
assertRouteRenderable(route);
|
|
1130
|
-
const allowed = [...(route.paths ?? []).map((path) => `Path(\`${path}\`)`), ...(route.prefixes ?? []).map((prefix) => `PathPrefix(\`${prefix}\`)`)];
|
|
1131
|
-
const paths = allowed.length ? ` && (${allowed.join(" || ")})` : "";
|
|
1132
|
-
const header = route.requireHeader ? ` && Header(\`${route.requireHeader.name}\`, \`${route.requireHeader.value}\`)` : "";
|
|
1133
|
-
const certificate = () => route.wildcard?.tls.kind === "dns" ? {
|
|
1134
|
-
certResolver: ACME_DNS_RESOLVER,
|
|
1135
|
-
domains: [{ main: `*.${route.wildcard.domain}` }]
|
|
1136
|
-
} : tls.kind === "acme" ? { certResolver: ACME_RESOLVER } : {};
|
|
1137
|
-
for (const handler of route.handlers ?? []) {
|
|
1138
|
-
const handlerName = name(route, handler.name);
|
|
1139
|
-
routers[handlerName] = {
|
|
1140
|
-
rule: `Host(\`${route.host}\`) && (${handler.prefixes.map((prefix) => `PathPrefix(\`${prefix}\`)`).join(" || ")})`,
|
|
1141
|
-
priority: 1e4,
|
|
1142
|
-
entryPoints: ["websecure"],
|
|
1143
|
-
service: handlerName,
|
|
1144
|
-
middlewares: [strip],
|
|
1145
|
-
tls: certificate()
|
|
1146
|
-
};
|
|
1147
|
-
services[handlerName] = { loadBalancer: { servers: handler.upstreams.map((upstream) => ({ url: url(upstream) })) } };
|
|
1148
|
-
}
|
|
1149
|
-
routers[name(route)] = {
|
|
1150
|
-
rule: `${hostRule(route)}${paths}${header}`,
|
|
1151
|
-
...route.wildcard ? { priority: 1 } : {},
|
|
1152
|
-
entryPoints: ["websecure"],
|
|
1153
|
-
service: name(route),
|
|
1154
|
-
middlewares: chain,
|
|
1155
|
-
tls: certificate()
|
|
1156
|
-
};
|
|
1157
|
-
services[name(route)] = { loadBalancer: {
|
|
1158
|
-
servers: route.upstreams.map((upstream) => ({ url: url(upstream) })),
|
|
1159
|
-
...route.prefix ? { passHostHeader: false } : {},
|
|
1160
|
-
...route.streaming ? { responseForwarding: { flushInterval: "-1ms" } } : {},
|
|
1161
|
-
...route.health ? { healthCheck: {
|
|
1162
|
-
path: route.health,
|
|
1163
|
-
interval: "5s",
|
|
1164
|
-
timeout: "3s"
|
|
1165
|
-
} } : {}
|
|
1166
|
-
} };
|
|
1167
|
-
}
|
|
1168
|
-
return {
|
|
1169
|
-
http: {
|
|
1170
|
-
routers,
|
|
1171
|
-
services,
|
|
1172
|
-
...Object.keys(middlewares).length > 0 ? { middlewares } : {}
|
|
1173
|
-
},
|
|
1174
|
-
...tls.kind === "files" ? { tls: { certificates: [{
|
|
1175
|
-
certFile: tls.certFile,
|
|
1176
|
-
keyFile: tls.keyFile
|
|
1177
|
-
}] } } : {}
|
|
1178
|
-
};
|
|
1179
|
-
}
|
|
1180
|
-
/**
|
|
1181
|
-
* The hosts a route answers, as a Traefik rule: its own, or — for a wildcard
|
|
1182
|
-
* site — exactly one label under its domain, but the ones it never takes.
|
|
1183
|
-
* One label, as a wildcard certificate covers: a stage at
|
|
1184
|
-
* `staging.example.com` is never reached through `example.com`'s wildcard.
|
|
1185
|
-
*/
|
|
1186
|
-
function hostRule(route) {
|
|
1187
|
-
if (!route.wildcard) return `Host(\`${route.host}\`)`;
|
|
1188
|
-
const { domain, except } = route.wildcard;
|
|
1189
|
-
return [`HostRegexp(\`${`^[a-z0-9-]+\\.${domain.replace(/\./g, "\\.")}$`}\`)`, ...except.map((label) => `!Host(\`${label}.${domain}\`)`)].join(" && ");
|
|
1190
|
-
}
|
|
1191
|
-
/** A stack's dynamic configuration file, as written to the edge's directory. */
|
|
1192
|
-
function traefikDynamicFile(routes, options) {
|
|
1193
|
-
return `# Generated by gkm compose for ${options.project} — do not edit.
|
|
1194
|
-
# The shared edge (${EDGE_PROJECT}) reads every file in this directory; this
|
|
1195
|
-
# one is removed by gkm compose --down.
|
|
1196
|
-
${yaml$1(traefikDynamic(routes, options))}`;
|
|
1197
|
-
}
|
|
1198
|
-
/** The edge's static configuration file. */
|
|
1199
|
-
function traefikStaticFile(ports) {
|
|
1200
|
-
return `# Generated by gkm compose — the server's shared edge. Do not edit.
|
|
1201
|
-
${yaml$1(traefikStatic(ports))}`;
|
|
1202
|
-
}
|
|
1203
|
-
/** The edge's compose file. */
|
|
1204
|
-
function edgeComposeFile(options) {
|
|
1205
|
-
return `# Generated by gkm compose — the server's shared edge. Do not edit.
|
|
1206
|
-
#
|
|
1207
|
-
# Started by the first stack that runs with proxy: 'traefik', and left
|
|
1208
|
-
# running by gkm compose --down. Stop it, once nothing uses it, with:
|
|
1209
|
-
#
|
|
1210
|
-
# docker compose -p ${EDGE_PROJECT} down
|
|
1211
|
-
${yaml$1(edgeCompose(options))}`;
|
|
1212
|
-
}
|
|
1213
|
-
function yaml$1(value) {
|
|
1214
|
-
return (0, yaml.stringify)(value, {
|
|
1215
|
-
lineWidth: 0,
|
|
1216
|
-
aliasDuplicateObjects: false
|
|
1217
|
-
});
|
|
1218
|
-
}
|
|
1219
|
-
//#endregion
|
|
1220
|
-
//#region src/compose/stack.ts
|
|
1221
|
-
/**
|
|
1222
|
-
* The stack a workspace runs as for one stage — pure.
|
|
1223
|
-
*
|
|
1224
|
-
* Everything `gkm compose` writes is decided here, as data: the compose file,
|
|
1225
|
-
* the Caddyfile, one env file per backend, and the image each app runs. The
|
|
1226
|
-
* command around it reads the workspace, asks the registry, writes the files
|
|
1227
|
-
* and starts Docker; none of those decide anything, so all of it can be
|
|
1228
|
-
* asserted without a daemon.
|
|
1229
|
-
*
|
|
1230
|
-
* The values come from the same derivations every other target uses. The
|
|
1231
|
-
* plan is reconcile's `planFor`, the keys an app reads are `appEnvKeys`, and
|
|
1232
|
-
* every URL is `envFor`'s — asked twice, once with each app at its public
|
|
1233
|
-
* address and once on the compose network, because a browser and a sibling
|
|
1234
|
-
* service reach the same API by different names.
|
|
1235
|
-
*/
|
|
1236
|
-
/** Where a stack's files are written, relative to the workspace root. */
|
|
1237
|
-
function stackDir(stage) {
|
|
1238
|
-
return `.gkm/compose/${stage}`;
|
|
1239
|
-
}
|
|
1240
|
-
/**
|
|
1241
|
-
* The compose project a stage's stack runs as.
|
|
1242
|
-
*
|
|
1243
|
-
* The deploy identity's scope, so two workspaces with one name in different
|
|
1244
|
-
* namespaces never share containers or volumes — and the stage, so a
|
|
1245
|
-
* machine can run two stages side by side.
|
|
1246
|
-
*/
|
|
1247
|
-
function composeProject(identity) {
|
|
1248
|
-
return `${identity.scope}-${identity.stage}`;
|
|
1249
|
-
}
|
|
1250
|
-
/** The ports the edge is published on, and the variables that move them. */
|
|
1251
|
-
const EDGE_PORT_ENV = {
|
|
1252
|
-
https: "GKM_COMPOSE_HTTPS_PORT",
|
|
1253
|
-
http: "GKM_COMPOSE_HTTP_PORT"
|
|
1254
|
-
};
|
|
1255
|
-
/**
|
|
1256
|
-
* The variable that moves the local stage's OpenObserve off its loopback
|
|
1257
|
-
* port, 5080 — which the local stage takes from nowhere else, since it
|
|
1258
|
-
* ignores `deploy.telemetry`. Another stack, or another tool, may hold 5080.
|
|
1259
|
-
*/
|
|
1260
|
-
const LOGS_PORT_ENV = "GKM_COMPOSE_LOGS_PORT";
|
|
1261
|
-
/**
|
|
1262
|
-
* Containers this target does not run.
|
|
1263
|
-
*
|
|
1264
|
-
* The AWS emulator never applies: a stack is a server target, whose events
|
|
1265
|
-
* are pg-boss. Reconcile's Caddy fronts `gkm dev`'s host processes; the stack
|
|
1266
|
-
* brings its own edge.
|
|
1267
|
-
*
|
|
1268
|
-
* MinIO and Mailpit run on the local stage always, and on a deployed stage
|
|
1269
|
-
* only where `--allow-dev-services` allowed them and its secrets configure no
|
|
1270
|
-
* real bucket or mail server — see `devServices.ts`.
|
|
1271
|
-
*/
|
|
1272
|
-
const NOT_RUN = {
|
|
1273
|
-
localstack: true,
|
|
1274
|
-
caddy: true
|
|
1275
|
-
};
|
|
1276
|
-
/** The kinds a deployed stage takes from its secrets, or a dev service. */
|
|
1277
|
-
const SERVICE_KINDS = {
|
|
1278
|
-
email: "email",
|
|
1279
|
-
objects: "objects",
|
|
1280
|
-
"file-server": "file-server"
|
|
1281
|
-
};
|
|
1282
|
-
/** The region MinIO is addressed with. It has no regions; the SDK wants one. */
|
|
1283
|
-
const MINIO_REGION = "us-east-1";
|
|
1284
|
-
/** The S3 client's credentials, read beside a bucket's URL when it has them. */
|
|
1285
|
-
const STORAGE_KEYS = [
|
|
1286
|
-
"AWS_ACCESS_KEY_ID",
|
|
1287
|
-
"AWS_SECRET_ACCESS_KEY",
|
|
1288
|
-
"AWS_REGION"
|
|
1289
|
-
];
|
|
1290
|
-
/**
|
|
1291
|
-
* Every service's Docker logs, rotated. The json-file driver keeps a
|
|
1292
|
-
* container's output in one file that grows until the disk is full — on a
|
|
1293
|
-
* small server, in weeks. Three files of 10 MB each per container is enough
|
|
1294
|
-
* to see what happened and never fills anything. A project's own override
|
|
1295
|
-
* file that sets `logging` wins over it.
|
|
1296
|
-
*/
|
|
1297
|
-
const LOG_ROTATION = {
|
|
1298
|
-
driver: "json-file",
|
|
1299
|
-
options: {
|
|
1300
|
-
"max-size": "10m",
|
|
1301
|
-
"max-file": "3"
|
|
1302
|
-
}
|
|
1303
|
-
};
|
|
1304
|
-
/** A CDN serves the bucket, and the secret it sends the processors is not in the stage. */
|
|
1305
|
-
var ProcessorOriginSecretMissing = class extends require_errors.GkmError {
|
|
1306
|
-
fileServer;
|
|
1307
|
-
key;
|
|
1308
|
-
stage;
|
|
1309
|
-
constructor(fileServer, key, stage) {
|
|
1310
|
-
super(`'${fileServer}' has processors, and its bucket is not the stack's MinIO, so they are reached through the CDN in front of it — which sends ${key}, and stage '${stage}' has none. It is written by the deploy that creates the CDN (\`deploy.objects.${stage}\` on s3, cdn on): run gkm deploy --stage ${stage}.`);
|
|
1311
|
-
this.fileServer = fileServer;
|
|
1312
|
-
this.key = key;
|
|
1313
|
-
this.stage = stage;
|
|
1314
|
-
this.name = "ProcessorOriginSecretMissing";
|
|
1315
|
-
}
|
|
1316
|
-
};
|
|
1317
|
-
/**
|
|
1318
|
-
* The stack with Caddy's files inline: its Caddyfile and, where the stage has
|
|
1319
|
-
* one, its own certificate — `configs` with their `content`, which compose
|
|
1320
|
-
* copies into the container through the engine's API. Nothing is mounted from
|
|
1321
|
-
* a path, so the stack runs the same on a server's engine, over SSH, as on
|
|
1322
|
-
* this machine's. Their hash is a label: a changed file is a changed service,
|
|
1323
|
-
* which `up` recreates (compose does not, for a config's content alone).
|
|
1324
|
-
*/
|
|
1325
|
-
function withCaddyConfigs(compose, files) {
|
|
1326
|
-
const caddy = compose.services.caddy;
|
|
1327
|
-
if (!caddy) return compose;
|
|
1328
|
-
const configs = {
|
|
1329
|
-
caddyfile: { content: files.caddyfile },
|
|
1330
|
-
...files.tls ? {
|
|
1331
|
-
"tls-cert": { content: files.tls.cert },
|
|
1332
|
-
"tls-key": { content: files.tls.key }
|
|
1333
|
-
} : {}
|
|
1334
|
-
};
|
|
1335
|
-
const hash = (0, node_crypto.createHash)("sha256");
|
|
1336
|
-
for (const [name, { content }] of Object.entries(configs)) hash.update(`${name}\0${content}\0`);
|
|
1337
|
-
return {
|
|
1338
|
-
...compose,
|
|
1339
|
-
services: {
|
|
1340
|
-
...compose.services,
|
|
1341
|
-
caddy: {
|
|
1342
|
-
...caddy,
|
|
1343
|
-
configs: [{
|
|
1344
|
-
source: "caddyfile",
|
|
1345
|
-
target: "/etc/caddy/Caddyfile"
|
|
1346
|
-
}, ...files.tls ? [{
|
|
1347
|
-
source: "tls-cert",
|
|
1348
|
-
target: `${CADDY_TLS_DIR}/cert.pem`
|
|
1349
|
-
}, {
|
|
1350
|
-
source: "tls-key",
|
|
1351
|
-
target: `${CADDY_TLS_DIR}/key.pem`,
|
|
1352
|
-
mode: 256
|
|
1353
|
-
}] : []],
|
|
1354
|
-
labels: {
|
|
1355
|
-
...caddy.labels,
|
|
1356
|
-
"dev.geekmidas.caddy.config": hash.digest("hex").slice(0, 16)
|
|
1357
|
-
}
|
|
1358
|
-
}
|
|
1359
|
-
},
|
|
1360
|
-
configs: {
|
|
1361
|
-
...compose.configs,
|
|
1362
|
-
...configs
|
|
1363
|
-
}
|
|
1364
|
-
};
|
|
1365
|
-
}
|
|
1366
|
-
/**
|
|
1367
|
-
* The services a stack publishes on its engine's loopback, and the port each
|
|
1368
|
-
* answers on inside — what gkm reaches from this machine to provision the
|
|
1369
|
-
* stack and run its migrations and seeds. Everything else is reached only on
|
|
1370
|
-
* the stack's network.
|
|
1371
|
-
*/
|
|
1372
|
-
const LOOPBACK_SERVICES = {
|
|
1373
|
-
postgres: 5432,
|
|
1374
|
-
minio: 9e3
|
|
1375
|
-
};
|
|
1376
|
-
/** The local stage's stack, without the logins `gkm dev` generates. */
|
|
1377
|
-
var LocalCredentialsMissing = class extends require_errors.GkmError {
|
|
1378
|
-
stage;
|
|
1379
|
-
constructor(stage) {
|
|
1380
|
-
super(`The local stage '${stage}' runs with this machine's generated logins, and none were passed. Load them with loadLocalCredentials(workspace) and pass them as localCredentials.`);
|
|
1381
|
-
this.stage = stage;
|
|
1382
|
-
this.name = "LocalCredentialsMissing";
|
|
1383
|
-
}
|
|
1384
|
-
};
|
|
1385
|
-
/**
|
|
1386
|
-
* A deployed stage's container logins, derived from its seed like its role
|
|
1387
|
-
* passwords — so every deploy of the stage computes the same ones, and no one
|
|
1388
|
-
* reading the repo can.
|
|
1389
|
-
*/
|
|
1390
|
-
function derivedCredentials(project, plan, seed) {
|
|
1391
|
-
const derive = (purpose) => require_seeds.localRolePassword(project, plan, purpose, seed);
|
|
1392
|
-
return {
|
|
1393
|
-
postgres: {
|
|
1394
|
-
user: require_seeds.postgresSuperuser(project),
|
|
1395
|
-
password: derive("master")
|
|
1396
|
-
},
|
|
1397
|
-
minio: {
|
|
1398
|
-
user: `${project}-minio`,
|
|
1399
|
-
password: derive("minio")
|
|
1400
|
-
},
|
|
1401
|
-
rabbitmq: {
|
|
1402
|
-
user: require_seeds.LOCAL_RABBITMQ_USER,
|
|
1403
|
-
password: derive("rabbitmq")
|
|
1404
|
-
},
|
|
1405
|
-
redis: { password: derive("redis") },
|
|
1406
|
-
cacheToken: derive("cache-token"),
|
|
1407
|
-
emulator: {
|
|
1408
|
-
accessKeyId: require_seeds.EMULATOR_ACCESS_KEY_ID,
|
|
1409
|
-
secretAccessKey: derive("emulator")
|
|
1410
|
-
},
|
|
1411
|
-
logs: {
|
|
1412
|
-
email: `admin@${project}`,
|
|
1413
|
-
password: derive("logs")
|
|
1414
|
-
}
|
|
1415
|
-
};
|
|
1416
|
-
}
|
|
1417
|
-
/** A value only the stage's secrets can hold, and they do not. */
|
|
1418
|
-
var StageSecretMissing = class extends require_errors.GkmError {
|
|
1419
|
-
app;
|
|
1420
|
-
key;
|
|
1421
|
-
stage;
|
|
1422
|
-
constructor(app, key, stage) {
|
|
1423
|
-
super(`'${app}' reads ${key}, and the stage '${stage}' has none. Nothing in the stack can derive it; set it in the stage's secrets: gkm secrets:set ${key} '…' --stage ${stage}`);
|
|
1424
|
-
this.app = app;
|
|
1425
|
-
this.key = key;
|
|
1426
|
-
this.stage = stage;
|
|
1427
|
-
this.name = "StageSecretMissing";
|
|
1428
|
-
}
|
|
1429
|
-
};
|
|
1430
|
-
/** A deployed stage's secrets with no seed to derive its passwords from. */
|
|
1431
|
-
var StageSeedMissing = class extends require_errors.GkmError {
|
|
1432
|
-
stage;
|
|
1433
|
-
constructor(stage) {
|
|
1434
|
-
super(`The stage '${stage}' has no seed in its secrets, and a deployed stage's database passwords are derived from it. Run gkm compose --stage ${stage} without --dry-run once, or gkm deploy, to generate it.`);
|
|
1435
|
-
this.stage = stage;
|
|
1436
|
-
this.name = "StageSeedMissing";
|
|
1437
|
-
}
|
|
1438
|
-
};
|
|
1439
|
-
/** A workspace with no API and no site to run. */
|
|
1440
|
-
var NothingToCompose = class extends require_errors.GkmError {
|
|
1441
|
-
root;
|
|
1442
|
-
constructor(root) {
|
|
1443
|
-
super(`${root} declares no RestApi, no site and no Worker with work to do, so a stack would run nothing. Mobile apps ship through their own toolchain.`);
|
|
1444
|
-
this.root = root;
|
|
1445
|
-
this.name = "NothingToCompose";
|
|
1446
|
-
}
|
|
1447
|
-
};
|
|
1448
|
-
/** A value that cannot be written to an env file a line at a time. */
|
|
1449
|
-
var EnvValueMultiline = class extends require_errors.GkmError {
|
|
1450
|
-
app;
|
|
1451
|
-
key;
|
|
1452
|
-
constructor(app, key) {
|
|
1453
|
-
super(`${key} for '${app}' spans more than one line, and an env file holds one value per line. Store it on one line — base64, or JSON — and decode it where it is read.`);
|
|
1454
|
-
this.app = app;
|
|
1455
|
-
this.key = key;
|
|
1456
|
-
this.name = "EnvValueMultiline";
|
|
1457
|
-
}
|
|
1458
|
-
};
|
|
1459
|
-
/** The services a stack's apps wait on and the edge waits on in turn. */
|
|
1460
|
-
const HEALTHY = { condition: "service_healthy" };
|
|
1461
|
-
/**
|
|
1462
|
-
* An app's health check: its own server, asked on 127.0.0.1 — not
|
|
1463
|
-
* `localhost`, which resolves to `::1` first in an Alpine container while a
|
|
1464
|
-
* server may listen on IPv4 alone.
|
|
1465
|
-
*/
|
|
1466
|
-
function probe(port, path) {
|
|
1467
|
-
return {
|
|
1468
|
-
test: [
|
|
1469
|
-
"CMD",
|
|
1470
|
-
"wget",
|
|
1471
|
-
"-q",
|
|
1472
|
-
"-O",
|
|
1473
|
-
"/dev/null",
|
|
1474
|
-
`http://127.0.0.1:${port}${path}`
|
|
1475
|
-
],
|
|
1476
|
-
interval: "5s",
|
|
1477
|
-
timeout: "3s",
|
|
1478
|
-
retries: 20,
|
|
1479
|
-
start_period: "10s"
|
|
1480
|
-
};
|
|
1481
|
-
}
|
|
1482
|
-
/**
|
|
1483
|
-
* What a stage's stack provisions: reconcile's plan, with a server target's
|
|
1484
|
-
* backends whatever `deploy.default` says — the stack is one machine running
|
|
1485
|
-
* containers, so events are pg-boss beside the declared database, and every
|
|
1486
|
-
* cache, one declared from that database included, is in the stack's own
|
|
1487
|
-
* Redis.
|
|
1488
|
-
*/
|
|
1489
|
-
function stackPlan(workspace, manifest, stage) {
|
|
1490
|
-
const protectedSubdomains = [...workspace.protectedSubdomains ?? [], ...nestedStageLabels(workspace.domains, stage)];
|
|
1491
|
-
return require_seeds.planFor(manifest, stage, (0, _geekmidas_manifest.provisionOrder)(manifest), {
|
|
1492
|
-
localStage: workspace.stages.local,
|
|
1493
|
-
...protectedSubdomains.length > 0 ? { protectedSubdomains } : {},
|
|
1494
|
-
events: require_drivers.DEFAULT_EVENTS.server,
|
|
1495
|
-
cache: require_seeds.STACK_CACHE,
|
|
1496
|
-
edge: false
|
|
1497
|
-
});
|
|
1498
|
-
}
|
|
1499
|
-
/** The stack for one stage. */
|
|
1500
|
-
function composeStack(input) {
|
|
1501
|
-
const { workspace, manifest, stage, identity } = input;
|
|
1502
|
-
const local = stage === workspace.stages.local;
|
|
1503
|
-
const project = composeProject(identity);
|
|
1504
|
-
const custom = input.secrets?.custom ?? {};
|
|
1505
|
-
const https = input.ports?.https ?? 443;
|
|
1506
|
-
const http = input.ports?.http ?? 80;
|
|
1507
|
-
const proxy = require_workspace.proxyFor(workspace.deploy?.compose, stage, local);
|
|
1508
|
-
const certificate = local ? void 0 : require_workspace.certificateFor(workspace.deploy?.compose, stage, workspace.root);
|
|
1509
|
-
const plan = stackPlan(workspace, manifest, stage);
|
|
1510
|
-
const byId = new Map(plan.resources.map((r) => [r.id, r]));
|
|
1511
|
-
if (local && !input.localCredentials) throw new LocalCredentialsMissing(stage);
|
|
1512
|
-
const seed = local ? input.localCredentials.seed : input.secrets?.seed;
|
|
1513
|
-
if (!seed) throw new StageSeedMissing(stage);
|
|
1514
|
-
const containers = local ? input.localCredentials : derivedCredentials(workspace.name, plan, seed);
|
|
1515
|
-
const credential = {
|
|
1516
|
-
containers: {
|
|
1517
|
-
...containers,
|
|
1518
|
-
minio: {
|
|
1519
|
-
user: custom.AWS_ACCESS_KEY_ID ?? containers.minio.user,
|
|
1520
|
-
password: custom.AWS_SECRET_ACCESS_KEY ?? containers.minio.password
|
|
1521
|
-
}
|
|
1522
|
-
},
|
|
1523
|
-
seed
|
|
1524
|
-
};
|
|
1525
|
-
const apps = stackApps(workspace, manifest, plan, {
|
|
1526
|
-
local,
|
|
1527
|
-
stage,
|
|
1528
|
-
https,
|
|
1529
|
-
identity,
|
|
1530
|
-
images: input.images
|
|
1531
|
-
});
|
|
1532
|
-
const workers = stackWorkers(require_seeds.workerUnits(workspace, manifest, input.background ?? {}), {
|
|
1533
|
-
stage,
|
|
1534
|
-
identity,
|
|
1535
|
-
images: input.images
|
|
1536
|
-
});
|
|
1537
|
-
const processors = stackProcessors(require_seeds.processorUnits(workspace, manifest), {
|
|
1538
|
-
manifest,
|
|
1539
|
-
stage,
|
|
1540
|
-
identity,
|
|
1541
|
-
images: input.images
|
|
1542
|
-
});
|
|
1543
|
-
if (apps.length === 0 && workers.length === 0 && processors.length === 0) throw new NothingToCompose(workspace.root);
|
|
1544
|
-
const owners = /* @__PURE__ */ new Map();
|
|
1545
|
-
for (const resource of plan.resources) {
|
|
1546
|
-
owners.set(resource.envKey, resource);
|
|
1547
|
-
if (resource.kind === "email") {
|
|
1548
|
-
owners.set((0, _geekmidas_manifest.provideKey)(resource.id, "from"), resource);
|
|
1549
|
-
owners.set((0, _geekmidas_manifest.provideKey)(resource.id, "inboxUrl"), resource);
|
|
1550
|
-
}
|
|
1551
|
-
if (resource.kind === "external-api") owners.set((0, _geekmidas_manifest.provideKey)(resource.id, "credentials"), resource);
|
|
1552
|
-
if (resource.kind === "inbox") owners.set((0, _geekmidas_manifest.provideKey)(resource.id, "domain"), resource);
|
|
1553
|
-
if (resource.kind === "websocket-api") owners.set((0, _geekmidas_manifest.provideKey)(resource.id, "publisherConnectionString"), resource);
|
|
1554
|
-
}
|
|
1555
|
-
const domain = workspace.domains?.[stage];
|
|
1556
|
-
const telemetry = require_workspace.resolveStageTelemetry({
|
|
1557
|
-
...workspace.deploy?.telemetry ? { telemetry: workspace.deploy.telemetry } : {},
|
|
1558
|
-
stage,
|
|
1559
|
-
local,
|
|
1560
|
-
target: "compose",
|
|
1561
|
-
runtime: "server",
|
|
1562
|
-
selfHosted: true,
|
|
1563
|
-
used: require_seeds.usesTelemetry(manifest)
|
|
1564
|
-
});
|
|
1565
|
-
const logsBase = telemetry?.provider === "self-hosted" ? require_seeds.stackLogs({
|
|
1566
|
-
config: local && input.ports?.logs ? {
|
|
1567
|
-
...telemetry.selfHosted,
|
|
1568
|
-
port: input.ports.logs
|
|
1569
|
-
} : telemetry.selfHosted,
|
|
1570
|
-
stage,
|
|
1571
|
-
local,
|
|
1572
|
-
project: workspace.name,
|
|
1573
|
-
...domain ? { domain } : {},
|
|
1574
|
-
custom,
|
|
1575
|
-
https,
|
|
1576
|
-
...local ? { localLogin: input.localCredentials.logs } : {}
|
|
1577
|
-
}) : void 0;
|
|
1578
|
-
const services = local ? {
|
|
1579
|
-
missing: [],
|
|
1580
|
-
minio: plan.resources.filter((r) => r.kind === "objects").map((r) => r.id),
|
|
1581
|
-
mailpit: plan.resources.filter((r) => r.kind === "email" || r.kind === "inbox").map((r) => r.id)
|
|
1582
|
-
} : require_seeds.externalServices({
|
|
1583
|
-
stage,
|
|
1584
|
-
declarations: require_seeds.stageServiceDeclarations({ manifest }),
|
|
1585
|
-
supplied: custom,
|
|
1586
|
-
allow: input.allowDevServices === true,
|
|
1587
|
-
...domain ? { domain } : {},
|
|
1588
|
-
providers: require_seeds.stageProviderNotes(workspace, stage)
|
|
1589
|
-
});
|
|
1590
|
-
const redis = require_seeds.stackRedis({
|
|
1591
|
-
plan,
|
|
1592
|
-
stage,
|
|
1593
|
-
local,
|
|
1594
|
-
custom,
|
|
1595
|
-
...local ? { localPassword: input.localCredentials.redis.password } : {}
|
|
1596
|
-
});
|
|
1597
|
-
const infra = [...plan.containers.filter((c) => !NOT_RUN[c]).filter((c) => c !== require_seeds.LOGS_SERVICE).filter((c) => c !== "minio" || services.minio.length > 0).filter((c) => c !== "mailpit" || services.mailpit.length > 0).filter((c) => c !== "redis" || redis !== void 0), ...logsBase ? [require_seeds.LOGS_SERVICE] : []].sort();
|
|
1598
|
-
const storage = infra.includes("minio") ? (() => {
|
|
1599
|
-
const buckets = services.minio.map((id) => byId.get(id)?.name).filter((name) => Boolean(name)).sort();
|
|
1600
|
-
return {
|
|
1601
|
-
...credential.containers.minio,
|
|
1602
|
-
buckets,
|
|
1603
|
-
policies: require_seeds.bucketPolicies(plan).filter((p) => buckets.includes(p.bucket)),
|
|
1604
|
-
objects: services.minio.map((id) => ({
|
|
1605
|
-
id,
|
|
1606
|
-
name: byId.get(id)?.name
|
|
1607
|
-
})).filter((b) => Boolean(b.name)).sort((a, b) => a.name.localeCompare(b.name)),
|
|
1608
|
-
webhooks: [],
|
|
1609
|
-
lifecycles: require_seeds.bucketLifecycles(plan).filter((l) => buckets.includes(l.bucket))
|
|
1610
|
-
};
|
|
1611
|
-
})() : void 0;
|
|
1612
|
-
const bucketEventKeys = /* @__PURE__ */ new Map();
|
|
1613
|
-
for (const resource of plan.resources) {
|
|
1614
|
-
if (resource.kind !== "objects") continue;
|
|
1615
|
-
bucketEventKeys.set((0, _geekmidas_manifest.provideKey)(resource.id, "eventsConnectionString"), resource.id);
|
|
1616
|
-
bucketEventKeys.set((0, _geekmidas_manifest.provideKey)(resource.id, "eventsToken"), resource.id);
|
|
1617
|
-
}
|
|
1618
|
-
const fileServers = /* @__PURE__ */ new Map();
|
|
1619
|
-
if (storage) for (const resource of plan.resources) {
|
|
1620
|
-
if (resource.kind !== "file-server" || !resource.of) continue;
|
|
1621
|
-
if (!services.minio.includes(resource.of)) continue;
|
|
1622
|
-
if (custom[resource.envKey] !== void 0) continue;
|
|
1623
|
-
const bucket = byId.get(resource.of);
|
|
1624
|
-
if (!bucket) continue;
|
|
1625
|
-
let host;
|
|
1626
|
-
if (local) host = require_seeds.hostFor(resource, workspace.name);
|
|
1627
|
-
else {
|
|
1628
|
-
if (!domain) throw new require_seeds.NoDomainForStage(stage);
|
|
1629
|
-
host = `${resource.subdomain ?? require_derive.appKey(resource.id)}.${domain}`;
|
|
1630
|
-
}
|
|
1631
|
-
fileServers.set(resource.id, {
|
|
1632
|
-
url: `https://${host}${local && https !== 443 ? `:${https}` : ""}`,
|
|
1633
|
-
route: {
|
|
1634
|
-
name: `files-${require_derive.appKey(resource.id)}`,
|
|
1635
|
-
host,
|
|
1636
|
-
upstreams: [{
|
|
1637
|
-
service: "minio",
|
|
1638
|
-
port: 9e3
|
|
1639
|
-
}],
|
|
1640
|
-
streaming: false,
|
|
1641
|
-
prefix: `/${bucket.name}`
|
|
1642
|
-
}
|
|
1643
|
-
});
|
|
1644
|
-
}
|
|
1645
|
-
const edgeServices = new Set(proxy === "traefik" ? [
|
|
1646
|
-
...apps.flatMap(replicaNames),
|
|
1647
|
-
...fileServers.size > 0 ? ["minio"] : [],
|
|
1648
|
-
...logsBase?.host && logsBase.public ? [require_seeds.LOGS_SERVICE] : []
|
|
1649
|
-
] : []);
|
|
1650
|
-
const hostOf = (service) => edgeServices.has(service) ? edgeAlias(project, service) : service;
|
|
1651
|
-
const logs = logsBase && {
|
|
1652
|
-
...logsBase,
|
|
1653
|
-
appEnv: {
|
|
1654
|
-
...logsBase.appEnv,
|
|
1655
|
-
OTEL_EXPORTER_OTLP_ENDPOINT: logsBase.appEnv.OTEL_EXPORTER_OTLP_ENDPOINT.replace(`//openobserve:`, `//${hostOf("openobserve")}:`)
|
|
1656
|
-
}
|
|
1657
|
-
};
|
|
1658
|
-
const derivation = {
|
|
1659
|
-
project: workspace.name,
|
|
1660
|
-
credentials: credential.containers,
|
|
1661
|
-
seed: credential.seed,
|
|
1662
|
-
...!local && domain ? { mailFrom: `noreply@${domain}` } : {},
|
|
1663
|
-
relayedBuckets: [...require_seeds.watchedBuckets(manifest, input.subscribers ?? {}).keys()].filter((bucket) => services.minio.includes(bucket))
|
|
1664
|
-
};
|
|
1665
|
-
const publicAddresses = Object.fromEntries(apps.map((app) => [app.id, app.url]));
|
|
1666
|
-
const outside = require_seeds.networkEnv(plan, {
|
|
1667
|
-
...derivation,
|
|
1668
|
-
addresses: publicAddresses
|
|
1669
|
-
}, hostOf);
|
|
1670
|
-
const inside = require_seeds.networkEnv(plan, {
|
|
1671
|
-
...derivation,
|
|
1672
|
-
addresses: Object.fromEntries(apps.map((app) => [app.id, `${app.kind === "websocket-api" ? "ws" : "http"}://${hostOf(app.name)}:${app.port}`]))
|
|
1673
|
-
}, hostOf);
|
|
1674
|
-
const surfaceUrls = new Map(plan.resources.filter((r) => r.kind === "rest-api" || r.kind === "websocket-api" || r.kind === "site").map((r) => [r.envKey, r.id]));
|
|
1675
|
-
const appById = new Map(apps.map((app) => [app.id, app]));
|
|
1676
|
-
/**
|
|
1677
|
-
* What a key resolves to for one app, from the stage's secrets where only
|
|
1678
|
-
* they can hold it, and the derivations otherwise.
|
|
1679
|
-
*/
|
|
1680
|
-
const valueFor = (app, key, owner) => {
|
|
1681
|
-
if (require_workspace.isReservedStageKey(key)) return void 0;
|
|
1682
|
-
const watching = bucketEventKeys.get(key);
|
|
1683
|
-
if (watching) {
|
|
1684
|
-
if (custom[key] !== void 0) return custom[key];
|
|
1685
|
-
return services.minio.includes(watching) ? outside[key] : void 0;
|
|
1686
|
-
}
|
|
1687
|
-
if (owner?.kind === "inbox") {
|
|
1688
|
-
if (local) return outside[key];
|
|
1689
|
-
if (key === (0, _geekmidas_manifest.provideKey)(owner.id, "domain")) {
|
|
1690
|
-
if (!domain) throw new require_seeds.NoDomainForStage(stage);
|
|
1691
|
-
return domain;
|
|
1692
|
-
}
|
|
1693
|
-
const value = custom[key];
|
|
1694
|
-
if (value === void 0) throw new StageSecretMissing(app.name, key, stage);
|
|
1695
|
-
return value;
|
|
1696
|
-
}
|
|
1697
|
-
if (!local && owner?.kind === "email" && key.endsWith("_INBOX_URL")) return;
|
|
1698
|
-
if (owner && SERVICE_KINDS[owner.kind]) {
|
|
1699
|
-
if (custom[key] !== void 0) return custom[key];
|
|
1700
|
-
if (owner.kind === "file-server") return fileServers.get(owner.id)?.url;
|
|
1701
|
-
return outside[key];
|
|
1702
|
-
}
|
|
1703
|
-
if (owner && require_seeds.suppliedOnly(owner.kind, owner.id, key, local)) {
|
|
1704
|
-
const value = custom[key];
|
|
1705
|
-
if (value === void 0) throw new StageSecretMissing(app.name, key, stage);
|
|
1706
|
-
return value;
|
|
1707
|
-
}
|
|
1708
|
-
if (custom[key] !== void 0) return custom[key];
|
|
1709
|
-
if (owner?.kind === "cache") return redis?.urls[key];
|
|
1710
|
-
if (owner?.kind === "websocket-api" && key === (0, _geekmidas_manifest.provideKey)(owner.id, "publisherConnectionString")) return redis?.urls[key];
|
|
1711
|
-
const surface = surfaceUrls.get(key);
|
|
1712
|
-
if ((app.kind === "rest-api" || app.kind === "websocket-api") && surface && surface !== app.id) return inside[key];
|
|
1713
|
-
return outside[key];
|
|
1714
|
-
};
|
|
1715
|
-
const telemetryValues = logs ? require_workspace.telemetryEnv({
|
|
1716
|
-
endpoint: logs.appEnv.OTEL_EXPORTER_OTLP_ENDPOINT,
|
|
1717
|
-
headers: logs.appEnv.OTEL_EXPORTER_OTLP_HEADERS
|
|
1718
|
-
}, telemetry?.sampleRate ?? 1) : telemetry?.provider === "otlp" ? require_workspace.otlpTelemetryEnv(telemetry) : void 0;
|
|
1719
|
-
/** Each key one backend process reads, resolved for this stage. */
|
|
1720
|
-
const valuesFor = (app, keys) => {
|
|
1721
|
-
const values = {};
|
|
1722
|
-
for (const key of [...keys].sort()) {
|
|
1723
|
-
if (require_seeds.isTelemetryKey(key)) continue;
|
|
1724
|
-
const owner = owners.get(key) ?? storageOwner(key, plan);
|
|
1725
|
-
if (STORAGE_KEYS.includes(key)) {
|
|
1726
|
-
const value = custom[key] ?? storageValue(key, storage);
|
|
1727
|
-
if (value !== void 0) values[key] = value;
|
|
1728
|
-
continue;
|
|
1729
|
-
}
|
|
1730
|
-
const value = valueFor(app, key, owner);
|
|
1731
|
-
if (value !== void 0) values[key] = value;
|
|
1732
|
-
}
|
|
1733
|
-
return values;
|
|
1734
|
-
};
|
|
1735
|
-
for (const app of apps) {
|
|
1736
|
-
if (app.kind === "site") {
|
|
1737
|
-
const site = manifest[app.id];
|
|
1738
|
-
if (site?.kind !== "site") continue;
|
|
1739
|
-
const args = require_seeds.publicBuildValues(site, manifest, (key) => valueFor(app, key, owners.get(key)), custom);
|
|
1740
|
-
if (app.build && Object.keys(args).length > 0) app.build.args = args;
|
|
1741
|
-
continue;
|
|
1742
|
-
}
|
|
1743
|
-
if (input.buildOnly) continue;
|
|
1744
|
-
const keys = require_seeds.appEnvKeys(manifest, app.name) ?? /* @__PURE__ */ new Set();
|
|
1745
|
-
const values = valuesFor(app, keys);
|
|
1746
|
-
const trusted = (0, _geekmidas_manifest.provideKey)(app.id, "trustedOrigins");
|
|
1747
|
-
if (keys.has(trusted)) {
|
|
1748
|
-
const internal = (byId.get(app.id)?.callers ?? []).map((caller) => appById.get(caller)).filter((caller) => caller?.kind === "rest-api" || caller?.kind === "websocket-api").map((caller) => `http://${hostOf(caller.name)}:${caller.port}`);
|
|
1749
|
-
const origins = [...(values[trusted] ?? "").split(",").filter(Boolean), ...internal];
|
|
1750
|
-
values[trusted] = [...new Set(origins)].join(",");
|
|
1751
|
-
}
|
|
1752
|
-
app.env = {
|
|
1753
|
-
...require_seeds.scopeTelemetryEnv(values, {
|
|
1754
|
-
uses: require_seeds.telemetryOf(manifest, app.id) !== void 0,
|
|
1755
|
-
serviceName: app.name,
|
|
1756
|
-
...telemetryValues ? { telemetry: telemetryValues } : {}
|
|
1757
|
-
}),
|
|
1758
|
-
NODE_ENV: "production",
|
|
1759
|
-
PORT: String(app.port),
|
|
1760
|
-
STAGE: stage
|
|
1761
|
-
};
|
|
1762
|
-
for (const [key, value] of Object.entries(app.env)) if (/[\r\n]/.test(value)) throw new EnvValueMultiline(app.name, key);
|
|
1763
|
-
}
|
|
1764
|
-
const mobileApps = [];
|
|
1765
|
-
for (const declaration of Object.values(manifest)) {
|
|
1766
|
-
if (declaration.kind !== "mobile-app") continue;
|
|
1767
|
-
const app = {
|
|
1768
|
-
name: require_derive.appKey(declaration.id),
|
|
1769
|
-
id: declaration.id,
|
|
1770
|
-
kind: "site"
|
|
1771
|
-
};
|
|
1772
|
-
mobileApps.push({
|
|
1773
|
-
name: app.name,
|
|
1774
|
-
id: app.id,
|
|
1775
|
-
values: require_seeds.publicBuildValues(declaration, manifest, (key) => valueFor(app, key, owners.get(key)), custom)
|
|
1776
|
-
});
|
|
1777
|
-
}
|
|
1778
|
-
for (const worker of input.buildOnly ? [] : workers) {
|
|
1779
|
-
const keys = require_seeds.workerEnvKeys(manifest, worker.id) ?? /* @__PURE__ */ new Set();
|
|
1780
|
-
const resolved = valuesFor({
|
|
1781
|
-
name: worker.name,
|
|
1782
|
-
id: worker.id,
|
|
1783
|
-
kind: "rest-api"
|
|
1784
|
-
}, keys);
|
|
1785
|
-
const push = local ? void 0 : workerPush(worker, input.subscribers?.[worker.id] ?? [], resolved, {
|
|
1786
|
-
stage,
|
|
1787
|
-
...domain ? { domain } : {}
|
|
1788
|
-
});
|
|
1789
|
-
if (push) {
|
|
1790
|
-
worker.push = push;
|
|
1791
|
-
if (proxy === "traefik") edgeServices.add(worker.name);
|
|
1792
|
-
}
|
|
1793
|
-
worker.env = {
|
|
1794
|
-
...require_seeds.scopeTelemetryEnv(resolved, {
|
|
1795
|
-
uses: require_seeds.telemetryOf(manifest, worker.id) !== void 0,
|
|
1796
|
-
serviceName: worker.name,
|
|
1797
|
-
...telemetryValues ? { telemetry: telemetryValues } : {}
|
|
1798
|
-
}),
|
|
1799
|
-
...push && !input.recordingSubscriptions ? { [require_SubscriberGenerator.SNS_SUBSCRIPTIONS_KEY]: recordedSubscriptions(worker, push, input.pushSubscriptions?.[worker.id]) } : {},
|
|
1800
|
-
NODE_ENV: "production",
|
|
1801
|
-
PORT: String(worker.port),
|
|
1802
|
-
STAGE: stage
|
|
1803
|
-
};
|
|
1804
|
-
for (const [key, value] of Object.entries(worker.env)) if (/[\r\n]/.test(value)) throw new EnvValueMultiline(worker.name, key);
|
|
1805
|
-
}
|
|
1806
|
-
for (const unit of processors) {
|
|
1807
|
-
const served = fileServers.get(unit.id);
|
|
1808
|
-
if (served) served.route = {
|
|
1809
|
-
...served.route,
|
|
1810
|
-
handlers: [{
|
|
1811
|
-
name: unit.name,
|
|
1812
|
-
prefixes: unit.prefixes,
|
|
1813
|
-
upstreams: [{
|
|
1814
|
-
service: unit.name,
|
|
1815
|
-
port: unit.port
|
|
1816
|
-
}]
|
|
1817
|
-
}]
|
|
1818
|
-
};
|
|
1819
|
-
else if (!local && !input.buildOnly) {
|
|
1820
|
-
if (!domain) throw new require_seeds.NoDomainForStage(stage);
|
|
1821
|
-
const key = require_seeds.originSecretKey(unit.id);
|
|
1822
|
-
const secret = custom[key];
|
|
1823
|
-
if (!secret) throw new ProcessorOriginSecretMissing(unit.id, key, stage);
|
|
1824
|
-
unit.origin = {
|
|
1825
|
-
host: require_seeds.processorOriginHost(unit.id, domain),
|
|
1826
|
-
secret
|
|
1827
|
-
};
|
|
1828
|
-
}
|
|
1829
|
-
if (proxy === "traefik" && (served || unit.origin)) edgeServices.add(unit.name);
|
|
1830
|
-
if (input.buildOnly) continue;
|
|
1831
|
-
const keys = require_seeds.processorEnvKeys(manifest, unit.id) ?? /* @__PURE__ */ new Set();
|
|
1832
|
-
unit.env = {
|
|
1833
|
-
...require_seeds.scopeTelemetryEnv(valuesFor({
|
|
1834
|
-
name: unit.name,
|
|
1835
|
-
id: unit.id,
|
|
1836
|
-
kind: "rest-api"
|
|
1837
|
-
}, keys), {
|
|
1838
|
-
uses: require_seeds.telemetryOf(manifest, unit.id) !== void 0,
|
|
1839
|
-
serviceName: unit.name,
|
|
1840
|
-
...telemetryValues ? { telemetry: telemetryValues } : {}
|
|
1841
|
-
}),
|
|
1842
|
-
NODE_ENV: "production",
|
|
1843
|
-
PORT: String(unit.port),
|
|
1844
|
-
STAGE: stage
|
|
1845
|
-
};
|
|
1846
|
-
for (const [key, value] of Object.entries(unit.env)) if (/[\r\n]/.test(value)) throw new EnvValueMultiline(unit.name, key);
|
|
1847
|
-
}
|
|
1848
|
-
if (storage && !input.buildOnly) {
|
|
1849
|
-
const watched = require_seeds.watchedBuckets(manifest, input.subscribers ?? {});
|
|
1850
|
-
for (const [bucket, workerId] of watched) {
|
|
1851
|
-
if (!services.minio.includes(bucket)) continue;
|
|
1852
|
-
const worker = workers.find((w) => w.id === workerId);
|
|
1853
|
-
const relay = worker?.env?.[(0, _geekmidas_manifest.provideKey)(bucket, "eventsConnectionString")];
|
|
1854
|
-
const token = worker?.env?.[(0, _geekmidas_manifest.provideKey)(bucket, "eventsToken")];
|
|
1855
|
-
if (!worker || !relay || relay.startsWith("sns:") || !token) continue;
|
|
1856
|
-
storage.webhooks.push({
|
|
1857
|
-
bucket,
|
|
1858
|
-
endpoint: `http://${hostOf(worker.name)}:${worker.port}${require_SubscriberGenerator.objectsRoute(bucket)}`,
|
|
1859
|
-
token
|
|
1860
|
-
});
|
|
1861
|
-
}
|
|
1862
|
-
}
|
|
1863
|
-
let inboxRelay;
|
|
1864
|
-
if (local && infra.includes("mailpit") && !input.buildOnly) {
|
|
1865
|
-
const relayId = require_SubscriberGenerator.inboxRelayWorker(manifest, input.subscribers ?? {});
|
|
1866
|
-
const relay = workers.find((w) => w.id === relayId);
|
|
1867
|
-
const token = relay?.env?.[require_SubscriberGenerator.INBOX_RELAY_TOKEN_KEY];
|
|
1868
|
-
if (relay && token) inboxRelay = require_SubscriberGenerator.inboxWebhookUrl(`http://${hostOf(relay.name)}:${relay.port}`, token);
|
|
1869
|
-
}
|
|
1870
|
-
const deployedTls = certificate ? {
|
|
1871
|
-
kind: "files",
|
|
1872
|
-
...proxy === "caddy" ? {
|
|
1873
|
-
certFile: `${CADDY_TLS_DIR}/cert.pem`,
|
|
1874
|
-
keyFile: `${CADDY_TLS_DIR}/key.pem`
|
|
1875
|
-
} : edgeCertificatePaths(project)
|
|
1876
|
-
} : { kind: "acme" };
|
|
1877
|
-
const tls = local ? { kind: "internal" } : deployedTls;
|
|
1878
|
-
const backupsChoice = input.buildOnly ? void 0 : require_snsSubscriptions.stageBackups(workspace, manifest, stage);
|
|
1879
|
-
const backups = backupsChoice?.mode === "on" && infra.includes("postgres") ? require_snsSubscriptions.stackBackups({
|
|
1880
|
-
workspace,
|
|
1881
|
-
stage,
|
|
1882
|
-
project,
|
|
1883
|
-
plan,
|
|
1884
|
-
backups: backupsChoice.backups,
|
|
1885
|
-
custom,
|
|
1886
|
-
seed,
|
|
1887
|
-
superuser: credential.containers.postgres,
|
|
1888
|
-
...telemetryValues ? { telemetry: telemetryValues } : {}
|
|
1889
|
-
}) : void 0;
|
|
1890
|
-
const layout = input.layout ?? defaultLayout(workspace.root);
|
|
1891
|
-
const compose = stackFile({
|
|
1892
|
-
project,
|
|
1893
|
-
plan,
|
|
1894
|
-
infra,
|
|
1895
|
-
apps,
|
|
1896
|
-
workers,
|
|
1897
|
-
processors,
|
|
1898
|
-
credentials: credential.containers,
|
|
1899
|
-
...storage ? { storage } : {},
|
|
1900
|
-
...inboxRelay ? { inboxRelay } : {},
|
|
1901
|
-
...logs ? { logs } : {},
|
|
1902
|
-
...redis ? { redis } : {},
|
|
1903
|
-
...backups ? { backups } : {},
|
|
1904
|
-
https,
|
|
1905
|
-
http,
|
|
1906
|
-
composeDir: (0, node_path.join)(workspace.root, stackDir(stage)),
|
|
1907
|
-
buildRoot: layout.buildRoot,
|
|
1908
|
-
workspaceRoot: workspace.root,
|
|
1909
|
-
envFiles: !input.buildOnly,
|
|
1910
|
-
proxy,
|
|
1911
|
-
edge: new Map([...edgeServices].map((service) => [service, hostOf(service)]))
|
|
1912
|
-
});
|
|
1913
|
-
if (!local) for (const app of apps) {
|
|
1914
|
-
const site = manifest[app.id];
|
|
1915
|
-
if (site?.kind !== "site") continue;
|
|
1916
|
-
const key = require_snsSubscriptions.sitePasswordKey(manifest, site, stage);
|
|
1917
|
-
if (key) app.auth = require_snsSubscriptions.siteAuth(stage, key, custom);
|
|
1918
|
-
}
|
|
1919
|
-
const wildcard = local ? void 0 : stackWildcard(apps, {
|
|
1920
|
-
manifest,
|
|
1921
|
-
byId,
|
|
1922
|
-
workspace,
|
|
1923
|
-
stage,
|
|
1924
|
-
proxy,
|
|
1925
|
-
certificate: certificate !== void 0,
|
|
1926
|
-
hostOf
|
|
1927
|
-
});
|
|
1928
|
-
const routes = [
|
|
1929
|
-
...apps.map((app) => ({
|
|
1930
|
-
name: app.name,
|
|
1931
|
-
host: app.host,
|
|
1932
|
-
...wildcard?.site === app.id ? { wildcard: wildcard.edge } : {},
|
|
1933
|
-
upstreams: replicaNames(app).map((service) => ({
|
|
1934
|
-
service,
|
|
1935
|
-
port: app.port
|
|
1936
|
-
})),
|
|
1937
|
-
streaming: true,
|
|
1938
|
-
...app.auth ? { auth: {
|
|
1939
|
-
user: app.auth.user,
|
|
1940
|
-
hash: app.auth.hash
|
|
1941
|
-
} } : {},
|
|
1942
|
-
health: app.kind === "site" ? "/" : "/health"
|
|
1943
|
-
})),
|
|
1944
|
-
...[...fileServers.values()].map(({ route }) => route),
|
|
1945
|
-
...processors.flatMap(({ name, port, prefixes, origin }) => origin ? [{
|
|
1946
|
-
name,
|
|
1947
|
-
host: origin.host,
|
|
1948
|
-
upstreams: [{
|
|
1949
|
-
service: name,
|
|
1950
|
-
port
|
|
1951
|
-
}],
|
|
1952
|
-
streaming: false,
|
|
1953
|
-
prefixes,
|
|
1954
|
-
requireHeader: {
|
|
1955
|
-
name: require_seeds.ORIGIN_VERIFY_HEADER,
|
|
1956
|
-
value: origin.secret
|
|
1957
|
-
},
|
|
1958
|
-
health: "/health"
|
|
1959
|
-
}] : []),
|
|
1960
|
-
...workers.flatMap(({ name, port, push }) => push ? [{
|
|
1961
|
-
name,
|
|
1962
|
-
host: push.host,
|
|
1963
|
-
upstreams: [{
|
|
1964
|
-
service: name,
|
|
1965
|
-
port
|
|
1966
|
-
}],
|
|
1967
|
-
streaming: false,
|
|
1968
|
-
paths: push.paths,
|
|
1969
|
-
health: "/health"
|
|
1970
|
-
}] : []),
|
|
1971
|
-
...logs?.host && logs.public ? [{
|
|
1972
|
-
name: require_seeds.LOGS_SERVICE,
|
|
1973
|
-
host: logs.host,
|
|
1974
|
-
upstreams: [{
|
|
1975
|
-
service: require_seeds.LOGS_SERVICE,
|
|
1976
|
-
port: require_workspace.LOGS_PORT
|
|
1977
|
-
}],
|
|
1978
|
-
streaming: true,
|
|
1979
|
-
allow: logs.public.allow
|
|
1980
|
-
}] : []
|
|
1981
|
-
];
|
|
1982
|
-
assertHostsUnique(routes);
|
|
1983
|
-
const dockerfiles = {};
|
|
1984
|
-
for (const app of apps) {
|
|
1985
|
-
if (!app.build) continue;
|
|
1986
|
-
dockerfiles[app.build.dockerfile] = require_seeds.appDockerfile(app.name, workspace.apps[app.name], {
|
|
1987
|
-
layout,
|
|
1988
|
-
workspaceRoot: workspace.root,
|
|
1989
|
-
apps: workspace.apps,
|
|
1990
|
-
manifest,
|
|
1991
|
-
cache: require_seeds.STACK_CACHE,
|
|
1992
|
-
workspace,
|
|
1993
|
-
stage,
|
|
1994
|
-
...app.kind === "site" && app.build.args ? { publicUrlArgs: Object.keys(app.build.args) } : {}
|
|
1995
|
-
});
|
|
1996
|
-
}
|
|
1997
|
-
for (const worker of workers) {
|
|
1998
|
-
if (!worker.build) continue;
|
|
1999
|
-
dockerfiles[worker.build.dockerfile] = require_seeds.workerDockerfile({
|
|
2000
|
-
id: worker.id,
|
|
2001
|
-
name: worker.name,
|
|
2002
|
-
app: worker.host
|
|
2003
|
-
}, workspace.apps[worker.host], {
|
|
2004
|
-
layout,
|
|
2005
|
-
workspaceRoot: workspace.root,
|
|
2006
|
-
cache: require_seeds.STACK_CACHE
|
|
2007
|
-
});
|
|
2008
|
-
}
|
|
2009
|
-
for (const unit of processors) {
|
|
2010
|
-
if (!unit.build) continue;
|
|
2011
|
-
dockerfiles[unit.build.dockerfile] = require_seeds.processorDockerfile({
|
|
2012
|
-
id: unit.id,
|
|
2013
|
-
name: unit.name,
|
|
2014
|
-
app: unit.host
|
|
2015
|
-
}, workspace.apps[unit.host], {
|
|
2016
|
-
layout,
|
|
2017
|
-
workspaceRoot: workspace.root,
|
|
2018
|
-
native: unit.native,
|
|
2019
|
-
cache: require_seeds.STACK_CACHE
|
|
2020
|
-
});
|
|
2021
|
-
}
|
|
2022
|
-
return {
|
|
2023
|
-
project,
|
|
2024
|
-
stage,
|
|
2025
|
-
local,
|
|
2026
|
-
apps,
|
|
2027
|
-
workers,
|
|
2028
|
-
processors,
|
|
2029
|
-
mobileApps,
|
|
2030
|
-
infra,
|
|
2031
|
-
compose,
|
|
2032
|
-
proxy,
|
|
2033
|
-
routes,
|
|
2034
|
-
...wildcard ? { wildcard: {
|
|
2035
|
-
site: wildcard.site,
|
|
2036
|
-
host: `*.${wildcard.edge.domain}`,
|
|
2037
|
-
tls: wildcard.edge.tls.kind
|
|
2038
|
-
} } : {},
|
|
2039
|
-
...proxy === "caddy" ? { caddyfile: edgeCaddyfile(routes, { tls }) } : { traefik: traefikDynamicFile(routes, {
|
|
2040
|
-
project,
|
|
2041
|
-
tls: deployedTls
|
|
2042
|
-
}) },
|
|
2043
|
-
...certificate ? { tls: certificate } : {},
|
|
2044
|
-
dockerfiles,
|
|
2045
|
-
plan,
|
|
2046
|
-
credential,
|
|
2047
|
-
resolution: {
|
|
2048
|
-
...derivation,
|
|
2049
|
-
addresses: {
|
|
2050
|
-
...publicAddresses,
|
|
2051
|
-
...Object.fromEntries([...fileServers].map(([id, { url }]) => [id, url]))
|
|
2052
|
-
}
|
|
2053
|
-
},
|
|
2054
|
-
...storage ? { storage } : {},
|
|
2055
|
-
devServices: local ? [] : require_seeds.devServicesUsed(services),
|
|
2056
|
-
...logs ? { logs } : {},
|
|
2057
|
-
...telemetry ? { telemetry } : {},
|
|
2058
|
-
...redis ? { redis } : {},
|
|
2059
|
-
...backups ? { backups } : {}
|
|
2060
|
-
};
|
|
2061
|
-
}
|
|
2062
|
-
/** The stack's MinIO's value for one of the S3 client's keys. */
|
|
2063
|
-
function storageValue(key, storage) {
|
|
2064
|
-
if (!storage) return void 0;
|
|
2065
|
-
if (key === "AWS_ACCESS_KEY_ID") return storage.user;
|
|
2066
|
-
if (key === "AWS_SECRET_ACCESS_KEY") return storage.password;
|
|
2067
|
-
if (key === "AWS_REGION") return MINIO_REGION;
|
|
2068
|
-
}
|
|
2069
|
-
/** Which bucket an S3 credential key belongs to — the first one declared. */
|
|
2070
|
-
function storageOwner(key, plan) {
|
|
2071
|
-
if (!STORAGE_KEYS.includes(key)) return void 0;
|
|
2072
|
-
return plan.resources.find((r) => r.kind === "objects");
|
|
2073
|
-
}
|
|
2074
|
-
/** The apps a stack runs: every API and every site, at its stage address. */
|
|
2075
|
-
function stackApps(workspace, manifest, plan, options) {
|
|
2076
|
-
const apps = [];
|
|
2077
|
-
const resources = new Map(plan.resources.map((r) => [r.id, r]));
|
|
2078
|
-
for (const [id, declaration] of Object.entries(manifest)) {
|
|
2079
|
-
if (declaration.kind !== "rest-api" && declaration.kind !== "websocket-api" && declaration.kind !== "site") continue;
|
|
2080
|
-
const name = require_derive.appKey(id);
|
|
2081
|
-
const app = workspace.apps[name];
|
|
2082
|
-
const resource = resources.get(id);
|
|
2083
|
-
if (!app || !resource || !app.port) continue;
|
|
2084
|
-
const host = hostOf(name, app, workspace, resource, options);
|
|
2085
|
-
const tag = declaration.kind === "site" ? siteTag(options.images.tag, options.stage) : options.images.tag;
|
|
2086
|
-
const ref = require_seeds.validateImageRef(require_identity.imageRef(options.identity, name, options.images.registry, tag));
|
|
2087
|
-
apps.push({
|
|
2088
|
-
app: name,
|
|
2089
|
-
name,
|
|
2090
|
-
id,
|
|
2091
|
-
kind: declaration.kind,
|
|
2092
|
-
replicas: declaration.kind === "websocket-api" ? declaration.replicas ?? 1 : 1,
|
|
2093
|
-
path: app.path,
|
|
2094
|
-
port: app.port,
|
|
2095
|
-
host,
|
|
2096
|
-
url: `${declaration.kind === "websocket-api" ? "wss" : "https"}://${host}${options.local && options.https !== 443 ? `:${options.https}` : ""}`,
|
|
2097
|
-
ref,
|
|
2098
|
-
tag,
|
|
2099
|
-
...options.images.mode === "build" ? { build: { dockerfile: `${stackDir(options.stage)}/Dockerfile.${name}` } } : {}
|
|
2100
|
-
});
|
|
2101
|
-
}
|
|
2102
|
-
return apps.sort((a, b) => a.name.localeCompare(b.name));
|
|
2103
|
-
}
|
|
2104
|
-
/**
|
|
2105
|
-
* Where SNS pushes to a worker on a deployed stage, or nothing when it pushes
|
|
2106
|
-
* to none of its subscribers.
|
|
2107
|
-
*
|
|
2108
|
-
* A subscriber is pushed to when the connection string its deliveries come
|
|
2109
|
-
* from — its topic's, or its bucket's events — as this stage resolved it for
|
|
2110
|
-
* the worker, is an SNS one — the same test the worker's own
|
|
2111
|
-
* startup makes, so the edge exposes a route exactly when the worker mounts
|
|
2112
|
-
* it. Each such route, and nothing else the worker serves, answers on
|
|
2113
|
-
* `<worker>.<domain>`.
|
|
2114
|
-
*/
|
|
2115
|
-
function workerPush(worker, subscribers, env, options) {
|
|
2116
|
-
const pushed = subscribers.filter(({ connectionKey }) => env[connectionKey]?.startsWith("sns:")).filter((subscriber, index, all) => all.findIndex((s) => s.name === subscriber.name) === index).sort((a, b) => a.name.localeCompare(b.name));
|
|
2117
|
-
if (pushed.length === 0) return void 0;
|
|
2118
|
-
if (!options.domain) throw new require_seeds.NoDomainForStage(options.stage);
|
|
2119
|
-
const host = `${worker.name}.${options.domain}`;
|
|
2120
|
-
const url = `https://${host}`;
|
|
2121
|
-
return {
|
|
2122
|
-
host,
|
|
2123
|
-
url,
|
|
2124
|
-
paths: pushed.map(({ name }) => require_SubscriberGenerator.subscriberRoute(name)),
|
|
2125
|
-
subscribers: pushed.map(({ name, connectionKey, events }) => ({
|
|
2126
|
-
name,
|
|
2127
|
-
connectionKey,
|
|
2128
|
-
endpoint: `${url}${require_SubscriberGenerator.subscriberRoute(name)}`,
|
|
2129
|
-
...events ? { events } : {}
|
|
2130
|
-
}))
|
|
2131
|
-
};
|
|
2132
|
-
}
|
|
2133
|
-
/** A pushed subscriber the deploy recorded no SNS subscription for. */
|
|
2134
|
-
var PushSubscriptionMissing = class extends require_errors.GkmError {
|
|
2135
|
-
worker;
|
|
2136
|
-
subscriber;
|
|
2137
|
-
constructor(worker, subscriber) {
|
|
2138
|
-
super(`SNS pushes to '${subscriber}' on the worker '${worker}', and the deploy recorded no subscription for it, so the worker would mount no route and SNS would deliver nowhere. Deploy the stage, which subscribes each pushed subscriber and records its ARN.`);
|
|
2139
|
-
this.worker = worker;
|
|
2140
|
-
this.subscriber = subscriber;
|
|
2141
|
-
this.name = "PushSubscriptionMissing";
|
|
2142
|
-
}
|
|
2143
|
-
};
|
|
2144
|
-
/**
|
|
2145
|
-
* The worker's `GKM_SNS_SUBSCRIPTIONS`: each pushed subscriber's recorded
|
|
2146
|
-
* subscription ARN, and nothing for a subscriber it does not run.
|
|
2147
|
-
*
|
|
2148
|
-
* @throws {PushSubscriptionMissing} when one has none
|
|
2149
|
-
*/
|
|
2150
|
-
function recordedSubscriptions(worker, push, recorded = {}) {
|
|
2151
|
-
const arns = {};
|
|
2152
|
-
for (const { name } of push.subscribers) {
|
|
2153
|
-
const arn = recorded[name];
|
|
2154
|
-
if (!arn) throw new PushSubscriptionMissing(worker.name, name);
|
|
2155
|
-
arns[name] = arn;
|
|
2156
|
-
}
|
|
2157
|
-
return JSON.stringify(arns);
|
|
2158
|
-
}
|
|
2159
|
-
/**
|
|
2160
|
-
* A wildcard site on a deployed stage with nowhere to get a certificate for
|
|
2161
|
-
* its tenants' hosts from. Let's Encrypt issues a wildcard certificate only
|
|
2162
|
-
* over the DNS challenge, so the stage either brings its own or gives the
|
|
2163
|
-
* proxy a way to get one.
|
|
2164
|
-
*/
|
|
2165
|
-
var WildcardSiteCertificateMissing = class extends require_errors.GkmError {
|
|
2166
|
-
site;
|
|
2167
|
-
stage;
|
|
2168
|
-
proxy;
|
|
2169
|
-
domain;
|
|
2170
|
-
constructor(site, stage, proxy, domain) {
|
|
2171
|
-
super(proxy === "traefik" ? `'${site}' answers on every subdomain of ${domain}, and '${stage}' has no certificate for them. Set deploy.compose.tls for '${stage}' to a *.${domain} certificate, or manage ${domain} with dns: { '<root domain>': { provider: 'route53' } } so the shared edge gets one over the DNS challenge.` : `'${site}' answers on every subdomain of ${domain}, and '${stage}' has no certificate for them. Set deploy.compose.tls for '${stage}' to a *.${domain} certificate, or give the site \`hosts\` so Caddy gets one per tenant, on demand.`);
|
|
2172
|
-
this.site = site;
|
|
2173
|
-
this.stage = stage;
|
|
2174
|
-
this.proxy = proxy;
|
|
2175
|
-
this.domain = domain;
|
|
2176
|
-
this.name = "WildcardSiteCertificateMissing";
|
|
2177
|
-
}
|
|
2178
|
-
};
|
|
2179
|
-
/**
|
|
2180
|
-
* A deployed stage's wildcard site, as its edge serves it: the labels it
|
|
2181
|
-
* never takes, and its certificate — the stage's own (`deploy.compose.tls`)
|
|
2182
|
-
* first; then, on the shared Traefik edge, a `*.<domain>` one over the DNS
|
|
2183
|
-
* challenge when Route 53 manages the domain; on the stack's own Caddy, one
|
|
2184
|
-
* per host on demand, asked of the site's `hosts` route.
|
|
2185
|
-
*
|
|
2186
|
-
* @throws {WildcardSiteCertificateMissing} when neither applies
|
|
2187
|
-
*/
|
|
2188
|
-
function stackWildcard(apps, options) {
|
|
2189
|
-
const { manifest, workspace, stage, proxy } = options;
|
|
2190
|
-
const app = apps.find((a) => (0, _geekmidas_manifest.isWildcardSite)(manifest[a.id]));
|
|
2191
|
-
if (!app) return void 0;
|
|
2192
|
-
const declaration = manifest[app.id];
|
|
2193
|
-
if (!(0, _geekmidas_manifest.isWildcardSite)(declaration)) return void 0;
|
|
2194
|
-
const domain = workspace.domains?.[stage];
|
|
2195
|
-
if (!domain) throw new require_seeds.NoDomainForStage(stage);
|
|
2196
|
-
const except = options.byId.get(app.id)?.protectedSubdomains ?? [];
|
|
2197
|
-
const tls = (() => {
|
|
2198
|
-
if (options.certificate) return { kind: "stage" };
|
|
2199
|
-
if (proxy === "traefik") {
|
|
2200
|
-
const dns = workspace.dns ? require_seeds.normalizeDnsConfig(workspace.dns) : {};
|
|
2201
|
-
const root = require_seeds.findRootDomain(domain, dns);
|
|
2202
|
-
if (root && dns[root]?.provider === "route53") return { kind: "dns" };
|
|
2203
|
-
} else if (declaration.hosts) {
|
|
2204
|
-
const surface = apps.find((a) => a.id === declaration.hosts?.surface);
|
|
2205
|
-
if (surface) return {
|
|
2206
|
-
kind: "on-demand",
|
|
2207
|
-
ask: `http://${options.hostOf(surface.name)}:${surface.port}${declaration.hosts.path}`
|
|
2208
|
-
};
|
|
2209
|
-
}
|
|
2210
|
-
throw new WildcardSiteCertificateMissing(app.id, stage, proxy, domain);
|
|
2211
|
-
})();
|
|
2212
|
-
return {
|
|
2213
|
-
site: app.id,
|
|
2214
|
-
edge: {
|
|
2215
|
-
domain,
|
|
2216
|
-
except,
|
|
2217
|
-
tls
|
|
2218
|
-
}
|
|
2219
|
-
};
|
|
2220
|
-
}
|
|
2221
|
-
/**
|
|
2222
|
-
* The first label under `stage`'s domain of every other stage's domain that
|
|
2223
|
-
* sits beneath it — `staging` for `staging.example.com` (or
|
|
2224
|
-
* `a.staging.example.com`) under `example.com`.
|
|
2225
|
-
*/
|
|
2226
|
-
function nestedStageLabels(domains, stage) {
|
|
2227
|
-
const own = domains?.[stage]?.toLowerCase();
|
|
2228
|
-
if (!own) return [];
|
|
2229
|
-
const labels = /* @__PURE__ */ new Set();
|
|
2230
|
-
for (const [other, domain] of Object.entries(domains ?? {})) {
|
|
2231
|
-
if (other === stage || !domain) continue;
|
|
2232
|
-
const lower = domain.toLowerCase();
|
|
2233
|
-
if (!lower.endsWith(`.${own}`)) continue;
|
|
2234
|
-
const rest = lower.slice(0, -(own.length + 1)).split(".");
|
|
2235
|
-
labels.add(rest.at(-1));
|
|
2236
|
-
}
|
|
2237
|
-
return [...labels].sort();
|
|
2238
|
-
}
|
|
2239
|
-
/** Two constructs the edge would answer on one host. */
|
|
2240
|
-
var EdgeHostTaken = class extends require_errors.GkmError {
|
|
2241
|
-
host;
|
|
2242
|
-
first;
|
|
2243
|
-
second;
|
|
2244
|
-
constructor(host, first, second) {
|
|
2245
|
-
super(`'${first}' and '${second}' would both answer on ${host}, and the edge can send a host to only one of them. Give one a subdomain of its own, or rename it.`);
|
|
2246
|
-
this.host = host;
|
|
2247
|
-
this.first = first;
|
|
2248
|
-
this.second = second;
|
|
2249
|
-
this.name = "EdgeHostTaken";
|
|
2250
|
-
}
|
|
2251
|
-
};
|
|
2252
|
-
/** Refuse a stack where one host would be routed to two services. */
|
|
2253
|
-
function assertHostsUnique(routes) {
|
|
2254
|
-
const claimed = /* @__PURE__ */ new Map();
|
|
2255
|
-
for (const { host, name } of routes) {
|
|
2256
|
-
const first = claimed.get(host);
|
|
2257
|
-
if (first !== void 0) throw new EdgeHostTaken(host, first, name);
|
|
2258
|
-
claimed.set(host, name);
|
|
2259
|
-
}
|
|
2260
|
-
}
|
|
2261
|
-
/** Each processor unit's image, and where it is built from. */
|
|
2262
|
-
function stackProcessors(units, options) {
|
|
2263
|
-
return units.map((unit) => {
|
|
2264
|
-
const server = options.manifest[unit.id];
|
|
2265
|
-
const processors = server?.kind === "file-server" ? server.processors ?? [] : [];
|
|
2266
|
-
return {
|
|
2267
|
-
app: unit.name,
|
|
2268
|
-
name: unit.name,
|
|
2269
|
-
id: unit.id,
|
|
2270
|
-
host: unit.app,
|
|
2271
|
-
port: require_seeds.PROCESSOR_PORT,
|
|
2272
|
-
prefixes: [...new Set(processors.map((p) => p.prefix))].sort(),
|
|
2273
|
-
native: require_seeds.processorNative(options.manifest, unit.id),
|
|
2274
|
-
ref: require_seeds.validateImageRef(require_identity.imageRef(options.identity, unit.name, options.images.registry, options.images.tag)),
|
|
2275
|
-
tag: options.images.tag,
|
|
2276
|
-
...options.images.mode === "build" ? { build: { dockerfile: `${stackDir(options.stage)}/Dockerfile.${unit.name}` } } : {}
|
|
2277
|
-
};
|
|
2278
|
-
});
|
|
2279
|
-
}
|
|
2280
|
-
/** Each worker's image, and where it is built from. */
|
|
2281
|
-
function stackWorkers(units, options) {
|
|
2282
|
-
return units.map((unit) => ({
|
|
2283
|
-
app: unit.name,
|
|
2284
|
-
name: unit.name,
|
|
2285
|
-
id: unit.id,
|
|
2286
|
-
host: unit.app,
|
|
2287
|
-
port: require_seeds.WORKER_PORT,
|
|
2288
|
-
ref: require_seeds.validateImageRef(require_identity.imageRef(options.identity, unit.name, options.images.registry, options.images.tag)),
|
|
2289
|
-
tag: options.images.tag,
|
|
2290
|
-
...options.images.mode === "build" ? { build: { dockerfile: `${stackDir(options.stage)}/Dockerfile.${unit.name}` } } : {}
|
|
2291
|
-
}));
|
|
2292
|
-
}
|
|
2293
|
-
/**
|
|
2294
|
-
* The host an app answers on for a stage: the `gkm dev` edge's
|
|
2295
|
-
* `*.localhost` names for the local stage, and the stage's domain — by the
|
|
2296
|
-
* same rule a deploy follows — for any other.
|
|
2297
|
-
*/
|
|
2298
|
-
function hostOf(name, app, workspace, resource, options) {
|
|
2299
|
-
if (options.local) return require_seeds.hostFor(resource, workspace.name);
|
|
2300
|
-
if (resource.subdomain === _geekmidas_manifest.WILDCARD_SUBDOMAIN) {
|
|
2301
|
-
const domain = workspace.domains?.[options.stage];
|
|
2302
|
-
if (!domain) throw new require_seeds.NoDomainForStage(options.stage);
|
|
2303
|
-
return `${_geekmidas_manifest.WILDCARD_SUBDOMAIN}.${domain}`;
|
|
2304
|
-
}
|
|
2305
|
-
return require_seeds.resolveHost(name, app, options.stage, workspace.domains, require_seeds.isMainFrontendApp(name, app, workspace.apps));
|
|
2306
|
-
}
|
|
2307
|
-
/** An app's compose services, one per replica: `api`, `api-2`, `api-3`. */
|
|
2308
|
-
function replicaNames(app) {
|
|
2309
|
-
return [app.name, ...Array.from({ length: app.replicas - 1 }, (_, i) => `${app.name}-${i + 2}`)];
|
|
2310
|
-
}
|
|
2311
|
-
/** The compose document: the infrastructure, the apps, and the edge. */
|
|
2312
|
-
function stackFile(options) {
|
|
2313
|
-
const { project, plan, apps } = options;
|
|
2314
|
-
const infra = options.infra.filter((name) => name !== require_seeds.LOGS_SERVICE);
|
|
2315
|
-
const derived = require_seeds.composeFor({
|
|
2316
|
-
...plan,
|
|
2317
|
-
containers: [...infra]
|
|
2318
|
-
}, {
|
|
2319
|
-
project,
|
|
2320
|
-
ports: Object.fromEntries(require_seeds.portKeys(infra, plan.fakes).map((key) => [key, 0])),
|
|
2321
|
-
credentials: options.credentials
|
|
2322
|
-
});
|
|
2323
|
-
const services = {};
|
|
2324
|
-
const volumes = {
|
|
2325
|
-
...derived.volumes,
|
|
2326
|
-
...options.proxy === "caddy" ? {
|
|
2327
|
-
"caddy-data": {},
|
|
2328
|
-
"caddy-config": {}
|
|
2329
|
-
} : {},
|
|
2330
|
-
...options.logs ? { "openobserve-data": {} } : {}
|
|
2331
|
-
};
|
|
2332
|
-
for (const name of infra) {
|
|
2333
|
-
const { ports: _ports, depends_on, profiles: _profiles, ...service } = derived.services[name];
|
|
2334
|
-
services[name] = {
|
|
2335
|
-
...service,
|
|
2336
|
-
...depends_on?.length ? { depends_on: Object.fromEntries(depends_on.map((dep) => [dep, HEALTHY])) } : {}
|
|
2337
|
-
};
|
|
2338
|
-
}
|
|
2339
|
-
const postgres = services.postgres;
|
|
2340
|
-
if (postgres) postgres.ports = [`127.0.0.1::${LOOPBACK_SERVICES.postgres}`];
|
|
2341
|
-
const minio = services.minio;
|
|
2342
|
-
if (minio && options.storage) {
|
|
2343
|
-
minio.environment = {
|
|
2344
|
-
...minio.environment,
|
|
2345
|
-
MINIO_ROOT_USER: options.storage.user,
|
|
2346
|
-
MINIO_ROOT_PASSWORD: options.storage.password,
|
|
2347
|
-
...require_seeds.minioWebhookEnv(options.storage.webhooks)
|
|
2348
|
-
};
|
|
2349
|
-
minio.ports = [`127.0.0.1::${LOOPBACK_SERVICES.minio}`];
|
|
2350
|
-
}
|
|
2351
|
-
const mailpit = services.mailpit;
|
|
2352
|
-
if (mailpit && options.inboxRelay) mailpit.environment = {
|
|
2353
|
-
...mailpit.environment,
|
|
2354
|
-
MP_WEBHOOK_URL: options.inboxRelay
|
|
2355
|
-
};
|
|
2356
|
-
if (services["redis"] && options.redis) services[require_seeds.REDIS_SERVICE] = require_seeds.redisService(options.redis);
|
|
2357
|
-
if (options.logs) services[require_seeds.LOGS_SERVICE] = require_seeds.logsService(options.logs);
|
|
2358
|
-
if (options.backups) services[require_snsSubscriptions.BACKUPS_SERVICE] = require_snsSubscriptions.backupsService(options.backups, options.envFiles);
|
|
2359
|
-
for (const app of apps) {
|
|
2360
|
-
const definition = {
|
|
2361
|
-
image: app.ref,
|
|
2362
|
-
...app.build ? { build: {
|
|
2363
|
-
...require_seeds.composeBuildPaths({
|
|
2364
|
-
composeDir: options.composeDir,
|
|
2365
|
-
buildRoot: options.buildRoot,
|
|
2366
|
-
workspaceRoot: options.workspaceRoot,
|
|
2367
|
-
dockerfile: app.build.dockerfile
|
|
2368
|
-
}),
|
|
2369
|
-
...app.build.args ? { args: app.build.args } : {}
|
|
2370
|
-
} } : {},
|
|
2371
|
-
restart: "unless-stopped",
|
|
2372
|
-
...app.kind !== "site" ? {
|
|
2373
|
-
env_file: [{
|
|
2374
|
-
path: `./${app.name}.env`,
|
|
2375
|
-
format: "raw"
|
|
2376
|
-
}],
|
|
2377
|
-
...infra.length ? { depends_on: Object.fromEntries(infra.map((name) => [name, HEALTHY])) } : {}
|
|
2378
|
-
} : {},
|
|
2379
|
-
healthcheck: probe(app.port, app.kind === "site" ? "/" : "/health"),
|
|
2380
|
-
...app.kind === "websocket-api" ? { ulimits: { nofile: NOFILE } } : {}
|
|
2381
|
-
};
|
|
2382
|
-
for (const name of replicaNames(app)) services[name] = { ...definition };
|
|
2383
|
-
}
|
|
2384
|
-
for (const worker of [...options.workers, ...options.processors]) services[worker.name] = {
|
|
2385
|
-
image: worker.ref,
|
|
2386
|
-
...worker.build ? { build: require_seeds.composeBuildPaths({
|
|
2387
|
-
composeDir: options.composeDir,
|
|
2388
|
-
buildRoot: options.buildRoot,
|
|
2389
|
-
workspaceRoot: options.workspaceRoot,
|
|
2390
|
-
dockerfile: worker.build.dockerfile
|
|
2391
|
-
}) } : {},
|
|
2392
|
-
restart: "unless-stopped",
|
|
2393
|
-
env_file: [{
|
|
2394
|
-
path: `./${worker.name}.env`,
|
|
2395
|
-
format: "raw"
|
|
2396
|
-
}],
|
|
2397
|
-
...infra.length ? { depends_on: Object.fromEntries(infra.map((name) => [name, HEALTHY])) } : {},
|
|
2398
|
-
healthcheck: probe(worker.port, "/health")
|
|
2399
|
-
};
|
|
2400
|
-
if (options.proxy === "caddy") services.caddy = {
|
|
2401
|
-
image: require_seeds.DEFAULT_IMAGES.caddy,
|
|
2402
|
-
restart: "unless-stopped",
|
|
2403
|
-
ports: [`${options.https}:443`, `${options.http}:80`],
|
|
2404
|
-
volumes: ["caddy-data:/data", "caddy-config:/config"],
|
|
2405
|
-
...EDGE_LIMITS,
|
|
2406
|
-
depends_on: Object.fromEntries([
|
|
2407
|
-
...apps.flatMap(replicaNames),
|
|
2408
|
-
...options.workers.filter((w) => w.push).map((w) => w.name),
|
|
2409
|
-
...options.processors.map((p) => p.name)
|
|
2410
|
-
].map((name) => [name, HEALTHY])),
|
|
2411
|
-
healthcheck: {
|
|
2412
|
-
test: [
|
|
2413
|
-
"CMD",
|
|
2414
|
-
"caddy",
|
|
2415
|
-
"version"
|
|
2416
|
-
],
|
|
2417
|
-
interval: "10s",
|
|
2418
|
-
timeout: "5s",
|
|
2419
|
-
retries: 5
|
|
2420
|
-
}
|
|
2421
|
-
};
|
|
2422
|
-
for (const [service, alias] of options.edge) {
|
|
2423
|
-
const definition = services[service];
|
|
2424
|
-
if (!definition) continue;
|
|
2425
|
-
definition.networks = {
|
|
2426
|
-
default: { aliases: [alias] },
|
|
2427
|
-
edge: { aliases: [alias] }
|
|
2428
|
-
};
|
|
2429
|
-
}
|
|
2430
|
-
for (const service of Object.values(services)) {
|
|
2431
|
-
if (!options.envFiles) delete service.env_file;
|
|
2432
|
-
service.logging = {
|
|
2433
|
-
driver: LOG_ROTATION.driver,
|
|
2434
|
-
options: { ...LOG_ROTATION.options }
|
|
2435
|
-
};
|
|
2436
|
-
}
|
|
2437
|
-
return {
|
|
2438
|
-
name: project,
|
|
2439
|
-
services,
|
|
2440
|
-
volumes,
|
|
2441
|
-
...options.edge.size > 0 ? { networks: { edge: {
|
|
2442
|
-
name: EDGE_NETWORK,
|
|
2443
|
-
external: true
|
|
2444
|
-
} } } : {}
|
|
2445
|
-
};
|
|
2446
|
-
}
|
|
2447
|
-
/**
|
|
2448
|
-
* A build without a layout: the workspace is the build root, with pnpm.
|
|
2449
|
-
* What a caller that never looked at the filesystem gets.
|
|
2450
|
-
*/
|
|
2451
|
-
function defaultLayout(root) {
|
|
2452
|
-
return {
|
|
2453
|
-
buildRoot: root,
|
|
2454
|
-
gkmRoot: ".",
|
|
2455
|
-
tools: {
|
|
2456
|
-
packageManager: "pnpm",
|
|
2457
|
-
turboVersion: require_seeds.TURBO_VERSION,
|
|
2458
|
-
monorepo: true
|
|
2459
|
-
},
|
|
2460
|
-
gkmPaths: ["gkm.config.*"]
|
|
2461
|
-
};
|
|
2462
|
-
}
|
|
2463
|
-
/** Render an app's env file: one `KEY=value` per line, read raw by compose. */
|
|
2464
|
-
function envFile(env) {
|
|
2465
|
-
return `${Object.entries(env).sort(([a], [b]) => a.localeCompare(b)).map(([key, value]) => `${key}=${value}`).join("\n")}\n`;
|
|
2466
|
-
}
|
|
2467
|
-
//#endregion
|
|
2468
653
|
//#region src/compose/edge.ts
|
|
2469
654
|
/**
|
|
2470
655
|
* The server's shared Traefik edge, in Docker: started when a stack needs it,
|
|
@@ -2485,7 +670,7 @@ function envFile(env) {
|
|
|
2485
670
|
/** The edge's compose project, as docker is asked about it. */
|
|
2486
671
|
function edgeRef(file, options = {}) {
|
|
2487
672
|
return {
|
|
2488
|
-
project: EDGE_PROJECT,
|
|
673
|
+
project: require_stack.EDGE_PROJECT,
|
|
2489
674
|
file,
|
|
2490
675
|
cwd: (0, node_path.dirname)(file),
|
|
2491
676
|
...options
|
|
@@ -2496,7 +681,7 @@ var EdgeWriteFailed = class extends require_errors.GkmError {
|
|
|
2496
681
|
path;
|
|
2497
682
|
output;
|
|
2498
683
|
constructor(path, output) {
|
|
2499
|
-
super(`Could not write ${path} in the shared edge (${EDGE_PROJECT}): ${output.trim() || "it is not running"}. Check it with \`docker compose -p ${EDGE_PROJECT} ps\` on the server, and run gkm compose again.`);
|
|
684
|
+
super(`Could not write ${path} in the shared edge (${require_stack.EDGE_PROJECT}): ${output.trim() || "it is not running"}. Check it with \`docker compose -p ${require_stack.EDGE_PROJECT} ps\` on the server, and run gkm compose again.`);
|
|
2500
685
|
this.path = path;
|
|
2501
686
|
this.output = output;
|
|
2502
687
|
this.name = "EdgeWriteFailed";
|
|
@@ -2517,7 +702,7 @@ var ComposeProxyClash = class extends require_errors.GkmError {
|
|
|
2517
702
|
holder;
|
|
2518
703
|
constructor(project, proxy, port, holder) {
|
|
2519
704
|
const by = holder.project ? `${holder.container} (compose project ${holder.project})` : holder.container;
|
|
2520
|
-
const fix = proxy === "traefik" ? holder.project === project && holder.service === "caddy" ? `That is this stack's own Caddy, from before it was switched to proxy: 'traefik'. Move it once: stop it (docker compose -p ${project} stop caddy), then run gkm compose again — the shared edge takes 80/443 and the stack registers with it.` : `The shared edge needs ports 80 and 443. Stop ${holder.container}${holder.project ? ` (docker compose -p ${holder.project} down, or its own gkm compose --down)` : ""}, or move the edge with GKM_COMPOSE_HTTPS_PORT/GKM_COMPOSE_HTTP_PORT.` : holder.project === "gkm-edge" ? `That is the server's shared Traefik edge, which other stacks register with. Set deploy.compose.proxy to 'traefik' for this stage so the stack registers with it too, or stop the edge once nothing uses it (docker compose -p ${EDGE_PROJECT} down).` : `Stop ${holder.container}, or publish this stack's Caddy elsewhere with GKM_COMPOSE_HTTPS_PORT/GKM_COMPOSE_HTTP_PORT.`;
|
|
705
|
+
const fix = proxy === "traefik" ? holder.project === project && holder.service === "caddy" ? `That is this stack's own Caddy, from before it was switched to proxy: 'traefik'. Move it once: stop it (docker compose -p ${project} stop caddy), then run gkm compose again — the shared edge takes 80/443 and the stack registers with it.` : `The shared edge needs ports 80 and 443. Stop ${holder.container}${holder.project ? ` (docker compose -p ${holder.project} down, or its own gkm compose --down)` : ""}, or move the edge with GKM_COMPOSE_HTTPS_PORT/GKM_COMPOSE_HTTP_PORT.` : holder.project === "gkm-edge" ? `That is the server's shared Traefik edge, which other stacks register with. Set deploy.compose.proxy to 'traefik' for this stage so the stack registers with it too, or stop the edge once nothing uses it (docker compose -p ${require_stack.EDGE_PROJECT} down).` : `Stop ${holder.container}, or publish this stack's Caddy elsewhere with GKM_COMPOSE_HTTPS_PORT/GKM_COMPOSE_HTTP_PORT.`;
|
|
2521
706
|
super(`${project} is set to proxy: '${proxy}', and port ${port} is held by ${by}. ${fix}`);
|
|
2522
707
|
this.project = project;
|
|
2523
708
|
this.proxy = proxy;
|
|
@@ -2540,7 +725,7 @@ async function assertEdgePorts(docker, options) {
|
|
|
2540
725
|
* `.yaml` and `.toml` files, so it never sees one half written.
|
|
2541
726
|
*/
|
|
2542
727
|
async function put(docker, edge, path, content, mode = "644") {
|
|
2543
|
-
const result = await docker.exec(edge, EDGE_SERVICE, [
|
|
728
|
+
const result = await docker.exec(edge, require_stack.EDGE_SERVICE, [
|
|
2544
729
|
"sh",
|
|
2545
730
|
"-c",
|
|
2546
731
|
"set -e; t=\"$1.tmp\"; cat > \"$t\"; chmod \"$2\" \"$t\"; mv \"$t\" \"$1\"",
|
|
@@ -2552,7 +737,7 @@ async function put(docker, edge, path, content, mode = "644") {
|
|
|
2552
737
|
}
|
|
2553
738
|
/** Remove files from the edge's container; whether the first was there. */
|
|
2554
739
|
async function remove(docker, edge, paths) {
|
|
2555
|
-
return (await docker.exec(edge, EDGE_SERVICE, [
|
|
740
|
+
return (await docker.exec(edge, require_stack.EDGE_SERVICE, [
|
|
2556
741
|
"sh",
|
|
2557
742
|
"-c",
|
|
2558
743
|
"e=1; [ -f \"$1\" ] && e=0; rm -f \"$@\"; exit $e",
|
|
@@ -2568,9 +753,10 @@ async function remove(docker, edge, paths) {
|
|
|
2568
753
|
*/
|
|
2569
754
|
async function ensureEdge(docker, options) {
|
|
2570
755
|
const { file, ports } = options;
|
|
2571
|
-
const
|
|
756
|
+
const staticConfig = require_stack.traefikStaticFile(ports);
|
|
757
|
+
const content = require_stack.edgeComposeFile({
|
|
2572
758
|
ports,
|
|
2573
|
-
staticConfig
|
|
759
|
+
staticConfig,
|
|
2574
760
|
logging: options.logging
|
|
2575
761
|
});
|
|
2576
762
|
await (0, node_fs_promises.mkdir)((0, node_path.dirname)(file), { recursive: true });
|
|
@@ -2580,13 +766,13 @@ async function ensureEdge(docker, options) {
|
|
|
2580
766
|
...options.output ? { output: options.output } : {},
|
|
2581
767
|
...options.signal ? { signal: options.signal } : {}
|
|
2582
768
|
});
|
|
2583
|
-
await docker.ensureNetwork(ref, EDGE_NETWORK);
|
|
2584
|
-
await docker.up(ref, [EDGE_SERVICE]);
|
|
769
|
+
await docker.ensureNetwork(ref, require_stack.EDGE_NETWORK);
|
|
770
|
+
await docker.up(ref, [require_stack.EDGE_SERVICE]);
|
|
2585
771
|
return [file];
|
|
2586
772
|
}
|
|
2587
773
|
/** A file inside the edge's running container, or undefined where there is none. */
|
|
2588
774
|
async function readEdgeFile(docker, edge, path) {
|
|
2589
|
-
const result = await docker.exec(edge, EDGE_SERVICE, ["cat", path]);
|
|
775
|
+
const result = await docker.exec(edge, require_stack.EDGE_SERVICE, ["cat", path]);
|
|
2590
776
|
return result.code === 0 ? result.stdout : void 0;
|
|
2591
777
|
}
|
|
2592
778
|
/** A file written into the edge's running container, whole, readable by it alone. */
|
|
@@ -2599,15 +785,15 @@ async function writeEdgeSecret(docker, edge, path, content) {
|
|
|
2599
785
|
* it back; `up` waits for it.
|
|
2600
786
|
*/
|
|
2601
787
|
async function restartEdge(docker, edge) {
|
|
2602
|
-
await docker.exec(edge, EDGE_SERVICE, ["kill", "1"]);
|
|
2603
|
-
await docker.up(edge, [EDGE_SERVICE]);
|
|
788
|
+
await docker.exec(edge, require_stack.EDGE_SERVICE, ["kill", "1"]);
|
|
789
|
+
await docker.up(edge, [require_stack.EDGE_SERVICE]);
|
|
2604
790
|
}
|
|
2605
791
|
/** A stack's routes, inside the edge's container. */
|
|
2606
792
|
function routesPath(project) {
|
|
2607
|
-
return `${EDGE_DYNAMIC_DIR}/${project}.yml`;
|
|
793
|
+
return `${require_stack.EDGE_DYNAMIC_DIR}/${project}.yml`;
|
|
2608
794
|
}
|
|
2609
795
|
function certificatePaths(project) {
|
|
2610
|
-
return [`${EDGE_CERTS_DIR}/${project}.crt`, `${EDGE_CERTS_DIR}/${project}.key`];
|
|
796
|
+
return [`${require_stack.EDGE_CERTS_DIR}/${project}.crt`, `${require_stack.EDGE_CERTS_DIR}/${project}.key`];
|
|
2611
797
|
}
|
|
2612
798
|
/**
|
|
2613
799
|
* Register a stack with the edge: its certificate first, where it has one,
|
|
@@ -2747,7 +933,7 @@ async function ensureEdgeAcmeKey(docker, options) {
|
|
|
2747
933
|
const zoneId = options.hostedZoneId ?? await hostedZoneId(clients.route53, options.zone);
|
|
2748
934
|
if (!zoneId) throw new AcmeHostedZoneMissing(domain);
|
|
2749
935
|
if (options.dryRun) {
|
|
2750
|
-
log(`🔑 Would let ${EDGE_PROJECT} write _acme-challenge.${domain} TXT records in ${zoneId}, as IAM user ${user} (dry run — nothing is written)`);
|
|
936
|
+
log(`🔑 Would let ${require_stack.EDGE_PROJECT} write _acme-challenge.${domain} TXT records in ${zoneId}, as IAM user ${user} (dry run — nothing is written)`);
|
|
2751
937
|
return {
|
|
2752
938
|
user,
|
|
2753
939
|
zoneId,
|
|
@@ -2774,8 +960,8 @@ async function ensureEdgeAcmeKey(docker, options) {
|
|
|
2774
960
|
PolicyName: project,
|
|
2775
961
|
PolicyDocument: acmeDnsPolicy(zoneId, domain)
|
|
2776
962
|
}));
|
|
2777
|
-
log(`🔑 ${EDGE_PROJECT} may write _acme-challenge.${domain} TXT records in ${zoneId}, and nothing else there, as IAM user ${user}`);
|
|
2778
|
-
const written = await readEdgeFile(docker, edge, EDGE_AWS_CREDENTIALS);
|
|
963
|
+
log(`🔑 ${require_stack.EDGE_PROJECT} may write _acme-challenge.${domain} TXT records in ${zoneId}, and nothing else there, as IAM user ${user}`);
|
|
964
|
+
const written = await readEdgeFile(docker, edge, require_stack.EDGE_AWS_CREDENTIALS);
|
|
2779
965
|
const held = written?.match(/aws_access_key_id\s*=\s*(\S+)/)?.[1];
|
|
2780
966
|
const { AccessKeyMetadata = [] } = await clients.iam.send(new IAM.ListAccessKeysCommand({ UserName: user }));
|
|
2781
967
|
if (held && AccessKeyMetadata.some((k) => k.AccessKeyId === held)) return {
|
|
@@ -2791,12 +977,12 @@ async function ensureEdgeAcmeKey(docker, options) {
|
|
|
2791
977
|
}));
|
|
2792
978
|
}
|
|
2793
979
|
const { AccessKey } = await clients.iam.send(new IAM.CreateAccessKeyCommand({ UserName: user }));
|
|
2794
|
-
await writeEdgeSecret(docker, edge, EDGE_AWS_CREDENTIALS, `# Written by gkm compose — the key ${EDGE_PROJECT} answers DNS challenges with.
|
|
980
|
+
await writeEdgeSecret(docker, edge, require_stack.EDGE_AWS_CREDENTIALS, `# Written by gkm compose — the key ${require_stack.EDGE_PROJECT} answers DNS challenges with.
|
|
2795
981
|
[default]
|
|
2796
982
|
aws_access_key_id = ${AccessKey?.AccessKeyId}
|
|
2797
983
|
aws_secret_access_key = ${AccessKey?.SecretAccessKey}
|
|
2798
984
|
`);
|
|
2799
|
-
log(`🔑 Wrote a new key for ${user} to ${EDGE_PROJECT} (${EDGE_AWS_CREDENTIALS})`);
|
|
985
|
+
log(`🔑 Wrote a new key for ${user} to ${require_stack.EDGE_PROJECT} (${require_stack.EDGE_AWS_CREDENTIALS})`);
|
|
2800
986
|
if (written !== void 0) await restartEdge(docker, edge);
|
|
2801
987
|
return {
|
|
2802
988
|
user,
|
|
@@ -2817,7 +1003,7 @@ async function hostedZoneId(route53, zone) {
|
|
|
2817
1003
|
//#endregion
|
|
2818
1004
|
//#region src/compose/secrets.ts
|
|
2819
1005
|
function deployedStackSecrets(workspace, stage, stored, manifest) {
|
|
2820
|
-
const withSeed =
|
|
1006
|
+
const withSeed = require_compose.withGeneratedSecrets(stored ?? require_credentials.initStageSecrets(stage), manifest);
|
|
2821
1007
|
const withLogs = require_workspace.resolveStageTelemetry({
|
|
2822
1008
|
...workspace.deploy?.telemetry ? { telemetry: workspace.deploy.telemetry } : {},
|
|
2823
1009
|
stage,
|
|
@@ -2825,12 +1011,12 @@ function deployedStackSecrets(workspace, stage, stored, manifest) {
|
|
|
2825
1011
|
target: "compose",
|
|
2826
1012
|
runtime: "server",
|
|
2827
1013
|
selfHosted: true,
|
|
2828
|
-
used:
|
|
2829
|
-
})?.provider === "self-hosted" ?
|
|
1014
|
+
used: require_apps.usesTelemetry(manifest)
|
|
1015
|
+
})?.provider === "self-hosted" ? require_compose.withLogsPassword(withSeed.secrets) : {
|
|
2830
1016
|
secrets: withSeed.secrets,
|
|
2831
1017
|
generated: []
|
|
2832
1018
|
};
|
|
2833
|
-
const withRedis =
|
|
1019
|
+
const withRedis = require_compose.runsRedis(manifest, withLogs.secrets.custom ?? {}) ? require_compose.withRedisPassword(withLogs.secrets) : {
|
|
2834
1020
|
secrets: withLogs.secrets,
|
|
2835
1021
|
generated: []
|
|
2836
1022
|
};
|
|
@@ -3124,10 +1310,10 @@ function edgePorts(env = process.env) {
|
|
|
3124
1310
|
if (!Number.isInteger(port) || port < 1 || port > 65535) throw new EdgePortInvalid(variable, value);
|
|
3125
1311
|
return port;
|
|
3126
1312
|
};
|
|
3127
|
-
const logs = env["GKM_COMPOSE_LOGS_PORT"] ? read(LOGS_PORT_ENV, 0) : void 0;
|
|
1313
|
+
const logs = env["GKM_COMPOSE_LOGS_PORT"] ? read(require_stack.LOGS_PORT_ENV, 0) : void 0;
|
|
3128
1314
|
return {
|
|
3129
|
-
https: read(EDGE_PORT_ENV.https, 443),
|
|
3130
|
-
http: read(EDGE_PORT_ENV.http, 80),
|
|
1315
|
+
https: read(require_stack.EDGE_PORT_ENV.https, 443),
|
|
1316
|
+
http: read(require_stack.EDGE_PORT_ENV.http, 80),
|
|
3131
1317
|
...logs ? { logs } : {}
|
|
3132
1318
|
};
|
|
3133
1319
|
}
|
|
@@ -3138,9 +1324,9 @@ function edgePorts(env = process.env) {
|
|
|
3138
1324
|
const defaultDeps = {
|
|
3139
1325
|
docker: dockerCompose,
|
|
3140
1326
|
revision: gitRevision,
|
|
3141
|
-
sql:
|
|
3142
|
-
buckets:
|
|
3143
|
-
logins:
|
|
1327
|
+
sql: require_apps.pgClient,
|
|
1328
|
+
buckets: require_apps.bucketClient,
|
|
1329
|
+
logins: require_apps.ensurePostgresLogin,
|
|
3144
1330
|
migrate: require_databases.migrateDatabases,
|
|
3145
1331
|
seed: require_databases.seedDatabases,
|
|
3146
1332
|
probe: httpsProbe,
|
|
@@ -3163,18 +1349,18 @@ async function validateCompose(ctx, deps, options = {}) {
|
|
|
3163
1349
|
if (push && mode !== "build") throw new ComposePushNeedsBuild();
|
|
3164
1350
|
if (options.pin && mode !== "pull") throw new ComposePinNeedsPull();
|
|
3165
1351
|
const registry = workspace.deploy?.registry;
|
|
3166
|
-
if (!registry && (push || mode === "pull")) throw new RegistryRequired(push ? "push" : "pull",
|
|
1352
|
+
if (!registry && (push || mode === "pull")) throw new require_stack.RegistryRequired(push ? "push" : "pull", require_credentials.imageRef(identity, ctx.apps[0] ?? workspace.name, void 0, tag));
|
|
3167
1353
|
const background = {};
|
|
3168
1354
|
const subscribers = {};
|
|
3169
1355
|
const manifest = await require_discover.discover({
|
|
3170
|
-
patterns:
|
|
1356
|
+
patterns: require_apps.constructGlobs(workspace),
|
|
3171
1357
|
cwd: root,
|
|
3172
1358
|
background,
|
|
3173
1359
|
subscribers
|
|
3174
1360
|
});
|
|
3175
1361
|
const { secrets, generated } = await stageSecrets(ctx, manifest);
|
|
3176
1362
|
const recorded = push ? void 0 : await ctx.state.read(stage);
|
|
3177
|
-
const layout = mode === "build" ?
|
|
1363
|
+
const layout = mode === "build" ? require_apps.imageLayout(workspace) : void 0;
|
|
3178
1364
|
const input = {
|
|
3179
1365
|
workspace,
|
|
3180
1366
|
manifest,
|
|
@@ -3188,14 +1374,14 @@ async function validateCompose(ctx, deps, options = {}) {
|
|
|
3188
1374
|
...registry ? { registry } : {}
|
|
3189
1375
|
},
|
|
3190
1376
|
secrets,
|
|
3191
|
-
...stage === workspace.stages.local ? { localCredentials: (await
|
|
1377
|
+
...stage === workspace.stages.local ? { localCredentials: (await require_compose.loadLocalCredentials(workspace)).credentials } : {},
|
|
3192
1378
|
allowDevServices: ctx.allowDevServices,
|
|
3193
1379
|
ports: edgePorts(deps.env),
|
|
3194
1380
|
...layout ? { layout } : {},
|
|
3195
1381
|
...push ? { buildOnly: true } : {}
|
|
3196
1382
|
};
|
|
3197
1383
|
const recordedArns = require_snsSubscriptions.recordedPushSubscriptions(recorded?.resources);
|
|
3198
|
-
const planned = push ? void 0 : composeStack({
|
|
1384
|
+
const planned = push ? void 0 : require_stack.composeStack({
|
|
3199
1385
|
...input,
|
|
3200
1386
|
recordingSubscriptions: true
|
|
3201
1387
|
});
|
|
@@ -3204,14 +1390,14 @@ async function validateCompose(ctx, deps, options = {}) {
|
|
|
3204
1390
|
pushes,
|
|
3205
1391
|
recorded: recorded?.resources
|
|
3206
1392
|
} : void 0;
|
|
3207
|
-
const composed = topics && planned ? planned : composeStack({
|
|
1393
|
+
const composed = topics && planned ? planned : require_stack.composeStack({
|
|
3208
1394
|
...input,
|
|
3209
1395
|
pushSubscriptions: recordedArns
|
|
3210
1396
|
});
|
|
3211
1397
|
if (mode === "build") assertRedisClient(workspace, composed, manifest);
|
|
3212
1398
|
const pinned = (unpinned) => options.pin ? withPinnedImages(unpinned, options.pin.file, options.pin.digests) : unpinned;
|
|
3213
1399
|
const stack = pinned(composed);
|
|
3214
|
-
if (mode === "pull" && !ctx.dryRun) await assertImagesExist(deps.docker, tag, [
|
|
1400
|
+
if (mode === "pull" && !ctx.dryRun) await require_stack.assertImagesExist(deps.docker, tag, [
|
|
3215
1401
|
...stack.apps,
|
|
3216
1402
|
...stack.workers,
|
|
3217
1403
|
...stack.processors
|
|
@@ -3228,7 +1414,7 @@ async function validateCompose(ctx, deps, options = {}) {
|
|
|
3228
1414
|
config: workspace.deploy?.compose?.server,
|
|
3229
1415
|
custom: secrets?.custom
|
|
3230
1416
|
});
|
|
3231
|
-
const dir = (0, node_path.join)(root, stackDir(stage));
|
|
1417
|
+
const dir = (0, node_path.join)(root, require_stack.stackDir(stage));
|
|
3232
1418
|
const override = stackOverrideFile(root, stage);
|
|
3233
1419
|
const overrides = (0, node_fs.existsSync)(override) ? [override] : [];
|
|
3234
1420
|
if (overrides.length > 0) ctx.logger.info(`🧩 Merging docker-compose.${stage}.yml over the generated stack`);
|
|
@@ -3252,7 +1438,7 @@ async function validateCompose(ctx, deps, options = {}) {
|
|
|
3252
1438
|
...merged[worker],
|
|
3253
1439
|
...own
|
|
3254
1440
|
};
|
|
3255
|
-
return pinned(composeStack({
|
|
1441
|
+
return pinned(require_stack.composeStack({
|
|
3256
1442
|
...input,
|
|
3257
1443
|
pushSubscriptions: merged
|
|
3258
1444
|
}));
|
|
@@ -3261,7 +1447,7 @@ async function validateCompose(ctx, deps, options = {}) {
|
|
|
3261
1447
|
...server ? { server } : {},
|
|
3262
1448
|
dir,
|
|
3263
1449
|
ref: {
|
|
3264
|
-
project: composeProject(identity),
|
|
1450
|
+
project: require_stack.composeProject(identity),
|
|
3265
1451
|
file: (0, node_path.join)(dir, "docker-compose.yml"),
|
|
3266
1452
|
...overrides.length > 0 ? { overrides } : {},
|
|
3267
1453
|
cwd: root,
|
|
@@ -3313,7 +1499,7 @@ function assertRedisClient(workspace, stack, manifest) {
|
|
|
3313
1499
|
if (!stack.plan.resources.some((r) => r.kind === "cache")) return;
|
|
3314
1500
|
const cacheKeys = Object.values(manifest).filter((d) => d.kind === "cache").flatMap((d) => d.provides ?? []);
|
|
3315
1501
|
const reachesCache = (keys) => cacheKeys.some((key) => keys?.has(key));
|
|
3316
|
-
const missing = [.../* @__PURE__ */ new Set([...stack.apps.filter((app) => (app.kind === "rest-api" || app.kind === "websocket-api") && reachesCache(
|
|
1502
|
+
const missing = [.../* @__PURE__ */ new Set([...stack.apps.filter((app) => (app.kind === "rest-api" || app.kind === "websocket-api") && reachesCache(require_apps.appEnvKeys(manifest, app.name))).map((a) => a.name), ...stack.workers.filter((worker) => reachesCache(require_apps.workerEnvKeys(manifest, worker.id))).map((worker) => worker.host)])].filter((name) => {
|
|
3317
1503
|
const app = workspace.apps[name];
|
|
3318
1504
|
return app && !require_drivers.installedFrom((0, node_path.join)(workspace.root, app.path), "ioredis");
|
|
3319
1505
|
}).sort();
|
|
@@ -3362,7 +1548,7 @@ async function stageHostsDns(ctx, deps, hosts, custom, wildcard) {
|
|
|
3362
1548
|
...deps.dnsProviderFor ? { providerFor: deps.dnsProviderFor } : {}
|
|
3363
1549
|
});
|
|
3364
1550
|
if (!ctx.dryRun) {
|
|
3365
|
-
const journal = await require_seeds.DeployJournal.open(ctx.state, stage, () =>
|
|
1551
|
+
const journal = await require_seeds.DeployJournal.open(ctx.state, stage, () => require_credentials.createComposeState(stage));
|
|
3366
1552
|
const providers = new Map(result.plan.domains.map((d) => [d.domain, d.provider]));
|
|
3367
1553
|
await require_seeds.recordDnsChanges(journal, result.changes, (domain) => providers.get(domain));
|
|
3368
1554
|
}
|
|
@@ -3389,7 +1575,7 @@ async function stageHostsDns(ctx, deps, hosts, custom, wildcard) {
|
|
|
3389
1575
|
async function pruneStageDns(ctx, run) {
|
|
3390
1576
|
if (!run.pruneDns) return;
|
|
3391
1577
|
const pruned = await run.pruneDns();
|
|
3392
|
-
const journal = await require_seeds.DeployJournal.open(ctx.state, ctx.stage, () =>
|
|
1578
|
+
const journal = await require_seeds.DeployJournal.open(ctx.state, ctx.stage, () => require_credentials.createComposeState(ctx.stage));
|
|
3393
1579
|
for (const { record } of pruned) await require_seeds.forgetDnsResource(journal, record);
|
|
3394
1580
|
const deleted = pruned.filter((p) => p.action === "delete").length;
|
|
3395
1581
|
if (deleted > 0) ctx.logger.info(`🌐 ${deleted} record${deleted === 1 ? "" : "s"} deleted`);
|
|
@@ -3420,9 +1606,9 @@ async function stageSecrets(ctx, manifest) {
|
|
|
3420
1606
|
* compose service runs.
|
|
3421
1607
|
*/
|
|
3422
1608
|
function withPinnedImages(stack, file, digests) {
|
|
3423
|
-
const apps = pinImages(file, digests, stack.apps);
|
|
3424
|
-
const workers = pinImages(file, digests, stack.workers);
|
|
3425
|
-
const processors = pinImages(file, digests, stack.processors);
|
|
1609
|
+
const apps = require_stack.pinImages(file, digests, stack.apps);
|
|
1610
|
+
const workers = require_stack.pinImages(file, digests, stack.workers);
|
|
1611
|
+
const processors = require_stack.pinImages(file, digests, stack.processors);
|
|
3426
1612
|
const services = { ...stack.compose.services };
|
|
3427
1613
|
for (const image of [
|
|
3428
1614
|
...apps,
|
|
@@ -3510,7 +1696,7 @@ async function planCompose(ctx, run) {
|
|
|
3510
1696
|
});
|
|
3511
1697
|
}
|
|
3512
1698
|
if (!run.push) planned({
|
|
3513
|
-
key: run.stack.proxy === "caddy" ? "service:caddy" : `service:${EDGE_PROJECT}/${EDGE_SERVICE}`,
|
|
1699
|
+
key: run.stack.proxy === "caddy" ? "service:caddy" : `service:${require_stack.EDGE_PROJECT}/${require_stack.EDGE_SERVICE}`,
|
|
3514
1700
|
resourceType: "service",
|
|
3515
1701
|
action: "ensure"
|
|
3516
1702
|
});
|
|
@@ -3523,8 +1709,8 @@ async function planCompose(ctx, run) {
|
|
|
3523
1709
|
async function edgeAcmeKey(ctx, run, deps) {
|
|
3524
1710
|
const { workspace, stage } = ctx;
|
|
3525
1711
|
const domain = workspace.domains?.[stage];
|
|
3526
|
-
const dns = workspace.dns ?
|
|
3527
|
-
const zone = domain ?
|
|
1712
|
+
const dns = workspace.dns ? require_credentials.normalizeDnsConfig(workspace.dns) : {};
|
|
1713
|
+
const zone = domain ? require_credentials.findRootDomain(domain, dns) : null;
|
|
3528
1714
|
const config = zone ? dns[zone] : void 0;
|
|
3529
1715
|
if (!domain || !zone || config?.provider !== "route53") return;
|
|
3530
1716
|
const route53 = config;
|
|
@@ -3585,23 +1771,23 @@ async function provisionCompose(ctx, run, deps) {
|
|
|
3585
1771
|
run.files = await writeStack(ctx.cwd, run.dir, stack);
|
|
3586
1772
|
printPlan(ctx, run);
|
|
3587
1773
|
if (stack.proxy === "traefik") {
|
|
3588
|
-
ctx.logger.info(`\n🌐 Starting the shared edge (${EDGE_PROJECT})…`);
|
|
1774
|
+
ctx.logger.info(`\n🌐 Starting the shared edge (${require_stack.EDGE_PROJECT})…`);
|
|
3589
1775
|
run.files.push(...await ensureEdge(deps.docker, {
|
|
3590
1776
|
file: edgeFile(run),
|
|
3591
1777
|
ports,
|
|
3592
1778
|
...ref.host ? { host: ref.host } : {},
|
|
3593
1779
|
logging: {
|
|
3594
|
-
driver: LOG_ROTATION.driver,
|
|
3595
|
-
options: { ...LOG_ROTATION.options }
|
|
1780
|
+
driver: require_stack.LOG_ROTATION.driver,
|
|
1781
|
+
options: { ...require_stack.LOG_ROTATION.options }
|
|
3596
1782
|
},
|
|
3597
1783
|
...ref.output ? { output: ref.output } : {},
|
|
3598
1784
|
...ref.signal ? { signal: ref.signal } : {}
|
|
3599
1785
|
}));
|
|
3600
1786
|
applied(ctx, run, {
|
|
3601
|
-
key: `service:${EDGE_PROJECT}/${EDGE_SERVICE}`,
|
|
1787
|
+
key: `service:${require_stack.EDGE_PROJECT}/${require_stack.EDGE_SERVICE}`,
|
|
3602
1788
|
resourceType: "service",
|
|
3603
1789
|
action: "ensure",
|
|
3604
|
-
id: `${EDGE_PROJECT}/${EDGE_SERVICE}`,
|
|
1790
|
+
id: `${require_stack.EDGE_PROJECT}/${require_stack.EDGE_SERVICE}`,
|
|
3605
1791
|
via: "found"
|
|
3606
1792
|
});
|
|
3607
1793
|
if (stack.wildcard?.tls === "dns") await edgeAcmeKey(ctx, run, deps);
|
|
@@ -3658,15 +1844,15 @@ async function subscribeTopics(ctx, run, deps) {
|
|
|
3658
1844
|
async function prepareBuckets(ctx, run, deps) {
|
|
3659
1845
|
const storage = run.stack.storage;
|
|
3660
1846
|
if (storage.buckets.length === 0) return;
|
|
3661
|
-
const tunnel = await reach(run, deps, "minio", LOOPBACK_SERVICES.minio);
|
|
1847
|
+
const tunnel = await reach(run, deps, "minio", require_stack.LOOPBACK_SERVICES.minio);
|
|
3662
1848
|
let done;
|
|
3663
1849
|
try {
|
|
3664
1850
|
const client = deps.buckets(tunnel.port, storage);
|
|
3665
1851
|
done = [
|
|
3666
|
-
...await
|
|
3667
|
-
...await
|
|
3668
|
-
...await
|
|
3669
|
-
...await
|
|
1852
|
+
...await require_apps.applyBuckets(client, storage.buckets),
|
|
1853
|
+
...await require_apps.applyPolicies(client, storage.policies),
|
|
1854
|
+
...await require_apps.applyLifecycles(client, storage.lifecycles),
|
|
1855
|
+
...await require_apps.applyNotifications(client, storage.objects, new Set(storage.webhooks.map((hook) => hook.bucket)))
|
|
3670
1856
|
];
|
|
3671
1857
|
} finally {
|
|
3672
1858
|
await tunnel.close();
|
|
@@ -3686,11 +1872,11 @@ async function prepareDatabases(ctx, run, deps) {
|
|
|
3686
1872
|
const tunnels = [];
|
|
3687
1873
|
try {
|
|
3688
1874
|
const ports = {};
|
|
3689
|
-
for (const [service, inside] of Object.entries(LOOPBACK_SERVICES)) {
|
|
1875
|
+
for (const [service, inside] of Object.entries(require_stack.LOOPBACK_SERVICES)) {
|
|
3690
1876
|
if (!run.stack.infra.includes(service)) continue;
|
|
3691
1877
|
const tunnel = await reach(run, deps, service, inside);
|
|
3692
1878
|
tunnels.push(tunnel);
|
|
3693
|
-
ports[
|
|
1879
|
+
ports[require_compose.primaryPortKey(service)] = tunnel.port;
|
|
3694
1880
|
}
|
|
3695
1881
|
await migrateAndSeed(ctx, run, deps, ports);
|
|
3696
1882
|
} finally {
|
|
@@ -3718,30 +1904,30 @@ async function reach(run, deps, service, inside) {
|
|
|
3718
1904
|
async function migrateAndSeed(ctx, run, deps, ports) {
|
|
3719
1905
|
const { stack } = run;
|
|
3720
1906
|
const workspace = ctx.workspace;
|
|
3721
|
-
const port = ports[
|
|
1907
|
+
const port = ports[require_compose.primaryPortKey("postgres")];
|
|
3722
1908
|
const superuser = stack.credential.containers.postgres;
|
|
3723
1909
|
const login = await deps.logins({
|
|
3724
1910
|
port,
|
|
3725
1911
|
login: superuser,
|
|
3726
1912
|
legacy: [{
|
|
3727
|
-
user:
|
|
1913
|
+
user: require_apps.LEGACY_LOCAL_LOGIN.user,
|
|
3728
1914
|
password: superuser.password
|
|
3729
|
-
}, ...stack.local ? [
|
|
1915
|
+
}, ...stack.local ? [require_apps.LEGACY_LOCAL_LOGIN] : []]
|
|
3730
1916
|
});
|
|
3731
1917
|
if (login.notice) ctx.logger.info(login.notice);
|
|
3732
|
-
const statements = [...
|
|
1918
|
+
const statements = [...require_apps.postgresStatements(stack.plan, workspace.name, stack.credential.seed), ...stack.backups ? require_stack.backupsRoleStatements(stack.backups) : []];
|
|
3733
1919
|
if (statements.length > 0) {
|
|
3734
1920
|
ctx.logger.info("🗄️ Creating databases, roles and grants…");
|
|
3735
|
-
await
|
|
1921
|
+
await require_apps.applyPostgres(deps.sql(port, login.login), statements);
|
|
3736
1922
|
}
|
|
3737
1923
|
const sources = {};
|
|
3738
1924
|
const manifest = await require_discover.discover({
|
|
3739
|
-
patterns:
|
|
1925
|
+
patterns: require_apps.constructGlobs(workspace),
|
|
3740
1926
|
cwd: workspace.root,
|
|
3741
1927
|
sources
|
|
3742
1928
|
});
|
|
3743
1929
|
const custom = run.secrets?.custom ?? {};
|
|
3744
|
-
const resolved =
|
|
1930
|
+
const resolved = require_apps.envFor(stack.plan, {
|
|
3745
1931
|
...stack.resolution,
|
|
3746
1932
|
ports,
|
|
3747
1933
|
credentials: {
|
|
@@ -3749,7 +1935,7 @@ async function migrateAndSeed(ctx, run, deps, ports) {
|
|
|
3749
1935
|
postgres: login.login
|
|
3750
1936
|
}
|
|
3751
1937
|
});
|
|
3752
|
-
const env =
|
|
1938
|
+
const env = require_apps.stageEnv(run.secrets ? require_credentials.toEmbeddableSecrets(run.secrets) : {}, Object.fromEntries(Object.entries(resolved).filter(([key]) => custom[key] === void 0)));
|
|
3753
1939
|
const options = {
|
|
3754
1940
|
root: workspace.root,
|
|
3755
1941
|
manifest,
|
|
@@ -3760,7 +1946,7 @@ async function migrateAndSeed(ctx, run, deps, ports) {
|
|
|
3760
1946
|
const seeds = await deps.seed({
|
|
3761
1947
|
...options,
|
|
3762
1948
|
stage: ctx.stage,
|
|
3763
|
-
backends:
|
|
1949
|
+
backends: require_apps.backendsOf(workspace)
|
|
3764
1950
|
}).catch((error) => {
|
|
3765
1951
|
if (error instanceof require_databases.SeedFailed) throw new require_seeds.DeploySeedsFailed(ctx.stage, error.construct, error.seed, error);
|
|
3766
1952
|
throw error;
|
|
@@ -3837,7 +2023,7 @@ async function releaseCompose(ctx, run, deps) {
|
|
|
3837
2023
|
});
|
|
3838
2024
|
if (stack.proxy === "traefik" && stack.traefik) {
|
|
3839
2025
|
const written = await writeEdgeRoutes(deps.docker, edge, stack.project, stack.traefik, stack.tls);
|
|
3840
|
-
ctx.logger.info(`🌐 Registered ${stack.routes.length} route(s) with ${EDGE_PROJECT}: ${written.at(-1)}`);
|
|
2026
|
+
ctx.logger.info(`🌐 Registered ${stack.routes.length} route(s) with ${require_stack.EDGE_PROJECT}: ${written.at(-1)}`);
|
|
3841
2027
|
} else if (!stack.local) await removeEdgeRoutes(deps.docker, edge, stack.project);
|
|
3842
2028
|
if (stack.local) await deps.docker.copyOut(ref, "caddy", "/data/caddy/pki/authorities/local/root.crt", caFile(run)).catch(() => {});
|
|
3843
2029
|
await recordImages(ctx, run);
|
|
@@ -3869,7 +2055,7 @@ async function releaseCompose(ctx, run, deps) {
|
|
|
3869
2055
|
for (const app of stack.apps) ctx.logger.info(` ${app.name.padEnd(12)} ${app.url}${app.auth ? ` 🔒 user: ${app.auth.user}, password: gkm secrets:show --stage ${ctx.stage} --reveal → ${app.auth.key}` : ""}`);
|
|
3870
2056
|
for (const worker of stack.workers) ctx.logger.info(` ${worker.name.padEnd(12)} worker ${worker.id}`);
|
|
3871
2057
|
for (const unit of stack.processors) ctx.logger.info(` ${unit.name.padEnd(12)} processors of ${unit.id}`);
|
|
3872
|
-
if (stack.local) ctx.logger.info(`\n🔐 Certificates are from Caddy's local CA: NODE_EXTRA_CA_CERTS=${(0, node_path.join)(stackDir(ctx.stage), "caddy-root.crt")}`);
|
|
2058
|
+
if (stack.local) ctx.logger.info(`\n🔐 Certificates are from Caddy's local CA: NODE_EXTRA_CA_CERTS=${(0, node_path.join)(require_stack.stackDir(ctx.stage), "caddy-root.crt")}`);
|
|
3873
2059
|
}
|
|
3874
2060
|
/**
|
|
3875
2061
|
* Each app's image in the stage's state — the same `images` a Dokploy deploy
|
|
@@ -3877,7 +2063,7 @@ async function releaseCompose(ctx, run, deps) {
|
|
|
3877
2063
|
* the tag resolved to.
|
|
3878
2064
|
*/
|
|
3879
2065
|
async function recordImages(ctx, run) {
|
|
3880
|
-
const journal = await require_seeds.DeployJournal.open(ctx.state, ctx.stage, () =>
|
|
2066
|
+
const journal = await require_seeds.DeployJournal.open(ctx.state, ctx.stage, () => require_credentials.createComposeState(ctx.stage));
|
|
3881
2067
|
const by = require_seeds.currentActor();
|
|
3882
2068
|
for (const app of [
|
|
3883
2069
|
...run.stack.apps,
|
|
@@ -3888,7 +2074,7 @@ async function recordImages(ctx, run) {
|
|
|
3888
2074
|
ref: app.ref,
|
|
3889
2075
|
tag: app.tag
|
|
3890
2076
|
};
|
|
3891
|
-
|
|
2077
|
+
require_credentials.recordRelease(journal.state, app.app, image, by);
|
|
3892
2078
|
}
|
|
3893
2079
|
journal.state.identity = ctx.identity.key;
|
|
3894
2080
|
await journal.save();
|
|
@@ -3913,7 +2099,7 @@ async function verifyCompose(ctx, run, deps) {
|
|
|
3913
2099
|
edge
|
|
3914
2100
|
})));
|
|
3915
2101
|
results.push(...await Promise.all([...stack.workers, ...stack.processors].map((worker) => checkContainer(ctx, run, deps, worker.name))));
|
|
3916
|
-
if (stack.logs) results.push(await checkContainer(ctx, run, deps,
|
|
2102
|
+
if (stack.logs) results.push(await checkContainer(ctx, run, deps, require_compose.LOGS_SERVICE));
|
|
3917
2103
|
const down = results.filter((result) => !result.healthy).map(({ app, url, last }) => ({
|
|
3918
2104
|
app,
|
|
3919
2105
|
url,
|
|
@@ -3993,7 +2179,7 @@ function basicAuthorization(auth) {
|
|
|
3993
2179
|
}
|
|
3994
2180
|
/** How to open the logs, printed — and as an event, for a headless caller. */
|
|
3995
2181
|
function reportLogs(ctx, logs, local, server) {
|
|
3996
|
-
const lines =
|
|
2182
|
+
const lines = require_compose.logsAccess(logs, {
|
|
3997
2183
|
stage: ctx.stage,
|
|
3998
2184
|
local,
|
|
3999
2185
|
user: server?.user ?? currentUser(),
|
|
@@ -4003,7 +2189,7 @@ function reportLogs(ctx, logs, local, server) {
|
|
|
4003
2189
|
ctx.logger.info(`\n${lines.join("\n")}`);
|
|
4004
2190
|
ctx.emit({
|
|
4005
2191
|
type: "logs.ready",
|
|
4006
|
-
service:
|
|
2192
|
+
service: require_compose.LOGS_SERVICE,
|
|
4007
2193
|
access: logs.public ? "public" : "tunnel",
|
|
4008
2194
|
url: logs.url,
|
|
4009
2195
|
...logs.public ? { allow: [...logs.public.allow] } : { port: logs.port },
|
|
@@ -4108,7 +2294,7 @@ function caFile(run) {
|
|
|
4108
2294
|
}
|
|
4109
2295
|
/** The shared edge's compose file, as this machine hands it to compose. */
|
|
4110
2296
|
function edgeFile(run) {
|
|
4111
|
-
return (0, node_path.join)(run.dir, `${EDGE_PROJECT}.yml`);
|
|
2297
|
+
return (0, node_path.join)(run.dir, `${require_stack.EDGE_PROJECT}.yml`);
|
|
4112
2298
|
}
|
|
4113
2299
|
function applied(ctx, run, change) {
|
|
4114
2300
|
const { via, ...rest } = change;
|
|
@@ -4137,7 +2323,7 @@ async function writeStack(root, dir, stack) {
|
|
|
4137
2323
|
cert: await (0, node_fs_promises.readFile)(stack.tls.certFile, "utf-8"),
|
|
4138
2324
|
key: await (0, node_fs_promises.readFile)(stack.tls.keyFile, "utf-8")
|
|
4139
2325
|
} : void 0;
|
|
4140
|
-
const compose = stack.caddyfile !== void 0 ? withCaddyConfigs(stack.compose, {
|
|
2326
|
+
const compose = stack.caddyfile !== void 0 ? require_stack.withCaddyConfigs(stack.compose, {
|
|
4141
2327
|
caddyfile: stack.caddyfile,
|
|
4142
2328
|
...tls ? { tls } : {}
|
|
4143
2329
|
}) : stack.compose;
|
|
@@ -4155,28 +2341,28 @@ async function writeStack(root, dir, stack) {
|
|
|
4155
2341
|
...stack.apps,
|
|
4156
2342
|
...stack.workers,
|
|
4157
2343
|
...stack.processors
|
|
4158
|
-
]) if (app.env) await write((0, node_path.join)(dir, `${app.name}.env`), envFile(app.env), 384);
|
|
4159
|
-
if (stack.logs && stack.compose.services["openobserve"]?.env_file) await write((0, node_path.join)(dir, `${
|
|
4160
|
-
if (stack.redis && stack.compose.services["redis"]?.env_file) await write((0, node_path.join)(dir, `${
|
|
2344
|
+
]) if (app.env) await write((0, node_path.join)(dir, `${app.name}.env`), require_stack.envFile(app.env), 384);
|
|
2345
|
+
if (stack.logs && stack.compose.services["openobserve"]?.env_file) await write((0, node_path.join)(dir, `${require_compose.LOGS_SERVICE}.env`), require_stack.envFile(stack.logs.env), 384);
|
|
2346
|
+
if (stack.redis && stack.compose.services["redis"]?.env_file) await write((0, node_path.join)(dir, `${require_compose.REDIS_SERVICE}.env`), require_stack.envFile(stack.redis.env), 384);
|
|
4161
2347
|
if (stack.backups) {
|
|
4162
|
-
for (const [name, content] of Object.entries(stack.backups.files)) await write((0, node_path.join)(dir,
|
|
4163
|
-
if (stack.compose.services["backups"]?.env_file) await write((0, node_path.join)(dir, `${
|
|
2348
|
+
for (const [name, content] of Object.entries(stack.backups.files)) await write((0, node_path.join)(dir, require_stack.BACKUPS_SERVICE, name), content);
|
|
2349
|
+
if (stack.compose.services["backups"]?.env_file) await write((0, node_path.join)(dir, `${require_stack.BACKUPS_SERVICE}.env`), require_stack.envFile(stack.backups.env), 384);
|
|
4164
2350
|
} else {
|
|
4165
|
-
await (0, node_fs_promises.rm)((0, node_path.join)(dir,
|
|
2351
|
+
await (0, node_fs_promises.rm)((0, node_path.join)(dir, require_stack.BACKUPS_SERVICE), {
|
|
4166
2352
|
recursive: true,
|
|
4167
2353
|
force: true
|
|
4168
2354
|
});
|
|
4169
|
-
await (0, node_fs_promises.rm)((0, node_path.join)(dir, `${
|
|
2355
|
+
await (0, node_fs_promises.rm)((0, node_path.join)(dir, `${require_stack.BACKUPS_SERVICE}.env`), { force: true });
|
|
4170
2356
|
}
|
|
4171
2357
|
for (const entry of await (0, node_fs_promises.readdir)(dir)) if (entry.endsWith(".credentials")) await (0, node_fs_promises.rm)((0, node_path.join)(dir, entry));
|
|
4172
2358
|
for (const [path, content] of Object.entries(stack.dockerfiles)) await write((0, node_path.join)(root, path), content);
|
|
4173
|
-
await
|
|
2359
|
+
await require_docker.ensureDockerignore(require_apps.findBuildRoot(root));
|
|
4174
2360
|
return files;
|
|
4175
2361
|
}
|
|
4176
2362
|
function composeYaml(stack, compose) {
|
|
4177
2363
|
const stage = ` --stage ${stack.stage}`;
|
|
4178
2364
|
return `# Generated by gkm compose from the construct manifest — do not edit.
|
|
4179
|
-
# The ${stack.stage} stage's APIs and sites behind ${stack.proxy === "caddy" ? "one Caddy" : `the shared Traefik edge (${EDGE_PROJECT})`}, and its workers.
|
|
2365
|
+
# The ${stack.stage} stage's APIs and sites behind ${stack.proxy === "caddy" ? "one Caddy" : `the shared Traefik edge (${require_stack.EDGE_PROJECT})`}, and its workers.
|
|
4180
2366
|
# Each backend and worker reads exactly the keys in its own env file beside
|
|
4181
2367
|
# this one.
|
|
4182
2368
|
#
|
|
@@ -4195,8 +2381,8 @@ function printPlan(ctx, run) {
|
|
|
4195
2381
|
for (const worker of stack.workers) ctx.logger.info(` ${worker.name.padEnd(12)} ${`worker ${worker.id} (no route)`.padEnd(40)} ${mode} ${worker.ref}`);
|
|
4196
2382
|
for (const unit of stack.processors) ctx.logger.info(` ${unit.name.padEnd(12)} ${`processors of ${unit.id}`.padEnd(40)} ${mode} ${unit.ref}`);
|
|
4197
2383
|
if (stack.infra.length > 0) ctx.logger.info(` infrastructure: ${stack.infra.join(", ")}`);
|
|
4198
|
-
if (stack.backups) ctx.logger.info(` ${
|
|
4199
|
-
ctx.logger.info(`\n📝 Wrote ${files.length} file(s) under ${stackDir(stack.stage)}/`);
|
|
2384
|
+
if (stack.backups) ctx.logger.info(` ${require_stack.BACKUPS_SERVICE.padEnd(12)} ${stack.backups.databases.map((d) => d.file).join(", ")} — ${stack.backups.backups.describe}, to ${stack.backups.prefix}/`);
|
|
2385
|
+
ctx.logger.info(`\n📝 Wrote ${files.length} file(s) under ${require_stack.stackDir(stack.stage)}/`);
|
|
4200
2386
|
}
|
|
4201
2387
|
//#endregion
|
|
4202
2388
|
//#region src/target/compose/index.ts
|
|
@@ -4282,30 +2468,12 @@ Object.defineProperty(exports, "ComposePushNeedsBuild", {
|
|
|
4282
2468
|
return ComposePushNeedsBuild;
|
|
4283
2469
|
}
|
|
4284
2470
|
});
|
|
4285
|
-
Object.defineProperty(exports, "EDGE_PROJECT", {
|
|
4286
|
-
enumerable: true,
|
|
4287
|
-
get: function() {
|
|
4288
|
-
return EDGE_PROJECT;
|
|
4289
|
-
}
|
|
4290
|
-
});
|
|
4291
|
-
Object.defineProperty(exports, "composeProject", {
|
|
4292
|
-
enumerable: true,
|
|
4293
|
-
get: function() {
|
|
4294
|
-
return composeProject;
|
|
4295
|
-
}
|
|
4296
|
-
});
|
|
4297
2471
|
Object.defineProperty(exports, "composeServer", {
|
|
4298
2472
|
enumerable: true,
|
|
4299
2473
|
get: function() {
|
|
4300
2474
|
return composeServer;
|
|
4301
2475
|
}
|
|
4302
2476
|
});
|
|
4303
|
-
Object.defineProperty(exports, "composeStack", {
|
|
4304
|
-
enumerable: true,
|
|
4305
|
-
get: function() {
|
|
4306
|
-
return composeStack;
|
|
4307
|
-
}
|
|
4308
|
-
});
|
|
4309
2477
|
Object.defineProperty(exports, "composeTarget", {
|
|
4310
2478
|
enumerable: true,
|
|
4311
2479
|
get: function() {
|
|
@@ -4324,12 +2492,6 @@ Object.defineProperty(exports, "deployedStackSecrets", {
|
|
|
4324
2492
|
return deployedStackSecrets;
|
|
4325
2493
|
}
|
|
4326
2494
|
});
|
|
4327
|
-
Object.defineProperty(exports, "derivedCredentials", {
|
|
4328
|
-
enumerable: true,
|
|
4329
|
-
get: function() {
|
|
4330
|
-
return derivedCredentials;
|
|
4331
|
-
}
|
|
4332
|
-
});
|
|
4333
2495
|
Object.defineProperty(exports, "dockerCompose", {
|
|
4334
2496
|
enumerable: true,
|
|
4335
2497
|
get: function() {
|
|
@@ -4342,12 +2504,6 @@ Object.defineProperty(exports, "dockerHost", {
|
|
|
4342
2504
|
return dockerHost;
|
|
4343
2505
|
}
|
|
4344
2506
|
});
|
|
4345
|
-
Object.defineProperty(exports, "edgeAlias", {
|
|
4346
|
-
enumerable: true,
|
|
4347
|
-
get: function() {
|
|
4348
|
-
return edgeAlias;
|
|
4349
|
-
}
|
|
4350
|
-
});
|
|
4351
2507
|
Object.defineProperty(exports, "edgePorts", {
|
|
4352
2508
|
enumerable: true,
|
|
4353
2509
|
get: function() {
|
|
@@ -4360,18 +2516,6 @@ Object.defineProperty(exports, "edgeRef", {
|
|
|
4360
2516
|
return edgeRef;
|
|
4361
2517
|
}
|
|
4362
2518
|
});
|
|
4363
|
-
Object.defineProperty(exports, "parseDigests", {
|
|
4364
|
-
enumerable: true,
|
|
4365
|
-
get: function() {
|
|
4366
|
-
return parseDigests;
|
|
4367
|
-
}
|
|
4368
|
-
});
|
|
4369
|
-
Object.defineProperty(exports, "pinnedRef", {
|
|
4370
|
-
enumerable: true,
|
|
4371
|
-
get: function() {
|
|
4372
|
-
return pinnedRef;
|
|
4373
|
-
}
|
|
4374
|
-
});
|
|
4375
2519
|
Object.defineProperty(exports, "projectNetwork", {
|
|
4376
2520
|
enumerable: true,
|
|
4377
2521
|
get: function() {
|
|
@@ -4396,23 +2540,11 @@ Object.defineProperty(exports, "sshTarget", {
|
|
|
4396
2540
|
return sshTarget;
|
|
4397
2541
|
}
|
|
4398
2542
|
});
|
|
4399
|
-
Object.defineProperty(exports, "stackDir", {
|
|
4400
|
-
enumerable: true,
|
|
4401
|
-
get: function() {
|
|
4402
|
-
return stackDir;
|
|
4403
|
-
}
|
|
4404
|
-
});
|
|
4405
2543
|
Object.defineProperty(exports, "stackOverrideFile", {
|
|
4406
2544
|
enumerable: true,
|
|
4407
2545
|
get: function() {
|
|
4408
2546
|
return stackOverrideFile;
|
|
4409
2547
|
}
|
|
4410
2548
|
});
|
|
4411
|
-
Object.defineProperty(exports, "stackPlan", {
|
|
4412
|
-
enumerable: true,
|
|
4413
|
-
get: function() {
|
|
4414
|
-
return stackPlan;
|
|
4415
|
-
}
|
|
4416
|
-
});
|
|
4417
2549
|
|
|
4418
|
-
//# sourceMappingURL=compose-
|
|
2550
|
+
//# sourceMappingURL=compose-D_fNsrkx.cjs.map
|