@geekmidas/cli 10.0.0-alpha.146 → 10.0.0-alpha.148
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/{GoDaddyProvider-BESq24p-.mjs → GoDaddyProvider-CGgS-I6m.mjs} +2 -2
- package/dist/{GoDaddyProvider-BESq24p-.mjs.map → GoDaddyProvider-CGgS-I6m.mjs.map} +1 -1
- package/dist/{GoDaddyProvider-BK5N6-fx.cjs → GoDaddyProvider-D_dZQJIX.cjs} +2 -2
- package/dist/{GoDaddyProvider-BK5N6-fx.cjs.map → GoDaddyProvider-D_dZQJIX.cjs.map} +1 -1
- package/dist/{HostingerProvider-BV30wTNI.mjs → HostingerProvider-CWRE6auw.mjs} +2 -2
- package/dist/{HostingerProvider-BV30wTNI.mjs.map → HostingerProvider-CWRE6auw.mjs.map} +1 -1
- package/dist/{HostingerProvider-BbQod5OB.cjs → HostingerProvider-eGuDBjfN.cjs} +2 -2
- package/dist/{HostingerProvider-BbQod5OB.cjs.map → HostingerProvider-eGuDBjfN.cjs.map} +1 -1
- package/dist/{LegacyStateStore-Ck3HI28A.mjs → LegacyStateStore-CLyFmPIj.mjs} +2 -2
- package/dist/{LegacyStateStore-Ck3HI28A.mjs.map → LegacyStateStore-CLyFmPIj.mjs.map} +1 -1
- package/dist/{LegacyStateStore-OEno6vIb.cjs → LegacyStateStore-DyX9-7R_.cjs} +2 -2
- package/dist/{LegacyStateStore-OEno6vIb.cjs.map → LegacyStateStore-DyX9-7R_.cjs.map} +1 -1
- package/dist/{LocalStateStore-ukDFg6GM.cjs → LocalStateStore-C-v8K8zO.cjs} +2 -2
- package/dist/{LocalStateStore-ukDFg6GM.cjs.map → LocalStateStore-C-v8K8zO.cjs.map} +1 -1
- package/dist/{LocalStateStore-Fa54CpLw.mjs → LocalStateStore-DQVwsyTh.mjs} +2 -2
- package/dist/{LocalStateStore-Fa54CpLw.mjs.map → LocalStateStore-DQVwsyTh.mjs.map} +1 -1
- package/dist/{S3StateStore-Cjuft2Lk.cjs → S3StateStore-GA-DOTmj.cjs} +4 -4
- package/dist/{S3StateStore-Cjuft2Lk.cjs.map → S3StateStore-GA-DOTmj.cjs.map} +1 -1
- package/dist/{S3StateStore-D53985SR.mjs → S3StateStore-gR_6fNF6.mjs} +4 -4
- package/dist/{S3StateStore-D53985SR.mjs.map → S3StateStore-gR_6fNF6.mjs.map} +1 -1
- package/dist/{SSMStateStore-CRjV2h2G.mjs → SSMStateStore-CT68N-Ti.mjs} +2 -2
- package/dist/{SSMStateStore-CRjV2h2G.mjs.map → SSMStateStore-CT68N-Ti.mjs.map} +1 -1
- package/dist/{SSMStateStore-CnJgw3_-.cjs → SSMStateStore-kdb9rf7x.cjs} +2 -2
- package/dist/{SSMStateStore-CnJgw3_-.cjs.map → SSMStateStore-kdb9rf7x.cjs.map} +1 -1
- package/dist/{add-CG_4mNir.cjs → add-C7_WJEv2.cjs} +7 -8
- package/dist/{add-CG_4mNir.cjs.map → add-C7_WJEv2.cjs.map} +1 -1
- package/dist/{add-D0-1UyFj.mjs → add-CvmRPEfW.mjs} +6 -7
- package/dist/{add-D0-1UyFj.mjs.map → add-CvmRPEfW.mjs.map} +1 -1
- package/dist/{apps-DHi6E_yH.cjs → apps-ClZkLcMz.cjs} +771 -17
- package/dist/apps-ClZkLcMz.cjs.map +1 -0
- package/dist/{apps-DWALM-8s.mjs → apps-CmKxFPTj.mjs} +611 -19
- package/dist/apps-CmKxFPTj.mjs.map +1 -0
- package/dist/{bundler-Cb5ynXXS.mjs → bundler-D6IEJvq4.mjs} +6 -6
- package/dist/{bundler-Cb5ynXXS.mjs.map → bundler-D6IEJvq4.mjs.map} +1 -1
- package/dist/{bundler-Co_7zpYC.cjs → bundler-Ronn7-mL.cjs} +6 -6
- package/dist/{bundler-Co_7zpYC.cjs.map → bundler-Ronn7-mL.cjs.map} +1 -1
- package/dist/{cli-D_9WqN6C.mjs → cli-AZVyGSRn.mjs} +4 -4
- package/dist/{cli-D_9WqN6C.mjs.map → cli-AZVyGSRn.mjs.map} +1 -1
- package/dist/{cli-C5M_7Kux.cjs → cli-B1g2OvS0.cjs} +4 -4
- package/dist/{cli-C5M_7Kux.cjs.map → cli-B1g2OvS0.cjs.map} +1 -1
- package/dist/{compose-BeQ01iYk.cjs → compose-B5AsRVqr.cjs} +291 -36
- package/dist/compose-B5AsRVqr.cjs.map +1 -0
- package/dist/{compose-DxmEMeTu.mjs → compose-BRNMF29g.mjs} +286 -31
- package/dist/compose-BRNMF29g.mjs.map +1 -0
- package/dist/{compose-7p0-3ogo.mjs → compose-DNuENvIt.mjs} +15 -9
- package/dist/{compose-7p0-3ogo.mjs.map → compose-DNuENvIt.mjs.map} +1 -1
- package/dist/{compose-C10hkeHU.cjs → compose-DVPWitEu.cjs} +32 -8
- package/dist/{compose-C10hkeHU.cjs.map → compose-DVPWitEu.cjs.map} +1 -1
- package/dist/{config-B-wza0Xk.mjs → config-BLrAd7Of.mjs} +2 -2
- package/dist/{config-B-wza0Xk.mjs.map → config-BLrAd7Of.mjs.map} +1 -1
- package/dist/{config-BcL1Fojs.d.cts → config-CRk2vdSp.d.mts} +3 -3
- package/dist/{config-BbivVpq0.d.mts.map → config-CRk2vdSp.d.mts.map} +1 -1
- package/dist/{config-CWExbDxA.cjs → config-juUyBlb1.cjs} +2 -2
- package/dist/{config-CWExbDxA.cjs.map → config-juUyBlb1.cjs.map} +1 -1
- package/dist/{config-BbivVpq0.d.mts → config-oBgsbLip.d.cts} +3 -3
- package/dist/{config-BcL1Fojs.d.cts.map → config-oBgsbLip.d.cts.map} +1 -1
- package/dist/config.cjs +2 -2
- package/dist/config.d.cts +3 -3
- package/dist/config.d.mts +3 -3
- package/dist/config.mjs +2 -2
- package/dist/{credentials-Csnd7M8M.cjs → credentials-CrQglKgo.cjs} +6 -70
- package/dist/credentials-CrQglKgo.cjs.map +1 -0
- package/dist/{credentials-B5Oe4fLE.mjs → credentials-FRF4PZYo.mjs} +8 -42
- package/dist/credentials-FRF4PZYo.mjs.map +1 -0
- package/dist/deploy/public.cjs +12 -12
- package/dist/deploy/public.d.cts +3 -3
- package/dist/deploy/public.d.cts.map +1 -1
- package/dist/deploy/public.d.mts +3 -3
- package/dist/deploy/public.d.mts.map +1 -1
- package/dist/deploy/public.mjs +12 -12
- package/dist/{deploy-6DDEG4Ai.mjs → deploy-DI_tg5Mi.mjs} +13 -13
- package/dist/{deploy-6DDEG4Ai.mjs.map → deploy-DI_tg5Mi.mjs.map} +1 -1
- package/dist/{deploy-BwNxJ3ZI.cjs → deploy-DTBod420.cjs} +31 -31
- package/dist/{deploy-BwNxJ3ZI.cjs.map → deploy-DTBod420.cjs.map} +1 -1
- package/dist/{docker-BZnNUJCy.cjs → docker-CnWX5QNR.cjs} +8 -8
- package/dist/{docker-BZnNUJCy.cjs.map → docker-CnWX5QNR.cjs.map} +1 -1
- package/dist/{docker-Ch5aPQ04.mjs → docker-DsJNWnaX.mjs} +5 -5
- package/dist/{docker-Ch5aPQ04.mjs.map → docker-DsJNWnaX.mjs.map} +1 -1
- package/dist/{dokploy-Cn7dQqmE.cjs → dokploy-CxttPnYP.cjs} +2 -2
- package/dist/{dokploy-Cn7dQqmE.cjs.map → dokploy-CxttPnYP.cjs.map} +1 -1
- package/dist/{dokploy-CTWw3WSo.mjs → dokploy-Dd2mXHgX.mjs} +2 -2
- package/dist/{dokploy-CTWw3WSo.mjs.map → dokploy-Dd2mXHgX.mjs.map} +1 -1
- package/dist/{eas-IPjz0PWK.cjs → eas-B-JskJLP.cjs} +3 -3
- package/dist/{eas-IPjz0PWK.cjs.map → eas-B-JskJLP.cjs.map} +1 -1
- package/dist/{eas-D0B8H7hT.mjs → eas-B_yjP_Sl.mjs} +3 -3
- package/dist/{eas-D0B8H7hT.mjs.map → eas-B_yjP_Sl.mjs.map} +1 -1
- package/dist/{encryption-C9auXcSV.mjs → encryption-dUnvnbu8.mjs} +4 -4
- package/dist/{encryption-C9auXcSV.mjs.map → encryption-dUnvnbu8.mjs.map} +1 -1
- package/dist/{encryption-vK64UP4M.cjs → encryption-yW6cWTsN.cjs} +4 -4
- package/dist/{encryption-vK64UP4M.cjs.map → encryption-yW6cWTsN.cjs.map} +1 -1
- package/dist/{engine-C3N2WhbC.mjs → engine-W1gbyy7T.mjs} +17 -12
- package/dist/engine-W1gbyy7T.mjs.map +1 -0
- package/dist/{engine-Icqv5JI6.cjs → engine-oBwumCI2.cjs} +21 -16
- package/dist/engine-oBwumCI2.cjs.map +1 -0
- package/dist/{github-D24wTOe2.mjs → github-D2-FIlNY.mjs} +8 -9
- package/dist/{github-D24wTOe2.mjs.map → github-D2-FIlNY.mjs.map} +1 -1
- package/dist/{github-DUuNInc0.cjs → github-DLucfS9E.cjs} +9 -10
- package/dist/{github-DUuNInc0.cjs.map → github-DLucfS9E.cjs.map} +1 -1
- package/dist/{googlePlay-BGDKlnPx.cjs → googlePlay-C91kIbBZ.cjs} +5 -5
- package/dist/{googlePlay-BGDKlnPx.cjs.map → googlePlay-C91kIbBZ.cjs.map} +1 -1
- package/dist/{googlePlay-Cy-MaYr2.mjs → googlePlay-CapfGnZ8.mjs} +5 -5
- package/dist/{googlePlay-Cy-MaYr2.mjs.map → googlePlay-CapfGnZ8.mjs.map} +1 -1
- package/dist/{index-C1jffZ5_.d.cts → index-B35vTdAW.d.cts} +2 -2
- package/dist/{index-BZZeEWug.d.mts.map → index-B35vTdAW.d.cts.map} +1 -1
- package/dist/{index-BZZeEWug.d.mts → index-Dv1Zj86i.d.mts} +2 -2
- package/dist/{index-C1jffZ5_.d.cts.map → index-Dv1Zj86i.d.mts.map} +1 -1
- package/dist/index.cjs +99 -81
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +87 -69
- package/dist/index.mjs.map +1 -1
- package/dist/{local-CdpBgn3d.mjs → local-2SR2d_BC.mjs} +2 -2
- package/dist/{local-CdpBgn3d.mjs.map → local-2SR2d_BC.mjs.map} +1 -1
- package/dist/{local-B4xobzh-.cjs → local-l5_-A-zI.cjs} +2 -2
- package/dist/{local-B4xobzh-.cjs.map → local-l5_-A-zI.cjs.map} +1 -1
- package/dist/{migrate--hMBtpx-.cjs → migrate-B05YVukh.cjs} +4 -4
- package/dist/{migrate--hMBtpx-.cjs.map → migrate-B05YVukh.cjs.map} +1 -1
- package/dist/{migrate-DVrXTq58.mjs → migrate-C0ecSkL2.mjs} +4 -4
- package/dist/{migrate-DVrXTq58.mjs.map → migrate-C0ecSkL2.mjs.map} +1 -1
- package/dist/{migrate-DwQ-zaMy.cjs → migrate-DNLNhKNT.cjs} +6 -6
- package/dist/{migrate-DwQ-zaMy.cjs.map → migrate-DNLNhKNT.cjs.map} +1 -1
- package/dist/{migrate-DhZfvCkJ.mjs → migrate-KdqlzELQ.mjs} +6 -6
- package/dist/{migrate-DhZfvCkJ.mjs.map → migrate-KdqlzELQ.mjs.map} +1 -1
- package/dist/{notes-z5OOMqm4.mjs → notes-Cj8jL1kS.mjs} +4 -4
- package/dist/{notes-z5OOMqm4.mjs.map → notes-Cj8jL1kS.mjs.map} +1 -1
- package/dist/{notes-C2b5RzGl.cjs → notes-DTTUGZyi.cjs} +4 -4
- package/dist/{notes-C2b5RzGl.cjs.map → notes-DTTUGZyi.cjs.map} +1 -1
- package/dist/openapi.cjs +2 -2
- package/dist/openapi.d.cts +1 -1
- package/dist/openapi.d.mts +1 -1
- package/dist/openapi.mjs +2 -2
- package/dist/{projectBucket-DPD0_B8N.mjs → projectBucket-6BKUPlDp.mjs} +2 -2
- package/dist/{projectBucket-DPD0_B8N.mjs.map → projectBucket-6BKUPlDp.mjs.map} +1 -1
- package/dist/{projectBucket-Dk_aZ1cD.cjs → projectBucket-CjJB-nom.cjs} +2 -2
- package/dist/{projectBucket-Dk_aZ1cD.cjs.map → projectBucket-CjJB-nom.cjs.map} +1 -1
- package/dist/{publish-CDvh-9OG.cjs → publish-Cj36G3de.cjs} +2 -2
- package/dist/{publish-CDvh-9OG.cjs.map → publish-Cj36G3de.cjs.map} +1 -1
- package/dist/{publish-Bmc1Wfs3.mjs → publish-DRsFN1td.mjs} +2 -2
- package/dist/{publish-Bmc1Wfs3.mjs.map → publish-DRsFN1td.mjs.map} +1 -1
- package/dist/reconcile/public.d.cts +1 -1
- package/dist/reconcile/public.d.mts +1 -1
- package/dist/{resolve-CuxPZ3ga.cjs → resolve-C1NkdIcy.cjs} +4 -4
- package/dist/{resolve-CuxPZ3ga.cjs.map → resolve-C1NkdIcy.cjs.map} +1 -1
- package/dist/{resolve-DHARlMdl.mjs → resolve-DjbMNLt-.mjs} +4 -4
- package/dist/{resolve-DHARlMdl.mjs.map → resolve-DjbMNLt-.mjs.map} +1 -1
- package/dist/{rollback-DxHut8C-.cjs → rollback-531Va3dw.cjs} +7 -7
- package/dist/{rollback-DxHut8C-.cjs.map → rollback-531Va3dw.cjs.map} +1 -1
- package/dist/{rollback-DZq_dIbl.mjs → rollback-D0ZpwlFq.mjs} +7 -7
- package/dist/{rollback-DZq_dIbl.mjs.map → rollback-D0ZpwlFq.mjs.map} +1 -1
- package/dist/{runtime-Bvgyxm88.d.cts → runtime-CFvcLEJW.d.cts} +2 -2
- package/dist/{runtime-Bvgyxm88.d.cts.map → runtime-CFvcLEJW.d.cts.map} +1 -1
- package/dist/{runtime-CeAt1IJd.d.mts → runtime-dwsH6ddo.d.mts} +2 -2
- package/dist/{runtime-CeAt1IJd.d.mts.map → runtime-dwsH6ddo.d.mts.map} +1 -1
- package/dist/{s3-Dhy58V_y.cjs → s3-BSfFgbms.cjs} +3 -3
- package/dist/{s3-Dhy58V_y.cjs.map → s3-BSfFgbms.cjs.map} +1 -1
- package/dist/{s3-Cd7UK2y8.mjs → s3-Ho00alt7.mjs} +3 -3
- package/dist/{s3-Cd7UK2y8.mjs.map → s3-Ho00alt7.mjs.map} +1 -1
- package/dist/{serverSetup-qe5bdBhO.mjs → serverSetup-BW1RgJXo.mjs} +7 -7
- package/dist/{serverSetup-qe5bdBhO.mjs.map → serverSetup-BW1RgJXo.mjs.map} +1 -1
- package/dist/{serverSetup-DYiKHMVp.cjs → serverSetup-C59lCe80.cjs} +7 -7
- package/dist/{serverSetup-DYiKHMVp.cjs.map → serverSetup-C59lCe80.cjs.map} +1 -1
- package/dist/{sniffer-DFix2ORf.cjs → sniffer-BL7X_kzC.cjs} +7 -7
- package/dist/{sniffer-DFix2ORf.cjs.map → sniffer-BL7X_kzC.cjs.map} +1 -1
- package/dist/{sniffer-BNcLP8MO.mjs → sniffer-DrmSlwg9.mjs} +7 -7
- package/dist/{sniffer-BNcLP8MO.mjs.map → sniffer-DrmSlwg9.mjs.map} +1 -1
- package/dist/{snsSubscriptions-Dr-gJWtR.cjs → snsSubscriptions-B8nZBBEE.cjs} +3 -3
- package/dist/{snsSubscriptions-Dr-gJWtR.cjs.map → snsSubscriptions-B8nZBBEE.cjs.map} +1 -1
- package/dist/{snsSubscriptions-BwX28_Kl.mjs → snsSubscriptions-DF7YGauz.mjs} +3 -3
- package/dist/{snsSubscriptions-BwX28_Kl.mjs.map → snsSubscriptions-DF7YGauz.mjs.map} +1 -1
- package/dist/{sst-Bvtx6uZ9.mjs → sst-C-RSpWC2.mjs} +5 -5
- package/dist/{sst-Bvtx6uZ9.mjs.map → sst-C-RSpWC2.mjs.map} +1 -1
- package/dist/{sst-CoKFPW7f.cjs → sst-Dvko43Y3.cjs} +5 -5
- package/dist/{sst-CoKFPW7f.cjs.map → sst-Dvko43Y3.cjs.map} +1 -1
- package/dist/{stack-BeSbt_7k.mjs → stack-CVzOFHed.mjs} +70 -387
- package/dist/stack-CVzOFHed.mjs.map +1 -0
- package/dist/{stack-DbaKGKnI.cjs → stack-l_eQ63Gl.cjs} +73 -462
- package/dist/stack-l_eQ63Gl.cjs.map +1 -0
- package/dist/{stage-BblkSR2C.mjs → stage-JMlDwobz.mjs} +18 -15
- package/dist/stage-JMlDwobz.mjs.map +1 -0
- package/dist/{stage-DI5mzoAi.cjs → stage-_vzQ82Gz.cjs} +19 -16
- package/dist/stage-_vzQ82Gz.cjs.map +1 -0
- package/dist/{stages-C-bVwvJZ.cjs → stages-Bs1THSy7.cjs} +3 -3
- package/dist/{stages-C-bVwvJZ.cjs.map → stages-Bs1THSy7.cjs.map} +1 -1
- package/dist/{stages-DBsDvEbo.mjs → stages-_xCG4Ymu.mjs} +3 -3
- package/dist/{stages-DBsDvEbo.mjs.map → stages-_xCG4Ymu.mjs.map} +1 -1
- package/dist/target/public.cjs +1 -1
- package/dist/target/public.d.cts +2 -2
- package/dist/target/public.d.mts +2 -2
- package/dist/target/public.mjs +1 -1
- package/dist/{terminal-DDqusYW0.mjs → terminal-BnKPi06T.mjs} +2 -2
- package/dist/{terminal-DDqusYW0.mjs.map → terminal-BnKPi06T.mjs.map} +1 -1
- package/dist/{terminal-Bxy_A8iP.cjs → terminal-CdPFlCS_.cjs} +2 -2
- package/dist/{terminal-Bxy_A8iP.cjs.map → terminal-CdPFlCS_.cjs.map} +1 -1
- package/dist/{types-Dy1eV7yc.d.cts → types-Dk--xVOT.d.cts} +31 -11
- package/dist/{types-Dy1eV7yc.d.cts.map → types-Dk--xVOT.d.cts.map} +1 -1
- package/dist/{types-C6hDCkV2.d.mts → types-DwQYpd_0.d.mts} +31 -11
- package/dist/{types-C6hDCkV2.d.mts.map → types-DwQYpd_0.d.mts.map} +1 -1
- package/dist/workspace/index.cjs +1 -1
- package/dist/workspace/index.d.cts +2 -2
- package/dist/workspace/index.d.mts +2 -2
- package/dist/workspace/index.mjs +1 -1
- package/dist/{workspace-BbbkJDUU.cjs → workspace-1szcahj9.cjs} +19 -27
- package/dist/workspace-1szcahj9.cjs.map +1 -0
- package/dist/{workspace-CZGJdcTs.mjs → workspace-DFGsrjGD.mjs} +19 -27
- package/dist/workspace-DFGsrjGD.mjs.map +1 -0
- package/package.json +15 -15
- package/dist/apps-DHi6E_yH.cjs.map +0 -1
- package/dist/apps-DWALM-8s.mjs.map +0 -1
- package/dist/compose-BeQ01iYk.cjs.map +0 -1
- package/dist/compose-DxmEMeTu.mjs.map +0 -1
- package/dist/credentials-B5Oe4fLE.mjs.map +0 -1
- package/dist/credentials-Csnd7M8M.cjs.map +0 -1
- package/dist/engine-C3N2WhbC.mjs.map +0 -1
- package/dist/engine-Icqv5JI6.cjs.map +0 -1
- package/dist/stack-BeSbt_7k.mjs.map +0 -1
- package/dist/stack-DbaKGKnI.cjs.map +0 -1
- package/dist/stage-BblkSR2C.mjs.map +0 -1
- package/dist/stage-DI5mzoAi.cjs.map +0 -1
- package/dist/workspace-BbbkJDUU.cjs.map +0 -1
- package/dist/workspace-CZGJdcTs.mjs.map +0 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
2
|
import { t as GkmError } from "./errors-D8Gwp5kU.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { R as stageSampleRate, _ as PUBLIC_ENV_PREFIXES, a as allConstructGlobs, j as TEST_STAGE, z as telemetryEnv } from "./workspace-
|
|
5
|
-
import {
|
|
3
|
+
import { E as providerOf, R as externalsManifestName, T as eventsBackendFor, bt as gkmHome, w as cacheBackendFor } from "./credentials-FRF4PZYo.mjs";
|
|
4
|
+
import { R as stageSampleRate, _ as PUBLIC_ENV_PREFIXES, a as allConstructGlobs, ht as checkStageBackups, j as TEST_STAGE, yt as isReservedStageKey, z as telemetryEnv } from "./workspace-DFGsrjGD.mjs";
|
|
5
|
+
import { $ as otlpHeaders, B as fakeKey, D as HOST_GATEWAY$1, F as emulatorEndpoint, G as serviceAddresses, H as portsOf, I as emulatorQueueUrl, J as LOGS_ORG, L as emulatorTopicArn, M as watchedBuckets, O as NOTIFICATION_RULE_PREFIX, P as EMULATOR_REGION, U as postgresImage, V as portKeys, W as primaryPortKey, Y as LOGS_PASSWORD_KEY, b as REDIS_PASSWORD_KEY, f as savePortState, h as postgresRoleSlug, j as objectsWebhookToken, k as minioNotificationRule, l as loadPortState, m as loadLocalCredentials, n as composeFor, ot as rootSite, q as LOGS_EMAIL_KEY, r as toYaml, t as CLUSTER_DATABASE, v as saveLocalCredentials } from "./compose-DNuENvIt.mjs";
|
|
6
6
|
import { c as INBOX_RELAY_TOKEN_KEY, d as inboxWebhookUrl, i as readFakes, l as inboxRelayToken, o as objectsRoute, r as readCredentialFakes, u as inboxRelayWorker } from "./SubscriberGenerator-CzPrixYu.mjs";
|
|
7
|
-
import { g as appKey, v as protectedSubdomains } from "./config-
|
|
7
|
+
import { g as appKey, v as protectedSubdomains } from "./config-BLrAd7Of.mjs";
|
|
8
8
|
import { i as holdsEveryCache, t as DEFAULT_CACHE } from "./types-Y1NfWlyG.mjs";
|
|
9
9
|
import { u as telemetryArgs } from "./EndpointGenerator-CusLH-9S.mjs";
|
|
10
10
|
import { i as discover, w as workerEdges, x as eventsEdgeBucket } from "./discover-DbDrCQ8h.mjs";
|
|
11
|
+
import { createRequire } from "node:module";
|
|
11
12
|
import { dirname, isAbsolute, join, parse, relative, sep } from "node:path";
|
|
12
13
|
import { existsSync, readFileSync } from "node:fs";
|
|
13
14
|
import { chmod, mkdir, readFile, readdir, rename, rm, writeFile } from "node:fs/promises";
|
|
@@ -15,7 +16,8 @@ import { hostname, networkInterfaces, userInfo } from "node:os";
|
|
|
15
16
|
import { execFile, spawn } from "node:child_process";
|
|
16
17
|
import { createServer } from "node:net";
|
|
17
18
|
import { createHash, createPrivateKey, createPublicKey, generateKeyPairSync, randomBytes } from "node:crypto";
|
|
18
|
-
import { CLIENT_IP_HEADER, PUBLIC_PREFIX, TELEMETRY_KEYS, WILDCARD_SUBDOMAIN, bucketExpiry, cacheTable, cookieDomain, dependenciesOf, dependentsOf, drawSecret, externalApiUrl, isWildcardSite, mobileOrigins, provideKey, providedKeyFor, provisionOrder, publicEnvFor, schemeBase, wildcardDomainOf } from "@geekmidas/manifest";
|
|
19
|
+
import { CLIENT_IP_HEADER, DEFAULT_POSTGRES_VERSION, EDGE_TOKEN_HEADER, EDGE_TOKEN_KEY, PUBLIC_PREFIX, TELEMETRY_KEYS, WILDCARD_SUBDOMAIN, bucketExpiry, cacheTable, cookieDomain, dependenciesOf, dependentsOf, drawSecret, externalApiUrl, isWildcardSite, kebabCase, mobileOrigins, provideKey, providedKeyFor, provisionOrder, publicEnvFor, schemeBase, wildcardDomainOf } from "@geekmidas/manifest";
|
|
20
|
+
import { fileURLToPath } from "node:url";
|
|
19
21
|
import { formatKeyring } from "@geekmidas/constructs/encryption";
|
|
20
22
|
import { ownerRole, readerRole, roleStatements } from "@geekmidas/db/pg/roles";
|
|
21
23
|
import * as snsUrl from "@geekmidas/events/sns/url";
|
|
@@ -27,6 +29,115 @@ import { CreateBucketCommand, DeleteBucketLifecycleCommand, GetBucketLifecycleCo
|
|
|
27
29
|
import { CreateTopicCommand, GetTopicAttributesCommand, SNSClient } from "@aws-sdk/client-sns";
|
|
28
30
|
import { CreateQueueCommand, GetQueueUrlCommand, SQSClient } from "@aws-sdk/client-sqs";
|
|
29
31
|
import { Client } from "pg";
|
|
32
|
+
//#region src/providers/dns.ts
|
|
33
|
+
/** Whether the workspace deploys through the compose target. */
|
|
34
|
+
function deploysWithCompose(workspace) {
|
|
35
|
+
return workspace.deploy?.default === "compose" || Object.values(workspace.apps).some((app) => app.resolvedDeployTarget === "compose");
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/backups/config.ts
|
|
39
|
+
/**
|
|
40
|
+
* Which stages take backups, and where they are kept.
|
|
41
|
+
*
|
|
42
|
+
* A deployed compose stage whose stack runs Postgres is backed up by
|
|
43
|
+
* default — every day at 02:00 UTC, kept 30 days — unless
|
|
44
|
+
* `deploy.backups.<stage>` says otherwise. The local stage never is.
|
|
45
|
+
*
|
|
46
|
+
* Every backup is kept in the project bucket (`providers/projectBucket.ts`),
|
|
47
|
+
* beside the stage's deploy state, one folder per run and one file per
|
|
48
|
+
* database:
|
|
49
|
+
*
|
|
50
|
+
* ```
|
|
51
|
+
* gkm/<project>/<stage>/backups/2026-10-10/02-00-00Z/database.sql.gz
|
|
52
|
+
* gkm/<project>/<stage>/backups/2026-10-10/02-00-00Z/auth-database.sql.gz
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* The file is named after the database's construct, the way its migrations
|
|
56
|
+
* folder is: `AuthDatabase` is `db/auth-database`, and `auth-database.sql.gz`.
|
|
57
|
+
*/
|
|
58
|
+
/** Whether the stack runs Postgres: some construct is a database. */
|
|
59
|
+
function runsPostgres(manifest) {
|
|
60
|
+
return Object.values(manifest).some((d) => d.kind === "database");
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* What `stage`'s backups are: on — by its entry or the default — off by
|
|
64
|
+
* `false`, or none, for the local stage, a stage compose does not deploy,
|
|
65
|
+
* and a stack with no database.
|
|
66
|
+
*/
|
|
67
|
+
function stageBackups(workspace, manifest, stage) {
|
|
68
|
+
if (stage === workspace.stages?.local) return {
|
|
69
|
+
mode: "none",
|
|
70
|
+
reason: "local"
|
|
71
|
+
};
|
|
72
|
+
if (!deploysWithCompose(workspace)) return {
|
|
73
|
+
mode: "none",
|
|
74
|
+
reason: "not-compose"
|
|
75
|
+
};
|
|
76
|
+
if (!runsPostgres(manifest)) return {
|
|
77
|
+
mode: "none",
|
|
78
|
+
reason: "no-postgres"
|
|
79
|
+
};
|
|
80
|
+
const value = (workspace.deploy?.backups)?.[stage];
|
|
81
|
+
const checked = checkStageBackups(stage, value ?? {});
|
|
82
|
+
if (checked === false) return { mode: "disabled" };
|
|
83
|
+
return {
|
|
84
|
+
mode: "on",
|
|
85
|
+
backups: checked,
|
|
86
|
+
source: value === void 0 ? "default" : "config"
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Where a stage's backups are, in the project bucket — under the same
|
|
91
|
+
* `<prefix>/<project>/<stage>` its deploy state is: `gkm/shop/production/backups`.
|
|
92
|
+
*/
|
|
93
|
+
function backupsPrefix(workspace, stage) {
|
|
94
|
+
const state = workspace.state;
|
|
95
|
+
const prefix = state?.provider === "s3" && state.prefix !== void 0 ? state.prefix.replace(/\/+$/, "") : "gkm";
|
|
96
|
+
return `${prefix ? `${prefix}/` : ""}${workspace.name}/${stage}/backups`;
|
|
97
|
+
}
|
|
98
|
+
/** A run folder's time back, or `undefined` for a key that is not one. */
|
|
99
|
+
function runTime(folder) {
|
|
100
|
+
const match = /^(\d{4}-\d{2}-\d{2})\/(\d{2})-(\d{2})-(\d{2})Z$/.exec(folder);
|
|
101
|
+
if (!match) return void 0;
|
|
102
|
+
const at = /* @__PURE__ */ new Date(`${match[1]}T${match[2]}:${match[3]}:${match[4]}Z`);
|
|
103
|
+
return Number.isNaN(at.getTime()) ? void 0 : at;
|
|
104
|
+
}
|
|
105
|
+
/** A database's file in a run's folder: `auth-database.sql.gz`. */
|
|
106
|
+
function backupFile(database) {
|
|
107
|
+
return `${database.file}.sql.gz`;
|
|
108
|
+
}
|
|
109
|
+
/** Each database the stack runs, by its construct and its name in Postgres. */
|
|
110
|
+
function backupDatabases(resources) {
|
|
111
|
+
return resources.filter((r) => r.kind === "database").map((r) => ({
|
|
112
|
+
id: r.id,
|
|
113
|
+
file: kebabCase(r.id),
|
|
114
|
+
name: r.name
|
|
115
|
+
})).sort((a, b) => a.file.localeCompare(b.file));
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The expiry of every stage's backups, by each stage's own entry — what the
|
|
119
|
+
* project bucket's lifecycle carries beside its own rule.
|
|
120
|
+
*
|
|
121
|
+
* A put replaces a bucket's whole lifecycle, so this is built from every
|
|
122
|
+
* deployed stage each time, never from the stage being deployed alone: one
|
|
123
|
+
* stage's deploy keeps every other's rule. A stage set to `false` has none,
|
|
124
|
+
* and its backups are kept until someone deletes them.
|
|
125
|
+
*/
|
|
126
|
+
function backupExpiries(workspace, manifest) {
|
|
127
|
+
const expiries = [];
|
|
128
|
+
for (const stage of [...workspace.stages?.deployed ?? []].sort()) {
|
|
129
|
+
const choice = stageBackups(workspace, manifest, stage);
|
|
130
|
+
if (choice.mode !== "on") continue;
|
|
131
|
+
expiries.push({
|
|
132
|
+
id: `gkm-backups-${stage}`,
|
|
133
|
+
prefix: `${backupsPrefix(workspace, stage)}/`,
|
|
134
|
+
days: choice.backups.keepDays,
|
|
135
|
+
abortIncompleteDays: 1
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return expiries;
|
|
139
|
+
}
|
|
140
|
+
//#endregion
|
|
30
141
|
//#region src/generators/processorRoute.ts
|
|
31
142
|
/**
|
|
32
143
|
* Where `gkm dev` serves a file server's processors, on the dev server of the
|
|
@@ -281,9 +392,7 @@ function toCaddyfile(sites, options) {
|
|
|
281
392
|
https://${host} {
|
|
282
393
|
tls ${options.certificate} ${options.certificate}
|
|
283
394
|
|
|
284
|
-
|
|
285
|
-
# server rate-limits by the client address it carries.
|
|
286
|
-
request_header -${CLIENT_IP_HEADER}
|
|
395
|
+
${clientIpRule(options.edgeToken)}
|
|
287
396
|
${processors ? `
|
|
288
397
|
# Its processors' patterns, to the dev server holding them — under the
|
|
289
398
|
# route it mounts them on. Answered there, so the bucket below never is.
|
|
@@ -334,6 +443,29 @@ const GENERATED = `# Generated by gkm from the construct manifest — do not edi
|
|
|
334
443
|
# its root, so nothing has to be installed to use these URLs from code; a
|
|
335
444
|
# browser needs the root trusted once ("gkm trust").
|
|
336
445
|
`;
|
|
446
|
+
/**
|
|
447
|
+
* The lines every site block of an edge opens with, for gkm's own
|
|
448
|
+
* `x-gkm-client-ip` — the client address the auth server rate-limits by.
|
|
449
|
+
*
|
|
450
|
+
* Only a service of this stack may send it. One that calls a sibling at its
|
|
451
|
+
* public address comes through this edge, and proves where it comes from with
|
|
452
|
+
* the stack's token (`x-gkm-edge-token`), derived from the stage's seed and
|
|
453
|
+
* handed to every process of the stack — never to a browser. A request
|
|
454
|
+
* without it has the header removed, so nobody outside can choose the address
|
|
455
|
+
* they are rate-limited by. Without a token, it is removed from every request.
|
|
456
|
+
*/
|
|
457
|
+
function clientIpRule(edgeToken) {
|
|
458
|
+
if (!edgeToken) return `
|
|
459
|
+
# gkm's own header, which only a service of this stack may send: the auth
|
|
460
|
+
# server rate-limits by the client address it carries.
|
|
461
|
+
request_header -${CLIENT_IP_HEADER}`;
|
|
462
|
+
return `
|
|
463
|
+
# gkm's own header, which only a service of this stack may send — proven by
|
|
464
|
+
# the stack's token: the auth server rate-limits by the client address it
|
|
465
|
+
# carries. Removed from every other request.
|
|
466
|
+
@gkm_outside not header ${EDGE_TOKEN_HEADER} ${edgeToken}
|
|
467
|
+
request_header @gkm_outside -${CLIENT_IP_HEADER}`;
|
|
468
|
+
}
|
|
337
469
|
//#endregion
|
|
338
470
|
//#region src/telemetry/edges.ts
|
|
339
471
|
/**
|
|
@@ -820,6 +952,15 @@ function stageEnv(stored, resolved) {
|
|
|
820
952
|
};
|
|
821
953
|
}
|
|
822
954
|
/**
|
|
955
|
+
* The token a stack's own services prove themselves with at its edge
|
|
956
|
+
* (`EDGE_TOKEN_HEADER`): derived from the stage's seed, as a bucket's webhook
|
|
957
|
+
* token is, so every process, the edge and the auth server agree on it with
|
|
958
|
+
* nothing stored.
|
|
959
|
+
*/
|
|
960
|
+
function edgeToken(project, seed) {
|
|
961
|
+
return createHash("sha256").update(`${seed ? `${seed}:` : ""}${project}:edge-token`).digest("base64url").slice(0, 43);
|
|
962
|
+
}
|
|
963
|
+
/**
|
|
823
964
|
* Every env key a reconciled plan resolves, and its value.
|
|
824
965
|
*
|
|
825
966
|
* Keys come from the declaration rather than being re-derived, so what the build
|
|
@@ -897,6 +1038,7 @@ function envFor(plan, options) {
|
|
|
897
1038
|
env[provideKey(resource.id, "eventsToken")] = objectsWebhookToken(options.project ?? "", resource.id, credential.seed);
|
|
898
1039
|
}
|
|
899
1040
|
if (plan.resources.some((r) => r.kind === "inbox" && env[r.envKey])) env[INBOX_RELAY_TOKEN_KEY] = inboxRelayToken(options.project ?? "", credential.seed);
|
|
1041
|
+
if (plan.resources.some((r) => (r.kind === "rest-api" || r.kind === "websocket-api") && env[r.envKey])) env[EDGE_TOKEN_KEY] = edgeToken(options.project ?? "", credential.seed);
|
|
900
1042
|
if (plan.resources.some((r) => r.kind === "objects" && env[r.envKey])) Object.assign(env, storageCredentials(options.credentials));
|
|
901
1043
|
return env;
|
|
902
1044
|
}
|
|
@@ -1814,6 +1956,207 @@ async function applyBuckets(client, buckets) {
|
|
|
1814
1956
|
return applied;
|
|
1815
1957
|
}
|
|
1816
1958
|
//#endregion
|
|
1959
|
+
//#region src/backups/service.ts
|
|
1960
|
+
/**
|
|
1961
|
+
* The stack's `backups` service: what a deployed compose stage with Postgres
|
|
1962
|
+
* runs beside its apps, unless `deploy.backups.<stage>` is `false`.
|
|
1963
|
+
*
|
|
1964
|
+
* - **The image** is built from the stack's own Postgres image —
|
|
1965
|
+
* `postgres:<major>-alpine`, already on the server for the stack, and with
|
|
1966
|
+
* the `pg_dump` that matches the server — with Node added and gkm's runner
|
|
1967
|
+
* (`runner.ts`) copied in. Nothing is pulled that the stack does not have,
|
|
1968
|
+
* and nothing is mounted from the host: the build context is two files.
|
|
1969
|
+
* - **Its key** is `BACKUPS_URL`, from the stage's secrets, like any app's:
|
|
1970
|
+
* allowed to put objects under the stage's backups prefix and nothing else.
|
|
1971
|
+
* The server holds no AWS credentials of its own.
|
|
1972
|
+
* - **Its login** is a role of its own, `<project>_backups`, granted
|
|
1973
|
+
* `pg_read_all_data` — it can read every database and write none. Postgres
|
|
1974
|
+
* before 14 has no such role, and there it signs in as the stack's
|
|
1975
|
+
* superuser.
|
|
1976
|
+
* - **Its health** is the last good run: unhealthy once that is more than
|
|
1977
|
+
* twice the schedule's longest gap old, after a startup grace.
|
|
1978
|
+
*/
|
|
1979
|
+
/** The service's name in the stack. */
|
|
1980
|
+
const BACKUPS_SERVICE = "backups";
|
|
1981
|
+
/** The secret its key is written to. */
|
|
1982
|
+
const BACKUPS_URL_KEY = "BACKUPS_URL";
|
|
1983
|
+
/** Where the runner is, in the image. */
|
|
1984
|
+
const RUNNER_PATH = "/gkm/backup.mjs";
|
|
1985
|
+
/** The first Postgres with `pg_read_all_data`. */
|
|
1986
|
+
const READ_ALL_DATA_SINCE = 14;
|
|
1987
|
+
/** A stage that backs up, and no key to back up with. */
|
|
1988
|
+
var BackupsUrlMissing = class extends GkmError {
|
|
1989
|
+
stage;
|
|
1990
|
+
constructor(stage) {
|
|
1991
|
+
super(`'${stage}' runs Postgres, so its stack backs it up, and its secrets hold no ${BACKUPS_URL_KEY} to back up with. The deploy writes it — the IAM user and key it creates in the stage's AWS account — so run the deploy with the account's credentials. To take no backups on this stage, set deploy.backups.${stage}: false.`);
|
|
1992
|
+
this.stage = stage;
|
|
1993
|
+
this.name = "BackupsUrlMissing";
|
|
1994
|
+
}
|
|
1995
|
+
};
|
|
1996
|
+
/** The backups role: `<project>_backups`, as the superuser is `<project>_admin`. */
|
|
1997
|
+
function backupsRole(project) {
|
|
1998
|
+
return `${postgresRoleSlug(project)}_backups`;
|
|
1999
|
+
}
|
|
2000
|
+
/**
|
|
2001
|
+
* The runner's source, as JavaScript: the built `backups/runner.mjs` beside
|
|
2002
|
+
* the CLI's bundle, or — run from source — `runner.ts`, with its types
|
|
2003
|
+
* stripped by esbuild.
|
|
2004
|
+
*/
|
|
2005
|
+
function runnerSource() {
|
|
2006
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
2007
|
+
for (const path of [
|
|
2008
|
+
join(here, "backups", "runner.mjs"),
|
|
2009
|
+
join(here, "runner.mjs"),
|
|
2010
|
+
join(here, "..", "backups", "runner.mjs")
|
|
2011
|
+
]) if (existsSync(path)) return readFileSync(path, "utf-8");
|
|
2012
|
+
const { transformSync } = createRequire(import.meta.url)("esbuild");
|
|
2013
|
+
return transformSync(readFileSync(join(here, "runner.ts"), "utf-8"), {
|
|
2014
|
+
loader: "ts",
|
|
2015
|
+
format: "esm",
|
|
2016
|
+
target: "node22"
|
|
2017
|
+
}).code;
|
|
2018
|
+
}
|
|
2019
|
+
/** The image's Dockerfile: the stack's Postgres, Node, and the runner. */
|
|
2020
|
+
function backupsDockerfile(from) {
|
|
2021
|
+
return `# Generated by gkm — the stage's backups: pg_dump from ${from}, and gkm's uploader.
|
|
2022
|
+
FROM ${from}
|
|
2023
|
+
RUN apk add --no-cache nodejs
|
|
2024
|
+
COPY backup.mjs ${RUNNER_PATH}
|
|
2025
|
+
USER postgres
|
|
2026
|
+
ENTRYPOINT []
|
|
2027
|
+
CMD ["node", "${RUNNER_PATH}", "serve"]
|
|
2028
|
+
`;
|
|
2029
|
+
}
|
|
2030
|
+
/**
|
|
2031
|
+
* The stack's backups service, for a stage whose backups are on.
|
|
2032
|
+
*
|
|
2033
|
+
* @throws {BackupsUrlMissing} when the stage's secrets hold no key
|
|
2034
|
+
*/
|
|
2035
|
+
function stackBackups(input) {
|
|
2036
|
+
const { plan, stage } = input;
|
|
2037
|
+
const version = plan.resources.find((r) => r.version)?.version ?? DEFAULT_POSTGRES_VERSION;
|
|
2038
|
+
const from = postgresImage(version);
|
|
2039
|
+
const script = runnerSource();
|
|
2040
|
+
const dockerfile = backupsDockerfile(from);
|
|
2041
|
+
const hash = createHash("sha256").update(dockerfile).update(script).digest("hex").slice(0, 12);
|
|
2042
|
+
const readOnly = version >= READ_ALL_DATA_SINCE;
|
|
2043
|
+
const role = backupsRole(input.workspace.name);
|
|
2044
|
+
const login = readOnly ? {
|
|
2045
|
+
user: role,
|
|
2046
|
+
password: localRolePassword(input.workspace.name, plan, role, input.seed)
|
|
2047
|
+
} : input.superuser;
|
|
2048
|
+
const databases = backupDatabases(plan.resources);
|
|
2049
|
+
const prefix = backupsPrefix(input.workspace, stage);
|
|
2050
|
+
const { kind, ...schedule } = input.backups.schedule;
|
|
2051
|
+
let env = {};
|
|
2052
|
+
if (!input.buildOnly) {
|
|
2053
|
+
const url = input.custom[BACKUPS_URL_KEY];
|
|
2054
|
+
if (!url) throw new BackupsUrlMissing(stage);
|
|
2055
|
+
env = {
|
|
2056
|
+
BACKUPS_URL: url,
|
|
2057
|
+
BACKUPS_PREFIX: prefix,
|
|
2058
|
+
BACKUPS_DATABASES: JSON.stringify(databases.map(({ file, name }) => ({
|
|
2059
|
+
file,
|
|
2060
|
+
name
|
|
2061
|
+
}))),
|
|
2062
|
+
BACKUPS_SCHEDULE: JSON.stringify(kind === "cron" ? {
|
|
2063
|
+
kind,
|
|
2064
|
+
minutes: input.backups.schedule.minutes,
|
|
2065
|
+
hours: input.backups.schedule.hours,
|
|
2066
|
+
days: input.backups.schedule.days,
|
|
2067
|
+
months: input.backups.schedule.months,
|
|
2068
|
+
weekdays: input.backups.schedule.weekdays
|
|
2069
|
+
} : {
|
|
2070
|
+
kind,
|
|
2071
|
+
...schedule
|
|
2072
|
+
}),
|
|
2073
|
+
BACKUPS_MAX_GAP_SECONDS: String(input.backups.maxGapSeconds),
|
|
2074
|
+
PGHOST: "postgres",
|
|
2075
|
+
PGPORT: "5432",
|
|
2076
|
+
PGUSER: login.user,
|
|
2077
|
+
PGPASSWORD: login.password,
|
|
2078
|
+
...input.telemetry?.OTEL_EXPORTER_OTLP_ENDPOINT ? {
|
|
2079
|
+
OTEL_EXPORTER_OTLP_ENDPOINT: input.telemetry.OTEL_EXPORTER_OTLP_ENDPOINT,
|
|
2080
|
+
...input.telemetry.OTEL_EXPORTER_OTLP_HEADERS ? { OTEL_EXPORTER_OTLP_HEADERS: input.telemetry.OTEL_EXPORTER_OTLP_HEADERS } : {},
|
|
2081
|
+
OTEL_SERVICE_NAME: BACKUPS_SERVICE
|
|
2082
|
+
} : {}
|
|
2083
|
+
};
|
|
2084
|
+
}
|
|
2085
|
+
return {
|
|
2086
|
+
backups: input.backups,
|
|
2087
|
+
databases,
|
|
2088
|
+
prefix,
|
|
2089
|
+
from,
|
|
2090
|
+
image: `${input.project}-backups:pg${version}-${hash}`,
|
|
2091
|
+
files: {
|
|
2092
|
+
Dockerfile: dockerfile,
|
|
2093
|
+
"backup.mjs": script
|
|
2094
|
+
},
|
|
2095
|
+
login,
|
|
2096
|
+
readOnly,
|
|
2097
|
+
env
|
|
2098
|
+
};
|
|
2099
|
+
}
|
|
2100
|
+
/** The service in the stack's compose file. */
|
|
2101
|
+
function backupsService(backups, envFiles) {
|
|
2102
|
+
return {
|
|
2103
|
+
image: backups.image,
|
|
2104
|
+
build: {
|
|
2105
|
+
context: `./${BACKUPS_SERVICE}`,
|
|
2106
|
+
dockerfile: "Dockerfile"
|
|
2107
|
+
},
|
|
2108
|
+
pull_policy: "build",
|
|
2109
|
+
restart: "unless-stopped",
|
|
2110
|
+
...envFiles ? { env_file: [{
|
|
2111
|
+
path: `./${BACKUPS_SERVICE}.env`,
|
|
2112
|
+
format: "raw"
|
|
2113
|
+
}] } : {},
|
|
2114
|
+
depends_on: { postgres: { condition: "service_healthy" } },
|
|
2115
|
+
healthcheck: {
|
|
2116
|
+
test: [
|
|
2117
|
+
"CMD",
|
|
2118
|
+
"node",
|
|
2119
|
+
RUNNER_PATH,
|
|
2120
|
+
"health"
|
|
2121
|
+
],
|
|
2122
|
+
interval: "1m",
|
|
2123
|
+
timeout: "10s",
|
|
2124
|
+
retries: 3,
|
|
2125
|
+
start_period: "30s"
|
|
2126
|
+
}
|
|
2127
|
+
};
|
|
2128
|
+
}
|
|
2129
|
+
/**
|
|
2130
|
+
* The backups role, created and kept: able to sign in and read every
|
|
2131
|
+
* database, and nothing else. None when it signs in as the superuser.
|
|
2132
|
+
*/
|
|
2133
|
+
function backupsRoleStatements(backups) {
|
|
2134
|
+
if (!backups.readOnly) return [];
|
|
2135
|
+
const role = quoteIdentifier(backups.login.user);
|
|
2136
|
+
const password = `'${backups.login.password.replace(/'/g, "''")}'`;
|
|
2137
|
+
return [
|
|
2138
|
+
{
|
|
2139
|
+
id: BACKUPS_SERVICE,
|
|
2140
|
+
describe: `role ${backups.login.user}`,
|
|
2141
|
+
exists: {
|
|
2142
|
+
sql: "SELECT 1 FROM pg_roles WHERE rolname = $1",
|
|
2143
|
+
values: [backups.login.user]
|
|
2144
|
+
},
|
|
2145
|
+
create: `CREATE ROLE ${role} LOGIN PASSWORD ${password}`
|
|
2146
|
+
},
|
|
2147
|
+
{
|
|
2148
|
+
id: BACKUPS_SERVICE,
|
|
2149
|
+
describe: `role ${backups.login.user}: its password`,
|
|
2150
|
+
create: `ALTER ROLE ${role} WITH LOGIN PASSWORD ${password}`
|
|
2151
|
+
},
|
|
2152
|
+
{
|
|
2153
|
+
id: BACKUPS_SERVICE,
|
|
2154
|
+
describe: `role ${backups.login.user}: read every database`,
|
|
2155
|
+
create: `GRANT pg_read_all_data TO ${role}`
|
|
2156
|
+
}
|
|
2157
|
+
];
|
|
2158
|
+
}
|
|
2159
|
+
//#endregion
|
|
1817
2160
|
//#region src/build/workers.ts
|
|
1818
2161
|
/** A worker with background work and no backend app to build it from. */
|
|
1819
2162
|
var WorkerHasNoApp = class extends GkmError {
|
|
@@ -1972,6 +2315,71 @@ function publicBuildValues(site, manifest, resolve, secrets) {
|
|
|
1972
2315
|
for (const [key, value] of Object.entries(secrets)) if (key.startsWith(prefix) && args[key] === void 0 && value) args[key] = value;
|
|
1973
2316
|
return args;
|
|
1974
2317
|
}
|
|
2318
|
+
/**
|
|
2319
|
+
* Where a site's own hosts point during its image build: this loopback
|
|
2320
|
+
* address, on which nothing in a build container listens — so a request to
|
|
2321
|
+
* one is refused at once instead of waiting on a host that is not up yet.
|
|
2322
|
+
*/
|
|
2323
|
+
const OFFLINE_BUILD_ADDRESS = "127.0.0.1";
|
|
2324
|
+
/**
|
|
2325
|
+
* The hosts a site's image build must not wait on: its own and those of the
|
|
2326
|
+
* constructs its `.dependsOn()` names, as this stage serves them.
|
|
2327
|
+
*
|
|
2328
|
+
* None of them answers while the image is built — the stack the site belongs
|
|
2329
|
+
* to is started after it — and a fetch to a public host that does not answer
|
|
2330
|
+
* yet can stall until the framework's prerender limit (Next's 60s). Mapped to
|
|
2331
|
+
* {@link OFFLINE_BUILD_ADDRESS} in the build's `/etc/hosts`, each is refused
|
|
2332
|
+
* at once, and the page renders on its first request instead.
|
|
2333
|
+
*
|
|
2334
|
+
* The mapping is the build's only: the URLs the bundle inlines are the real
|
|
2335
|
+
* ones, and the running container resolves them as anything else does. A
|
|
2336
|
+
* stage secret named for the bundle is someone else's host (an analytics
|
|
2337
|
+
* service, a store) and is left alone, as are `localhost` and an address.
|
|
2338
|
+
*/
|
|
2339
|
+
function offlineBuildHosts(site, manifest, resolve) {
|
|
2340
|
+
const sources = [provideKey(site.id, "url"), ...Object.values(publicEnvFor(site, manifest))];
|
|
2341
|
+
const hosts = /* @__PURE__ */ new Set();
|
|
2342
|
+
for (const source of sources) {
|
|
2343
|
+
const host = hostOf(resolve(source));
|
|
2344
|
+
if (host) hosts.add(host);
|
|
2345
|
+
}
|
|
2346
|
+
return [...hosts].sort();
|
|
2347
|
+
}
|
|
2348
|
+
/** A URL's host, where it is a name `/etc/hosts` can map. */
|
|
2349
|
+
function hostOf(value) {
|
|
2350
|
+
if (!value || !URL.canParse(value)) return void 0;
|
|
2351
|
+
const { protocol, hostname } = new URL(value);
|
|
2352
|
+
if (!/^(https?|wss?):$/.test(protocol)) return void 0;
|
|
2353
|
+
if (hostname === "localhost" || hostname.includes("*")) return void 0;
|
|
2354
|
+
if (/^[\d.]+$/.test(hostname) || hostname.startsWith("[")) return void 0;
|
|
2355
|
+
return hostname;
|
|
2356
|
+
}
|
|
2357
|
+
/**
|
|
2358
|
+
* {@link offlineBuildHosts} for a target that knows each app's public URL by
|
|
2359
|
+
* its app key rather than by construct key — the site's own, and each app it
|
|
2360
|
+
* calls. None, for an app that declares no site.
|
|
2361
|
+
*/
|
|
2362
|
+
function siteOfflineHosts(manifest, appName, ownUrl, urls) {
|
|
2363
|
+
const entries = Object.entries(manifest);
|
|
2364
|
+
const site = entries.find(([id, d]) => d.kind === "site" && appKey(id) === appName)?.[1];
|
|
2365
|
+
if (site?.kind !== "site") return [];
|
|
2366
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
2367
|
+
for (const [id] of entries) {
|
|
2368
|
+
const name = appKey(id);
|
|
2369
|
+
const url = name === appName ? ownUrl : urls[name];
|
|
2370
|
+
if (url) byKey.set(provideKey(id, "url"), url);
|
|
2371
|
+
}
|
|
2372
|
+
return offlineBuildHosts(site, manifest, (key) => byKey.get(key));
|
|
2373
|
+
}
|
|
2374
|
+
/**
|
|
2375
|
+
* Whether a site runs a server of its own — Next's, TanStack Start's — which
|
|
2376
|
+
* reads an environment at runtime as a backend does: its edges' public URLs
|
|
2377
|
+
* and the stage's secrets. A `static` site is a finished bundle, and reads
|
|
2378
|
+
* nothing once it is built.
|
|
2379
|
+
*/
|
|
2380
|
+
function runsServer(site) {
|
|
2381
|
+
return site.variant !== "static";
|
|
2382
|
+
}
|
|
1975
2383
|
//#endregion
|
|
1976
2384
|
//#region src/exec/imageBuild.ts
|
|
1977
2385
|
/**
|
|
@@ -1990,6 +2398,22 @@ function isImageBuild(env = process.env) {
|
|
|
1990
2398
|
return env[IMAGE_BUILD_ENV] === "1";
|
|
1991
2399
|
}
|
|
1992
2400
|
/**
|
|
2401
|
+
* Set by a site's Dockerfile in its builder stage: this build is offline —
|
|
2402
|
+
* no stage is reachable from it.
|
|
2403
|
+
*
|
|
2404
|
+
* A site's image is built before the stack it belongs to runs, so the APIs
|
|
2405
|
+
* its `.dependsOn()` names do not answer yet: data a page fetches while the
|
|
2406
|
+
* framework prerenders it would be none, cached as the page. A site tests
|
|
2407
|
+
* `process.env.GKM_BUILD_OFFLINE === '1'` to skip that fetch, and renders the
|
|
2408
|
+
* page on its first request instead — which gkm's warm-up after a deploy
|
|
2409
|
+
* makes before any visitor does.
|
|
2410
|
+
*
|
|
2411
|
+
* Separate from {@link IMAGE_BUILD_ENV}, which says what `gkm exec` injects:
|
|
2412
|
+
* this says what the build can reach. Only the builder stage sets it; the
|
|
2413
|
+
* running container never has it.
|
|
2414
|
+
*/
|
|
2415
|
+
const BUILD_OFFLINE_ENV = "GKM_BUILD_OFFLINE";
|
|
2416
|
+
/**
|
|
1993
2417
|
* What `gkm exec` injects inside an image build: the public values its build
|
|
1994
2418
|
* args set — every `NEXT_PUBLIC_*`, `VITE_*` and `EXPO_PUBLIC_*` — and
|
|
1995
2419
|
* nothing read from a secrets store, a file or a container.
|
|
@@ -2335,6 +2759,9 @@ const FIND_GKM_BIN = `let d=process.cwd();const{existsSync:e}=require("fs"),{dir
|
|
|
2335
2759
|
* no bin linked.
|
|
2336
2760
|
* - `GKM_IMAGE_BUILD`, which has `gkm exec` inject the build args above — the
|
|
2337
2761
|
* stage's public URLs — and never load a secret or resolve a local address.
|
|
2762
|
+
* - `GKM_BUILD_OFFLINE`, which tells the site's own code that no stage is
|
|
2763
|
+
* reachable from this build: its APIs are not up yet, so a page that
|
|
2764
|
+
* fetches from them renders on request rather than at build.
|
|
2338
2765
|
* - each backend's typed client, generated from its endpoints at the
|
|
2339
2766
|
* workspace root's `.gkm/client/`, where the site's tsconfig paths point.
|
|
2340
2767
|
*/
|
|
@@ -2362,12 +2789,15 @@ RUN cd ${root} && GKM_BIN="$(node -e '${FIND_GKM_BIN}')" && \\
|
|
|
2362
2789
|
chmod +x /usr/local/bin/gkm
|
|
2363
2790
|
|
|
2364
2791
|
# \`gkm exec\` in this build injects the build args, never a stage's secrets
|
|
2365
|
-
ENV ${IMAGE_BUILD_ENV}=1
|
|
2792
|
+
ENV ${IMAGE_BUILD_ENV}=1
|
|
2793
|
+
# No stage is reachable from this build: the site's APIs are not up yet
|
|
2794
|
+
ENV ${BUILD_OFFLINE_ENV}=1${generate}`;
|
|
2366
2795
|
}
|
|
2367
2796
|
/**
|
|
2368
2797
|
* Build the site with turbo. Loose env mode, so the task sees what the
|
|
2369
|
-
* Dockerfile set — the build args
|
|
2370
|
-
* project's turbo.json declares: the image's environment
|
|
2798
|
+
* Dockerfile set — the build args, `GKM_IMAGE_BUILD` and `GKM_BUILD_OFFLINE`
|
|
2799
|
+
* — whatever the project's turbo.json declares: the image's environment
|
|
2800
|
+
* holds nothing else.
|
|
2371
2801
|
*/
|
|
2372
2802
|
function siteBuild(options) {
|
|
2373
2803
|
const { turbo } = layout(options);
|
|
@@ -2973,6 +3403,64 @@ function toPosix(path) {
|
|
|
2973
3403
|
return path.split(sep).join("/");
|
|
2974
3404
|
}
|
|
2975
3405
|
//#endregion
|
|
3406
|
+
//#region src/providers/processorOrigin.ts
|
|
3407
|
+
/**
|
|
3408
|
+
* A file server's processors as a CDN origin: the names both sides agree on.
|
|
3409
|
+
*
|
|
3410
|
+
* On a compose stage whose bucket is on S3, the CDN serves the bucket and
|
|
3411
|
+
* sends each processor pattern to the stack's processor unit, at a host of
|
|
3412
|
+
* its own. That host is public — a CDN reaches its origin over the internet —
|
|
3413
|
+
* so the CDN adds a secret header and the edge refuses any request without
|
|
3414
|
+
* it. One definition, read by the CDN that sends the header and by the stack
|
|
3415
|
+
* whose edge checks it, so the two cannot drift.
|
|
3416
|
+
*/
|
|
3417
|
+
/** The header the CDN adds to every request it sends a processor. */
|
|
3418
|
+
const ORIGIN_VERIFY_HEADER = "X-Gkm-Origin-Verify";
|
|
3419
|
+
/** Where a file server's processors answer the CDN: `<fileserver>-processors.<domain>`. */
|
|
3420
|
+
function processorOriginHost(serverId, domain) {
|
|
3421
|
+
return `${appKey(serverId)}-processors.${domain}`.toLowerCase();
|
|
3422
|
+
}
|
|
3423
|
+
/** The stage secret holding the header's value: `ASSETS_SERVER_ORIGIN_SECRET`. */
|
|
3424
|
+
function originSecretKey(serverId) {
|
|
3425
|
+
return provideKey(serverId, "originSecret");
|
|
3426
|
+
}
|
|
3427
|
+
/**
|
|
3428
|
+
* What the processor unit reads that secret from. Set wherever the CDN fronts
|
|
3429
|
+
* it, so the unit refuses a request without the header itself — on Dokploy,
|
|
3430
|
+
* whose edge cannot match a header, the only check; behind the stack's own
|
|
3431
|
+
* edge, a second one.
|
|
3432
|
+
*/
|
|
3433
|
+
const PROCESSOR_ORIGIN_SECRET_ENV = "GKM_PROCESSOR_ORIGIN_SECRET";
|
|
3434
|
+
/** A new value for that secret: random, generated once, kept in the stage. */
|
|
3435
|
+
function newOriginSecret() {
|
|
3436
|
+
return randomBytes(32).toString("base64url");
|
|
3437
|
+
}
|
|
3438
|
+
//#endregion
|
|
3439
|
+
//#region src/secrets/stackKeys.ts
|
|
3440
|
+
/**
|
|
3441
|
+
* The stage secrets gkm keeps for the stack itself rather than for the
|
|
3442
|
+
* application: the server's address, the logins of the containers it runs
|
|
3443
|
+
* (Redis, OpenObserve), the key backups write with, the secret a CDN sends a
|
|
3444
|
+
* file server's processors.
|
|
3445
|
+
*
|
|
3446
|
+
* Nothing in an app reads them, so no process is handed one as "the stage's
|
|
3447
|
+
* own" (`processEnvKeys`) — the containers that do read them are given them
|
|
3448
|
+
* by name.
|
|
3449
|
+
*/
|
|
3450
|
+
const STACK_KEYS = /* @__PURE__ */ new Set([
|
|
3451
|
+
BACKUPS_URL_KEY,
|
|
3452
|
+
LOGS_EMAIL_KEY,
|
|
3453
|
+
LOGS_PASSWORD_KEY,
|
|
3454
|
+
REDIS_PASSWORD_KEY,
|
|
3455
|
+
PROCESSOR_ORIGIN_SECRET_ENV
|
|
3456
|
+
]);
|
|
3457
|
+
/** A file server's origin secret: `ASSETS_SERVER_ORIGIN_SECRET`. */
|
|
3458
|
+
const ORIGIN_SECRET = /_ORIGIN_SECRET$/;
|
|
3459
|
+
/** Whether a stage secret is the stack's own, which no app process reads. */
|
|
3460
|
+
function isStackKey(key) {
|
|
3461
|
+
return isReservedStageKey(key) || key.startsWith("GKM_") || STACK_KEYS.has(key) || ORIGIN_SECRET.test(key);
|
|
3462
|
+
}
|
|
3463
|
+
//#endregion
|
|
2976
3464
|
//#region src/trust/authority.ts
|
|
2977
3465
|
/**
|
|
2978
3466
|
* gkm's local certificate authority: one per machine, and every local edge's
|
|
@@ -4247,7 +4735,10 @@ async function reconcile(options) {
|
|
|
4247
4735
|
const sites = sitesFor(plan, project, options.addresses, options.processorAddresses);
|
|
4248
4736
|
const edged = plan.containers.includes("caddy");
|
|
4249
4737
|
const authorityPaths = options.authority ?? localAuthorityPaths();
|
|
4250
|
-
const caddyfile = toCaddyfile(sites, {
|
|
4738
|
+
const caddyfile = toCaddyfile(sites, {
|
|
4739
|
+
certificate: `${CADDY_SITES_IN_CONTAINER}/${stage}.pem`,
|
|
4740
|
+
edgeToken: edgeToken(project, seed)
|
|
4741
|
+
});
|
|
4251
4742
|
const hash = planHash(plan, compose, {
|
|
4252
4743
|
caddyfile,
|
|
4253
4744
|
postgres: postgresStatements(plan, project, seed).map((statement) => statement.create).join(";\n")
|
|
@@ -4539,7 +5030,8 @@ async function reconcileWorkspace(workspace, options) {
|
|
|
4539
5030
|
for (const outcome of result.logins) if (outcome.notice) console.log(outcome.notice);
|
|
4540
5031
|
return {
|
|
4541
5032
|
...result,
|
|
4542
|
-
manifest
|
|
5033
|
+
manifest,
|
|
5034
|
+
background
|
|
4543
5035
|
};
|
|
4544
5036
|
}
|
|
4545
5037
|
/**
|
|
@@ -4675,6 +5167,21 @@ function localAddress(port) {
|
|
|
4675
5167
|
* `gkm test` rewrites the same file, and running the tests must not quietly
|
|
4676
5168
|
* point these apps at the test databases.
|
|
4677
5169
|
*/
|
|
5170
|
+
var apps_exports = /* @__PURE__ */ __exportAll({
|
|
5171
|
+
APPS_PROFILE: () => APPS_PROFILE,
|
|
5172
|
+
appEnvKeys: () => appEnvKeys,
|
|
5173
|
+
appProcess: () => appProcess,
|
|
5174
|
+
appServices: () => appServices,
|
|
5175
|
+
constructKeys: () => constructKeys,
|
|
5176
|
+
dockerfileOf: () => dockerfileOf,
|
|
5177
|
+
healthcheck: () => healthcheck,
|
|
5178
|
+
networkEnv: () => networkEnv,
|
|
5179
|
+
processEnv: () => processEnv,
|
|
5180
|
+
processEnvKeys: () => processEnvKeys,
|
|
5181
|
+
processorEnvKeys: () => processorEnvKeys,
|
|
5182
|
+
sitePublicArgs: () => sitePublicArgs,
|
|
5183
|
+
workerEnvKeys: () => workerEnvKeys
|
|
5184
|
+
});
|
|
4678
5185
|
/** The profile app services carry, so `gkm dev` starts only the containers. */
|
|
4679
5186
|
const APPS_PROFILE = "apps";
|
|
4680
5187
|
/**
|
|
@@ -4723,9 +5230,10 @@ function sitePublicArgs(manifest, appName, env) {
|
|
|
4723
5230
|
* name on the compose network — `postgres:5432` rather than the port
|
|
4724
5231
|
* published for the host.
|
|
4725
5232
|
*
|
|
4726
|
-
* The addresses of surfaces and sites are the caller's:
|
|
4727
|
-
*
|
|
4728
|
-
*
|
|
5233
|
+
* The addresses of surfaces and sites are the caller's: `gkm compose` hands
|
|
5234
|
+
* every process the public ones, which one app calls another on through the
|
|
5235
|
+
* edge; `gkm docker`'s apps profile, which runs no edge, the compose
|
|
5236
|
+
* network's.
|
|
4729
5237
|
*/
|
|
4730
5238
|
function networkEnv(plan, options, hostOf = (container) => container) {
|
|
4731
5239
|
const placeholders = {};
|
|
@@ -4803,7 +5311,6 @@ function workerEnvKeys(manifest, workerId) {
|
|
|
4803
5311
|
addEdgeKeys(manifest, workerEdges(manifest, workerId), keys);
|
|
4804
5312
|
return keys;
|
|
4805
5313
|
}
|
|
4806
|
-
/** What each construct an edge reaches hands the process that reaches it. */
|
|
4807
5314
|
/**
|
|
4808
5315
|
* The keys a file server's processor unit reads: its bucket's, and what each
|
|
4809
5316
|
* of its processors depends on. `undefined` for a file server with none.
|
|
@@ -4815,6 +5322,91 @@ function processorEnvKeys(manifest, fileServerId) {
|
|
|
4815
5322
|
addEdgeKeys(manifest, [server.of, ...server.processors.flatMap((p) => p.dependencies.map((d) => d.target))], keys);
|
|
4816
5323
|
return keys;
|
|
4817
5324
|
}
|
|
5325
|
+
/**
|
|
5326
|
+
* The keys the declared constructs hand to some process — each scoped to the
|
|
5327
|
+
* processes with an edge to it. A stage key outside this set is the stage's
|
|
5328
|
+
* own: one set by hand, which nothing declares a reader of.
|
|
5329
|
+
*/
|
|
5330
|
+
function constructKeys(manifest) {
|
|
5331
|
+
const keys = /* @__PURE__ */ new Set();
|
|
5332
|
+
const add = (more) => {
|
|
5333
|
+
for (const key of more ?? []) keys.add(key);
|
|
5334
|
+
};
|
|
5335
|
+
for (const [id, declaration] of Object.entries(manifest)) {
|
|
5336
|
+
add(declaration.provides);
|
|
5337
|
+
add(declaration.requires);
|
|
5338
|
+
if (declaration.kind === "worker") add(workerEnvKeys(manifest, id));
|
|
5339
|
+
if (declaration.kind === "file-server") add(processorEnvKeys(manifest, id));
|
|
5340
|
+
if (declaration.kind === "rest-api" || declaration.kind === "websocket-api" || declaration.kind === "site" || declaration.kind === "mobile-app") add(appEnvKeys(manifest, appKey(id)));
|
|
5341
|
+
}
|
|
5342
|
+
return keys;
|
|
5343
|
+
}
|
|
5344
|
+
/**
|
|
5345
|
+
* The keys one process is handed — the one rule `gkm dev`, `gkm exec` and
|
|
5346
|
+
* `gkm compose` all apply, so an app gets the same keys whichever runs it:
|
|
5347
|
+
*
|
|
5348
|
+
* - **What its constructs reach**, by their edges: `appEnvKeys` for its app,
|
|
5349
|
+
* `workerEnvKeys` for each worker it runs, `processorEnvKeys` for each
|
|
5350
|
+
* file server's processors. A key a construct provides reaches only a
|
|
5351
|
+
* process with an edge to it, a stored one included — an auth server's
|
|
5352
|
+
* signing secret stays with the auth server.
|
|
5353
|
+
* - **The stack's edge token** (`EDGE_TOKEN_KEY`), which a call to a
|
|
5354
|
+
* sibling through the edge carries beside the client's address.
|
|
5355
|
+
* - **Every one of the stage's own keys** (`stageKeys` no construct
|
|
5356
|
+
* provides): a value set with `gkm secrets:set` that the code reads with
|
|
5357
|
+
* `get('X')`. Nothing declares which process reads it, so every process is
|
|
5358
|
+
* handed it — but for what gkm keeps for the stack itself (`isStackKey`):
|
|
5359
|
+
* a container's login, the backups key, the server's address.
|
|
5360
|
+
*
|
|
5361
|
+
* `undefined` for an app no declaration describes, which nothing narrows.
|
|
5362
|
+
*/
|
|
5363
|
+
function processEnvKeys(manifest, units, stageKeys) {
|
|
5364
|
+
const keys = /* @__PURE__ */ new Set();
|
|
5365
|
+
if (units.app !== void 0) {
|
|
5366
|
+
const own = appEnvKeys(manifest, units.app);
|
|
5367
|
+
if (!own && !units.workers?.length && !units.processors?.length) return;
|
|
5368
|
+
for (const key of own ?? []) keys.add(key);
|
|
5369
|
+
}
|
|
5370
|
+
for (const id of units.workers ?? []) for (const key of workerEnvKeys(manifest, id) ?? []) keys.add(key);
|
|
5371
|
+
for (const id of units.processors ?? []) for (const key of processorEnvKeys(manifest, id) ?? []) keys.add(key);
|
|
5372
|
+
keys.add(EDGE_TOKEN_KEY);
|
|
5373
|
+
const owned = constructKeys(manifest);
|
|
5374
|
+
for (const key of stageKeys) if (!owned.has(key) && !isStackKey(key)) keys.add(key);
|
|
5375
|
+
return keys;
|
|
5376
|
+
}
|
|
5377
|
+
/**
|
|
5378
|
+
* One process's environment, from the stage's stored keys and every value
|
|
5379
|
+
* it resolved (`stageEnv`'s merge): exactly {@link processEnvKeys}.
|
|
5380
|
+
*/
|
|
5381
|
+
function processEnv(manifest, units, stored, resolved) {
|
|
5382
|
+
const env = stageEnv(stored, resolved);
|
|
5383
|
+
const keys = processEnvKeys(manifest, units, Object.keys(stored));
|
|
5384
|
+
if (!keys) return env;
|
|
5385
|
+
return Object.fromEntries(Object.entries(env).filter(([key]) => keys.has(key)));
|
|
5386
|
+
}
|
|
5387
|
+
/**
|
|
5388
|
+
* What an app's own process runs locally: its surface or site, and the
|
|
5389
|
+
* workers and processors whose code it holds — the same choice `gkm build`
|
|
5390
|
+
* makes (`workerUnits`, `processorUnits`).
|
|
5391
|
+
*
|
|
5392
|
+
* A worker no app can build is left out here: `gkm build` says so, and a
|
|
5393
|
+
* dev loop has nothing to run it in.
|
|
5394
|
+
*/
|
|
5395
|
+
function appProcess(workspace, manifest, background, appName) {
|
|
5396
|
+
const hosted = (units) => {
|
|
5397
|
+
try {
|
|
5398
|
+
return units().filter((unit) => unit.app === appName).map((unit) => unit.id);
|
|
5399
|
+
} catch (error) {
|
|
5400
|
+
if (error instanceof WorkerHasNoApp || error instanceof WorkerNameTaken || error instanceof ProcessorsHaveNoApp) return [];
|
|
5401
|
+
throw error;
|
|
5402
|
+
}
|
|
5403
|
+
};
|
|
5404
|
+
return {
|
|
5405
|
+
app: appName,
|
|
5406
|
+
workers: hosted(() => workerUnits(workspace, manifest, background)),
|
|
5407
|
+
processors: hosted(() => processorUnits(workspace, manifest))
|
|
5408
|
+
};
|
|
5409
|
+
}
|
|
4818
5410
|
function addEdgeKeys(manifest, edges, keys, client = false) {
|
|
4819
5411
|
for (const id of edges) {
|
|
4820
5412
|
const bucket = eventsEdgeBucket(id);
|
|
@@ -4928,6 +5520,6 @@ function healthcheck(port, path) {
|
|
|
4928
5520
|
};
|
|
4929
5521
|
}
|
|
4930
5522
|
//#endregion
|
|
4931
|
-
export {
|
|
5523
|
+
export { publicBuildValues as $, originSecretKey as A, isTelemetryKey as At, generateBackendDockerfile as B, backupDatabases as Bt, ensureLocalCertificate as C, envFor as Ct, ORIGIN_VERIFY_HEADER as D, planFor as Dt, readLocalAuthority as E, TELEMETRY_CONTAINER as Et, PROCESSOR_PORT as F, usesTelemetry as Ft, generateProcessorDockerfile as G, stageBackups as Gt, generateEntryDockerfile as H, backupFile as Ht, TURBO_VERSION as I, LOCAL_TLD as It, resolveDockerConfig as J, generateViteStaticDockerfile as K, deploysWithCompose as Kt, WORKER_PORT as L, clientIpRule as Lt, appImageOptions as M, siteClientTelemetry as Mt, composeBuildPaths as N, surfaceClientTraced as Nt, PROCESSOR_ORIGIN_SECRET_ENV as O, resourceName as Ot, imageLayout as P, telemetryOf as Pt, offlineBuildHosts as Q, detectPackageManager as R, hostFor$1 as Rt, ensureLocalAuthority as S, mergeLifecycle as St, localCertificateNames as T, stageEnv as Tt, generateNextjsDockerfile as U, backupsPrefix as Ut, generateDockerignore as V, backupExpiries as Vt, generateNodeWebDockerfile as W, runTime as Wt, isImageBuild as X, imageBuildCredentials as Y, OFFLINE_BUILD_ADDRESS as Z, forgetState as _, bucketLifecycles as _t, networkEnv as a, workerUnits as at, bucketClient as b, postgresStatements as bt, processorEnvKeys as c, RUNNER_PATH as ct, backendsOf as d, stackBackups as dt, runsServer as et, constructGlobs as f, applyBuckets as ft, COMPOSE_PATH as g, applyPostgres as gt, workspace_exports as h, applyPolicies as ht, dockerfileOf as i, processorUnits as it, processorOriginHost as j, scopeTelemetryEnv as jt, newOriginSecret as k, appTelemetry as kt, workerEnvKeys as l, backupsRoleStatements as lt, reconcileWorkspace as m, applyNotifications as mt, appProcess as n, isUnder as nt, processEnv as o, BACKUPS_SERVICE as ot, derivedContainers as p, applyLifecycles as pt, generateWorkerDockerfile as q, apps_exports as r, processorUnitName as rt, processEnvKeys as s, BACKUPS_URL_KEY as st, appEnvKeys as t, siteOfflineHosts as tt, FAKE_ENV as u, backupsService as ut, LEGACY_LOCAL_LOGIN as v, bucketPolicies as vt, localAuthorityPaths as w, localRolePassword as wt, pgClient as x, quoteIdentifier as xt, ensurePostgresLogin as y, postgresDatabaseNames as yt, findBuildRoot as z, PROCESSORS_DEV_PREFIX as zt };
|
|
4932
5524
|
|
|
4933
|
-
//# sourceMappingURL=apps-
|
|
5525
|
+
//# sourceMappingURL=apps-CmKxFPTj.mjs.map
|