@geekmidas/cli 10.0.0-alpha.147 → 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-DXuPFufW.mjs → GoDaddyProvider-CGgS-I6m.mjs} +2 -2
- package/dist/{GoDaddyProvider-DXuPFufW.mjs.map → GoDaddyProvider-CGgS-I6m.mjs.map} +1 -1
- package/dist/{GoDaddyProvider-CpO8dFYC.cjs → GoDaddyProvider-D_dZQJIX.cjs} +2 -2
- package/dist/{GoDaddyProvider-CpO8dFYC.cjs.map → GoDaddyProvider-D_dZQJIX.cjs.map} +1 -1
- package/dist/{HostingerProvider-Dum492dc.mjs → HostingerProvider-CWRE6auw.mjs} +2 -2
- package/dist/{HostingerProvider-Dum492dc.mjs.map → HostingerProvider-CWRE6auw.mjs.map} +1 -1
- package/dist/{HostingerProvider-Beu0Ciky.cjs → HostingerProvider-eGuDBjfN.cjs} +2 -2
- package/dist/{HostingerProvider-Beu0Ciky.cjs.map → HostingerProvider-eGuDBjfN.cjs.map} +1 -1
- package/dist/{LegacyStateStore-DZjph7ES.mjs → LegacyStateStore-CLyFmPIj.mjs} +2 -2
- package/dist/{LegacyStateStore-DZjph7ES.mjs.map → LegacyStateStore-CLyFmPIj.mjs.map} +1 -1
- package/dist/{LegacyStateStore-V4R0llou.cjs → LegacyStateStore-DyX9-7R_.cjs} +2 -2
- package/dist/{LegacyStateStore-V4R0llou.cjs.map → LegacyStateStore-DyX9-7R_.cjs.map} +1 -1
- package/dist/{LocalStateStore-DuSotrd3.cjs → LocalStateStore-C-v8K8zO.cjs} +2 -2
- package/dist/{LocalStateStore-DuSotrd3.cjs.map → LocalStateStore-C-v8K8zO.cjs.map} +1 -1
- package/dist/{LocalStateStore-Bth8pBp-.mjs → LocalStateStore-DQVwsyTh.mjs} +2 -2
- package/dist/{LocalStateStore-Bth8pBp-.mjs.map → LocalStateStore-DQVwsyTh.mjs.map} +1 -1
- package/dist/{S3StateStore-DTPxQS3z.cjs → S3StateStore-GA-DOTmj.cjs} +4 -4
- package/dist/{S3StateStore-DTPxQS3z.cjs.map → S3StateStore-GA-DOTmj.cjs.map} +1 -1
- package/dist/{S3StateStore-DGlh3s2p.mjs → S3StateStore-gR_6fNF6.mjs} +4 -4
- package/dist/{S3StateStore-DGlh3s2p.mjs.map → S3StateStore-gR_6fNF6.mjs.map} +1 -1
- package/dist/{SSMStateStore-DCa85jhG.mjs → SSMStateStore-CT68N-Ti.mjs} +2 -2
- package/dist/{SSMStateStore-DCa85jhG.mjs.map → SSMStateStore-CT68N-Ti.mjs.map} +1 -1
- package/dist/{SSMStateStore-B9R317q0.cjs → SSMStateStore-kdb9rf7x.cjs} +2 -2
- package/dist/{SSMStateStore-B9R317q0.cjs.map → SSMStateStore-kdb9rf7x.cjs.map} +1 -1
- package/dist/{add-Cr-9Ku0W.cjs → add-C7_WJEv2.cjs} +5 -6
- package/dist/{add-Cr-9Ku0W.cjs.map → add-C7_WJEv2.cjs.map} +1 -1
- package/dist/{add-Bl33BvDW.mjs → add-CvmRPEfW.mjs} +4 -5
- package/dist/{add-Bl33BvDW.mjs.map → add-CvmRPEfW.mjs.map} +1 -1
- package/dist/{apps-BIsxWYUo.cjs → apps-ClZkLcMz.cjs} +670 -12
- package/dist/apps-ClZkLcMz.cjs.map +1 -0
- package/dist/{apps-DFzUuJ22.mjs → apps-CmKxFPTj.mjs} +529 -15
- package/dist/apps-CmKxFPTj.mjs.map +1 -0
- package/dist/{bundler-BagXzefF.mjs → bundler-D6IEJvq4.mjs} +6 -6
- package/dist/{bundler-BagXzefF.mjs.map → bundler-D6IEJvq4.mjs.map} +1 -1
- package/dist/{bundler-Cael9EDc.cjs → bundler-Ronn7-mL.cjs} +6 -6
- package/dist/{bundler-Cael9EDc.cjs.map → bundler-Ronn7-mL.cjs.map} +1 -1
- package/dist/{cli-BJRPsFq7.mjs → cli-AZVyGSRn.mjs} +4 -4
- package/dist/{cli-BJRPsFq7.mjs.map → cli-AZVyGSRn.mjs.map} +1 -1
- package/dist/{cli-B1A-cLy-.cjs → cli-B1g2OvS0.cjs} +4 -4
- package/dist/{cli-B1A-cLy-.cjs.map → cli-B1g2OvS0.cjs.map} +1 -1
- package/dist/{compose-CnNmDNph.cjs → compose-B5AsRVqr.cjs} +13 -13
- package/dist/{compose-CnNmDNph.cjs.map → compose-B5AsRVqr.cjs.map} +1 -1
- package/dist/{compose-CZU60dwb.mjs → compose-BRNMF29g.mjs} +7 -7
- package/dist/{compose-CZU60dwb.mjs.map → compose-BRNMF29g.mjs.map} +1 -1
- package/dist/{compose-C7izI7Eo.mjs → compose-DNuENvIt.mjs} +13 -7
- package/dist/{compose-C7izI7Eo.mjs.map → compose-DNuENvIt.mjs.map} +1 -1
- package/dist/{compose-Cius-YHS.cjs → compose-DVPWitEu.cjs} +30 -6
- package/dist/{compose-Cius-YHS.cjs.map → compose-DVPWitEu.cjs.map} +1 -1
- package/dist/{credentials-D11xozSF.cjs → credentials-CrQglKgo.cjs} +5 -69
- package/dist/credentials-CrQglKgo.cjs.map +1 -0
- package/dist/{credentials-CJ_z0Nni.mjs → credentials-FRF4PZYo.mjs} +7 -41
- package/dist/credentials-FRF4PZYo.mjs.map +1 -0
- package/dist/deploy/public.cjs +10 -10
- package/dist/deploy/public.mjs +10 -10
- package/dist/{deploy-Dfn21QYG.mjs → deploy-DI_tg5Mi.mjs} +11 -11
- package/dist/{deploy-Dfn21QYG.mjs.map → deploy-DI_tg5Mi.mjs.map} +1 -1
- package/dist/{deploy-Ch1wCsU1.cjs → deploy-DTBod420.cjs} +29 -29
- package/dist/{deploy-Ch1wCsU1.cjs.map → deploy-DTBod420.cjs.map} +1 -1
- package/dist/{docker-BT6G7aJE.cjs → docker-CnWX5QNR.cjs} +7 -7
- package/dist/{docker-BT6G7aJE.cjs.map → docker-CnWX5QNR.cjs.map} +1 -1
- package/dist/{docker-_W_CauBY.mjs → docker-DsJNWnaX.mjs} +4 -4
- package/dist/{docker-_W_CauBY.mjs.map → docker-DsJNWnaX.mjs.map} +1 -1
- package/dist/{dokploy-DaQbR_NH.cjs → dokploy-CxttPnYP.cjs} +2 -2
- package/dist/{dokploy-DaQbR_NH.cjs.map → dokploy-CxttPnYP.cjs.map} +1 -1
- package/dist/{dokploy-CBgGuei3.mjs → dokploy-Dd2mXHgX.mjs} +2 -2
- package/dist/{dokploy-CBgGuei3.mjs.map → dokploy-Dd2mXHgX.mjs.map} +1 -1
- package/dist/{eas-YxDTJ3ql.cjs → eas-B-JskJLP.cjs} +2 -2
- package/dist/{eas-YxDTJ3ql.cjs.map → eas-B-JskJLP.cjs.map} +1 -1
- package/dist/{eas-3L1_yKhk.mjs → eas-B_yjP_Sl.mjs} +2 -2
- package/dist/{eas-3L1_yKhk.mjs.map → eas-B_yjP_Sl.mjs.map} +1 -1
- package/dist/{encryption-CRyFk5nu.mjs → encryption-dUnvnbu8.mjs} +2 -2
- package/dist/{encryption-CRyFk5nu.mjs.map → encryption-dUnvnbu8.mjs.map} +1 -1
- package/dist/{encryption-CVIu104e.cjs → encryption-yW6cWTsN.cjs} +2 -2
- package/dist/{encryption-CVIu104e.cjs.map → encryption-yW6cWTsN.cjs.map} +1 -1
- package/dist/{engine-DZnZy1R5.mjs → engine-W1gbyy7T.mjs} +8 -8
- package/dist/{engine-DZnZy1R5.mjs.map → engine-W1gbyy7T.mjs.map} +1 -1
- package/dist/{engine-XecwdLdj.cjs → engine-oBwumCI2.cjs} +12 -12
- package/dist/{engine-XecwdLdj.cjs.map → engine-oBwumCI2.cjs.map} +1 -1
- package/dist/{github-CDJXpBCT.mjs → github-D2-FIlNY.mjs} +6 -7
- package/dist/{github-CDJXpBCT.mjs.map → github-D2-FIlNY.mjs.map} +1 -1
- package/dist/{github-dnxU_tMp.cjs → github-DLucfS9E.cjs} +7 -8
- package/dist/{github-dnxU_tMp.cjs.map → github-DLucfS9E.cjs.map} +1 -1
- package/dist/{googlePlay-CnIU3qIV.cjs → googlePlay-C91kIbBZ.cjs} +4 -4
- package/dist/{googlePlay-CnIU3qIV.cjs.map → googlePlay-C91kIbBZ.cjs.map} +1 -1
- package/dist/{googlePlay-BYeXKpNE.mjs → googlePlay-CapfGnZ8.mjs} +4 -4
- package/dist/{googlePlay-BYeXKpNE.mjs.map → googlePlay-CapfGnZ8.mjs.map} +1 -1
- package/dist/index.cjs +94 -77
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +82 -65
- package/dist/index.mjs.map +1 -1
- package/dist/{local-BIOpCtLE.mjs → local-2SR2d_BC.mjs} +2 -2
- package/dist/{local-BIOpCtLE.mjs.map → local-2SR2d_BC.mjs.map} +1 -1
- package/dist/{local-qdNfjzxQ.cjs → local-l5_-A-zI.cjs} +2 -2
- package/dist/{local-qdNfjzxQ.cjs.map → local-l5_-A-zI.cjs.map} +1 -1
- package/dist/{migrate-CkHtNdre.cjs → migrate-B05YVukh.cjs} +2 -2
- package/dist/{migrate-CkHtNdre.cjs.map → migrate-B05YVukh.cjs.map} +1 -1
- package/dist/{migrate-svXhccrs.mjs → migrate-C0ecSkL2.mjs} +2 -2
- package/dist/{migrate-svXhccrs.mjs.map → migrate-C0ecSkL2.mjs.map} +1 -1
- package/dist/{migrate-CDEHWq-e.cjs → migrate-DNLNhKNT.cjs} +4 -4
- package/dist/{migrate-CDEHWq-e.cjs.map → migrate-DNLNhKNT.cjs.map} +1 -1
- package/dist/{migrate--VNdTWT7.mjs → migrate-KdqlzELQ.mjs} +4 -4
- package/dist/{migrate--VNdTWT7.mjs.map → migrate-KdqlzELQ.mjs.map} +1 -1
- package/dist/{notes-D9ofENLJ.mjs → notes-Cj8jL1kS.mjs} +2 -2
- package/dist/{notes-D9ofENLJ.mjs.map → notes-Cj8jL1kS.mjs.map} +1 -1
- package/dist/{notes-DBNPml4N.cjs → notes-DTTUGZyi.cjs} +2 -2
- package/dist/{notes-DBNPml4N.cjs.map → notes-DTTUGZyi.cjs.map} +1 -1
- package/dist/{projectBucket-De0MQeNj.mjs → projectBucket-6BKUPlDp.mjs} +2 -2
- package/dist/{projectBucket-De0MQeNj.mjs.map → projectBucket-6BKUPlDp.mjs.map} +1 -1
- package/dist/{projectBucket-BtiC0Cn8.cjs → projectBucket-CjJB-nom.cjs} +2 -2
- package/dist/{projectBucket-BtiC0Cn8.cjs.map → projectBucket-CjJB-nom.cjs.map} +1 -1
- package/dist/{publish-CohTrVKe.cjs → publish-Cj36G3de.cjs} +2 -2
- package/dist/{publish-CohTrVKe.cjs.map → publish-Cj36G3de.cjs.map} +1 -1
- package/dist/{publish-k38S418e.mjs → publish-DRsFN1td.mjs} +2 -2
- package/dist/{publish-k38S418e.mjs.map → publish-DRsFN1td.mjs.map} +1 -1
- package/dist/{resolve-Cr3Qj8ch.cjs → resolve-C1NkdIcy.cjs} +4 -4
- package/dist/{resolve-Cr3Qj8ch.cjs.map → resolve-C1NkdIcy.cjs.map} +1 -1
- package/dist/{resolve-YMxlYJtO.mjs → resolve-DjbMNLt-.mjs} +4 -4
- package/dist/{resolve-YMxlYJtO.mjs.map → resolve-DjbMNLt-.mjs.map} +1 -1
- package/dist/{rollback-eyqvtzW_.cjs → rollback-531Va3dw.cjs} +5 -5
- package/dist/{rollback-eyqvtzW_.cjs.map → rollback-531Va3dw.cjs.map} +1 -1
- package/dist/{rollback-DIoyVrQI.mjs → rollback-D0ZpwlFq.mjs} +5 -5
- package/dist/{rollback-DIoyVrQI.mjs.map → rollback-D0ZpwlFq.mjs.map} +1 -1
- package/dist/{s3-CegRM8Sa.cjs → s3-BSfFgbms.cjs} +2 -2
- package/dist/{s3-CegRM8Sa.cjs.map → s3-BSfFgbms.cjs.map} +1 -1
- package/dist/{s3-Cl3tRemt.mjs → s3-Ho00alt7.mjs} +2 -2
- package/dist/{s3-Cl3tRemt.mjs.map → s3-Ho00alt7.mjs.map} +1 -1
- package/dist/{serverSetup-fQwkJ_EI.mjs → serverSetup-BW1RgJXo.mjs} +5 -5
- package/dist/{serverSetup-fQwkJ_EI.mjs.map → serverSetup-BW1RgJXo.mjs.map} +1 -1
- package/dist/{serverSetup-BwfMgz3W.cjs → serverSetup-C59lCe80.cjs} +5 -5
- package/dist/{serverSetup-BwfMgz3W.cjs.map → serverSetup-C59lCe80.cjs.map} +1 -1
- package/dist/{sniffer-BgdVvvzU.cjs → sniffer-BL7X_kzC.cjs} +6 -6
- package/dist/{sniffer-BgdVvvzU.cjs.map → sniffer-BL7X_kzC.cjs.map} +1 -1
- package/dist/{sniffer-FF7mfuR8.mjs → sniffer-DrmSlwg9.mjs} +6 -6
- package/dist/{sniffer-FF7mfuR8.mjs.map → sniffer-DrmSlwg9.mjs.map} +1 -1
- package/dist/{snsSubscriptions-DUY-Tu6J.cjs → snsSubscriptions-B8nZBBEE.cjs} +2 -2
- package/dist/{snsSubscriptions-DUY-Tu6J.cjs.map → snsSubscriptions-B8nZBBEE.cjs.map} +1 -1
- package/dist/{snsSubscriptions-B_WH4o1S.mjs → snsSubscriptions-DF7YGauz.mjs} +2 -2
- package/dist/{snsSubscriptions-B_WH4o1S.mjs.map → snsSubscriptions-DF7YGauz.mjs.map} +1 -1
- package/dist/{sst-BkTtncop.mjs → sst-C-RSpWC2.mjs} +4 -4
- package/dist/{sst-BkTtncop.mjs.map → sst-C-RSpWC2.mjs.map} +1 -1
- package/dist/{sst-BEXeTgDQ.cjs → sst-Dvko43Y3.cjs} +4 -4
- package/dist/{sst-BEXeTgDQ.cjs.map → sst-Dvko43Y3.cjs.map} +1 -1
- package/dist/{stack-CqfBL5LA.mjs → stack-CVzOFHed.mjs} +49 -368
- package/dist/stack-CVzOFHed.mjs.map +1 -0
- package/dist/{stack-CcFgY4sJ.cjs → stack-l_eQ63Gl.cjs} +51 -442
- package/dist/stack-l_eQ63Gl.cjs.map +1 -0
- package/dist/{stage-4ZtteXz8.mjs → stage-JMlDwobz.mjs} +16 -13
- package/dist/stage-JMlDwobz.mjs.map +1 -0
- package/dist/{stage-C19XRx7W.cjs → stage-_vzQ82Gz.cjs} +17 -14
- package/dist/stage-_vzQ82Gz.cjs.map +1 -0
- package/dist/target/public.cjs +1 -1
- package/dist/target/public.mjs +1 -1
- package/dist/{terminal-KVX_MmCR.mjs → terminal-BnKPi06T.mjs} +2 -2
- package/dist/{terminal-KVX_MmCR.mjs.map → terminal-BnKPi06T.mjs.map} +1 -1
- package/dist/{terminal-BkyVVOb-.cjs → terminal-CdPFlCS_.cjs} +2 -2
- package/dist/{terminal-BkyVVOb-.cjs.map → terminal-CdPFlCS_.cjs.map} +1 -1
- package/package.json +15 -15
- package/dist/apps-BIsxWYUo.cjs.map +0 -1
- package/dist/apps-DFzUuJ22.mjs.map +0 -1
- package/dist/credentials-CJ_z0Nni.mjs.map +0 -1
- package/dist/credentials-D11xozSF.cjs.map +0 -1
- package/dist/stack-CcFgY4sJ.cjs.map +0 -1
- package/dist/stack-CqfBL5LA.mjs.map +0 -1
- package/dist/stage-4ZtteXz8.mjs.map +0 -1
- package/dist/stage-C19XRx7W.cjs.map +0 -1
|
@@ -1,331 +1,18 @@
|
|
|
1
1
|
import { t as GkmError } from "./errors-D8Gwp5kU.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { B as LOGS_PORT, I as otlpTelemetryEnv, L as resolveStageTelemetry,
|
|
4
|
-
import { $ as
|
|
5
|
-
import {
|
|
2
|
+
import { Q as imageRef, a as findRootDomain, o as normalizeDnsConfig } from "./credentials-FRF4PZYo.mjs";
|
|
3
|
+
import { B as LOGS_PORT, I as otlpTelemetryEnv, L as resolveStageTelemetry, lt as certificateFor, ut as proxyFor, yt as isReservedStageKey, z as telemetryEnv } from "./workspace-DFGsrjGD.mjs";
|
|
4
|
+
import { $ as publicBuildValues, A as originSecretKey, At as isTelemetryKey, D as ORIGIN_VERIFY_HEADER, Dt as planFor, F as PROCESSOR_PORT, Ft as usesTelemetry, Gt as stageBackups, I as TURBO_VERSION, It as LOCAL_TLD, L as WORKER_PORT, Lt as clientIpRule, N as composeBuildPaths, Pt as telemetryOf, Q as offlineBuildHosts, Rt as hostFor, Z as OFFLINE_BUILD_ADDRESS, _t as bucketLifecycles, a as networkEnv, at as workerUnits, dt as stackBackups, et as runsServer, it as processorUnits, j as processorOriginHost, jt as scopeTelemetryEnv, ot as BACKUPS_SERVICE, s as processEnvKeys, ut as backupsService, vt as bucketPolicies, w as localAuthorityPaths, wt as localRolePassword } from "./apps-CmKxFPTj.mjs";
|
|
5
|
+
import { A as minioWebhookEnv, C as redisService, M as watchedBuckets, N as EMULATOR_ACCESS_KEY_ID, Q as logsService, R as DEFAULT_IMAGES, S as STACK_CACHE, T as stackRedis, V as portKeys, X as LOGS_SERVICE, at as resolveHost, et as stackLogs, g as postgresSuperuser, it as isMainFrontendApp, n as composeFor, nt as NoDomainForStage, p as LOCAL_RABBITMQ_USER, x as REDIS_SERVICE } from "./compose-DNuENvIt.mjs";
|
|
6
6
|
import { a as SNS_SUBSCRIPTIONS_KEY, c as INBOX_RELAY_TOKEN_KEY, d as inboxWebhookUrl, o as objectsRoute, s as subscriberRoute, u as inboxRelayWorker } from "./SubscriberGenerator-CzPrixYu.mjs";
|
|
7
7
|
import { g as appKey } from "./config-BLrAd7Of.mjs";
|
|
8
8
|
import { n as DEFAULT_EVENTS } from "./types-Y1NfWlyG.mjs";
|
|
9
|
-
import { _ as suppliedOnly, f as devServicesUsed, g as stageServiceDeclarations, i as stageProviderNotes, p as externalServices } from "./notes-
|
|
10
|
-
import { o as processorDockerfile, r as appDockerfile, s as workerDockerfile, v as validateImageRef } from "./docker-
|
|
11
|
-
import {
|
|
12
|
-
import { dirname, join } from "node:path";
|
|
13
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
9
|
+
import { _ as suppliedOnly, f as devServicesUsed, g as stageServiceDeclarations, i as stageProviderNotes, p as externalServices } from "./notes-Cj8jL1kS.mjs";
|
|
10
|
+
import { o as processorDockerfile, r as appDockerfile, s as workerDockerfile, v as validateImageRef } from "./docker-DsJNWnaX.mjs";
|
|
11
|
+
import { join } from "node:path";
|
|
14
12
|
import { createHash } from "node:crypto";
|
|
15
|
-
import { CLIENT_IP_HEADER,
|
|
16
|
-
import { fileURLToPath } from "node:url";
|
|
13
|
+
import { CLIENT_IP_HEADER, EDGE_TOKEN_HEADER, EDGE_TOKEN_KEY, WILDCARD_SUBDOMAIN, isWildcardSite, provideKey, provisionOrder } from "@geekmidas/manifest";
|
|
17
14
|
import { stringify } from "yaml";
|
|
18
15
|
import bcrypt from "bcryptjs";
|
|
19
|
-
//#region src/providers/dns.ts
|
|
20
|
-
/** Whether the workspace deploys through the compose target. */
|
|
21
|
-
function deploysWithCompose(workspace) {
|
|
22
|
-
return workspace.deploy?.default === "compose" || Object.values(workspace.apps).some((app) => app.resolvedDeployTarget === "compose");
|
|
23
|
-
}
|
|
24
|
-
//#endregion
|
|
25
|
-
//#region src/backups/config.ts
|
|
26
|
-
/**
|
|
27
|
-
* Which stages take backups, and where they are kept.
|
|
28
|
-
*
|
|
29
|
-
* A deployed compose stage whose stack runs Postgres is backed up by
|
|
30
|
-
* default — every day at 02:00 UTC, kept 30 days — unless
|
|
31
|
-
* `deploy.backups.<stage>` says otherwise. The local stage never is.
|
|
32
|
-
*
|
|
33
|
-
* Every backup is kept in the project bucket (`providers/projectBucket.ts`),
|
|
34
|
-
* beside the stage's deploy state, one folder per run and one file per
|
|
35
|
-
* database:
|
|
36
|
-
*
|
|
37
|
-
* ```
|
|
38
|
-
* gkm/<project>/<stage>/backups/2026-10-10/02-00-00Z/database.sql.gz
|
|
39
|
-
* gkm/<project>/<stage>/backups/2026-10-10/02-00-00Z/auth-database.sql.gz
|
|
40
|
-
* ```
|
|
41
|
-
*
|
|
42
|
-
* The file is named after the database's construct, the way its migrations
|
|
43
|
-
* folder is: `AuthDatabase` is `db/auth-database`, and `auth-database.sql.gz`.
|
|
44
|
-
*/
|
|
45
|
-
/** Whether the stack runs Postgres: some construct is a database. */
|
|
46
|
-
function runsPostgres(manifest) {
|
|
47
|
-
return Object.values(manifest).some((d) => d.kind === "database");
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* What `stage`'s backups are: on — by its entry or the default — off by
|
|
51
|
-
* `false`, or none, for the local stage, a stage compose does not deploy,
|
|
52
|
-
* and a stack with no database.
|
|
53
|
-
*/
|
|
54
|
-
function stageBackups(workspace, manifest, stage) {
|
|
55
|
-
if (stage === workspace.stages?.local) return {
|
|
56
|
-
mode: "none",
|
|
57
|
-
reason: "local"
|
|
58
|
-
};
|
|
59
|
-
if (!deploysWithCompose(workspace)) return {
|
|
60
|
-
mode: "none",
|
|
61
|
-
reason: "not-compose"
|
|
62
|
-
};
|
|
63
|
-
if (!runsPostgres(manifest)) return {
|
|
64
|
-
mode: "none",
|
|
65
|
-
reason: "no-postgres"
|
|
66
|
-
};
|
|
67
|
-
const value = (workspace.deploy?.backups)?.[stage];
|
|
68
|
-
const checked = checkStageBackups(stage, value ?? {});
|
|
69
|
-
if (checked === false) return { mode: "disabled" };
|
|
70
|
-
return {
|
|
71
|
-
mode: "on",
|
|
72
|
-
backups: checked,
|
|
73
|
-
source: value === void 0 ? "default" : "config"
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Where a stage's backups are, in the project bucket — under the same
|
|
78
|
-
* `<prefix>/<project>/<stage>` its deploy state is: `gkm/shop/production/backups`.
|
|
79
|
-
*/
|
|
80
|
-
function backupsPrefix(workspace, stage) {
|
|
81
|
-
const state = workspace.state;
|
|
82
|
-
const prefix = state?.provider === "s3" && state.prefix !== void 0 ? state.prefix.replace(/\/+$/, "") : "gkm";
|
|
83
|
-
return `${prefix ? `${prefix}/` : ""}${workspace.name}/${stage}/backups`;
|
|
84
|
-
}
|
|
85
|
-
/** A run folder's time back, or `undefined` for a key that is not one. */
|
|
86
|
-
function runTime(folder) {
|
|
87
|
-
const match = /^(\d{4}-\d{2}-\d{2})\/(\d{2})-(\d{2})-(\d{2})Z$/.exec(folder);
|
|
88
|
-
if (!match) return void 0;
|
|
89
|
-
const at = /* @__PURE__ */ new Date(`${match[1]}T${match[2]}:${match[3]}:${match[4]}Z`);
|
|
90
|
-
return Number.isNaN(at.getTime()) ? void 0 : at;
|
|
91
|
-
}
|
|
92
|
-
/** A database's file in a run's folder: `auth-database.sql.gz`. */
|
|
93
|
-
function backupFile(database) {
|
|
94
|
-
return `${database.file}.sql.gz`;
|
|
95
|
-
}
|
|
96
|
-
/** Each database the stack runs, by its construct and its name in Postgres. */
|
|
97
|
-
function backupDatabases(resources) {
|
|
98
|
-
return resources.filter((r) => r.kind === "database").map((r) => ({
|
|
99
|
-
id: r.id,
|
|
100
|
-
file: kebabCase(r.id),
|
|
101
|
-
name: r.name
|
|
102
|
-
})).sort((a, b) => a.file.localeCompare(b.file));
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* The expiry of every stage's backups, by each stage's own entry — what the
|
|
106
|
-
* project bucket's lifecycle carries beside its own rule.
|
|
107
|
-
*
|
|
108
|
-
* A put replaces a bucket's whole lifecycle, so this is built from every
|
|
109
|
-
* deployed stage each time, never from the stage being deployed alone: one
|
|
110
|
-
* stage's deploy keeps every other's rule. A stage set to `false` has none,
|
|
111
|
-
* and its backups are kept until someone deletes them.
|
|
112
|
-
*/
|
|
113
|
-
function backupExpiries(workspace, manifest) {
|
|
114
|
-
const expiries = [];
|
|
115
|
-
for (const stage of [...workspace.stages?.deployed ?? []].sort()) {
|
|
116
|
-
const choice = stageBackups(workspace, manifest, stage);
|
|
117
|
-
if (choice.mode !== "on") continue;
|
|
118
|
-
expiries.push({
|
|
119
|
-
id: `gkm-backups-${stage}`,
|
|
120
|
-
prefix: `${backupsPrefix(workspace, stage)}/`,
|
|
121
|
-
days: choice.backups.keepDays,
|
|
122
|
-
abortIncompleteDays: 1
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
return expiries;
|
|
126
|
-
}
|
|
127
|
-
//#endregion
|
|
128
|
-
//#region src/backups/service.ts
|
|
129
|
-
/**
|
|
130
|
-
* The stack's `backups` service: what a deployed compose stage with Postgres
|
|
131
|
-
* runs beside its apps, unless `deploy.backups.<stage>` is `false`.
|
|
132
|
-
*
|
|
133
|
-
* - **The image** is built from the stack's own Postgres image —
|
|
134
|
-
* `postgres:<major>-alpine`, already on the server for the stack, and with
|
|
135
|
-
* the `pg_dump` that matches the server — with Node added and gkm's runner
|
|
136
|
-
* (`runner.ts`) copied in. Nothing is pulled that the stack does not have,
|
|
137
|
-
* and nothing is mounted from the host: the build context is two files.
|
|
138
|
-
* - **Its key** is `BACKUPS_URL`, from the stage's secrets, like any app's:
|
|
139
|
-
* allowed to put objects under the stage's backups prefix and nothing else.
|
|
140
|
-
* The server holds no AWS credentials of its own.
|
|
141
|
-
* - **Its login** is a role of its own, `<project>_backups`, granted
|
|
142
|
-
* `pg_read_all_data` — it can read every database and write none. Postgres
|
|
143
|
-
* before 14 has no such role, and there it signs in as the stack's
|
|
144
|
-
* superuser.
|
|
145
|
-
* - **Its health** is the last good run: unhealthy once that is more than
|
|
146
|
-
* twice the schedule's longest gap old, after a startup grace.
|
|
147
|
-
*/
|
|
148
|
-
/** The service's name in the stack. */
|
|
149
|
-
const BACKUPS_SERVICE = "backups";
|
|
150
|
-
/** The secret its key is written to. */
|
|
151
|
-
const BACKUPS_URL_KEY = "BACKUPS_URL";
|
|
152
|
-
/** Where the runner is, in the image. */
|
|
153
|
-
const RUNNER_PATH = "/gkm/backup.mjs";
|
|
154
|
-
/** The first Postgres with `pg_read_all_data`. */
|
|
155
|
-
const READ_ALL_DATA_SINCE = 14;
|
|
156
|
-
/** A stage that backs up, and no key to back up with. */
|
|
157
|
-
var BackupsUrlMissing = class extends GkmError {
|
|
158
|
-
stage;
|
|
159
|
-
constructor(stage) {
|
|
160
|
-
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.`);
|
|
161
|
-
this.stage = stage;
|
|
162
|
-
this.name = "BackupsUrlMissing";
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
/** The backups role: `<project>_backups`, as the superuser is `<project>_admin`. */
|
|
166
|
-
function backupsRole(project) {
|
|
167
|
-
return `${postgresRoleSlug(project)}_backups`;
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* The runner's source, as JavaScript: the built `backups/runner.mjs` beside
|
|
171
|
-
* the CLI's bundle, or — run from source — `runner.ts`, with its types
|
|
172
|
-
* stripped by esbuild.
|
|
173
|
-
*/
|
|
174
|
-
function runnerSource() {
|
|
175
|
-
const here = dirname(fileURLToPath(import.meta.url));
|
|
176
|
-
for (const path of [
|
|
177
|
-
join(here, "backups", "runner.mjs"),
|
|
178
|
-
join(here, "runner.mjs"),
|
|
179
|
-
join(here, "..", "backups", "runner.mjs")
|
|
180
|
-
]) if (existsSync(path)) return readFileSync(path, "utf-8");
|
|
181
|
-
const { transformSync } = createRequire(import.meta.url)("esbuild");
|
|
182
|
-
return transformSync(readFileSync(join(here, "runner.ts"), "utf-8"), {
|
|
183
|
-
loader: "ts",
|
|
184
|
-
format: "esm",
|
|
185
|
-
target: "node22"
|
|
186
|
-
}).code;
|
|
187
|
-
}
|
|
188
|
-
/** The image's Dockerfile: the stack's Postgres, Node, and the runner. */
|
|
189
|
-
function backupsDockerfile(from) {
|
|
190
|
-
return `# Generated by gkm — the stage's backups: pg_dump from ${from}, and gkm's uploader.
|
|
191
|
-
FROM ${from}
|
|
192
|
-
RUN apk add --no-cache nodejs
|
|
193
|
-
COPY backup.mjs ${RUNNER_PATH}
|
|
194
|
-
USER postgres
|
|
195
|
-
ENTRYPOINT []
|
|
196
|
-
CMD ["node", "${RUNNER_PATH}", "serve"]
|
|
197
|
-
`;
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* The stack's backups service, for a stage whose backups are on.
|
|
201
|
-
*
|
|
202
|
-
* @throws {BackupsUrlMissing} when the stage's secrets hold no key
|
|
203
|
-
*/
|
|
204
|
-
function stackBackups(input) {
|
|
205
|
-
const { plan, stage } = input;
|
|
206
|
-
const version = plan.resources.find((r) => r.version)?.version ?? DEFAULT_POSTGRES_VERSION;
|
|
207
|
-
const from = postgresImage(version);
|
|
208
|
-
const script = runnerSource();
|
|
209
|
-
const dockerfile = backupsDockerfile(from);
|
|
210
|
-
const hash = createHash("sha256").update(dockerfile).update(script).digest("hex").slice(0, 12);
|
|
211
|
-
const readOnly = version >= READ_ALL_DATA_SINCE;
|
|
212
|
-
const role = backupsRole(input.workspace.name);
|
|
213
|
-
const login = readOnly ? {
|
|
214
|
-
user: role,
|
|
215
|
-
password: localRolePassword(input.workspace.name, plan, role, input.seed)
|
|
216
|
-
} : input.superuser;
|
|
217
|
-
const databases = backupDatabases(plan.resources);
|
|
218
|
-
const prefix = backupsPrefix(input.workspace, stage);
|
|
219
|
-
const { kind, ...schedule } = input.backups.schedule;
|
|
220
|
-
let env = {};
|
|
221
|
-
if (!input.buildOnly) {
|
|
222
|
-
const url = input.custom[BACKUPS_URL_KEY];
|
|
223
|
-
if (!url) throw new BackupsUrlMissing(stage);
|
|
224
|
-
env = {
|
|
225
|
-
BACKUPS_URL: url,
|
|
226
|
-
BACKUPS_PREFIX: prefix,
|
|
227
|
-
BACKUPS_DATABASES: JSON.stringify(databases.map(({ file, name }) => ({
|
|
228
|
-
file,
|
|
229
|
-
name
|
|
230
|
-
}))),
|
|
231
|
-
BACKUPS_SCHEDULE: JSON.stringify(kind === "cron" ? {
|
|
232
|
-
kind,
|
|
233
|
-
minutes: input.backups.schedule.minutes,
|
|
234
|
-
hours: input.backups.schedule.hours,
|
|
235
|
-
days: input.backups.schedule.days,
|
|
236
|
-
months: input.backups.schedule.months,
|
|
237
|
-
weekdays: input.backups.schedule.weekdays
|
|
238
|
-
} : {
|
|
239
|
-
kind,
|
|
240
|
-
...schedule
|
|
241
|
-
}),
|
|
242
|
-
BACKUPS_MAX_GAP_SECONDS: String(input.backups.maxGapSeconds),
|
|
243
|
-
PGHOST: "postgres",
|
|
244
|
-
PGPORT: "5432",
|
|
245
|
-
PGUSER: login.user,
|
|
246
|
-
PGPASSWORD: login.password,
|
|
247
|
-
...input.telemetry?.OTEL_EXPORTER_OTLP_ENDPOINT ? {
|
|
248
|
-
OTEL_EXPORTER_OTLP_ENDPOINT: input.telemetry.OTEL_EXPORTER_OTLP_ENDPOINT,
|
|
249
|
-
...input.telemetry.OTEL_EXPORTER_OTLP_HEADERS ? { OTEL_EXPORTER_OTLP_HEADERS: input.telemetry.OTEL_EXPORTER_OTLP_HEADERS } : {},
|
|
250
|
-
OTEL_SERVICE_NAME: BACKUPS_SERVICE
|
|
251
|
-
} : {}
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
return {
|
|
255
|
-
backups: input.backups,
|
|
256
|
-
databases,
|
|
257
|
-
prefix,
|
|
258
|
-
from,
|
|
259
|
-
image: `${input.project}-backups:pg${version}-${hash}`,
|
|
260
|
-
files: {
|
|
261
|
-
Dockerfile: dockerfile,
|
|
262
|
-
"backup.mjs": script
|
|
263
|
-
},
|
|
264
|
-
login,
|
|
265
|
-
readOnly,
|
|
266
|
-
env
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
/** The service in the stack's compose file. */
|
|
270
|
-
function backupsService(backups, envFiles) {
|
|
271
|
-
return {
|
|
272
|
-
image: backups.image,
|
|
273
|
-
build: {
|
|
274
|
-
context: `./${BACKUPS_SERVICE}`,
|
|
275
|
-
dockerfile: "Dockerfile"
|
|
276
|
-
},
|
|
277
|
-
pull_policy: "build",
|
|
278
|
-
restart: "unless-stopped",
|
|
279
|
-
...envFiles ? { env_file: [{
|
|
280
|
-
path: `./${BACKUPS_SERVICE}.env`,
|
|
281
|
-
format: "raw"
|
|
282
|
-
}] } : {},
|
|
283
|
-
depends_on: { postgres: { condition: "service_healthy" } },
|
|
284
|
-
healthcheck: {
|
|
285
|
-
test: [
|
|
286
|
-
"CMD",
|
|
287
|
-
"node",
|
|
288
|
-
RUNNER_PATH,
|
|
289
|
-
"health"
|
|
290
|
-
],
|
|
291
|
-
interval: "1m",
|
|
292
|
-
timeout: "10s",
|
|
293
|
-
retries: 3,
|
|
294
|
-
start_period: "30s"
|
|
295
|
-
}
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* The backups role, created and kept: able to sign in and read every
|
|
300
|
-
* database, and nothing else. None when it signs in as the superuser.
|
|
301
|
-
*/
|
|
302
|
-
function backupsRoleStatements(backups) {
|
|
303
|
-
if (!backups.readOnly) return [];
|
|
304
|
-
const role = quoteIdentifier(backups.login.user);
|
|
305
|
-
const password = `'${backups.login.password.replace(/'/g, "''")}'`;
|
|
306
|
-
return [
|
|
307
|
-
{
|
|
308
|
-
id: BACKUPS_SERVICE,
|
|
309
|
-
describe: `role ${backups.login.user}`,
|
|
310
|
-
exists: {
|
|
311
|
-
sql: "SELECT 1 FROM pg_roles WHERE rolname = $1",
|
|
312
|
-
values: [backups.login.user]
|
|
313
|
-
},
|
|
314
|
-
create: `CREATE ROLE ${role} LOGIN PASSWORD ${password}`
|
|
315
|
-
},
|
|
316
|
-
{
|
|
317
|
-
id: BACKUPS_SERVICE,
|
|
318
|
-
describe: `role ${backups.login.user}: its password`,
|
|
319
|
-
create: `ALTER ROLE ${role} WITH LOGIN PASSWORD ${password}`
|
|
320
|
-
},
|
|
321
|
-
{
|
|
322
|
-
id: BACKUPS_SERVICE,
|
|
323
|
-
describe: `role ${backups.login.user}: read every database`,
|
|
324
|
-
create: `GRANT pg_read_all_data TO ${role}`
|
|
325
|
-
}
|
|
326
|
-
];
|
|
327
|
-
}
|
|
328
|
-
//#endregion
|
|
329
16
|
//#region src/compose/routes.ts
|
|
330
17
|
/** A route with handlers and a check that would have to hold for each of them. */
|
|
331
18
|
var EdgeRouteConflict = class extends Error {
|
|
@@ -389,7 +76,7 @@ function edgeCaddyfile(routes, options) {
|
|
|
389
76
|
const certificate = tls.kind === "files" ? `
|
|
390
77
|
tls ${tls.certFile} ${tls.keyFile}
|
|
391
78
|
` : "";
|
|
392
|
-
const blocks = [...routes.filter((route) => !route.wildcard), ...routes.filter((route) => route.wildcard)].map((route) => siteBlock(route, route.wildcard?.tls.kind === "on-demand" ? `
|
|
79
|
+
const blocks = [...routes.filter((route) => !route.wildcard), ...routes.filter((route) => route.wildcard)].map((route) => siteBlock(route, options.edgeToken, route.wildcard?.tls.kind === "on-demand" ? `
|
|
393
80
|
tls {
|
|
394
81
|
on_demand
|
|
395
82
|
}
|
|
@@ -397,7 +84,7 @@ function edgeCaddyfile(routes, options) {
|
|
|
397
84
|
return `${HEADER}${global ? `${global}\n\n` : ""}${blocks.join("\n\n")}\n`;
|
|
398
85
|
}
|
|
399
86
|
/** One route's site block. */
|
|
400
|
-
function siteBlock(route, certificate) {
|
|
87
|
+
function siteBlock(route, edgeToken, certificate) {
|
|
401
88
|
assertRouteRenderable(route);
|
|
402
89
|
const { host, allow, auth, paths, prefixes, requireHeader, handlers } = route;
|
|
403
90
|
const allowed = [...paths ?? [], ...(prefixes ?? []).map((prefix) => `${prefix}*`)];
|
|
@@ -437,10 +124,7 @@ function siteBlock(route, certificate) {
|
|
|
437
124
|
`).join("")}
|
|
438
125
|
handle {${proxy.replace(/\n/g, "\n ")}
|
|
439
126
|
}` : proxy;
|
|
440
|
-
return `https://${host} {${certificate}
|
|
441
|
-
# gkm's own header, which only a service of this stack may send: the auth
|
|
442
|
-
# server rate-limits by the client address it carries.
|
|
443
|
-
request_header -${CLIENT_IP_HEADER}
|
|
127
|
+
return `https://${host} {${certificate}${clientIpRule(edgeToken)}
|
|
444
128
|
${checks}${body}
|
|
445
129
|
}`;
|
|
446
130
|
}
|
|
@@ -923,7 +607,7 @@ function edgeCompose(options) {
|
|
|
923
607
|
}
|
|
924
608
|
/** A stack's dynamic configuration, as an object. */
|
|
925
609
|
function traefikDynamic(routes, options) {
|
|
926
|
-
const { project, tls } = options;
|
|
610
|
+
const { project, tls, edgeToken } = options;
|
|
927
611
|
const name = (route, suffix) => `${project}-${route.name}${suffix ? `-${suffix}` : ""}`;
|
|
928
612
|
const url = ({ service, port }) => `http://${edgeAlias(project, service)}:${port}`;
|
|
929
613
|
const routers = {};
|
|
@@ -965,14 +649,23 @@ function traefikDynamic(routes, options) {
|
|
|
965
649
|
};
|
|
966
650
|
services[handlerName] = { loadBalancer: { servers: handler.upstreams.map((upstream) => ({ url: url(upstream) })) } };
|
|
967
651
|
}
|
|
652
|
+
const rule = `${hostRule(route)}${paths}${header}`;
|
|
968
653
|
routers[name(route)] = {
|
|
969
|
-
rule
|
|
654
|
+
rule,
|
|
970
655
|
...route.wildcard ? { priority: 1 } : {},
|
|
971
656
|
entryPoints: ["websecure"],
|
|
972
657
|
service: name(route),
|
|
973
658
|
middlewares: chain,
|
|
974
659
|
tls: certificate()
|
|
975
660
|
};
|
|
661
|
+
if (edgeToken && !route.prefix) routers[name(route, "stack")] = {
|
|
662
|
+
rule: `${rule} && Header(\`${EDGE_TOKEN_HEADER}\`, \`${edgeToken}\`)`,
|
|
663
|
+
...route.wildcard ? { priority: 2 } : {},
|
|
664
|
+
entryPoints: ["websecure"],
|
|
665
|
+
service: name(route),
|
|
666
|
+
...chain.length > 1 ? { middlewares: chain.slice(1) } : {},
|
|
667
|
+
tls: certificate()
|
|
668
|
+
};
|
|
976
669
|
services[name(route)] = { loadBalancer: {
|
|
977
670
|
servers: route.upstreams.map((upstream) => ({ url: url(upstream) })),
|
|
978
671
|
...route.prefix ? { passHostHeader: false } : {},
|
|
@@ -1041,16 +734,17 @@ function yaml(value) {
|
|
|
1041
734
|
* The stack a workspace runs as for one stage — pure.
|
|
1042
735
|
*
|
|
1043
736
|
* Everything `gkm compose` writes is decided here, as data: the compose file,
|
|
1044
|
-
* the Caddyfile, one env file per
|
|
737
|
+
* the Caddyfile, one env file per process that reads one — each backend,
|
|
738
|
+
* worker and site that runs a server — and the image each app runs. The
|
|
1045
739
|
* command around it reads the workspace, asks the registry, writes the files
|
|
1046
740
|
* and starts Docker; none of those decide anything, so all of it can be
|
|
1047
741
|
* asserted without a daemon.
|
|
1048
742
|
*
|
|
1049
743
|
* The values come from the same derivations every other target uses. The
|
|
1050
|
-
* plan is reconcile's `planFor`, the keys
|
|
1051
|
-
*
|
|
1052
|
-
*
|
|
1053
|
-
* service reach the same
|
|
744
|
+
* plan is reconcile's `planFor`, the keys a process reads are
|
|
745
|
+
* `processEnvKeys` — the rule `gkm dev` and `gkm exec` apply — and every URL
|
|
746
|
+
* is `envFor`'s, with each app at its public address: a browser and a sibling
|
|
747
|
+
* service reach an API by the same name, through the edge.
|
|
1054
748
|
*/
|
|
1055
749
|
/** Where a stack's files are written, relative to the workspace root. */
|
|
1056
750
|
function stackDir(stage) {
|
|
@@ -1554,12 +1248,6 @@ function composeStack(input) {
|
|
|
1554
1248
|
...derivation,
|
|
1555
1249
|
addresses: publicAddresses
|
|
1556
1250
|
}, hostOf);
|
|
1557
|
-
const inside = networkEnv(plan, {
|
|
1558
|
-
...derivation,
|
|
1559
|
-
addresses: Object.fromEntries(apps.map((app) => [app.id, `${app.kind === "websocket-api" ? "ws" : "http"}://${hostOf(app.name)}:${app.port}`]))
|
|
1560
|
-
}, hostOf);
|
|
1561
|
-
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]));
|
|
1562
|
-
const appById = new Map(apps.map((app) => [app.id, app]));
|
|
1563
1251
|
/**
|
|
1564
1252
|
* What a key resolves to for one app, from the stage's secrets where only
|
|
1565
1253
|
* they can hold it, and the derivations otherwise.
|
|
@@ -1594,8 +1282,6 @@ function composeStack(input) {
|
|
|
1594
1282
|
if (custom[key] !== void 0) return custom[key];
|
|
1595
1283
|
if (owner?.kind === "cache") return redis?.urls[key];
|
|
1596
1284
|
if (owner?.kind === "websocket-api" && key === provideKey(owner.id, "publisherConnectionString")) return redis?.urls[key];
|
|
1597
|
-
const surface = surfaceUrls.get(key);
|
|
1598
|
-
if ((app.kind === "rest-api" || app.kind === "websocket-api") && surface && surface !== app.id) return inside[key];
|
|
1599
1285
|
return outside[key];
|
|
1600
1286
|
};
|
|
1601
1287
|
const telemetryValues = logs ? telemetryEnv({
|
|
@@ -1618,28 +1304,21 @@ function composeStack(input) {
|
|
|
1618
1304
|
}
|
|
1619
1305
|
return values;
|
|
1620
1306
|
};
|
|
1307
|
+
const stageKeys = Object.keys(custom);
|
|
1621
1308
|
for (const app of apps) {
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
if (site?.kind !== "site") continue;
|
|
1309
|
+
const site = manifest[app.id];
|
|
1310
|
+
if (site?.kind === "site") {
|
|
1625
1311
|
const args = publicBuildValues(site, manifest, (key) => valueFor(app, key, owners.get(key)), custom);
|
|
1626
1312
|
if (app.build && Object.keys(args).length > 0) app.build.args = args;
|
|
1627
1313
|
const offline = offlineBuildHosts(site, manifest, (key) => valueFor(app, key, owners.get(key)));
|
|
1628
1314
|
if (app.build && offline.length > 0) app.build.offlineHosts = offline;
|
|
1629
|
-
continue;
|
|
1315
|
+
if (!app.runtime) continue;
|
|
1630
1316
|
}
|
|
1631
1317
|
if (input.buildOnly) continue;
|
|
1632
|
-
const
|
|
1633
|
-
const values = valuesFor(app, keys);
|
|
1634
|
-
const trusted = provideKey(app.id, "trustedOrigins");
|
|
1635
|
-
if (keys.has(trusted)) {
|
|
1636
|
-
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}`);
|
|
1637
|
-
const origins = [...(values[trusted] ?? "").split(",").filter(Boolean), ...internal];
|
|
1638
|
-
values[trusted] = [...new Set(origins)].join(",");
|
|
1639
|
-
}
|
|
1318
|
+
const values = valuesFor(app, processEnvKeys(manifest, { app: app.name }, stageKeys) ?? /* @__PURE__ */ new Set());
|
|
1640
1319
|
app.env = {
|
|
1641
1320
|
...scopeTelemetryEnv(values, {
|
|
1642
|
-
uses: telemetryOf(manifest, app.id) !== void 0,
|
|
1321
|
+
uses: app.kind !== "site" && telemetryOf(manifest, app.id) !== void 0,
|
|
1643
1322
|
serviceName: app.name,
|
|
1644
1323
|
...telemetryValues ? { telemetry: telemetryValues } : {}
|
|
1645
1324
|
}),
|
|
@@ -1664,7 +1343,7 @@ function composeStack(input) {
|
|
|
1664
1343
|
});
|
|
1665
1344
|
}
|
|
1666
1345
|
for (const worker of input.buildOnly ? [] : workers) {
|
|
1667
|
-
const keys =
|
|
1346
|
+
const keys = processEnvKeys(manifest, { workers: [worker.id] }, stageKeys) ?? /* @__PURE__ */ new Set();
|
|
1668
1347
|
const resolved = valuesFor({
|
|
1669
1348
|
name: worker.name,
|
|
1670
1349
|
id: worker.id,
|
|
@@ -1716,7 +1395,7 @@ function composeStack(input) {
|
|
|
1716
1395
|
}
|
|
1717
1396
|
if (proxy === "traefik" && (served || unit.origin)) edgeServices.add(unit.name);
|
|
1718
1397
|
if (input.buildOnly) continue;
|
|
1719
|
-
const keys =
|
|
1398
|
+
const keys = processEnvKeys(manifest, { processors: [unit.id] }, stageKeys) ?? /* @__PURE__ */ new Set();
|
|
1720
1399
|
unit.env = {
|
|
1721
1400
|
...scopeTelemetryEnv(valuesFor({
|
|
1722
1401
|
name: unit.name,
|
|
@@ -1944,10 +1623,12 @@ function composeStack(input) {
|
|
|
1944
1623
|
} } : {},
|
|
1945
1624
|
...proxy === "caddy" ? { caddyfile: edgeCaddyfile(routes, {
|
|
1946
1625
|
tls,
|
|
1626
|
+
edgeToken: outside[EDGE_TOKEN_KEY],
|
|
1947
1627
|
...local ? { redirects: false } : {}
|
|
1948
1628
|
}) } : { traefik: traefikDynamicFile(routes, {
|
|
1949
1629
|
project,
|
|
1950
|
-
tls
|
|
1630
|
+
tls,
|
|
1631
|
+
edgeToken: outside[EDGE_TOKEN_KEY]
|
|
1951
1632
|
}) },
|
|
1952
1633
|
...certificate ? { tls: certificate } : {},
|
|
1953
1634
|
dockerfiles,
|
|
@@ -1992,7 +1673,8 @@ function stackApps(workspace, manifest, plan, options) {
|
|
|
1992
1673
|
const resource = resources.get(id);
|
|
1993
1674
|
if (!app || !resource || !app.port) continue;
|
|
1994
1675
|
const host = hostOf(name, app, workspace, resource, options);
|
|
1995
|
-
const
|
|
1676
|
+
const site = declaration.kind === "site";
|
|
1677
|
+
const tag = site ? siteTag(options.images.tag, options.stage) : options.images.tag;
|
|
1996
1678
|
const ref = validateImageRef(imageRef(options.identity, name, options.images.registry, tag));
|
|
1997
1679
|
apps.push({
|
|
1998
1680
|
app: name,
|
|
@@ -2001,6 +1683,7 @@ function stackApps(workspace, manifest, plan, options) {
|
|
|
2001
1683
|
kind: declaration.kind,
|
|
2002
1684
|
...declaration.kind === "site" ? { variant: declaration.variant } : {},
|
|
2003
1685
|
replicas: declaration.kind === "websocket-api" ? declaration.replicas ?? 1 : 1,
|
|
1686
|
+
runtime: !site || runsServer(declaration),
|
|
2004
1687
|
path: app.path,
|
|
2005
1688
|
port: app.port,
|
|
2006
1689
|
host,
|
|
@@ -2310,13 +1993,11 @@ function stackFile(options) {
|
|
|
2310
1993
|
...app.build.offlineHosts ? { extra_hosts: app.build.offlineHosts.map((host) => `${host}:${OFFLINE_BUILD_ADDRESS}`) } : {}
|
|
2311
1994
|
} } : {},
|
|
2312
1995
|
restart: "unless-stopped",
|
|
2313
|
-
...app.
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
...infra.length ? { depends_on: Object.fromEntries(infra.map((name) => [name, HEALTHY])) } : {}
|
|
2319
|
-
} : {},
|
|
1996
|
+
...app.runtime ? { env_file: [{
|
|
1997
|
+
path: `./${app.name}.env`,
|
|
1998
|
+
format: "raw"
|
|
1999
|
+
}] } : {},
|
|
2000
|
+
...app.kind !== "site" && infra.length ? { depends_on: Object.fromEntries(infra.map((name) => [name, HEALTHY])) } : {},
|
|
2320
2001
|
healthcheck: probe(app.port, app.kind === "site" ? "/" : "/health"),
|
|
2321
2002
|
...app.kind === "websocket-api" ? { ulimits: { nofile: NOFILE } } : {}
|
|
2322
2003
|
};
|
|
@@ -2426,6 +2107,6 @@ function envFile(env) {
|
|
|
2426
2107
|
return `${Object.entries(env).sort(([a], [b]) => a.localeCompare(b)).map(([key, value]) => `${key}=${value}`).join("\n")}\n`;
|
|
2427
2108
|
}
|
|
2428
2109
|
//#endregion
|
|
2429
|
-
export {
|
|
2110
|
+
export { RegistryRequired as C, pinnedRef as D, pinImages as E, assertSitePasswords as S, parseDigests as T, EDGE_NETWORK as _, composeProject as a, edgeComposeFile as b, derivedCredentials as c, stackDir as d, stackPlan as f, EDGE_DYNAMIC_DIR as g, EDGE_CERTS_DIR as h, LOOPBACK_SERVICES as i, envFile as l, EDGE_AWS_CREDENTIALS as m, LOGS_PORT_ENV as n, composeStack as o, withCaddyConfigs as p, LOG_ROTATION as r, deployedInboxEnv as s, EDGE_PORT_ENV as t, replicaNames as u, EDGE_PROJECT as v, assertImagesExist as w, traefikStaticFile as x, EDGE_SERVICE as y };
|
|
2430
2111
|
|
|
2431
|
-
//# sourceMappingURL=stack-
|
|
2112
|
+
//# sourceMappingURL=stack-CVzOFHed.mjs.map
|