@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,333 +1,20 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
|
|
2
2
|
const require_errors = require("./errors-DMC4Umsb.cjs");
|
|
3
|
-
const require_credentials = require("./credentials-
|
|
3
|
+
const require_credentials = require("./credentials-CrQglKgo.cjs");
|
|
4
4
|
const require_workspace = require("./workspace-1szcahj9.cjs");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const require_apps = require("./apps-ClZkLcMz.cjs");
|
|
6
|
+
const require_compose = require("./compose-DVPWitEu.cjs");
|
|
7
7
|
const require_SubscriberGenerator = require("./SubscriberGenerator-BNJyPmXJ.cjs");
|
|
8
8
|
const require_config = require("./config-juUyBlb1.cjs");
|
|
9
9
|
const require_types = require("./types-Bl_CwZC9.cjs");
|
|
10
|
-
const require_notes = require("./notes-
|
|
11
|
-
const require_docker = require("./docker-
|
|
10
|
+
const require_notes = require("./notes-DTTUGZyi.cjs");
|
|
11
|
+
const require_docker = require("./docker-CnWX5QNR.cjs");
|
|
12
12
|
let node_path = require("node:path");
|
|
13
|
-
let node_fs = require("node:fs");
|
|
14
13
|
let node_crypto = require("node:crypto");
|
|
15
14
|
let _geekmidas_manifest = require("@geekmidas/manifest");
|
|
16
|
-
let node_module = require("node:module");
|
|
17
|
-
let node_url = require("node:url");
|
|
18
15
|
let yaml = require("yaml");
|
|
19
16
|
let bcryptjs = require("bcryptjs");
|
|
20
17
|
bcryptjs = require_rolldown_runtime.__toESM(bcryptjs, 1);
|
|
21
|
-
//#region src/providers/dns.ts
|
|
22
|
-
/** Whether the workspace deploys through the compose target. */
|
|
23
|
-
function deploysWithCompose(workspace) {
|
|
24
|
-
return workspace.deploy?.default === "compose" || Object.values(workspace.apps).some((app) => app.resolvedDeployTarget === "compose");
|
|
25
|
-
}
|
|
26
|
-
//#endregion
|
|
27
|
-
//#region src/backups/config.ts
|
|
28
|
-
/**
|
|
29
|
-
* Which stages take backups, and where they are kept.
|
|
30
|
-
*
|
|
31
|
-
* A deployed compose stage whose stack runs Postgres is backed up by
|
|
32
|
-
* default — every day at 02:00 UTC, kept 30 days — unless
|
|
33
|
-
* `deploy.backups.<stage>` says otherwise. The local stage never is.
|
|
34
|
-
*
|
|
35
|
-
* Every backup is kept in the project bucket (`providers/projectBucket.ts`),
|
|
36
|
-
* beside the stage's deploy state, one folder per run and one file per
|
|
37
|
-
* database:
|
|
38
|
-
*
|
|
39
|
-
* ```
|
|
40
|
-
* gkm/<project>/<stage>/backups/2026-10-10/02-00-00Z/database.sql.gz
|
|
41
|
-
* gkm/<project>/<stage>/backups/2026-10-10/02-00-00Z/auth-database.sql.gz
|
|
42
|
-
* ```
|
|
43
|
-
*
|
|
44
|
-
* The file is named after the database's construct, the way its migrations
|
|
45
|
-
* folder is: `AuthDatabase` is `db/auth-database`, and `auth-database.sql.gz`.
|
|
46
|
-
*/
|
|
47
|
-
/** Whether the stack runs Postgres: some construct is a database. */
|
|
48
|
-
function runsPostgres(manifest) {
|
|
49
|
-
return Object.values(manifest).some((d) => d.kind === "database");
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* What `stage`'s backups are: on — by its entry or the default — off by
|
|
53
|
-
* `false`, or none, for the local stage, a stage compose does not deploy,
|
|
54
|
-
* and a stack with no database.
|
|
55
|
-
*/
|
|
56
|
-
function stageBackups(workspace, manifest, stage) {
|
|
57
|
-
if (stage === workspace.stages?.local) return {
|
|
58
|
-
mode: "none",
|
|
59
|
-
reason: "local"
|
|
60
|
-
};
|
|
61
|
-
if (!deploysWithCompose(workspace)) return {
|
|
62
|
-
mode: "none",
|
|
63
|
-
reason: "not-compose"
|
|
64
|
-
};
|
|
65
|
-
if (!runsPostgres(manifest)) return {
|
|
66
|
-
mode: "none",
|
|
67
|
-
reason: "no-postgres"
|
|
68
|
-
};
|
|
69
|
-
const value = (workspace.deploy?.backups)?.[stage];
|
|
70
|
-
const checked = require_workspace.checkStageBackups(stage, value ?? {});
|
|
71
|
-
if (checked === false) return { mode: "disabled" };
|
|
72
|
-
return {
|
|
73
|
-
mode: "on",
|
|
74
|
-
backups: checked,
|
|
75
|
-
source: value === void 0 ? "default" : "config"
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Where a stage's backups are, in the project bucket — under the same
|
|
80
|
-
* `<prefix>/<project>/<stage>` its deploy state is: `gkm/shop/production/backups`.
|
|
81
|
-
*/
|
|
82
|
-
function backupsPrefix(workspace, stage) {
|
|
83
|
-
const state = workspace.state;
|
|
84
|
-
const prefix = state?.provider === "s3" && state.prefix !== void 0 ? state.prefix.replace(/\/+$/, "") : "gkm";
|
|
85
|
-
return `${prefix ? `${prefix}/` : ""}${workspace.name}/${stage}/backups`;
|
|
86
|
-
}
|
|
87
|
-
/** A run folder's time back, or `undefined` for a key that is not one. */
|
|
88
|
-
function runTime(folder) {
|
|
89
|
-
const match = /^(\d{4}-\d{2}-\d{2})\/(\d{2})-(\d{2})-(\d{2})Z$/.exec(folder);
|
|
90
|
-
if (!match) return void 0;
|
|
91
|
-
const at = /* @__PURE__ */ new Date(`${match[1]}T${match[2]}:${match[3]}:${match[4]}Z`);
|
|
92
|
-
return Number.isNaN(at.getTime()) ? void 0 : at;
|
|
93
|
-
}
|
|
94
|
-
/** A database's file in a run's folder: `auth-database.sql.gz`. */
|
|
95
|
-
function backupFile(database) {
|
|
96
|
-
return `${database.file}.sql.gz`;
|
|
97
|
-
}
|
|
98
|
-
/** Each database the stack runs, by its construct and its name in Postgres. */
|
|
99
|
-
function backupDatabases(resources) {
|
|
100
|
-
return resources.filter((r) => r.kind === "database").map((r) => ({
|
|
101
|
-
id: r.id,
|
|
102
|
-
file: (0, _geekmidas_manifest.kebabCase)(r.id),
|
|
103
|
-
name: r.name
|
|
104
|
-
})).sort((a, b) => a.file.localeCompare(b.file));
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* The expiry of every stage's backups, by each stage's own entry — what the
|
|
108
|
-
* project bucket's lifecycle carries beside its own rule.
|
|
109
|
-
*
|
|
110
|
-
* A put replaces a bucket's whole lifecycle, so this is built from every
|
|
111
|
-
* deployed stage each time, never from the stage being deployed alone: one
|
|
112
|
-
* stage's deploy keeps every other's rule. A stage set to `false` has none,
|
|
113
|
-
* and its backups are kept until someone deletes them.
|
|
114
|
-
*/
|
|
115
|
-
function backupExpiries(workspace, manifest) {
|
|
116
|
-
const expiries = [];
|
|
117
|
-
for (const stage of [...workspace.stages?.deployed ?? []].sort()) {
|
|
118
|
-
const choice = stageBackups(workspace, manifest, stage);
|
|
119
|
-
if (choice.mode !== "on") continue;
|
|
120
|
-
expiries.push({
|
|
121
|
-
id: `gkm-backups-${stage}`,
|
|
122
|
-
prefix: `${backupsPrefix(workspace, stage)}/`,
|
|
123
|
-
days: choice.backups.keepDays,
|
|
124
|
-
abortIncompleteDays: 1
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
return expiries;
|
|
128
|
-
}
|
|
129
|
-
//#endregion
|
|
130
|
-
//#region src/backups/service.ts
|
|
131
|
-
/**
|
|
132
|
-
* The stack's `backups` service: what a deployed compose stage with Postgres
|
|
133
|
-
* runs beside its apps, unless `deploy.backups.<stage>` is `false`.
|
|
134
|
-
*
|
|
135
|
-
* - **The image** is built from the stack's own Postgres image —
|
|
136
|
-
* `postgres:<major>-alpine`, already on the server for the stack, and with
|
|
137
|
-
* the `pg_dump` that matches the server — with Node added and gkm's runner
|
|
138
|
-
* (`runner.ts`) copied in. Nothing is pulled that the stack does not have,
|
|
139
|
-
* and nothing is mounted from the host: the build context is two files.
|
|
140
|
-
* - **Its key** is `BACKUPS_URL`, from the stage's secrets, like any app's:
|
|
141
|
-
* allowed to put objects under the stage's backups prefix and nothing else.
|
|
142
|
-
* The server holds no AWS credentials of its own.
|
|
143
|
-
* - **Its login** is a role of its own, `<project>_backups`, granted
|
|
144
|
-
* `pg_read_all_data` — it can read every database and write none. Postgres
|
|
145
|
-
* before 14 has no such role, and there it signs in as the stack's
|
|
146
|
-
* superuser.
|
|
147
|
-
* - **Its health** is the last good run: unhealthy once that is more than
|
|
148
|
-
* twice the schedule's longest gap old, after a startup grace.
|
|
149
|
-
*/
|
|
150
|
-
/** The service's name in the stack. */
|
|
151
|
-
const BACKUPS_SERVICE = "backups";
|
|
152
|
-
/** The secret its key is written to. */
|
|
153
|
-
const BACKUPS_URL_KEY = "BACKUPS_URL";
|
|
154
|
-
/** Where the runner is, in the image. */
|
|
155
|
-
const RUNNER_PATH = "/gkm/backup.mjs";
|
|
156
|
-
/** The first Postgres with `pg_read_all_data`. */
|
|
157
|
-
const READ_ALL_DATA_SINCE = 14;
|
|
158
|
-
/** A stage that backs up, and no key to back up with. */
|
|
159
|
-
var BackupsUrlMissing = class extends require_errors.GkmError {
|
|
160
|
-
stage;
|
|
161
|
-
constructor(stage) {
|
|
162
|
-
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.`);
|
|
163
|
-
this.stage = stage;
|
|
164
|
-
this.name = "BackupsUrlMissing";
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
/** The backups role: `<project>_backups`, as the superuser is `<project>_admin`. */
|
|
168
|
-
function backupsRole(project) {
|
|
169
|
-
return `${require_compose.postgresRoleSlug(project)}_backups`;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* The runner's source, as JavaScript: the built `backups/runner.mjs` beside
|
|
173
|
-
* the CLI's bundle, or — run from source — `runner.ts`, with its types
|
|
174
|
-
* stripped by esbuild.
|
|
175
|
-
*/
|
|
176
|
-
function runnerSource() {
|
|
177
|
-
const here = (0, node_path.dirname)((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
|
|
178
|
-
for (const path of [
|
|
179
|
-
(0, node_path.join)(here, "backups", "runner.mjs"),
|
|
180
|
-
(0, node_path.join)(here, "runner.mjs"),
|
|
181
|
-
(0, node_path.join)(here, "..", "backups", "runner.mjs")
|
|
182
|
-
]) if ((0, node_fs.existsSync)(path)) return (0, node_fs.readFileSync)(path, "utf-8");
|
|
183
|
-
const { transformSync } = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href)("esbuild");
|
|
184
|
-
return transformSync((0, node_fs.readFileSync)((0, node_path.join)(here, "runner.ts"), "utf-8"), {
|
|
185
|
-
loader: "ts",
|
|
186
|
-
format: "esm",
|
|
187
|
-
target: "node22"
|
|
188
|
-
}).code;
|
|
189
|
-
}
|
|
190
|
-
/** The image's Dockerfile: the stack's Postgres, Node, and the runner. */
|
|
191
|
-
function backupsDockerfile(from) {
|
|
192
|
-
return `# Generated by gkm — the stage's backups: pg_dump from ${from}, and gkm's uploader.
|
|
193
|
-
FROM ${from}
|
|
194
|
-
RUN apk add --no-cache nodejs
|
|
195
|
-
COPY backup.mjs ${RUNNER_PATH}
|
|
196
|
-
USER postgres
|
|
197
|
-
ENTRYPOINT []
|
|
198
|
-
CMD ["node", "${RUNNER_PATH}", "serve"]
|
|
199
|
-
`;
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* The stack's backups service, for a stage whose backups are on.
|
|
203
|
-
*
|
|
204
|
-
* @throws {BackupsUrlMissing} when the stage's secrets hold no key
|
|
205
|
-
*/
|
|
206
|
-
function stackBackups(input) {
|
|
207
|
-
const { plan, stage } = input;
|
|
208
|
-
const version = plan.resources.find((r) => r.version)?.version ?? _geekmidas_manifest.DEFAULT_POSTGRES_VERSION;
|
|
209
|
-
const from = require_compose.postgresImage(version);
|
|
210
|
-
const script = runnerSource();
|
|
211
|
-
const dockerfile = backupsDockerfile(from);
|
|
212
|
-
const hash = (0, node_crypto.createHash)("sha256").update(dockerfile).update(script).digest("hex").slice(0, 12);
|
|
213
|
-
const readOnly = version >= READ_ALL_DATA_SINCE;
|
|
214
|
-
const role = backupsRole(input.workspace.name);
|
|
215
|
-
const login = readOnly ? {
|
|
216
|
-
user: role,
|
|
217
|
-
password: require_apps.localRolePassword(input.workspace.name, plan, role, input.seed)
|
|
218
|
-
} : input.superuser;
|
|
219
|
-
const databases = backupDatabases(plan.resources);
|
|
220
|
-
const prefix = backupsPrefix(input.workspace, stage);
|
|
221
|
-
const { kind, ...schedule } = input.backups.schedule;
|
|
222
|
-
let env = {};
|
|
223
|
-
if (!input.buildOnly) {
|
|
224
|
-
const url = input.custom[BACKUPS_URL_KEY];
|
|
225
|
-
if (!url) throw new BackupsUrlMissing(stage);
|
|
226
|
-
env = {
|
|
227
|
-
BACKUPS_URL: url,
|
|
228
|
-
BACKUPS_PREFIX: prefix,
|
|
229
|
-
BACKUPS_DATABASES: JSON.stringify(databases.map(({ file, name }) => ({
|
|
230
|
-
file,
|
|
231
|
-
name
|
|
232
|
-
}))),
|
|
233
|
-
BACKUPS_SCHEDULE: JSON.stringify(kind === "cron" ? {
|
|
234
|
-
kind,
|
|
235
|
-
minutes: input.backups.schedule.minutes,
|
|
236
|
-
hours: input.backups.schedule.hours,
|
|
237
|
-
days: input.backups.schedule.days,
|
|
238
|
-
months: input.backups.schedule.months,
|
|
239
|
-
weekdays: input.backups.schedule.weekdays
|
|
240
|
-
} : {
|
|
241
|
-
kind,
|
|
242
|
-
...schedule
|
|
243
|
-
}),
|
|
244
|
-
BACKUPS_MAX_GAP_SECONDS: String(input.backups.maxGapSeconds),
|
|
245
|
-
PGHOST: "postgres",
|
|
246
|
-
PGPORT: "5432",
|
|
247
|
-
PGUSER: login.user,
|
|
248
|
-
PGPASSWORD: login.password,
|
|
249
|
-
...input.telemetry?.OTEL_EXPORTER_OTLP_ENDPOINT ? {
|
|
250
|
-
OTEL_EXPORTER_OTLP_ENDPOINT: input.telemetry.OTEL_EXPORTER_OTLP_ENDPOINT,
|
|
251
|
-
...input.telemetry.OTEL_EXPORTER_OTLP_HEADERS ? { OTEL_EXPORTER_OTLP_HEADERS: input.telemetry.OTEL_EXPORTER_OTLP_HEADERS } : {},
|
|
252
|
-
OTEL_SERVICE_NAME: BACKUPS_SERVICE
|
|
253
|
-
} : {}
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
return {
|
|
257
|
-
backups: input.backups,
|
|
258
|
-
databases,
|
|
259
|
-
prefix,
|
|
260
|
-
from,
|
|
261
|
-
image: `${input.project}-backups:pg${version}-${hash}`,
|
|
262
|
-
files: {
|
|
263
|
-
Dockerfile: dockerfile,
|
|
264
|
-
"backup.mjs": script
|
|
265
|
-
},
|
|
266
|
-
login,
|
|
267
|
-
readOnly,
|
|
268
|
-
env
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
/** The service in the stack's compose file. */
|
|
272
|
-
function backupsService(backups, envFiles) {
|
|
273
|
-
return {
|
|
274
|
-
image: backups.image,
|
|
275
|
-
build: {
|
|
276
|
-
context: `./${BACKUPS_SERVICE}`,
|
|
277
|
-
dockerfile: "Dockerfile"
|
|
278
|
-
},
|
|
279
|
-
pull_policy: "build",
|
|
280
|
-
restart: "unless-stopped",
|
|
281
|
-
...envFiles ? { env_file: [{
|
|
282
|
-
path: `./${BACKUPS_SERVICE}.env`,
|
|
283
|
-
format: "raw"
|
|
284
|
-
}] } : {},
|
|
285
|
-
depends_on: { postgres: { condition: "service_healthy" } },
|
|
286
|
-
healthcheck: {
|
|
287
|
-
test: [
|
|
288
|
-
"CMD",
|
|
289
|
-
"node",
|
|
290
|
-
RUNNER_PATH,
|
|
291
|
-
"health"
|
|
292
|
-
],
|
|
293
|
-
interval: "1m",
|
|
294
|
-
timeout: "10s",
|
|
295
|
-
retries: 3,
|
|
296
|
-
start_period: "30s"
|
|
297
|
-
}
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
/**
|
|
301
|
-
* The backups role, created and kept: able to sign in and read every
|
|
302
|
-
* database, and nothing else. None when it signs in as the superuser.
|
|
303
|
-
*/
|
|
304
|
-
function backupsRoleStatements(backups) {
|
|
305
|
-
if (!backups.readOnly) return [];
|
|
306
|
-
const role = require_apps.quoteIdentifier(backups.login.user);
|
|
307
|
-
const password = `'${backups.login.password.replace(/'/g, "''")}'`;
|
|
308
|
-
return [
|
|
309
|
-
{
|
|
310
|
-
id: BACKUPS_SERVICE,
|
|
311
|
-
describe: `role ${backups.login.user}`,
|
|
312
|
-
exists: {
|
|
313
|
-
sql: "SELECT 1 FROM pg_roles WHERE rolname = $1",
|
|
314
|
-
values: [backups.login.user]
|
|
315
|
-
},
|
|
316
|
-
create: `CREATE ROLE ${role} LOGIN PASSWORD ${password}`
|
|
317
|
-
},
|
|
318
|
-
{
|
|
319
|
-
id: BACKUPS_SERVICE,
|
|
320
|
-
describe: `role ${backups.login.user}: its password`,
|
|
321
|
-
create: `ALTER ROLE ${role} WITH LOGIN PASSWORD ${password}`
|
|
322
|
-
},
|
|
323
|
-
{
|
|
324
|
-
id: BACKUPS_SERVICE,
|
|
325
|
-
describe: `role ${backups.login.user}: read every database`,
|
|
326
|
-
create: `GRANT pg_read_all_data TO ${role}`
|
|
327
|
-
}
|
|
328
|
-
];
|
|
329
|
-
}
|
|
330
|
-
//#endregion
|
|
331
18
|
//#region src/compose/routes.ts
|
|
332
19
|
/** A route with handlers and a check that would have to hold for each of them. */
|
|
333
20
|
var EdgeRouteConflict = class extends Error {
|
|
@@ -391,7 +78,7 @@ function edgeCaddyfile(routes, options) {
|
|
|
391
78
|
const certificate = tls.kind === "files" ? `
|
|
392
79
|
tls ${tls.certFile} ${tls.keyFile}
|
|
393
80
|
` : "";
|
|
394
|
-
const blocks = [...routes.filter((route) => !route.wildcard), ...routes.filter((route) => route.wildcard)].map((route) => siteBlock(route, route.wildcard?.tls.kind === "on-demand" ? `
|
|
81
|
+
const blocks = [...routes.filter((route) => !route.wildcard), ...routes.filter((route) => route.wildcard)].map((route) => siteBlock(route, options.edgeToken, route.wildcard?.tls.kind === "on-demand" ? `
|
|
395
82
|
tls {
|
|
396
83
|
on_demand
|
|
397
84
|
}
|
|
@@ -399,7 +86,7 @@ function edgeCaddyfile(routes, options) {
|
|
|
399
86
|
return `${HEADER}${global ? `${global}\n\n` : ""}${blocks.join("\n\n")}\n`;
|
|
400
87
|
}
|
|
401
88
|
/** One route's site block. */
|
|
402
|
-
function siteBlock(route, certificate) {
|
|
89
|
+
function siteBlock(route, edgeToken, certificate) {
|
|
403
90
|
assertRouteRenderable(route);
|
|
404
91
|
const { host, allow, auth, paths, prefixes, requireHeader, handlers } = route;
|
|
405
92
|
const allowed = [...paths ?? [], ...(prefixes ?? []).map((prefix) => `${prefix}*`)];
|
|
@@ -439,10 +126,7 @@ function siteBlock(route, certificate) {
|
|
|
439
126
|
`).join("")}
|
|
440
127
|
handle {${proxy.replace(/\n/g, "\n ")}
|
|
441
128
|
}` : proxy;
|
|
442
|
-
return `https://${host} {${certificate}
|
|
443
|
-
# gkm's own header, which only a service of this stack may send: the auth
|
|
444
|
-
# server rate-limits by the client address it carries.
|
|
445
|
-
request_header -${_geekmidas_manifest.CLIENT_IP_HEADER}
|
|
129
|
+
return `https://${host} {${certificate}${require_apps.clientIpRule(edgeToken)}
|
|
446
130
|
${checks}${body}
|
|
447
131
|
}`;
|
|
448
132
|
}
|
|
@@ -925,7 +609,7 @@ function edgeCompose(options) {
|
|
|
925
609
|
}
|
|
926
610
|
/** A stack's dynamic configuration, as an object. */
|
|
927
611
|
function traefikDynamic(routes, options) {
|
|
928
|
-
const { project, tls } = options;
|
|
612
|
+
const { project, tls, edgeToken } = options;
|
|
929
613
|
const name = (route, suffix) => `${project}-${route.name}${suffix ? `-${suffix}` : ""}`;
|
|
930
614
|
const url = ({ service, port }) => `http://${edgeAlias(project, service)}:${port}`;
|
|
931
615
|
const routers = {};
|
|
@@ -967,14 +651,23 @@ function traefikDynamic(routes, options) {
|
|
|
967
651
|
};
|
|
968
652
|
services[handlerName] = { loadBalancer: { servers: handler.upstreams.map((upstream) => ({ url: url(upstream) })) } };
|
|
969
653
|
}
|
|
654
|
+
const rule = `${hostRule(route)}${paths}${header}`;
|
|
970
655
|
routers[name(route)] = {
|
|
971
|
-
rule
|
|
656
|
+
rule,
|
|
972
657
|
...route.wildcard ? { priority: 1 } : {},
|
|
973
658
|
entryPoints: ["websecure"],
|
|
974
659
|
service: name(route),
|
|
975
660
|
middlewares: chain,
|
|
976
661
|
tls: certificate()
|
|
977
662
|
};
|
|
663
|
+
if (edgeToken && !route.prefix) routers[name(route, "stack")] = {
|
|
664
|
+
rule: `${rule} && Header(\`${_geekmidas_manifest.EDGE_TOKEN_HEADER}\`, \`${edgeToken}\`)`,
|
|
665
|
+
...route.wildcard ? { priority: 2 } : {},
|
|
666
|
+
entryPoints: ["websecure"],
|
|
667
|
+
service: name(route),
|
|
668
|
+
...chain.length > 1 ? { middlewares: chain.slice(1) } : {},
|
|
669
|
+
tls: certificate()
|
|
670
|
+
};
|
|
978
671
|
services[name(route)] = { loadBalancer: {
|
|
979
672
|
servers: route.upstreams.map((upstream) => ({ url: url(upstream) })),
|
|
980
673
|
...route.prefix ? { passHostHeader: false } : {},
|
|
@@ -1043,16 +736,17 @@ function yaml$1(value) {
|
|
|
1043
736
|
* The stack a workspace runs as for one stage — pure.
|
|
1044
737
|
*
|
|
1045
738
|
* Everything `gkm compose` writes is decided here, as data: the compose file,
|
|
1046
|
-
* the Caddyfile, one env file per
|
|
739
|
+
* the Caddyfile, one env file per process that reads one — each backend,
|
|
740
|
+
* worker and site that runs a server — and the image each app runs. The
|
|
1047
741
|
* command around it reads the workspace, asks the registry, writes the files
|
|
1048
742
|
* and starts Docker; none of those decide anything, so all of it can be
|
|
1049
743
|
* asserted without a daemon.
|
|
1050
744
|
*
|
|
1051
745
|
* The values come from the same derivations every other target uses. The
|
|
1052
|
-
* plan is reconcile's `planFor`, the keys
|
|
1053
|
-
*
|
|
1054
|
-
*
|
|
1055
|
-
* service reach the same
|
|
746
|
+
* plan is reconcile's `planFor`, the keys a process reads are
|
|
747
|
+
* `processEnvKeys` — the rule `gkm dev` and `gkm exec` apply — and every URL
|
|
748
|
+
* is `envFor`'s, with each app at its public address: a browser and a sibling
|
|
749
|
+
* service reach an API by the same name, through the edge.
|
|
1056
750
|
*/
|
|
1057
751
|
/** Where a stack's files are written, relative to the workspace root. */
|
|
1058
752
|
function stackDir(stage) {
|
|
@@ -1556,12 +1250,6 @@ function composeStack(input) {
|
|
|
1556
1250
|
...derivation,
|
|
1557
1251
|
addresses: publicAddresses
|
|
1558
1252
|
}, hostOf);
|
|
1559
|
-
const inside = require_apps.networkEnv(plan, {
|
|
1560
|
-
...derivation,
|
|
1561
|
-
addresses: Object.fromEntries(apps.map((app) => [app.id, `${app.kind === "websocket-api" ? "ws" : "http"}://${hostOf(app.name)}:${app.port}`]))
|
|
1562
|
-
}, hostOf);
|
|
1563
|
-
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]));
|
|
1564
|
-
const appById = new Map(apps.map((app) => [app.id, app]));
|
|
1565
1253
|
/**
|
|
1566
1254
|
* What a key resolves to for one app, from the stage's secrets where only
|
|
1567
1255
|
* they can hold it, and the derivations otherwise.
|
|
@@ -1596,8 +1284,6 @@ function composeStack(input) {
|
|
|
1596
1284
|
if (custom[key] !== void 0) return custom[key];
|
|
1597
1285
|
if (owner?.kind === "cache") return redis?.urls[key];
|
|
1598
1286
|
if (owner?.kind === "websocket-api" && key === (0, _geekmidas_manifest.provideKey)(owner.id, "publisherConnectionString")) return redis?.urls[key];
|
|
1599
|
-
const surface = surfaceUrls.get(key);
|
|
1600
|
-
if ((app.kind === "rest-api" || app.kind === "websocket-api") && surface && surface !== app.id) return inside[key];
|
|
1601
1287
|
return outside[key];
|
|
1602
1288
|
};
|
|
1603
1289
|
const telemetryValues = logs ? require_workspace.telemetryEnv({
|
|
@@ -1620,28 +1306,21 @@ function composeStack(input) {
|
|
|
1620
1306
|
}
|
|
1621
1307
|
return values;
|
|
1622
1308
|
};
|
|
1309
|
+
const stageKeys = Object.keys(custom);
|
|
1623
1310
|
for (const app of apps) {
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
if (site?.kind !== "site") continue;
|
|
1311
|
+
const site = manifest[app.id];
|
|
1312
|
+
if (site?.kind === "site") {
|
|
1627
1313
|
const args = require_apps.publicBuildValues(site, manifest, (key) => valueFor(app, key, owners.get(key)), custom);
|
|
1628
1314
|
if (app.build && Object.keys(args).length > 0) app.build.args = args;
|
|
1629
1315
|
const offline = require_apps.offlineBuildHosts(site, manifest, (key) => valueFor(app, key, owners.get(key)));
|
|
1630
1316
|
if (app.build && offline.length > 0) app.build.offlineHosts = offline;
|
|
1631
|
-
continue;
|
|
1317
|
+
if (!app.runtime) continue;
|
|
1632
1318
|
}
|
|
1633
1319
|
if (input.buildOnly) continue;
|
|
1634
|
-
const
|
|
1635
|
-
const values = valuesFor(app, keys);
|
|
1636
|
-
const trusted = (0, _geekmidas_manifest.provideKey)(app.id, "trustedOrigins");
|
|
1637
|
-
if (keys.has(trusted)) {
|
|
1638
|
-
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}`);
|
|
1639
|
-
const origins = [...(values[trusted] ?? "").split(",").filter(Boolean), ...internal];
|
|
1640
|
-
values[trusted] = [...new Set(origins)].join(",");
|
|
1641
|
-
}
|
|
1320
|
+
const values = valuesFor(app, require_apps.processEnvKeys(manifest, { app: app.name }, stageKeys) ?? /* @__PURE__ */ new Set());
|
|
1642
1321
|
app.env = {
|
|
1643
1322
|
...require_apps.scopeTelemetryEnv(values, {
|
|
1644
|
-
uses: require_apps.telemetryOf(manifest, app.id) !== void 0,
|
|
1323
|
+
uses: app.kind !== "site" && require_apps.telemetryOf(manifest, app.id) !== void 0,
|
|
1645
1324
|
serviceName: app.name,
|
|
1646
1325
|
...telemetryValues ? { telemetry: telemetryValues } : {}
|
|
1647
1326
|
}),
|
|
@@ -1666,7 +1345,7 @@ function composeStack(input) {
|
|
|
1666
1345
|
});
|
|
1667
1346
|
}
|
|
1668
1347
|
for (const worker of input.buildOnly ? [] : workers) {
|
|
1669
|
-
const keys = require_apps.
|
|
1348
|
+
const keys = require_apps.processEnvKeys(manifest, { workers: [worker.id] }, stageKeys) ?? /* @__PURE__ */ new Set();
|
|
1670
1349
|
const resolved = valuesFor({
|
|
1671
1350
|
name: worker.name,
|
|
1672
1351
|
id: worker.id,
|
|
@@ -1708,17 +1387,17 @@ function composeStack(input) {
|
|
|
1708
1387
|
};
|
|
1709
1388
|
else if (!local && !input.buildOnly) {
|
|
1710
1389
|
if (!domain) throw new require_compose.NoDomainForStage(stage);
|
|
1711
|
-
const key =
|
|
1390
|
+
const key = require_apps.originSecretKey(unit.id);
|
|
1712
1391
|
const secret = custom[key];
|
|
1713
1392
|
if (!secret) throw new ProcessorOriginSecretMissing(unit.id, key, stage);
|
|
1714
1393
|
unit.origin = {
|
|
1715
|
-
host:
|
|
1394
|
+
host: require_apps.processorOriginHost(unit.id, domain),
|
|
1716
1395
|
secret
|
|
1717
1396
|
};
|
|
1718
1397
|
}
|
|
1719
1398
|
if (proxy === "traefik" && (served || unit.origin)) edgeServices.add(unit.name);
|
|
1720
1399
|
if (input.buildOnly) continue;
|
|
1721
|
-
const keys = require_apps.
|
|
1400
|
+
const keys = require_apps.processEnvKeys(manifest, { processors: [unit.id] }, stageKeys) ?? /* @__PURE__ */ new Set();
|
|
1722
1401
|
unit.env = {
|
|
1723
1402
|
...require_apps.scopeTelemetryEnv(valuesFor({
|
|
1724
1403
|
name: unit.name,
|
|
@@ -1766,8 +1445,8 @@ function composeStack(input) {
|
|
|
1766
1445
|
} : { kind: "acme" };
|
|
1767
1446
|
const authority = local && !certificate ? input.localAuthority ?? require_apps.localAuthorityPaths() : void 0;
|
|
1768
1447
|
const root = authority?.certFile ?? certificate?.caFile;
|
|
1769
|
-
const backupsChoice = input.buildOnly ? void 0 : stageBackups(workspace, manifest, stage);
|
|
1770
|
-
const backups = backupsChoice?.mode === "on" && infra.includes("postgres") ? stackBackups({
|
|
1448
|
+
const backupsChoice = input.buildOnly ? void 0 : require_apps.stageBackups(workspace, manifest, stage);
|
|
1449
|
+
const backups = backupsChoice?.mode === "on" && infra.includes("postgres") ? require_apps.stackBackups({
|
|
1771
1450
|
workspace,
|
|
1772
1451
|
stage,
|
|
1773
1452
|
project,
|
|
@@ -1820,7 +1499,7 @@ function composeStack(input) {
|
|
|
1820
1499
|
streaming: false,
|
|
1821
1500
|
prefixes,
|
|
1822
1501
|
requireHeader: {
|
|
1823
|
-
name:
|
|
1502
|
+
name: require_apps.ORIGIN_VERIFY_HEADER,
|
|
1824
1503
|
value: origin.secret
|
|
1825
1504
|
},
|
|
1826
1505
|
health: "/health"
|
|
@@ -1946,10 +1625,12 @@ function composeStack(input) {
|
|
|
1946
1625
|
} } : {},
|
|
1947
1626
|
...proxy === "caddy" ? { caddyfile: edgeCaddyfile(routes, {
|
|
1948
1627
|
tls,
|
|
1628
|
+
edgeToken: outside[_geekmidas_manifest.EDGE_TOKEN_KEY],
|
|
1949
1629
|
...local ? { redirects: false } : {}
|
|
1950
1630
|
}) } : { traefik: traefikDynamicFile(routes, {
|
|
1951
1631
|
project,
|
|
1952
|
-
tls
|
|
1632
|
+
tls,
|
|
1633
|
+
edgeToken: outside[_geekmidas_manifest.EDGE_TOKEN_KEY]
|
|
1953
1634
|
}) },
|
|
1954
1635
|
...certificate ? { tls: certificate } : {},
|
|
1955
1636
|
dockerfiles,
|
|
@@ -1994,7 +1675,8 @@ function stackApps(workspace, manifest, plan, options) {
|
|
|
1994
1675
|
const resource = resources.get(id);
|
|
1995
1676
|
if (!app || !resource || !app.port) continue;
|
|
1996
1677
|
const host = hostOf(name, app, workspace, resource, options);
|
|
1997
|
-
const
|
|
1678
|
+
const site = declaration.kind === "site";
|
|
1679
|
+
const tag = site ? siteTag(options.images.tag, options.stage) : options.images.tag;
|
|
1998
1680
|
const ref = require_docker.validateImageRef(require_credentials.imageRef(options.identity, name, options.images.registry, tag));
|
|
1999
1681
|
apps.push({
|
|
2000
1682
|
app: name,
|
|
@@ -2003,6 +1685,7 @@ function stackApps(workspace, manifest, plan, options) {
|
|
|
2003
1685
|
kind: declaration.kind,
|
|
2004
1686
|
...declaration.kind === "site" ? { variant: declaration.variant } : {},
|
|
2005
1687
|
replicas: declaration.kind === "websocket-api" ? declaration.replicas ?? 1 : 1,
|
|
1688
|
+
runtime: !site || require_apps.runsServer(declaration),
|
|
2006
1689
|
path: app.path,
|
|
2007
1690
|
port: app.port,
|
|
2008
1691
|
host,
|
|
@@ -2297,7 +1980,7 @@ function stackFile(options) {
|
|
|
2297
1980
|
};
|
|
2298
1981
|
if (services["redis"] && options.redis) services[require_compose.REDIS_SERVICE] = require_compose.redisService(options.redis);
|
|
2299
1982
|
if (options.logs) services[require_compose.LOGS_SERVICE] = require_compose.logsService(options.logs);
|
|
2300
|
-
if (options.backups) services[BACKUPS_SERVICE] = backupsService(options.backups, options.envFiles);
|
|
1983
|
+
if (options.backups) services[require_apps.BACKUPS_SERVICE] = require_apps.backupsService(options.backups, options.envFiles);
|
|
2301
1984
|
for (const app of apps) {
|
|
2302
1985
|
const definition = {
|
|
2303
1986
|
image: app.ref,
|
|
@@ -2312,13 +1995,11 @@ function stackFile(options) {
|
|
|
2312
1995
|
...app.build.offlineHosts ? { extra_hosts: app.build.offlineHosts.map((host) => `${host}:${require_apps.OFFLINE_BUILD_ADDRESS}`) } : {}
|
|
2313
1996
|
} } : {},
|
|
2314
1997
|
restart: "unless-stopped",
|
|
2315
|
-
...app.
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
...infra.length ? { depends_on: Object.fromEntries(infra.map((name) => [name, HEALTHY])) } : {}
|
|
2321
|
-
} : {},
|
|
1998
|
+
...app.runtime ? { env_file: [{
|
|
1999
|
+
path: `./${app.name}.env`,
|
|
2000
|
+
format: "raw"
|
|
2001
|
+
}] } : {},
|
|
2002
|
+
...app.kind !== "site" && infra.length ? { depends_on: Object.fromEntries(infra.map((name) => [name, HEALTHY])) } : {},
|
|
2322
2003
|
healthcheck: probe(app.port, app.kind === "site" ? "/" : "/health"),
|
|
2323
2004
|
...app.kind === "websocket-api" ? { ulimits: { nofile: NOFILE } } : {}
|
|
2324
2005
|
};
|
|
@@ -2428,18 +2109,6 @@ function envFile(env) {
|
|
|
2428
2109
|
return `${Object.entries(env).sort(([a], [b]) => a.localeCompare(b)).map(([key, value]) => `${key}=${value}`).join("\n")}\n`;
|
|
2429
2110
|
}
|
|
2430
2111
|
//#endregion
|
|
2431
|
-
Object.defineProperty(exports, "BACKUPS_SERVICE", {
|
|
2432
|
-
enumerable: true,
|
|
2433
|
-
get: function() {
|
|
2434
|
-
return BACKUPS_SERVICE;
|
|
2435
|
-
}
|
|
2436
|
-
});
|
|
2437
|
-
Object.defineProperty(exports, "BACKUPS_URL_KEY", {
|
|
2438
|
-
enumerable: true,
|
|
2439
|
-
get: function() {
|
|
2440
|
-
return BACKUPS_URL_KEY;
|
|
2441
|
-
}
|
|
2442
|
-
});
|
|
2443
2112
|
Object.defineProperty(exports, "EDGE_AWS_CREDENTIALS", {
|
|
2444
2113
|
enumerable: true,
|
|
2445
2114
|
get: function() {
|
|
@@ -2500,12 +2169,6 @@ Object.defineProperty(exports, "LOOPBACK_SERVICES", {
|
|
|
2500
2169
|
return LOOPBACK_SERVICES;
|
|
2501
2170
|
}
|
|
2502
2171
|
});
|
|
2503
|
-
Object.defineProperty(exports, "RUNNER_PATH", {
|
|
2504
|
-
enumerable: true,
|
|
2505
|
-
get: function() {
|
|
2506
|
-
return RUNNER_PATH;
|
|
2507
|
-
}
|
|
2508
|
-
});
|
|
2509
2172
|
Object.defineProperty(exports, "RegistryRequired", {
|
|
2510
2173
|
enumerable: true,
|
|
2511
2174
|
get: function() {
|
|
@@ -2524,36 +2187,6 @@ Object.defineProperty(exports, "assertSitePasswords", {
|
|
|
2524
2187
|
return assertSitePasswords;
|
|
2525
2188
|
}
|
|
2526
2189
|
});
|
|
2527
|
-
Object.defineProperty(exports, "backupDatabases", {
|
|
2528
|
-
enumerable: true,
|
|
2529
|
-
get: function() {
|
|
2530
|
-
return backupDatabases;
|
|
2531
|
-
}
|
|
2532
|
-
});
|
|
2533
|
-
Object.defineProperty(exports, "backupExpiries", {
|
|
2534
|
-
enumerable: true,
|
|
2535
|
-
get: function() {
|
|
2536
|
-
return backupExpiries;
|
|
2537
|
-
}
|
|
2538
|
-
});
|
|
2539
|
-
Object.defineProperty(exports, "backupFile", {
|
|
2540
|
-
enumerable: true,
|
|
2541
|
-
get: function() {
|
|
2542
|
-
return backupFile;
|
|
2543
|
-
}
|
|
2544
|
-
});
|
|
2545
|
-
Object.defineProperty(exports, "backupsPrefix", {
|
|
2546
|
-
enumerable: true,
|
|
2547
|
-
get: function() {
|
|
2548
|
-
return backupsPrefix;
|
|
2549
|
-
}
|
|
2550
|
-
});
|
|
2551
|
-
Object.defineProperty(exports, "backupsRoleStatements", {
|
|
2552
|
-
enumerable: true,
|
|
2553
|
-
get: function() {
|
|
2554
|
-
return backupsRoleStatements;
|
|
2555
|
-
}
|
|
2556
|
-
});
|
|
2557
2190
|
Object.defineProperty(exports, "composeProject", {
|
|
2558
2191
|
enumerable: true,
|
|
2559
2192
|
get: function() {
|
|
@@ -2572,24 +2205,12 @@ Object.defineProperty(exports, "deployedInboxEnv", {
|
|
|
2572
2205
|
return deployedInboxEnv;
|
|
2573
2206
|
}
|
|
2574
2207
|
});
|
|
2575
|
-
Object.defineProperty(exports, "deploysWithCompose", {
|
|
2576
|
-
enumerable: true,
|
|
2577
|
-
get: function() {
|
|
2578
|
-
return deploysWithCompose;
|
|
2579
|
-
}
|
|
2580
|
-
});
|
|
2581
2208
|
Object.defineProperty(exports, "derivedCredentials", {
|
|
2582
2209
|
enumerable: true,
|
|
2583
2210
|
get: function() {
|
|
2584
2211
|
return derivedCredentials;
|
|
2585
2212
|
}
|
|
2586
2213
|
});
|
|
2587
|
-
Object.defineProperty(exports, "edgeAlias", {
|
|
2588
|
-
enumerable: true,
|
|
2589
|
-
get: function() {
|
|
2590
|
-
return edgeAlias;
|
|
2591
|
-
}
|
|
2592
|
-
});
|
|
2593
2214
|
Object.defineProperty(exports, "edgeComposeFile", {
|
|
2594
2215
|
enumerable: true,
|
|
2595
2216
|
get: function() {
|
|
@@ -2626,12 +2247,6 @@ Object.defineProperty(exports, "replicaNames", {
|
|
|
2626
2247
|
return replicaNames;
|
|
2627
2248
|
}
|
|
2628
2249
|
});
|
|
2629
|
-
Object.defineProperty(exports, "runTime", {
|
|
2630
|
-
enumerable: true,
|
|
2631
|
-
get: function() {
|
|
2632
|
-
return runTime;
|
|
2633
|
-
}
|
|
2634
|
-
});
|
|
2635
2250
|
Object.defineProperty(exports, "stackDir", {
|
|
2636
2251
|
enumerable: true,
|
|
2637
2252
|
get: function() {
|
|
@@ -2644,12 +2259,6 @@ Object.defineProperty(exports, "stackPlan", {
|
|
|
2644
2259
|
return stackPlan;
|
|
2645
2260
|
}
|
|
2646
2261
|
});
|
|
2647
|
-
Object.defineProperty(exports, "stageBackups", {
|
|
2648
|
-
enumerable: true,
|
|
2649
|
-
get: function() {
|
|
2650
|
-
return stageBackups;
|
|
2651
|
-
}
|
|
2652
|
-
});
|
|
2653
2262
|
Object.defineProperty(exports, "traefikStaticFile", {
|
|
2654
2263
|
enumerable: true,
|
|
2655
2264
|
get: function() {
|
|
@@ -2663,4 +2272,4 @@ Object.defineProperty(exports, "withCaddyConfigs", {
|
|
|
2663
2272
|
}
|
|
2664
2273
|
});
|
|
2665
2274
|
|
|
2666
|
-
//# sourceMappingURL=stack-
|
|
2275
|
+
//# sourceMappingURL=stack-l_eQ63Gl.cjs.map
|