@geekmidas/cli 10.0.0-alpha.141 → 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-DxFAueU4.mjs → GoDaddyProvider-BIibcRG4.mjs} +2 -3
- package/dist/{GoDaddyProvider-DxFAueU4.mjs.map → GoDaddyProvider-BIibcRG4.mjs.map} +1 -1
- package/dist/{GoDaddyProvider-hAc0q5s-.cjs → GoDaddyProvider-C7Zt4dVy.cjs} +5 -6
- package/dist/{GoDaddyProvider-hAc0q5s-.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-BPY8Acgs.mjs → LegacyStateStore-Bd2I3zz7.mjs} +3 -3
- package/dist/{LegacyStateStore-BPY8Acgs.mjs.map → LegacyStateStore-Bd2I3zz7.mjs.map} +1 -1
- package/dist/{LegacyStateStore-BqSVgWi1.cjs → LegacyStateStore-DzRGMFhs.cjs} +3 -3
- package/dist/{LegacyStateStore-BqSVgWi1.cjs.map → LegacyStateStore-DzRGMFhs.cjs.map} +1 -1
- package/dist/{LocalStateStore-Df4RyGi2.cjs → LocalStateStore-Ci_tzIfp.cjs} +2 -2
- package/dist/{LocalStateStore-Df4RyGi2.cjs.map → LocalStateStore-Ci_tzIfp.cjs.map} +1 -1
- package/dist/{LocalStateStore-5pVR26KA.mjs → LocalStateStore-CzNrVQd2.mjs} +2 -2
- package/dist/{LocalStateStore-5pVR26KA.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-Do1DwEMX.mjs → S3StateStore-DVtcCMEc.mjs} +4 -4
- package/dist/{S3StateStore-Do1DwEMX.mjs.map → S3StateStore-DVtcCMEc.mjs.map} +1 -1
- package/dist/{S3StateStore-uykstvZI.cjs → S3StateStore-LrKb9lH7.cjs} +5 -5
- package/dist/{S3StateStore-uykstvZI.cjs.map → S3StateStore-LrKb9lH7.cjs.map} +1 -1
- package/dist/{SSMStateStore-xQ-Ce91W.mjs → SSMStateStore-CNHYH6g7.mjs} +2 -2
- package/dist/{SSMStateStore-xQ-Ce91W.mjs.map → SSMStateStore-CNHYH6g7.mjs.map} +1 -1
- package/dist/{SSMStateStore-DQXFWqkE.cjs → SSMStateStore-CpkvL95K.cjs} +2 -2
- package/dist/{SSMStateStore-DQXFWqkE.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-Y_nPkjIf.cjs → add-AlV6_ljM.cjs} +18 -17
- package/dist/{add-Y_nPkjIf.cjs.map → add-AlV6_ljM.cjs.map} +1 -1
- package/dist/{add-DLkN488n.mjs → add-B51nMuUd.mjs} +8 -7
- package/dist/{add-DLkN488n.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-COOvv27I.cjs → bundler-B-hw8rJi.cjs} +9 -9
- package/dist/{bundler-COOvv27I.cjs.map → bundler-B-hw8rJi.cjs.map} +1 -1
- package/dist/{bundler-DFyrGST-.mjs → bundler-DbIt3a6I.mjs} +6 -6
- package/dist/{bundler-DFyrGST-.mjs.map → bundler-DbIt3a6I.mjs.map} +1 -1
- package/dist/{cli-DKsV-Myw.cjs → cli-6eYxU_Q2.cjs} +4 -4
- package/dist/{cli-DKsV-Myw.cjs.map → cli-6eYxU_Q2.cjs.map} +1 -1
- package/dist/{cli-iAX4BQ3t.mjs → cli-CmmrPCM_.mjs} +4 -4
- package/dist/{cli-iAX4BQ3t.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-ofZIpp2q.mjs → compose-DVARqEeR.mjs} +16 -1828
- package/dist/compose-DVARqEeR.mjs.map +1 -0
- package/dist/{compose-CGXx22Wy.cjs → compose-D_fNsrkx.cjs} +101 -1967
- 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-BibGpDAz.cjs → deploy-CjJ447kd.cjs} +73 -72
- package/dist/{deploy-BibGpDAz.cjs.map → deploy-CjJ447kd.cjs.map} +1 -1
- package/dist/{deploy-C4QQkHK7.mjs → deploy-DqJiCwI9.mjs} +16 -15
- package/dist/{deploy-C4QQkHK7.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-pSrsileA.mjs → dokploy-B5_Y5wf0.mjs} +2 -2
- package/dist/{dokploy-pSrsileA.mjs.map → dokploy-B5_Y5wf0.mjs.map} +1 -1
- package/dist/{dokploy-B_VX3nLM.cjs → dokploy-EJKX2T7M.cjs} +2 -2
- package/dist/{dokploy-B_VX3nLM.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-cSSc8Lex.cjs → eas-AqSay-vE.cjs} +6 -6
- package/dist/{eas-cSSc8Lex.cjs.map → eas-AqSay-vE.cjs.map} +1 -1
- package/dist/{eas-Bou-_M76.mjs → eas-BQlD6Z-u.mjs} +3 -3
- package/dist/{eas-Bou-_M76.mjs.map → eas-BQlD6Z-u.mjs.map} +1 -1
- package/dist/{encryption-CElaAwJs.cjs → encryption-B6_aL5d-.cjs} +6 -6
- package/dist/{encryption-CElaAwJs.cjs.map → encryption-B6_aL5d-.cjs.map} +1 -1
- package/dist/{encryption-Bps9As2D.mjs → encryption-Dlh5mcE1.mjs} +3 -3
- package/dist/{encryption-Bps9As2D.mjs.map → encryption-Dlh5mcE1.mjs.map} +1 -1
- package/dist/{engine-CiG7Wfyc.cjs → engine-BAkmPI2z.cjs} +99 -97
- package/dist/{engine-CiG7Wfyc.cjs.map → engine-BAkmPI2z.cjs.map} +1 -1
- package/dist/{engine-CXE4UOHj.mjs → engine-D3P2P6RK.mjs} +12 -10
- package/dist/{engine-CXE4UOHj.mjs.map → engine-D3P2P6RK.mjs.map} +1 -1
- package/dist/{github-BzppIvpw.cjs → github-DokGIXT-.cjs} +18 -17
- package/dist/{github-BzppIvpw.cjs.map → github-DokGIXT-.cjs.map} +1 -1
- package/dist/{github-CvFJlFWA.mjs → github-STWxD6cu.mjs} +9 -8
- package/dist/{github-CvFJlFWA.mjs.map → github-STWxD6cu.mjs.map} +1 -1
- package/dist/{googlePlay-BJnMCWoa.cjs → googlePlay-DL0htRJD.cjs} +5 -5
- package/dist/{googlePlay-BJnMCWoa.cjs.map → googlePlay-DL0htRJD.cjs.map} +1 -1
- package/dist/{googlePlay-RSe9wOfZ.mjs → googlePlay-uAyXzxlu.mjs} +5 -5
- package/dist/{googlePlay-RSe9wOfZ.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-BCBs0BMn.cjs → migrate-BbJUJ4CY.cjs} +6 -6
- package/dist/{migrate-BCBs0BMn.cjs.map → migrate-BbJUJ4CY.cjs.map} +1 -1
- package/dist/{migrate-Dmh5Dbcr.cjs → migrate-CMurhHuj.cjs} +15 -13
- package/dist/{migrate-Dmh5Dbcr.cjs.map → migrate-CMurhHuj.cjs.map} +1 -1
- package/dist/{migrate-B0nQra2W.mjs → migrate-D079sADO.mjs} +3 -3
- package/dist/{migrate-B0nQra2W.mjs.map → migrate-D079sADO.mjs.map} +1 -1
- package/dist/{migrate-BPCJBL7_.mjs → migrate-D27h4H79.mjs} +7 -5
- package/dist/{migrate-BPCJBL7_.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-cthyGGQt.mjs → publish-B9BNIaf2.mjs} +2 -2
- package/dist/{publish-cthyGGQt.mjs.map → publish-B9BNIaf2.mjs.map} +1 -1
- package/dist/{publish-DKy3hn8a.cjs → publish-Bwgb-1JN.cjs} +2 -2
- package/dist/{publish-DKy3hn8a.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-BaRqJlqV.mjs → resolve-DheFxtmy.mjs} +4 -4
- package/dist/{resolve-BaRqJlqV.mjs.map → resolve-DheFxtmy.mjs.map} +1 -1
- package/dist/{resolve-AYtMIgoq.cjs → resolve-Dir9EjMu.cjs} +4 -4
- package/dist/{resolve-AYtMIgoq.cjs.map → resolve-Dir9EjMu.cjs.map} +1 -1
- package/dist/{rollback-DqV6t9oo.mjs → rollback-BWAB77F9.mjs} +8 -8
- package/dist/{rollback-DqV6t9oo.mjs.map → rollback-BWAB77F9.mjs.map} +1 -1
- package/dist/{rollback-CQ184yFu.cjs → rollback-CrtuUKqe.cjs} +11 -11
- package/dist/{rollback-CQ184yFu.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-Dnw9Kdel.cjs → serverSetup-BVL9HhNE.cjs} +9 -8
- package/dist/{serverSetup-Dnw9Kdel.cjs.map → serverSetup-BVL9HhNE.cjs.map} +1 -1
- package/dist/{serverSetup-AfG0-at8.mjs → serverSetup-D---hcyW.mjs} +7 -6
- package/dist/{serverSetup-AfG0-at8.mjs.map → serverSetup-D---hcyW.mjs.map} +1 -1
- package/dist/{sniffer-taO-AXSk.cjs → sniffer-BjHnOaCe.cjs} +9 -10
- package/dist/{sniffer-taO-AXSk.cjs.map → sniffer-BjHnOaCe.cjs.map} +1 -1
- package/dist/{sniffer-BHhJ8DiC.mjs → sniffer-DOyzfgPF.mjs} +8 -9
- package/dist/{sniffer-BHhJ8DiC.mjs.map → sniffer-DOyzfgPF.mjs.map} +1 -1
- package/dist/{snsSubscriptions-D_IBKhni.mjs → snsSubscriptions-Cf5DZfO5.mjs} +4 -453
- package/dist/snsSubscriptions-Cf5DZfO5.mjs.map +1 -0
- package/dist/{snsSubscriptions-CC-WM1zC.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-dd9dtLfh.mjs → stage-CTq3Gjsx.mjs} +7 -7
- package/dist/{stage-dd9dtLfh.mjs.map → stage-CTq3Gjsx.mjs.map} +1 -1
- package/dist/{stage-CTibxcpA.cjs → stage-s_8HOsH0.cjs} +13 -13
- package/dist/{stage-CTibxcpA.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/compose-CGXx22Wy.cjs.map +0 -1
- package/dist/compose-ofZIpp2q.mjs.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-DndMeyzm.cjs +0 -10669
- package/dist/seeds-DndMeyzm.cjs.map +0 -1
- package/dist/seeds-o6x6BTRo.mjs +0 -9534
- package/dist/seeds-o6x6BTRo.mjs.map +0 -1
- package/dist/snsSubscriptions-CC-WM1zC.cjs.map +0 -1
- package/dist/snsSubscriptions-D_IBKhni.mjs.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,1820 +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
|
-
cache: require_seeds.STACK_CACHE
|
|
2019
|
-
});
|
|
2020
|
-
}
|
|
2021
|
-
return {
|
|
2022
|
-
project,
|
|
2023
|
-
stage,
|
|
2024
|
-
local,
|
|
2025
|
-
apps,
|
|
2026
|
-
workers,
|
|
2027
|
-
processors,
|
|
2028
|
-
mobileApps,
|
|
2029
|
-
infra,
|
|
2030
|
-
compose,
|
|
2031
|
-
proxy,
|
|
2032
|
-
routes,
|
|
2033
|
-
...wildcard ? { wildcard: {
|
|
2034
|
-
site: wildcard.site,
|
|
2035
|
-
host: `*.${wildcard.edge.domain}`,
|
|
2036
|
-
tls: wildcard.edge.tls.kind
|
|
2037
|
-
} } : {},
|
|
2038
|
-
...proxy === "caddy" ? { caddyfile: edgeCaddyfile(routes, { tls }) } : { traefik: traefikDynamicFile(routes, {
|
|
2039
|
-
project,
|
|
2040
|
-
tls: deployedTls
|
|
2041
|
-
}) },
|
|
2042
|
-
...certificate ? { tls: certificate } : {},
|
|
2043
|
-
dockerfiles,
|
|
2044
|
-
plan,
|
|
2045
|
-
credential,
|
|
2046
|
-
resolution: {
|
|
2047
|
-
...derivation,
|
|
2048
|
-
addresses: {
|
|
2049
|
-
...publicAddresses,
|
|
2050
|
-
...Object.fromEntries([...fileServers].map(([id, { url }]) => [id, url]))
|
|
2051
|
-
}
|
|
2052
|
-
},
|
|
2053
|
-
...storage ? { storage } : {},
|
|
2054
|
-
devServices: local ? [] : require_seeds.devServicesUsed(services),
|
|
2055
|
-
...logs ? { logs } : {},
|
|
2056
|
-
...telemetry ? { telemetry } : {},
|
|
2057
|
-
...redis ? { redis } : {},
|
|
2058
|
-
...backups ? { backups } : {}
|
|
2059
|
-
};
|
|
2060
|
-
}
|
|
2061
|
-
/** The stack's MinIO's value for one of the S3 client's keys. */
|
|
2062
|
-
function storageValue(key, storage) {
|
|
2063
|
-
if (!storage) return void 0;
|
|
2064
|
-
if (key === "AWS_ACCESS_KEY_ID") return storage.user;
|
|
2065
|
-
if (key === "AWS_SECRET_ACCESS_KEY") return storage.password;
|
|
2066
|
-
if (key === "AWS_REGION") return MINIO_REGION;
|
|
2067
|
-
}
|
|
2068
|
-
/** Which bucket an S3 credential key belongs to — the first one declared. */
|
|
2069
|
-
function storageOwner(key, plan) {
|
|
2070
|
-
if (!STORAGE_KEYS.includes(key)) return void 0;
|
|
2071
|
-
return plan.resources.find((r) => r.kind === "objects");
|
|
2072
|
-
}
|
|
2073
|
-
/** The apps a stack runs: every API and every site, at its stage address. */
|
|
2074
|
-
function stackApps(workspace, manifest, plan, options) {
|
|
2075
|
-
const apps = [];
|
|
2076
|
-
const resources = new Map(plan.resources.map((r) => [r.id, r]));
|
|
2077
|
-
for (const [id, declaration] of Object.entries(manifest)) {
|
|
2078
|
-
if (declaration.kind !== "rest-api" && declaration.kind !== "websocket-api" && declaration.kind !== "site") continue;
|
|
2079
|
-
const name = require_derive.appKey(id);
|
|
2080
|
-
const app = workspace.apps[name];
|
|
2081
|
-
const resource = resources.get(id);
|
|
2082
|
-
if (!app || !resource || !app.port) continue;
|
|
2083
|
-
const host = hostOf(name, app, workspace, resource, options);
|
|
2084
|
-
const tag = declaration.kind === "site" ? siteTag(options.images.tag, options.stage) : options.images.tag;
|
|
2085
|
-
const ref = require_seeds.validateImageRef(require_identity.imageRef(options.identity, name, options.images.registry, tag));
|
|
2086
|
-
apps.push({
|
|
2087
|
-
app: name,
|
|
2088
|
-
name,
|
|
2089
|
-
id,
|
|
2090
|
-
kind: declaration.kind,
|
|
2091
|
-
replicas: declaration.kind === "websocket-api" ? declaration.replicas ?? 1 : 1,
|
|
2092
|
-
path: app.path,
|
|
2093
|
-
port: app.port,
|
|
2094
|
-
host,
|
|
2095
|
-
url: `${declaration.kind === "websocket-api" ? "wss" : "https"}://${host}${options.local && options.https !== 443 ? `:${options.https}` : ""}`,
|
|
2096
|
-
ref,
|
|
2097
|
-
tag,
|
|
2098
|
-
...options.images.mode === "build" ? { build: { dockerfile: `${stackDir(options.stage)}/Dockerfile.${name}` } } : {}
|
|
2099
|
-
});
|
|
2100
|
-
}
|
|
2101
|
-
return apps.sort((a, b) => a.name.localeCompare(b.name));
|
|
2102
|
-
}
|
|
2103
|
-
/**
|
|
2104
|
-
* Where SNS pushes to a worker on a deployed stage, or nothing when it pushes
|
|
2105
|
-
* to none of its subscribers.
|
|
2106
|
-
*
|
|
2107
|
-
* A subscriber is pushed to when the connection string its deliveries come
|
|
2108
|
-
* from — its topic's, or its bucket's events — as this stage resolved it for
|
|
2109
|
-
* the worker, is an SNS one — the same test the worker's own
|
|
2110
|
-
* startup makes, so the edge exposes a route exactly when the worker mounts
|
|
2111
|
-
* it. Each such route, and nothing else the worker serves, answers on
|
|
2112
|
-
* `<worker>.<domain>`.
|
|
2113
|
-
*/
|
|
2114
|
-
function workerPush(worker, subscribers, env, options) {
|
|
2115
|
-
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));
|
|
2116
|
-
if (pushed.length === 0) return void 0;
|
|
2117
|
-
if (!options.domain) throw new require_seeds.NoDomainForStage(options.stage);
|
|
2118
|
-
const host = `${worker.name}.${options.domain}`;
|
|
2119
|
-
const url = `https://${host}`;
|
|
2120
|
-
return {
|
|
2121
|
-
host,
|
|
2122
|
-
url,
|
|
2123
|
-
paths: pushed.map(({ name }) => require_SubscriberGenerator.subscriberRoute(name)),
|
|
2124
|
-
subscribers: pushed.map(({ name, connectionKey, events }) => ({
|
|
2125
|
-
name,
|
|
2126
|
-
connectionKey,
|
|
2127
|
-
endpoint: `${url}${require_SubscriberGenerator.subscriberRoute(name)}`,
|
|
2128
|
-
...events ? { events } : {}
|
|
2129
|
-
}))
|
|
2130
|
-
};
|
|
2131
|
-
}
|
|
2132
|
-
/** A pushed subscriber the deploy recorded no SNS subscription for. */
|
|
2133
|
-
var PushSubscriptionMissing = class extends require_errors.GkmError {
|
|
2134
|
-
worker;
|
|
2135
|
-
subscriber;
|
|
2136
|
-
constructor(worker, subscriber) {
|
|
2137
|
-
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.`);
|
|
2138
|
-
this.worker = worker;
|
|
2139
|
-
this.subscriber = subscriber;
|
|
2140
|
-
this.name = "PushSubscriptionMissing";
|
|
2141
|
-
}
|
|
2142
|
-
};
|
|
2143
|
-
/**
|
|
2144
|
-
* The worker's `GKM_SNS_SUBSCRIPTIONS`: each pushed subscriber's recorded
|
|
2145
|
-
* subscription ARN, and nothing for a subscriber it does not run.
|
|
2146
|
-
*
|
|
2147
|
-
* @throws {PushSubscriptionMissing} when one has none
|
|
2148
|
-
*/
|
|
2149
|
-
function recordedSubscriptions(worker, push, recorded = {}) {
|
|
2150
|
-
const arns = {};
|
|
2151
|
-
for (const { name } of push.subscribers) {
|
|
2152
|
-
const arn = recorded[name];
|
|
2153
|
-
if (!arn) throw new PushSubscriptionMissing(worker.name, name);
|
|
2154
|
-
arns[name] = arn;
|
|
2155
|
-
}
|
|
2156
|
-
return JSON.stringify(arns);
|
|
2157
|
-
}
|
|
2158
|
-
/**
|
|
2159
|
-
* A wildcard site on a deployed stage with nowhere to get a certificate for
|
|
2160
|
-
* its tenants' hosts from. Let's Encrypt issues a wildcard certificate only
|
|
2161
|
-
* over the DNS challenge, so the stage either brings its own or gives the
|
|
2162
|
-
* proxy a way to get one.
|
|
2163
|
-
*/
|
|
2164
|
-
var WildcardSiteCertificateMissing = class extends require_errors.GkmError {
|
|
2165
|
-
site;
|
|
2166
|
-
stage;
|
|
2167
|
-
proxy;
|
|
2168
|
-
domain;
|
|
2169
|
-
constructor(site, stage, proxy, domain) {
|
|
2170
|
-
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.`);
|
|
2171
|
-
this.site = site;
|
|
2172
|
-
this.stage = stage;
|
|
2173
|
-
this.proxy = proxy;
|
|
2174
|
-
this.domain = domain;
|
|
2175
|
-
this.name = "WildcardSiteCertificateMissing";
|
|
2176
|
-
}
|
|
2177
|
-
};
|
|
2178
|
-
/**
|
|
2179
|
-
* A deployed stage's wildcard site, as its edge serves it: the labels it
|
|
2180
|
-
* never takes, and its certificate — the stage's own (`deploy.compose.tls`)
|
|
2181
|
-
* first; then, on the shared Traefik edge, a `*.<domain>` one over the DNS
|
|
2182
|
-
* challenge when Route 53 manages the domain; on the stack's own Caddy, one
|
|
2183
|
-
* per host on demand, asked of the site's `hosts` route.
|
|
2184
|
-
*
|
|
2185
|
-
* @throws {WildcardSiteCertificateMissing} when neither applies
|
|
2186
|
-
*/
|
|
2187
|
-
function stackWildcard(apps, options) {
|
|
2188
|
-
const { manifest, workspace, stage, proxy } = options;
|
|
2189
|
-
const app = apps.find((a) => (0, _geekmidas_manifest.isWildcardSite)(manifest[a.id]));
|
|
2190
|
-
if (!app) return void 0;
|
|
2191
|
-
const declaration = manifest[app.id];
|
|
2192
|
-
if (!(0, _geekmidas_manifest.isWildcardSite)(declaration)) return void 0;
|
|
2193
|
-
const domain = workspace.domains?.[stage];
|
|
2194
|
-
if (!domain) throw new require_seeds.NoDomainForStage(stage);
|
|
2195
|
-
const except = options.byId.get(app.id)?.protectedSubdomains ?? [];
|
|
2196
|
-
const tls = (() => {
|
|
2197
|
-
if (options.certificate) return { kind: "stage" };
|
|
2198
|
-
if (proxy === "traefik") {
|
|
2199
|
-
const dns = workspace.dns ? require_seeds.normalizeDnsConfig(workspace.dns) : {};
|
|
2200
|
-
const root = require_seeds.findRootDomain(domain, dns);
|
|
2201
|
-
if (root && dns[root]?.provider === "route53") return { kind: "dns" };
|
|
2202
|
-
} else if (declaration.hosts) {
|
|
2203
|
-
const surface = apps.find((a) => a.id === declaration.hosts?.surface);
|
|
2204
|
-
if (surface) return {
|
|
2205
|
-
kind: "on-demand",
|
|
2206
|
-
ask: `http://${options.hostOf(surface.name)}:${surface.port}${declaration.hosts.path}`
|
|
2207
|
-
};
|
|
2208
|
-
}
|
|
2209
|
-
throw new WildcardSiteCertificateMissing(app.id, stage, proxy, domain);
|
|
2210
|
-
})();
|
|
2211
|
-
return {
|
|
2212
|
-
site: app.id,
|
|
2213
|
-
edge: {
|
|
2214
|
-
domain,
|
|
2215
|
-
except,
|
|
2216
|
-
tls
|
|
2217
|
-
}
|
|
2218
|
-
};
|
|
2219
|
-
}
|
|
2220
|
-
/**
|
|
2221
|
-
* The first label under `stage`'s domain of every other stage's domain that
|
|
2222
|
-
* sits beneath it — `staging` for `staging.example.com` (or
|
|
2223
|
-
* `a.staging.example.com`) under `example.com`.
|
|
2224
|
-
*/
|
|
2225
|
-
function nestedStageLabels(domains, stage) {
|
|
2226
|
-
const own = domains?.[stage]?.toLowerCase();
|
|
2227
|
-
if (!own) return [];
|
|
2228
|
-
const labels = /* @__PURE__ */ new Set();
|
|
2229
|
-
for (const [other, domain] of Object.entries(domains ?? {})) {
|
|
2230
|
-
if (other === stage || !domain) continue;
|
|
2231
|
-
const lower = domain.toLowerCase();
|
|
2232
|
-
if (!lower.endsWith(`.${own}`)) continue;
|
|
2233
|
-
const rest = lower.slice(0, -(own.length + 1)).split(".");
|
|
2234
|
-
labels.add(rest.at(-1));
|
|
2235
|
-
}
|
|
2236
|
-
return [...labels].sort();
|
|
2237
|
-
}
|
|
2238
|
-
/** Two constructs the edge would answer on one host. */
|
|
2239
|
-
var EdgeHostTaken = class extends require_errors.GkmError {
|
|
2240
|
-
host;
|
|
2241
|
-
first;
|
|
2242
|
-
second;
|
|
2243
|
-
constructor(host, first, second) {
|
|
2244
|
-
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.`);
|
|
2245
|
-
this.host = host;
|
|
2246
|
-
this.first = first;
|
|
2247
|
-
this.second = second;
|
|
2248
|
-
this.name = "EdgeHostTaken";
|
|
2249
|
-
}
|
|
2250
|
-
};
|
|
2251
|
-
/** Refuse a stack where one host would be routed to two services. */
|
|
2252
|
-
function assertHostsUnique(routes) {
|
|
2253
|
-
const claimed = /* @__PURE__ */ new Map();
|
|
2254
|
-
for (const { host, name } of routes) {
|
|
2255
|
-
const first = claimed.get(host);
|
|
2256
|
-
if (first !== void 0) throw new EdgeHostTaken(host, first, name);
|
|
2257
|
-
claimed.set(host, name);
|
|
2258
|
-
}
|
|
2259
|
-
}
|
|
2260
|
-
/** Each processor unit's image, and where it is built from. */
|
|
2261
|
-
function stackProcessors(units, options) {
|
|
2262
|
-
return units.map((unit) => {
|
|
2263
|
-
const server = options.manifest[unit.id];
|
|
2264
|
-
const processors = server?.kind === "file-server" ? server.processors ?? [] : [];
|
|
2265
|
-
return {
|
|
2266
|
-
app: unit.name,
|
|
2267
|
-
name: unit.name,
|
|
2268
|
-
id: unit.id,
|
|
2269
|
-
host: unit.app,
|
|
2270
|
-
port: require_seeds.PROCESSOR_PORT,
|
|
2271
|
-
prefixes: [...new Set(processors.map((p) => p.prefix))].sort(),
|
|
2272
|
-
ref: require_seeds.validateImageRef(require_identity.imageRef(options.identity, unit.name, options.images.registry, options.images.tag)),
|
|
2273
|
-
tag: options.images.tag,
|
|
2274
|
-
...options.images.mode === "build" ? { build: { dockerfile: `${stackDir(options.stage)}/Dockerfile.${unit.name}` } } : {}
|
|
2275
|
-
};
|
|
2276
|
-
});
|
|
2277
|
-
}
|
|
2278
|
-
/** Each worker's image, and where it is built from. */
|
|
2279
|
-
function stackWorkers(units, options) {
|
|
2280
|
-
return units.map((unit) => ({
|
|
2281
|
-
app: unit.name,
|
|
2282
|
-
name: unit.name,
|
|
2283
|
-
id: unit.id,
|
|
2284
|
-
host: unit.app,
|
|
2285
|
-
port: require_seeds.WORKER_PORT,
|
|
2286
|
-
ref: require_seeds.validateImageRef(require_identity.imageRef(options.identity, unit.name, options.images.registry, options.images.tag)),
|
|
2287
|
-
tag: options.images.tag,
|
|
2288
|
-
...options.images.mode === "build" ? { build: { dockerfile: `${stackDir(options.stage)}/Dockerfile.${unit.name}` } } : {}
|
|
2289
|
-
}));
|
|
2290
|
-
}
|
|
2291
|
-
/**
|
|
2292
|
-
* The host an app answers on for a stage: the `gkm dev` edge's
|
|
2293
|
-
* `*.localhost` names for the local stage, and the stage's domain — by the
|
|
2294
|
-
* same rule a deploy follows — for any other.
|
|
2295
|
-
*/
|
|
2296
|
-
function hostOf(name, app, workspace, resource, options) {
|
|
2297
|
-
if (options.local) return require_seeds.hostFor(resource, workspace.name);
|
|
2298
|
-
if (resource.subdomain === _geekmidas_manifest.WILDCARD_SUBDOMAIN) {
|
|
2299
|
-
const domain = workspace.domains?.[options.stage];
|
|
2300
|
-
if (!domain) throw new require_seeds.NoDomainForStage(options.stage);
|
|
2301
|
-
return `${_geekmidas_manifest.WILDCARD_SUBDOMAIN}.${domain}`;
|
|
2302
|
-
}
|
|
2303
|
-
return require_seeds.resolveHost(name, app, options.stage, workspace.domains, require_seeds.isMainFrontendApp(name, app, workspace.apps));
|
|
2304
|
-
}
|
|
2305
|
-
/** An app's compose services, one per replica: `api`, `api-2`, `api-3`. */
|
|
2306
|
-
function replicaNames(app) {
|
|
2307
|
-
return [app.name, ...Array.from({ length: app.replicas - 1 }, (_, i) => `${app.name}-${i + 2}`)];
|
|
2308
|
-
}
|
|
2309
|
-
/** The compose document: the infrastructure, the apps, and the edge. */
|
|
2310
|
-
function stackFile(options) {
|
|
2311
|
-
const { project, plan, apps } = options;
|
|
2312
|
-
const infra = options.infra.filter((name) => name !== require_seeds.LOGS_SERVICE);
|
|
2313
|
-
const derived = require_seeds.composeFor({
|
|
2314
|
-
...plan,
|
|
2315
|
-
containers: [...infra]
|
|
2316
|
-
}, {
|
|
2317
|
-
project,
|
|
2318
|
-
ports: Object.fromEntries(require_seeds.portKeys(infra, plan.fakes).map((key) => [key, 0])),
|
|
2319
|
-
credentials: options.credentials
|
|
2320
|
-
});
|
|
2321
|
-
const services = {};
|
|
2322
|
-
const volumes = {
|
|
2323
|
-
...derived.volumes,
|
|
2324
|
-
...options.proxy === "caddy" ? {
|
|
2325
|
-
"caddy-data": {},
|
|
2326
|
-
"caddy-config": {}
|
|
2327
|
-
} : {},
|
|
2328
|
-
...options.logs ? { "openobserve-data": {} } : {}
|
|
2329
|
-
};
|
|
2330
|
-
for (const name of infra) {
|
|
2331
|
-
const { ports: _ports, depends_on, profiles: _profiles, ...service } = derived.services[name];
|
|
2332
|
-
services[name] = {
|
|
2333
|
-
...service,
|
|
2334
|
-
...depends_on?.length ? { depends_on: Object.fromEntries(depends_on.map((dep) => [dep, HEALTHY])) } : {}
|
|
2335
|
-
};
|
|
2336
|
-
}
|
|
2337
|
-
const postgres = services.postgres;
|
|
2338
|
-
if (postgres) postgres.ports = [`127.0.0.1::${LOOPBACK_SERVICES.postgres}`];
|
|
2339
|
-
const minio = services.minio;
|
|
2340
|
-
if (minio && options.storage) {
|
|
2341
|
-
minio.environment = {
|
|
2342
|
-
...minio.environment,
|
|
2343
|
-
MINIO_ROOT_USER: options.storage.user,
|
|
2344
|
-
MINIO_ROOT_PASSWORD: options.storage.password,
|
|
2345
|
-
...require_seeds.minioWebhookEnv(options.storage.webhooks)
|
|
2346
|
-
};
|
|
2347
|
-
minio.ports = [`127.0.0.1::${LOOPBACK_SERVICES.minio}`];
|
|
2348
|
-
}
|
|
2349
|
-
const mailpit = services.mailpit;
|
|
2350
|
-
if (mailpit && options.inboxRelay) mailpit.environment = {
|
|
2351
|
-
...mailpit.environment,
|
|
2352
|
-
MP_WEBHOOK_URL: options.inboxRelay
|
|
2353
|
-
};
|
|
2354
|
-
if (services["redis"] && options.redis) services[require_seeds.REDIS_SERVICE] = require_seeds.redisService(options.redis);
|
|
2355
|
-
if (options.logs) services[require_seeds.LOGS_SERVICE] = require_seeds.logsService(options.logs);
|
|
2356
|
-
if (options.backups) services[require_snsSubscriptions.BACKUPS_SERVICE] = require_snsSubscriptions.backupsService(options.backups, options.envFiles);
|
|
2357
|
-
for (const app of apps) {
|
|
2358
|
-
const definition = {
|
|
2359
|
-
image: app.ref,
|
|
2360
|
-
...app.build ? { build: {
|
|
2361
|
-
...require_seeds.composeBuildPaths({
|
|
2362
|
-
composeDir: options.composeDir,
|
|
2363
|
-
buildRoot: options.buildRoot,
|
|
2364
|
-
workspaceRoot: options.workspaceRoot,
|
|
2365
|
-
dockerfile: app.build.dockerfile
|
|
2366
|
-
}),
|
|
2367
|
-
...app.build.args ? { args: app.build.args } : {}
|
|
2368
|
-
} } : {},
|
|
2369
|
-
restart: "unless-stopped",
|
|
2370
|
-
...app.kind !== "site" ? {
|
|
2371
|
-
env_file: [{
|
|
2372
|
-
path: `./${app.name}.env`,
|
|
2373
|
-
format: "raw"
|
|
2374
|
-
}],
|
|
2375
|
-
...infra.length ? { depends_on: Object.fromEntries(infra.map((name) => [name, HEALTHY])) } : {}
|
|
2376
|
-
} : {},
|
|
2377
|
-
healthcheck: probe(app.port, app.kind === "site" ? "/" : "/health"),
|
|
2378
|
-
...app.kind === "websocket-api" ? { ulimits: { nofile: NOFILE } } : {}
|
|
2379
|
-
};
|
|
2380
|
-
for (const name of replicaNames(app)) services[name] = { ...definition };
|
|
2381
|
-
}
|
|
2382
|
-
for (const worker of [...options.workers, ...options.processors]) services[worker.name] = {
|
|
2383
|
-
image: worker.ref,
|
|
2384
|
-
...worker.build ? { build: require_seeds.composeBuildPaths({
|
|
2385
|
-
composeDir: options.composeDir,
|
|
2386
|
-
buildRoot: options.buildRoot,
|
|
2387
|
-
workspaceRoot: options.workspaceRoot,
|
|
2388
|
-
dockerfile: worker.build.dockerfile
|
|
2389
|
-
}) } : {},
|
|
2390
|
-
restart: "unless-stopped",
|
|
2391
|
-
env_file: [{
|
|
2392
|
-
path: `./${worker.name}.env`,
|
|
2393
|
-
format: "raw"
|
|
2394
|
-
}],
|
|
2395
|
-
...infra.length ? { depends_on: Object.fromEntries(infra.map((name) => [name, HEALTHY])) } : {},
|
|
2396
|
-
healthcheck: probe(worker.port, "/health")
|
|
2397
|
-
};
|
|
2398
|
-
if (options.proxy === "caddy") services.caddy = {
|
|
2399
|
-
image: require_seeds.DEFAULT_IMAGES.caddy,
|
|
2400
|
-
restart: "unless-stopped",
|
|
2401
|
-
ports: [`${options.https}:443`, `${options.http}:80`],
|
|
2402
|
-
volumes: ["caddy-data:/data", "caddy-config:/config"],
|
|
2403
|
-
...EDGE_LIMITS,
|
|
2404
|
-
depends_on: Object.fromEntries([
|
|
2405
|
-
...apps.flatMap(replicaNames),
|
|
2406
|
-
...options.workers.filter((w) => w.push).map((w) => w.name),
|
|
2407
|
-
...options.processors.map((p) => p.name)
|
|
2408
|
-
].map((name) => [name, HEALTHY])),
|
|
2409
|
-
healthcheck: {
|
|
2410
|
-
test: [
|
|
2411
|
-
"CMD",
|
|
2412
|
-
"caddy",
|
|
2413
|
-
"version"
|
|
2414
|
-
],
|
|
2415
|
-
interval: "10s",
|
|
2416
|
-
timeout: "5s",
|
|
2417
|
-
retries: 5
|
|
2418
|
-
}
|
|
2419
|
-
};
|
|
2420
|
-
for (const [service, alias] of options.edge) {
|
|
2421
|
-
const definition = services[service];
|
|
2422
|
-
if (!definition) continue;
|
|
2423
|
-
definition.networks = {
|
|
2424
|
-
default: { aliases: [alias] },
|
|
2425
|
-
edge: { aliases: [alias] }
|
|
2426
|
-
};
|
|
2427
|
-
}
|
|
2428
|
-
for (const service of Object.values(services)) {
|
|
2429
|
-
if (!options.envFiles) delete service.env_file;
|
|
2430
|
-
service.logging = {
|
|
2431
|
-
driver: LOG_ROTATION.driver,
|
|
2432
|
-
options: { ...LOG_ROTATION.options }
|
|
2433
|
-
};
|
|
2434
|
-
}
|
|
2435
|
-
return {
|
|
2436
|
-
name: project,
|
|
2437
|
-
services,
|
|
2438
|
-
volumes,
|
|
2439
|
-
...options.edge.size > 0 ? { networks: { edge: {
|
|
2440
|
-
name: EDGE_NETWORK,
|
|
2441
|
-
external: true
|
|
2442
|
-
} } } : {}
|
|
2443
|
-
};
|
|
2444
|
-
}
|
|
2445
|
-
/**
|
|
2446
|
-
* A build without a layout: the workspace is the build root, with pnpm.
|
|
2447
|
-
* What a caller that never looked at the filesystem gets.
|
|
2448
|
-
*/
|
|
2449
|
-
function defaultLayout(root) {
|
|
2450
|
-
return {
|
|
2451
|
-
buildRoot: root,
|
|
2452
|
-
gkmRoot: ".",
|
|
2453
|
-
tools: {
|
|
2454
|
-
packageManager: "pnpm",
|
|
2455
|
-
turboVersion: require_seeds.TURBO_VERSION,
|
|
2456
|
-
monorepo: true
|
|
2457
|
-
},
|
|
2458
|
-
gkmPaths: ["gkm.config.*"]
|
|
2459
|
-
};
|
|
2460
|
-
}
|
|
2461
|
-
/** Render an app's env file: one `KEY=value` per line, read raw by compose. */
|
|
2462
|
-
function envFile(env) {
|
|
2463
|
-
return `${Object.entries(env).sort(([a], [b]) => a.localeCompare(b)).map(([key, value]) => `${key}=${value}`).join("\n")}\n`;
|
|
2464
|
-
}
|
|
2465
|
-
//#endregion
|
|
2466
653
|
//#region src/compose/edge.ts
|
|
2467
654
|
/**
|
|
2468
655
|
* The server's shared Traefik edge, in Docker: started when a stack needs it,
|
|
@@ -2483,7 +670,7 @@ function envFile(env) {
|
|
|
2483
670
|
/** The edge's compose project, as docker is asked about it. */
|
|
2484
671
|
function edgeRef(file, options = {}) {
|
|
2485
672
|
return {
|
|
2486
|
-
project: EDGE_PROJECT,
|
|
673
|
+
project: require_stack.EDGE_PROJECT,
|
|
2487
674
|
file,
|
|
2488
675
|
cwd: (0, node_path.dirname)(file),
|
|
2489
676
|
...options
|
|
@@ -2494,7 +681,7 @@ var EdgeWriteFailed = class extends require_errors.GkmError {
|
|
|
2494
681
|
path;
|
|
2495
682
|
output;
|
|
2496
683
|
constructor(path, output) {
|
|
2497
|
-
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.`);
|
|
2498
685
|
this.path = path;
|
|
2499
686
|
this.output = output;
|
|
2500
687
|
this.name = "EdgeWriteFailed";
|
|
@@ -2515,7 +702,7 @@ var ComposeProxyClash = class extends require_errors.GkmError {
|
|
|
2515
702
|
holder;
|
|
2516
703
|
constructor(project, proxy, port, holder) {
|
|
2517
704
|
const by = holder.project ? `${holder.container} (compose project ${holder.project})` : holder.container;
|
|
2518
|
-
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.`;
|
|
2519
706
|
super(`${project} is set to proxy: '${proxy}', and port ${port} is held by ${by}. ${fix}`);
|
|
2520
707
|
this.project = project;
|
|
2521
708
|
this.proxy = proxy;
|
|
@@ -2538,7 +725,7 @@ async function assertEdgePorts(docker, options) {
|
|
|
2538
725
|
* `.yaml` and `.toml` files, so it never sees one half written.
|
|
2539
726
|
*/
|
|
2540
727
|
async function put(docker, edge, path, content, mode = "644") {
|
|
2541
|
-
const result = await docker.exec(edge, EDGE_SERVICE, [
|
|
728
|
+
const result = await docker.exec(edge, require_stack.EDGE_SERVICE, [
|
|
2542
729
|
"sh",
|
|
2543
730
|
"-c",
|
|
2544
731
|
"set -e; t=\"$1.tmp\"; cat > \"$t\"; chmod \"$2\" \"$t\"; mv \"$t\" \"$1\"",
|
|
@@ -2550,7 +737,7 @@ async function put(docker, edge, path, content, mode = "644") {
|
|
|
2550
737
|
}
|
|
2551
738
|
/** Remove files from the edge's container; whether the first was there. */
|
|
2552
739
|
async function remove(docker, edge, paths) {
|
|
2553
|
-
return (await docker.exec(edge, EDGE_SERVICE, [
|
|
740
|
+
return (await docker.exec(edge, require_stack.EDGE_SERVICE, [
|
|
2554
741
|
"sh",
|
|
2555
742
|
"-c",
|
|
2556
743
|
"e=1; [ -f \"$1\" ] && e=0; rm -f \"$@\"; exit $e",
|
|
@@ -2566,9 +753,10 @@ async function remove(docker, edge, paths) {
|
|
|
2566
753
|
*/
|
|
2567
754
|
async function ensureEdge(docker, options) {
|
|
2568
755
|
const { file, ports } = options;
|
|
2569
|
-
const
|
|
756
|
+
const staticConfig = require_stack.traefikStaticFile(ports);
|
|
757
|
+
const content = require_stack.edgeComposeFile({
|
|
2570
758
|
ports,
|
|
2571
|
-
staticConfig
|
|
759
|
+
staticConfig,
|
|
2572
760
|
logging: options.logging
|
|
2573
761
|
});
|
|
2574
762
|
await (0, node_fs_promises.mkdir)((0, node_path.dirname)(file), { recursive: true });
|
|
@@ -2578,13 +766,13 @@ async function ensureEdge(docker, options) {
|
|
|
2578
766
|
...options.output ? { output: options.output } : {},
|
|
2579
767
|
...options.signal ? { signal: options.signal } : {}
|
|
2580
768
|
});
|
|
2581
|
-
await docker.ensureNetwork(ref, EDGE_NETWORK);
|
|
2582
|
-
await docker.up(ref, [EDGE_SERVICE]);
|
|
769
|
+
await docker.ensureNetwork(ref, require_stack.EDGE_NETWORK);
|
|
770
|
+
await docker.up(ref, [require_stack.EDGE_SERVICE]);
|
|
2583
771
|
return [file];
|
|
2584
772
|
}
|
|
2585
773
|
/** A file inside the edge's running container, or undefined where there is none. */
|
|
2586
774
|
async function readEdgeFile(docker, edge, path) {
|
|
2587
|
-
const result = await docker.exec(edge, EDGE_SERVICE, ["cat", path]);
|
|
775
|
+
const result = await docker.exec(edge, require_stack.EDGE_SERVICE, ["cat", path]);
|
|
2588
776
|
return result.code === 0 ? result.stdout : void 0;
|
|
2589
777
|
}
|
|
2590
778
|
/** A file written into the edge's running container, whole, readable by it alone. */
|
|
@@ -2597,15 +785,15 @@ async function writeEdgeSecret(docker, edge, path, content) {
|
|
|
2597
785
|
* it back; `up` waits for it.
|
|
2598
786
|
*/
|
|
2599
787
|
async function restartEdge(docker, edge) {
|
|
2600
|
-
await docker.exec(edge, EDGE_SERVICE, ["kill", "1"]);
|
|
2601
|
-
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]);
|
|
2602
790
|
}
|
|
2603
791
|
/** A stack's routes, inside the edge's container. */
|
|
2604
792
|
function routesPath(project) {
|
|
2605
|
-
return `${EDGE_DYNAMIC_DIR}/${project}.yml`;
|
|
793
|
+
return `${require_stack.EDGE_DYNAMIC_DIR}/${project}.yml`;
|
|
2606
794
|
}
|
|
2607
795
|
function certificatePaths(project) {
|
|
2608
|
-
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`];
|
|
2609
797
|
}
|
|
2610
798
|
/**
|
|
2611
799
|
* Register a stack with the edge: its certificate first, where it has one,
|
|
@@ -2745,7 +933,7 @@ async function ensureEdgeAcmeKey(docker, options) {
|
|
|
2745
933
|
const zoneId = options.hostedZoneId ?? await hostedZoneId(clients.route53, options.zone);
|
|
2746
934
|
if (!zoneId) throw new AcmeHostedZoneMissing(domain);
|
|
2747
935
|
if (options.dryRun) {
|
|
2748
|
-
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)`);
|
|
2749
937
|
return {
|
|
2750
938
|
user,
|
|
2751
939
|
zoneId,
|
|
@@ -2772,8 +960,8 @@ async function ensureEdgeAcmeKey(docker, options) {
|
|
|
2772
960
|
PolicyName: project,
|
|
2773
961
|
PolicyDocument: acmeDnsPolicy(zoneId, domain)
|
|
2774
962
|
}));
|
|
2775
|
-
log(`🔑 ${EDGE_PROJECT} may write _acme-challenge.${domain} TXT records in ${zoneId}, and nothing else there, as IAM user ${user}`);
|
|
2776
|
-
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);
|
|
2777
965
|
const held = written?.match(/aws_access_key_id\s*=\s*(\S+)/)?.[1];
|
|
2778
966
|
const { AccessKeyMetadata = [] } = await clients.iam.send(new IAM.ListAccessKeysCommand({ UserName: user }));
|
|
2779
967
|
if (held && AccessKeyMetadata.some((k) => k.AccessKeyId === held)) return {
|
|
@@ -2789,12 +977,12 @@ async function ensureEdgeAcmeKey(docker, options) {
|
|
|
2789
977
|
}));
|
|
2790
978
|
}
|
|
2791
979
|
const { AccessKey } = await clients.iam.send(new IAM.CreateAccessKeyCommand({ UserName: user }));
|
|
2792
|
-
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.
|
|
2793
981
|
[default]
|
|
2794
982
|
aws_access_key_id = ${AccessKey?.AccessKeyId}
|
|
2795
983
|
aws_secret_access_key = ${AccessKey?.SecretAccessKey}
|
|
2796
984
|
`);
|
|
2797
|
-
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})`);
|
|
2798
986
|
if (written !== void 0) await restartEdge(docker, edge);
|
|
2799
987
|
return {
|
|
2800
988
|
user,
|
|
@@ -2815,7 +1003,7 @@ async function hostedZoneId(route53, zone) {
|
|
|
2815
1003
|
//#endregion
|
|
2816
1004
|
//#region src/compose/secrets.ts
|
|
2817
1005
|
function deployedStackSecrets(workspace, stage, stored, manifest) {
|
|
2818
|
-
const withSeed =
|
|
1006
|
+
const withSeed = require_compose.withGeneratedSecrets(stored ?? require_credentials.initStageSecrets(stage), manifest);
|
|
2819
1007
|
const withLogs = require_workspace.resolveStageTelemetry({
|
|
2820
1008
|
...workspace.deploy?.telemetry ? { telemetry: workspace.deploy.telemetry } : {},
|
|
2821
1009
|
stage,
|
|
@@ -2823,12 +1011,12 @@ function deployedStackSecrets(workspace, stage, stored, manifest) {
|
|
|
2823
1011
|
target: "compose",
|
|
2824
1012
|
runtime: "server",
|
|
2825
1013
|
selfHosted: true,
|
|
2826
|
-
used:
|
|
2827
|
-
})?.provider === "self-hosted" ?
|
|
1014
|
+
used: require_apps.usesTelemetry(manifest)
|
|
1015
|
+
})?.provider === "self-hosted" ? require_compose.withLogsPassword(withSeed.secrets) : {
|
|
2828
1016
|
secrets: withSeed.secrets,
|
|
2829
1017
|
generated: []
|
|
2830
1018
|
};
|
|
2831
|
-
const withRedis =
|
|
1019
|
+
const withRedis = require_compose.runsRedis(manifest, withLogs.secrets.custom ?? {}) ? require_compose.withRedisPassword(withLogs.secrets) : {
|
|
2832
1020
|
secrets: withLogs.secrets,
|
|
2833
1021
|
generated: []
|
|
2834
1022
|
};
|
|
@@ -3122,10 +1310,10 @@ function edgePorts(env = process.env) {
|
|
|
3122
1310
|
if (!Number.isInteger(port) || port < 1 || port > 65535) throw new EdgePortInvalid(variable, value);
|
|
3123
1311
|
return port;
|
|
3124
1312
|
};
|
|
3125
|
-
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;
|
|
3126
1314
|
return {
|
|
3127
|
-
https: read(EDGE_PORT_ENV.https, 443),
|
|
3128
|
-
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),
|
|
3129
1317
|
...logs ? { logs } : {}
|
|
3130
1318
|
};
|
|
3131
1319
|
}
|
|
@@ -3136,9 +1324,9 @@ function edgePorts(env = process.env) {
|
|
|
3136
1324
|
const defaultDeps = {
|
|
3137
1325
|
docker: dockerCompose,
|
|
3138
1326
|
revision: gitRevision,
|
|
3139
|
-
sql:
|
|
3140
|
-
buckets:
|
|
3141
|
-
logins:
|
|
1327
|
+
sql: require_apps.pgClient,
|
|
1328
|
+
buckets: require_apps.bucketClient,
|
|
1329
|
+
logins: require_apps.ensurePostgresLogin,
|
|
3142
1330
|
migrate: require_databases.migrateDatabases,
|
|
3143
1331
|
seed: require_databases.seedDatabases,
|
|
3144
1332
|
probe: httpsProbe,
|
|
@@ -3161,18 +1349,18 @@ async function validateCompose(ctx, deps, options = {}) {
|
|
|
3161
1349
|
if (push && mode !== "build") throw new ComposePushNeedsBuild();
|
|
3162
1350
|
if (options.pin && mode !== "pull") throw new ComposePinNeedsPull();
|
|
3163
1351
|
const registry = workspace.deploy?.registry;
|
|
3164
|
-
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));
|
|
3165
1353
|
const background = {};
|
|
3166
1354
|
const subscribers = {};
|
|
3167
1355
|
const manifest = await require_discover.discover({
|
|
3168
|
-
patterns:
|
|
1356
|
+
patterns: require_apps.constructGlobs(workspace),
|
|
3169
1357
|
cwd: root,
|
|
3170
1358
|
background,
|
|
3171
1359
|
subscribers
|
|
3172
1360
|
});
|
|
3173
1361
|
const { secrets, generated } = await stageSecrets(ctx, manifest);
|
|
3174
1362
|
const recorded = push ? void 0 : await ctx.state.read(stage);
|
|
3175
|
-
const layout = mode === "build" ?
|
|
1363
|
+
const layout = mode === "build" ? require_apps.imageLayout(workspace) : void 0;
|
|
3176
1364
|
const input = {
|
|
3177
1365
|
workspace,
|
|
3178
1366
|
manifest,
|
|
@@ -3186,14 +1374,14 @@ async function validateCompose(ctx, deps, options = {}) {
|
|
|
3186
1374
|
...registry ? { registry } : {}
|
|
3187
1375
|
},
|
|
3188
1376
|
secrets,
|
|
3189
|
-
...stage === workspace.stages.local ? { localCredentials: (await
|
|
1377
|
+
...stage === workspace.stages.local ? { localCredentials: (await require_compose.loadLocalCredentials(workspace)).credentials } : {},
|
|
3190
1378
|
allowDevServices: ctx.allowDevServices,
|
|
3191
1379
|
ports: edgePorts(deps.env),
|
|
3192
1380
|
...layout ? { layout } : {},
|
|
3193
1381
|
...push ? { buildOnly: true } : {}
|
|
3194
1382
|
};
|
|
3195
1383
|
const recordedArns = require_snsSubscriptions.recordedPushSubscriptions(recorded?.resources);
|
|
3196
|
-
const planned = push ? void 0 : composeStack({
|
|
1384
|
+
const planned = push ? void 0 : require_stack.composeStack({
|
|
3197
1385
|
...input,
|
|
3198
1386
|
recordingSubscriptions: true
|
|
3199
1387
|
});
|
|
@@ -3202,14 +1390,14 @@ async function validateCompose(ctx, deps, options = {}) {
|
|
|
3202
1390
|
pushes,
|
|
3203
1391
|
recorded: recorded?.resources
|
|
3204
1392
|
} : void 0;
|
|
3205
|
-
const composed = topics && planned ? planned : composeStack({
|
|
1393
|
+
const composed = topics && planned ? planned : require_stack.composeStack({
|
|
3206
1394
|
...input,
|
|
3207
1395
|
pushSubscriptions: recordedArns
|
|
3208
1396
|
});
|
|
3209
1397
|
if (mode === "build") assertRedisClient(workspace, composed, manifest);
|
|
3210
1398
|
const pinned = (unpinned) => options.pin ? withPinnedImages(unpinned, options.pin.file, options.pin.digests) : unpinned;
|
|
3211
1399
|
const stack = pinned(composed);
|
|
3212
|
-
if (mode === "pull" && !ctx.dryRun) await assertImagesExist(deps.docker, tag, [
|
|
1400
|
+
if (mode === "pull" && !ctx.dryRun) await require_stack.assertImagesExist(deps.docker, tag, [
|
|
3213
1401
|
...stack.apps,
|
|
3214
1402
|
...stack.workers,
|
|
3215
1403
|
...stack.processors
|
|
@@ -3226,7 +1414,7 @@ async function validateCompose(ctx, deps, options = {}) {
|
|
|
3226
1414
|
config: workspace.deploy?.compose?.server,
|
|
3227
1415
|
custom: secrets?.custom
|
|
3228
1416
|
});
|
|
3229
|
-
const dir = (0, node_path.join)(root, stackDir(stage));
|
|
1417
|
+
const dir = (0, node_path.join)(root, require_stack.stackDir(stage));
|
|
3230
1418
|
const override = stackOverrideFile(root, stage);
|
|
3231
1419
|
const overrides = (0, node_fs.existsSync)(override) ? [override] : [];
|
|
3232
1420
|
if (overrides.length > 0) ctx.logger.info(`🧩 Merging docker-compose.${stage}.yml over the generated stack`);
|
|
@@ -3250,7 +1438,7 @@ async function validateCompose(ctx, deps, options = {}) {
|
|
|
3250
1438
|
...merged[worker],
|
|
3251
1439
|
...own
|
|
3252
1440
|
};
|
|
3253
|
-
return pinned(composeStack({
|
|
1441
|
+
return pinned(require_stack.composeStack({
|
|
3254
1442
|
...input,
|
|
3255
1443
|
pushSubscriptions: merged
|
|
3256
1444
|
}));
|
|
@@ -3259,7 +1447,7 @@ async function validateCompose(ctx, deps, options = {}) {
|
|
|
3259
1447
|
...server ? { server } : {},
|
|
3260
1448
|
dir,
|
|
3261
1449
|
ref: {
|
|
3262
|
-
project: composeProject(identity),
|
|
1450
|
+
project: require_stack.composeProject(identity),
|
|
3263
1451
|
file: (0, node_path.join)(dir, "docker-compose.yml"),
|
|
3264
1452
|
...overrides.length > 0 ? { overrides } : {},
|
|
3265
1453
|
cwd: root,
|
|
@@ -3311,7 +1499,7 @@ function assertRedisClient(workspace, stack, manifest) {
|
|
|
3311
1499
|
if (!stack.plan.resources.some((r) => r.kind === "cache")) return;
|
|
3312
1500
|
const cacheKeys = Object.values(manifest).filter((d) => d.kind === "cache").flatMap((d) => d.provides ?? []);
|
|
3313
1501
|
const reachesCache = (keys) => cacheKeys.some((key) => keys?.has(key));
|
|
3314
|
-
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) => {
|
|
3315
1503
|
const app = workspace.apps[name];
|
|
3316
1504
|
return app && !require_drivers.installedFrom((0, node_path.join)(workspace.root, app.path), "ioredis");
|
|
3317
1505
|
}).sort();
|
|
@@ -3360,7 +1548,7 @@ async function stageHostsDns(ctx, deps, hosts, custom, wildcard) {
|
|
|
3360
1548
|
...deps.dnsProviderFor ? { providerFor: deps.dnsProviderFor } : {}
|
|
3361
1549
|
});
|
|
3362
1550
|
if (!ctx.dryRun) {
|
|
3363
|
-
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));
|
|
3364
1552
|
const providers = new Map(result.plan.domains.map((d) => [d.domain, d.provider]));
|
|
3365
1553
|
await require_seeds.recordDnsChanges(journal, result.changes, (domain) => providers.get(domain));
|
|
3366
1554
|
}
|
|
@@ -3387,7 +1575,7 @@ async function stageHostsDns(ctx, deps, hosts, custom, wildcard) {
|
|
|
3387
1575
|
async function pruneStageDns(ctx, run) {
|
|
3388
1576
|
if (!run.pruneDns) return;
|
|
3389
1577
|
const pruned = await run.pruneDns();
|
|
3390
|
-
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));
|
|
3391
1579
|
for (const { record } of pruned) await require_seeds.forgetDnsResource(journal, record);
|
|
3392
1580
|
const deleted = pruned.filter((p) => p.action === "delete").length;
|
|
3393
1581
|
if (deleted > 0) ctx.logger.info(`🌐 ${deleted} record${deleted === 1 ? "" : "s"} deleted`);
|
|
@@ -3418,9 +1606,9 @@ async function stageSecrets(ctx, manifest) {
|
|
|
3418
1606
|
* compose service runs.
|
|
3419
1607
|
*/
|
|
3420
1608
|
function withPinnedImages(stack, file, digests) {
|
|
3421
|
-
const apps = pinImages(file, digests, stack.apps);
|
|
3422
|
-
const workers = pinImages(file, digests, stack.workers);
|
|
3423
|
-
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);
|
|
3424
1612
|
const services = { ...stack.compose.services };
|
|
3425
1613
|
for (const image of [
|
|
3426
1614
|
...apps,
|
|
@@ -3508,7 +1696,7 @@ async function planCompose(ctx, run) {
|
|
|
3508
1696
|
});
|
|
3509
1697
|
}
|
|
3510
1698
|
if (!run.push) planned({
|
|
3511
|
-
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}`,
|
|
3512
1700
|
resourceType: "service",
|
|
3513
1701
|
action: "ensure"
|
|
3514
1702
|
});
|
|
@@ -3521,8 +1709,8 @@ async function planCompose(ctx, run) {
|
|
|
3521
1709
|
async function edgeAcmeKey(ctx, run, deps) {
|
|
3522
1710
|
const { workspace, stage } = ctx;
|
|
3523
1711
|
const domain = workspace.domains?.[stage];
|
|
3524
|
-
const dns = workspace.dns ?
|
|
3525
|
-
const zone = domain ?
|
|
1712
|
+
const dns = workspace.dns ? require_credentials.normalizeDnsConfig(workspace.dns) : {};
|
|
1713
|
+
const zone = domain ? require_credentials.findRootDomain(domain, dns) : null;
|
|
3526
1714
|
const config = zone ? dns[zone] : void 0;
|
|
3527
1715
|
if (!domain || !zone || config?.provider !== "route53") return;
|
|
3528
1716
|
const route53 = config;
|
|
@@ -3583,23 +1771,23 @@ async function provisionCompose(ctx, run, deps) {
|
|
|
3583
1771
|
run.files = await writeStack(ctx.cwd, run.dir, stack);
|
|
3584
1772
|
printPlan(ctx, run);
|
|
3585
1773
|
if (stack.proxy === "traefik") {
|
|
3586
|
-
ctx.logger.info(`\n🌐 Starting the shared edge (${EDGE_PROJECT})…`);
|
|
1774
|
+
ctx.logger.info(`\n🌐 Starting the shared edge (${require_stack.EDGE_PROJECT})…`);
|
|
3587
1775
|
run.files.push(...await ensureEdge(deps.docker, {
|
|
3588
1776
|
file: edgeFile(run),
|
|
3589
1777
|
ports,
|
|
3590
1778
|
...ref.host ? { host: ref.host } : {},
|
|
3591
1779
|
logging: {
|
|
3592
|
-
driver: LOG_ROTATION.driver,
|
|
3593
|
-
options: { ...LOG_ROTATION.options }
|
|
1780
|
+
driver: require_stack.LOG_ROTATION.driver,
|
|
1781
|
+
options: { ...require_stack.LOG_ROTATION.options }
|
|
3594
1782
|
},
|
|
3595
1783
|
...ref.output ? { output: ref.output } : {},
|
|
3596
1784
|
...ref.signal ? { signal: ref.signal } : {}
|
|
3597
1785
|
}));
|
|
3598
1786
|
applied(ctx, run, {
|
|
3599
|
-
key: `service:${EDGE_PROJECT}/${EDGE_SERVICE}`,
|
|
1787
|
+
key: `service:${require_stack.EDGE_PROJECT}/${require_stack.EDGE_SERVICE}`,
|
|
3600
1788
|
resourceType: "service",
|
|
3601
1789
|
action: "ensure",
|
|
3602
|
-
id: `${EDGE_PROJECT}/${EDGE_SERVICE}`,
|
|
1790
|
+
id: `${require_stack.EDGE_PROJECT}/${require_stack.EDGE_SERVICE}`,
|
|
3603
1791
|
via: "found"
|
|
3604
1792
|
});
|
|
3605
1793
|
if (stack.wildcard?.tls === "dns") await edgeAcmeKey(ctx, run, deps);
|
|
@@ -3656,15 +1844,15 @@ async function subscribeTopics(ctx, run, deps) {
|
|
|
3656
1844
|
async function prepareBuckets(ctx, run, deps) {
|
|
3657
1845
|
const storage = run.stack.storage;
|
|
3658
1846
|
if (storage.buckets.length === 0) return;
|
|
3659
|
-
const tunnel = await reach(run, deps, "minio", LOOPBACK_SERVICES.minio);
|
|
1847
|
+
const tunnel = await reach(run, deps, "minio", require_stack.LOOPBACK_SERVICES.minio);
|
|
3660
1848
|
let done;
|
|
3661
1849
|
try {
|
|
3662
1850
|
const client = deps.buckets(tunnel.port, storage);
|
|
3663
1851
|
done = [
|
|
3664
|
-
...await
|
|
3665
|
-
...await
|
|
3666
|
-
...await
|
|
3667
|
-
...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)))
|
|
3668
1856
|
];
|
|
3669
1857
|
} finally {
|
|
3670
1858
|
await tunnel.close();
|
|
@@ -3684,11 +1872,11 @@ async function prepareDatabases(ctx, run, deps) {
|
|
|
3684
1872
|
const tunnels = [];
|
|
3685
1873
|
try {
|
|
3686
1874
|
const ports = {};
|
|
3687
|
-
for (const [service, inside] of Object.entries(LOOPBACK_SERVICES)) {
|
|
1875
|
+
for (const [service, inside] of Object.entries(require_stack.LOOPBACK_SERVICES)) {
|
|
3688
1876
|
if (!run.stack.infra.includes(service)) continue;
|
|
3689
1877
|
const tunnel = await reach(run, deps, service, inside);
|
|
3690
1878
|
tunnels.push(tunnel);
|
|
3691
|
-
ports[
|
|
1879
|
+
ports[require_compose.primaryPortKey(service)] = tunnel.port;
|
|
3692
1880
|
}
|
|
3693
1881
|
await migrateAndSeed(ctx, run, deps, ports);
|
|
3694
1882
|
} finally {
|
|
@@ -3716,30 +1904,30 @@ async function reach(run, deps, service, inside) {
|
|
|
3716
1904
|
async function migrateAndSeed(ctx, run, deps, ports) {
|
|
3717
1905
|
const { stack } = run;
|
|
3718
1906
|
const workspace = ctx.workspace;
|
|
3719
|
-
const port = ports[
|
|
1907
|
+
const port = ports[require_compose.primaryPortKey("postgres")];
|
|
3720
1908
|
const superuser = stack.credential.containers.postgres;
|
|
3721
1909
|
const login = await deps.logins({
|
|
3722
1910
|
port,
|
|
3723
1911
|
login: superuser,
|
|
3724
1912
|
legacy: [{
|
|
3725
|
-
user:
|
|
1913
|
+
user: require_apps.LEGACY_LOCAL_LOGIN.user,
|
|
3726
1914
|
password: superuser.password
|
|
3727
|
-
}, ...stack.local ? [
|
|
1915
|
+
}, ...stack.local ? [require_apps.LEGACY_LOCAL_LOGIN] : []]
|
|
3728
1916
|
});
|
|
3729
1917
|
if (login.notice) ctx.logger.info(login.notice);
|
|
3730
|
-
const statements = [...
|
|
1918
|
+
const statements = [...require_apps.postgresStatements(stack.plan, workspace.name, stack.credential.seed), ...stack.backups ? require_stack.backupsRoleStatements(stack.backups) : []];
|
|
3731
1919
|
if (statements.length > 0) {
|
|
3732
1920
|
ctx.logger.info("🗄️ Creating databases, roles and grants…");
|
|
3733
|
-
await
|
|
1921
|
+
await require_apps.applyPostgres(deps.sql(port, login.login), statements);
|
|
3734
1922
|
}
|
|
3735
1923
|
const sources = {};
|
|
3736
1924
|
const manifest = await require_discover.discover({
|
|
3737
|
-
patterns:
|
|
1925
|
+
patterns: require_apps.constructGlobs(workspace),
|
|
3738
1926
|
cwd: workspace.root,
|
|
3739
1927
|
sources
|
|
3740
1928
|
});
|
|
3741
1929
|
const custom = run.secrets?.custom ?? {};
|
|
3742
|
-
const resolved =
|
|
1930
|
+
const resolved = require_apps.envFor(stack.plan, {
|
|
3743
1931
|
...stack.resolution,
|
|
3744
1932
|
ports,
|
|
3745
1933
|
credentials: {
|
|
@@ -3747,7 +1935,7 @@ async function migrateAndSeed(ctx, run, deps, ports) {
|
|
|
3747
1935
|
postgres: login.login
|
|
3748
1936
|
}
|
|
3749
1937
|
});
|
|
3750
|
-
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)));
|
|
3751
1939
|
const options = {
|
|
3752
1940
|
root: workspace.root,
|
|
3753
1941
|
manifest,
|
|
@@ -3758,7 +1946,7 @@ async function migrateAndSeed(ctx, run, deps, ports) {
|
|
|
3758
1946
|
const seeds = await deps.seed({
|
|
3759
1947
|
...options,
|
|
3760
1948
|
stage: ctx.stage,
|
|
3761
|
-
backends:
|
|
1949
|
+
backends: require_apps.backendsOf(workspace)
|
|
3762
1950
|
}).catch((error) => {
|
|
3763
1951
|
if (error instanceof require_databases.SeedFailed) throw new require_seeds.DeploySeedsFailed(ctx.stage, error.construct, error.seed, error);
|
|
3764
1952
|
throw error;
|
|
@@ -3835,7 +2023,7 @@ async function releaseCompose(ctx, run, deps) {
|
|
|
3835
2023
|
});
|
|
3836
2024
|
if (stack.proxy === "traefik" && stack.traefik) {
|
|
3837
2025
|
const written = await writeEdgeRoutes(deps.docker, edge, stack.project, stack.traefik, stack.tls);
|
|
3838
|
-
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)}`);
|
|
3839
2027
|
} else if (!stack.local) await removeEdgeRoutes(deps.docker, edge, stack.project);
|
|
3840
2028
|
if (stack.local) await deps.docker.copyOut(ref, "caddy", "/data/caddy/pki/authorities/local/root.crt", caFile(run)).catch(() => {});
|
|
3841
2029
|
await recordImages(ctx, run);
|
|
@@ -3867,7 +2055,7 @@ async function releaseCompose(ctx, run, deps) {
|
|
|
3867
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}` : ""}`);
|
|
3868
2056
|
for (const worker of stack.workers) ctx.logger.info(` ${worker.name.padEnd(12)} worker ${worker.id}`);
|
|
3869
2057
|
for (const unit of stack.processors) ctx.logger.info(` ${unit.name.padEnd(12)} processors of ${unit.id}`);
|
|
3870
|
-
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")}`);
|
|
3871
2059
|
}
|
|
3872
2060
|
/**
|
|
3873
2061
|
* Each app's image in the stage's state — the same `images` a Dokploy deploy
|
|
@@ -3875,7 +2063,7 @@ async function releaseCompose(ctx, run, deps) {
|
|
|
3875
2063
|
* the tag resolved to.
|
|
3876
2064
|
*/
|
|
3877
2065
|
async function recordImages(ctx, run) {
|
|
3878
|
-
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));
|
|
3879
2067
|
const by = require_seeds.currentActor();
|
|
3880
2068
|
for (const app of [
|
|
3881
2069
|
...run.stack.apps,
|
|
@@ -3886,7 +2074,7 @@ async function recordImages(ctx, run) {
|
|
|
3886
2074
|
ref: app.ref,
|
|
3887
2075
|
tag: app.tag
|
|
3888
2076
|
};
|
|
3889
|
-
|
|
2077
|
+
require_credentials.recordRelease(journal.state, app.app, image, by);
|
|
3890
2078
|
}
|
|
3891
2079
|
journal.state.identity = ctx.identity.key;
|
|
3892
2080
|
await journal.save();
|
|
@@ -3911,7 +2099,7 @@ async function verifyCompose(ctx, run, deps) {
|
|
|
3911
2099
|
edge
|
|
3912
2100
|
})));
|
|
3913
2101
|
results.push(...await Promise.all([...stack.workers, ...stack.processors].map((worker) => checkContainer(ctx, run, deps, worker.name))));
|
|
3914
|
-
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));
|
|
3915
2103
|
const down = results.filter((result) => !result.healthy).map(({ app, url, last }) => ({
|
|
3916
2104
|
app,
|
|
3917
2105
|
url,
|
|
@@ -3991,7 +2179,7 @@ function basicAuthorization(auth) {
|
|
|
3991
2179
|
}
|
|
3992
2180
|
/** How to open the logs, printed — and as an event, for a headless caller. */
|
|
3993
2181
|
function reportLogs(ctx, logs, local, server) {
|
|
3994
|
-
const lines =
|
|
2182
|
+
const lines = require_compose.logsAccess(logs, {
|
|
3995
2183
|
stage: ctx.stage,
|
|
3996
2184
|
local,
|
|
3997
2185
|
user: server?.user ?? currentUser(),
|
|
@@ -4001,7 +2189,7 @@ function reportLogs(ctx, logs, local, server) {
|
|
|
4001
2189
|
ctx.logger.info(`\n${lines.join("\n")}`);
|
|
4002
2190
|
ctx.emit({
|
|
4003
2191
|
type: "logs.ready",
|
|
4004
|
-
service:
|
|
2192
|
+
service: require_compose.LOGS_SERVICE,
|
|
4005
2193
|
access: logs.public ? "public" : "tunnel",
|
|
4006
2194
|
url: logs.url,
|
|
4007
2195
|
...logs.public ? { allow: [...logs.public.allow] } : { port: logs.port },
|
|
@@ -4106,7 +2294,7 @@ function caFile(run) {
|
|
|
4106
2294
|
}
|
|
4107
2295
|
/** The shared edge's compose file, as this machine hands it to compose. */
|
|
4108
2296
|
function edgeFile(run) {
|
|
4109
|
-
return (0, node_path.join)(run.dir, `${EDGE_PROJECT}.yml`);
|
|
2297
|
+
return (0, node_path.join)(run.dir, `${require_stack.EDGE_PROJECT}.yml`);
|
|
4110
2298
|
}
|
|
4111
2299
|
function applied(ctx, run, change) {
|
|
4112
2300
|
const { via, ...rest } = change;
|
|
@@ -4135,7 +2323,7 @@ async function writeStack(root, dir, stack) {
|
|
|
4135
2323
|
cert: await (0, node_fs_promises.readFile)(stack.tls.certFile, "utf-8"),
|
|
4136
2324
|
key: await (0, node_fs_promises.readFile)(stack.tls.keyFile, "utf-8")
|
|
4137
2325
|
} : void 0;
|
|
4138
|
-
const compose = stack.caddyfile !== void 0 ? withCaddyConfigs(stack.compose, {
|
|
2326
|
+
const compose = stack.caddyfile !== void 0 ? require_stack.withCaddyConfigs(stack.compose, {
|
|
4139
2327
|
caddyfile: stack.caddyfile,
|
|
4140
2328
|
...tls ? { tls } : {}
|
|
4141
2329
|
}) : stack.compose;
|
|
@@ -4153,28 +2341,28 @@ async function writeStack(root, dir, stack) {
|
|
|
4153
2341
|
...stack.apps,
|
|
4154
2342
|
...stack.workers,
|
|
4155
2343
|
...stack.processors
|
|
4156
|
-
]) if (app.env) await write((0, node_path.join)(dir, `${app.name}.env`), envFile(app.env), 384);
|
|
4157
|
-
if (stack.logs && stack.compose.services["openobserve"]?.env_file) await write((0, node_path.join)(dir, `${
|
|
4158
|
-
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);
|
|
4159
2347
|
if (stack.backups) {
|
|
4160
|
-
for (const [name, content] of Object.entries(stack.backups.files)) await write((0, node_path.join)(dir,
|
|
4161
|
-
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);
|
|
4162
2350
|
} else {
|
|
4163
|
-
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), {
|
|
4164
2352
|
recursive: true,
|
|
4165
2353
|
force: true
|
|
4166
2354
|
});
|
|
4167
|
-
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 });
|
|
4168
2356
|
}
|
|
4169
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));
|
|
4170
2358
|
for (const [path, content] of Object.entries(stack.dockerfiles)) await write((0, node_path.join)(root, path), content);
|
|
4171
|
-
await
|
|
2359
|
+
await require_docker.ensureDockerignore(require_apps.findBuildRoot(root));
|
|
4172
2360
|
return files;
|
|
4173
2361
|
}
|
|
4174
2362
|
function composeYaml(stack, compose) {
|
|
4175
2363
|
const stage = ` --stage ${stack.stage}`;
|
|
4176
2364
|
return `# Generated by gkm compose from the construct manifest — do not edit.
|
|
4177
|
-
# 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.
|
|
4178
2366
|
# Each backend and worker reads exactly the keys in its own env file beside
|
|
4179
2367
|
# this one.
|
|
4180
2368
|
#
|
|
@@ -4193,8 +2381,8 @@ function printPlan(ctx, run) {
|
|
|
4193
2381
|
for (const worker of stack.workers) ctx.logger.info(` ${worker.name.padEnd(12)} ${`worker ${worker.id} (no route)`.padEnd(40)} ${mode} ${worker.ref}`);
|
|
4194
2382
|
for (const unit of stack.processors) ctx.logger.info(` ${unit.name.padEnd(12)} ${`processors of ${unit.id}`.padEnd(40)} ${mode} ${unit.ref}`);
|
|
4195
2383
|
if (stack.infra.length > 0) ctx.logger.info(` infrastructure: ${stack.infra.join(", ")}`);
|
|
4196
|
-
if (stack.backups) ctx.logger.info(` ${
|
|
4197
|
-
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)}/`);
|
|
4198
2386
|
}
|
|
4199
2387
|
//#endregion
|
|
4200
2388
|
//#region src/target/compose/index.ts
|
|
@@ -4280,30 +2468,12 @@ Object.defineProperty(exports, "ComposePushNeedsBuild", {
|
|
|
4280
2468
|
return ComposePushNeedsBuild;
|
|
4281
2469
|
}
|
|
4282
2470
|
});
|
|
4283
|
-
Object.defineProperty(exports, "EDGE_PROJECT", {
|
|
4284
|
-
enumerable: true,
|
|
4285
|
-
get: function() {
|
|
4286
|
-
return EDGE_PROJECT;
|
|
4287
|
-
}
|
|
4288
|
-
});
|
|
4289
|
-
Object.defineProperty(exports, "composeProject", {
|
|
4290
|
-
enumerable: true,
|
|
4291
|
-
get: function() {
|
|
4292
|
-
return composeProject;
|
|
4293
|
-
}
|
|
4294
|
-
});
|
|
4295
2471
|
Object.defineProperty(exports, "composeServer", {
|
|
4296
2472
|
enumerable: true,
|
|
4297
2473
|
get: function() {
|
|
4298
2474
|
return composeServer;
|
|
4299
2475
|
}
|
|
4300
2476
|
});
|
|
4301
|
-
Object.defineProperty(exports, "composeStack", {
|
|
4302
|
-
enumerable: true,
|
|
4303
|
-
get: function() {
|
|
4304
|
-
return composeStack;
|
|
4305
|
-
}
|
|
4306
|
-
});
|
|
4307
2477
|
Object.defineProperty(exports, "composeTarget", {
|
|
4308
2478
|
enumerable: true,
|
|
4309
2479
|
get: function() {
|
|
@@ -4322,12 +2492,6 @@ Object.defineProperty(exports, "deployedStackSecrets", {
|
|
|
4322
2492
|
return deployedStackSecrets;
|
|
4323
2493
|
}
|
|
4324
2494
|
});
|
|
4325
|
-
Object.defineProperty(exports, "derivedCredentials", {
|
|
4326
|
-
enumerable: true,
|
|
4327
|
-
get: function() {
|
|
4328
|
-
return derivedCredentials;
|
|
4329
|
-
}
|
|
4330
|
-
});
|
|
4331
2495
|
Object.defineProperty(exports, "dockerCompose", {
|
|
4332
2496
|
enumerable: true,
|
|
4333
2497
|
get: function() {
|
|
@@ -4340,12 +2504,6 @@ Object.defineProperty(exports, "dockerHost", {
|
|
|
4340
2504
|
return dockerHost;
|
|
4341
2505
|
}
|
|
4342
2506
|
});
|
|
4343
|
-
Object.defineProperty(exports, "edgeAlias", {
|
|
4344
|
-
enumerable: true,
|
|
4345
|
-
get: function() {
|
|
4346
|
-
return edgeAlias;
|
|
4347
|
-
}
|
|
4348
|
-
});
|
|
4349
2507
|
Object.defineProperty(exports, "edgePorts", {
|
|
4350
2508
|
enumerable: true,
|
|
4351
2509
|
get: function() {
|
|
@@ -4358,18 +2516,6 @@ Object.defineProperty(exports, "edgeRef", {
|
|
|
4358
2516
|
return edgeRef;
|
|
4359
2517
|
}
|
|
4360
2518
|
});
|
|
4361
|
-
Object.defineProperty(exports, "parseDigests", {
|
|
4362
|
-
enumerable: true,
|
|
4363
|
-
get: function() {
|
|
4364
|
-
return parseDigests;
|
|
4365
|
-
}
|
|
4366
|
-
});
|
|
4367
|
-
Object.defineProperty(exports, "pinnedRef", {
|
|
4368
|
-
enumerable: true,
|
|
4369
|
-
get: function() {
|
|
4370
|
-
return pinnedRef;
|
|
4371
|
-
}
|
|
4372
|
-
});
|
|
4373
2519
|
Object.defineProperty(exports, "projectNetwork", {
|
|
4374
2520
|
enumerable: true,
|
|
4375
2521
|
get: function() {
|
|
@@ -4394,23 +2540,11 @@ Object.defineProperty(exports, "sshTarget", {
|
|
|
4394
2540
|
return sshTarget;
|
|
4395
2541
|
}
|
|
4396
2542
|
});
|
|
4397
|
-
Object.defineProperty(exports, "stackDir", {
|
|
4398
|
-
enumerable: true,
|
|
4399
|
-
get: function() {
|
|
4400
|
-
return stackDir;
|
|
4401
|
-
}
|
|
4402
|
-
});
|
|
4403
2543
|
Object.defineProperty(exports, "stackOverrideFile", {
|
|
4404
2544
|
enumerable: true,
|
|
4405
2545
|
get: function() {
|
|
4406
2546
|
return stackOverrideFile;
|
|
4407
2547
|
}
|
|
4408
2548
|
});
|
|
4409
|
-
Object.defineProperty(exports, "stackPlan", {
|
|
4410
|
-
enumerable: true,
|
|
4411
|
-
get: function() {
|
|
4412
|
-
return stackPlan;
|
|
4413
|
-
}
|
|
4414
|
-
});
|
|
4415
2549
|
|
|
4416
|
-
//# sourceMappingURL=compose-
|
|
2550
|
+
//# sourceMappingURL=compose-D_fNsrkx.cjs.map
|