@geekmidas/cli 10.0.0-alpha.147 → 10.0.0-alpha.149
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-C6aEo0CV.mjs} +2 -2
- package/dist/{GoDaddyProvider-DXuPFufW.mjs.map → GoDaddyProvider-C6aEo0CV.mjs.map} +1 -1
- package/dist/{GoDaddyProvider-CpO8dFYC.cjs → GoDaddyProvider-DKDe-23b.cjs} +2 -2
- package/dist/{GoDaddyProvider-CpO8dFYC.cjs.map → GoDaddyProvider-DKDe-23b.cjs.map} +1 -1
- package/dist/{HostingerProvider-Dum492dc.mjs → HostingerProvider-BzEOqVG_.mjs} +2 -2
- package/dist/{HostingerProvider-Dum492dc.mjs.map → HostingerProvider-BzEOqVG_.mjs.map} +1 -1
- package/dist/{HostingerProvider-Beu0Ciky.cjs → HostingerProvider-CoM1tmcE.cjs} +2 -2
- package/dist/{HostingerProvider-Beu0Ciky.cjs.map → HostingerProvider-CoM1tmcE.cjs.map} +1 -1
- package/dist/{LegacyStateStore-V4R0llou.cjs → LegacyStateStore-BPy-BWdo.cjs} +2 -2
- package/dist/{LegacyStateStore-V4R0llou.cjs.map → LegacyStateStore-BPy-BWdo.cjs.map} +1 -1
- package/dist/{LegacyStateStore-DZjph7ES.mjs → LegacyStateStore-DQZ9WVJP.mjs} +2 -2
- package/dist/{LegacyStateStore-DZjph7ES.mjs.map → LegacyStateStore-DQZ9WVJP.mjs.map} +1 -1
- package/dist/{LocalStateStore-DuSotrd3.cjs → LocalStateStore-DLMSHOGc.cjs} +2 -2
- package/dist/{LocalStateStore-DuSotrd3.cjs.map → LocalStateStore-DLMSHOGc.cjs.map} +1 -1
- package/dist/{LocalStateStore-Bth8pBp-.mjs → LocalStateStore-GbMChTQl.mjs} +2 -2
- package/dist/{LocalStateStore-Bth8pBp-.mjs.map → LocalStateStore-GbMChTQl.mjs.map} +1 -1
- package/dist/{S3StateStore-DTPxQS3z.cjs → S3StateStore-CzRoknWG.cjs} +4 -4
- package/dist/{S3StateStore-DTPxQS3z.cjs.map → S3StateStore-CzRoknWG.cjs.map} +1 -1
- package/dist/{S3StateStore-DGlh3s2p.mjs → S3StateStore-DxxflvGI.mjs} +4 -4
- package/dist/{S3StateStore-DGlh3s2p.mjs.map → S3StateStore-DxxflvGI.mjs.map} +1 -1
- package/dist/{SSMStateStore-B9R317q0.cjs → SSMStateStore-D6-G2IaT.cjs} +2 -2
- package/dist/{SSMStateStore-B9R317q0.cjs.map → SSMStateStore-D6-G2IaT.cjs.map} +1 -1
- package/dist/{SSMStateStore-DCa85jhG.mjs → SSMStateStore-DYV0_6qN.mjs} +2 -2
- package/dist/{SSMStateStore-DCa85jhG.mjs.map → SSMStateStore-DYV0_6qN.mjs.map} +1 -1
- package/dist/{add-Bl33BvDW.mjs → add-BJzIaBVd.mjs} +4 -5
- package/dist/{add-Bl33BvDW.mjs.map → add-BJzIaBVd.mjs.map} +1 -1
- package/dist/{add-Cr-9Ku0W.cjs → add-CdkSyhjZ.cjs} +5 -6
- package/dist/{add-Cr-9Ku0W.cjs.map → add-CdkSyhjZ.cjs.map} +1 -1
- package/dist/{apps-DFzUuJ22.mjs → apps-CGYHQ_bC.mjs} +529 -15
- package/dist/apps-CGYHQ_bC.mjs.map +1 -0
- package/dist/{apps-BIsxWYUo.cjs → apps-DwSctcdn.cjs} +670 -12
- package/dist/apps-DwSctcdn.cjs.map +1 -0
- package/dist/{bundler-Cael9EDc.cjs → bundler-BwFWenXT.cjs} +6 -6
- package/dist/{bundler-Cael9EDc.cjs.map → bundler-BwFWenXT.cjs.map} +1 -1
- package/dist/{bundler-BagXzefF.mjs → bundler-DSrq790y.mjs} +6 -6
- package/dist/{bundler-BagXzefF.mjs.map → bundler-DSrq790y.mjs.map} +1 -1
- package/dist/{cli-BJRPsFq7.mjs → cli-C_vq_-TX.mjs} +4 -4
- package/dist/{cli-BJRPsFq7.mjs.map → cli-C_vq_-TX.mjs.map} +1 -1
- package/dist/{cli-B1A-cLy-.cjs → cli-Dj51FtjV.cjs} +4 -4
- package/dist/{cli-B1A-cLy-.cjs.map → cli-Dj51FtjV.cjs.map} +1 -1
- package/dist/{compose-CnNmDNph.cjs → compose-BQ50cQvm.cjs} +17 -17
- package/dist/compose-BQ50cQvm.cjs.map +1 -0
- package/dist/{compose-CZU60dwb.mjs → compose-CQyP3elv.mjs} +11 -11
- package/dist/compose-CQyP3elv.mjs.map +1 -0
- package/dist/{compose-Cius-YHS.cjs → compose-DwDO8HCV.cjs} +30 -6
- package/dist/{compose-Cius-YHS.cjs.map → compose-DwDO8HCV.cjs.map} +1 -1
- package/dist/{compose-C7izI7Eo.mjs → compose-vViCpmhM.mjs} +13 -7
- package/dist/{compose-C7izI7Eo.mjs.map → compose-vViCpmhM.mjs.map} +1 -1
- package/dist/{credentials-CJ_z0Nni.mjs → credentials-BpWbdbnM.mjs} +7 -41
- package/dist/credentials-BpWbdbnM.mjs.map +1 -0
- package/dist/{credentials-D11xozSF.cjs → credentials-D4_8P1n4.cjs} +5 -69
- package/dist/credentials-D4_8P1n4.cjs.map +1 -0
- package/dist/deploy/public.cjs +10 -10
- package/dist/deploy/public.mjs +10 -10
- package/dist/{deploy-Ch1wCsU1.cjs → deploy-C-LoRdGS.cjs} +29 -29
- package/dist/{deploy-Ch1wCsU1.cjs.map → deploy-C-LoRdGS.cjs.map} +1 -1
- package/dist/{deploy-Dfn21QYG.mjs → deploy-tDMjMPGx.mjs} +11 -11
- package/dist/{deploy-Dfn21QYG.mjs.map → deploy-tDMjMPGx.mjs.map} +1 -1
- package/dist/{docker-_W_CauBY.mjs → docker-Cs86mqnh.mjs} +4 -4
- package/dist/{docker-_W_CauBY.mjs.map → docker-Cs86mqnh.mjs.map} +1 -1
- package/dist/{docker-BT6G7aJE.cjs → docker-Dh_6VdKL.cjs} +7 -7
- package/dist/{docker-BT6G7aJE.cjs.map → docker-Dh_6VdKL.cjs.map} +1 -1
- package/dist/{dokploy-CBgGuei3.mjs → dokploy-BH2nvE1B.mjs} +2 -2
- package/dist/{dokploy-CBgGuei3.mjs.map → dokploy-BH2nvE1B.mjs.map} +1 -1
- package/dist/{dokploy-DaQbR_NH.cjs → dokploy-g_mjOwgA.cjs} +2 -2
- package/dist/{dokploy-DaQbR_NH.cjs.map → dokploy-g_mjOwgA.cjs.map} +1 -1
- package/dist/{eas-3L1_yKhk.mjs → eas-CYLLcPHB.mjs} +2 -2
- package/dist/{eas-3L1_yKhk.mjs.map → eas-CYLLcPHB.mjs.map} +1 -1
- package/dist/{eas-YxDTJ3ql.cjs → eas-DmTuxuGQ.cjs} +2 -2
- package/dist/{eas-YxDTJ3ql.cjs.map → eas-DmTuxuGQ.cjs.map} +1 -1
- package/dist/{encryption-CVIu104e.cjs → encryption-D1FLAwoj.cjs} +2 -2
- package/dist/{encryption-CVIu104e.cjs.map → encryption-D1FLAwoj.cjs.map} +1 -1
- package/dist/{encryption-CRyFk5nu.mjs → encryption-DaXUWqQj.mjs} +2 -2
- package/dist/{encryption-CRyFk5nu.mjs.map → encryption-DaXUWqQj.mjs.map} +1 -1
- package/dist/{engine-DZnZy1R5.mjs → engine-BCAnRM5B.mjs} +8 -8
- package/dist/{engine-DZnZy1R5.mjs.map → engine-BCAnRM5B.mjs.map} +1 -1
- package/dist/{engine-XecwdLdj.cjs → engine-BoB6d_i2.cjs} +12 -12
- package/dist/{engine-XecwdLdj.cjs.map → engine-BoB6d_i2.cjs.map} +1 -1
- package/dist/{github-dnxU_tMp.cjs → github-B-aHo2RW.cjs} +7 -8
- package/dist/{github-dnxU_tMp.cjs.map → github-B-aHo2RW.cjs.map} +1 -1
- package/dist/{github-CDJXpBCT.mjs → github-CDz8alqv.mjs} +6 -7
- package/dist/{github-CDJXpBCT.mjs.map → github-CDz8alqv.mjs.map} +1 -1
- package/dist/{googlePlay-BYeXKpNE.mjs → googlePlay-B3bvoWQe.mjs} +4 -4
- package/dist/{googlePlay-BYeXKpNE.mjs.map → googlePlay-B3bvoWQe.mjs.map} +1 -1
- package/dist/{googlePlay-CnIU3qIV.cjs → googlePlay-DSw0ATpH.cjs} +4 -4
- package/dist/{googlePlay-CnIU3qIV.cjs.map → googlePlay-DSw0ATpH.cjs.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-qdNfjzxQ.cjs → local-Di2r0D3l.cjs} +2 -2
- package/dist/{local-qdNfjzxQ.cjs.map → local-Di2r0D3l.cjs.map} +1 -1
- package/dist/{local-BIOpCtLE.mjs → local-k8h74TMP.mjs} +2 -2
- package/dist/{local-BIOpCtLE.mjs.map → local-k8h74TMP.mjs.map} +1 -1
- package/dist/{migrate--VNdTWT7.mjs → migrate-0O-FVzry.mjs} +4 -4
- package/dist/{migrate--VNdTWT7.mjs.map → migrate-0O-FVzry.mjs.map} +1 -1
- package/dist/{migrate-CDEHWq-e.cjs → migrate-B_FC5R7G.cjs} +4 -4
- package/dist/{migrate-CDEHWq-e.cjs.map → migrate-B_FC5R7G.cjs.map} +1 -1
- package/dist/{migrate-CkHtNdre.cjs → migrate-BhAirXeQ.cjs} +2 -2
- package/dist/{migrate-CkHtNdre.cjs.map → migrate-BhAirXeQ.cjs.map} +1 -1
- package/dist/{migrate-svXhccrs.mjs → migrate-CFjGx83P.mjs} +2 -2
- package/dist/{migrate-svXhccrs.mjs.map → migrate-CFjGx83P.mjs.map} +1 -1
- package/dist/{notes-DBNPml4N.cjs → notes-BUcrKh85.cjs} +2 -2
- package/dist/{notes-DBNPml4N.cjs.map → notes-BUcrKh85.cjs.map} +1 -1
- package/dist/{notes-D9ofENLJ.mjs → notes-DaJnmY0Z.mjs} +2 -2
- package/dist/{notes-D9ofENLJ.mjs.map → notes-DaJnmY0Z.mjs.map} +1 -1
- package/dist/{projectBucket-BtiC0Cn8.cjs → projectBucket-NSYdtlYC.cjs} +2 -2
- package/dist/{projectBucket-BtiC0Cn8.cjs.map → projectBucket-NSYdtlYC.cjs.map} +1 -1
- package/dist/{projectBucket-De0MQeNj.mjs → projectBucket-p6F4RuBz.mjs} +2 -2
- package/dist/{projectBucket-De0MQeNj.mjs.map → projectBucket-p6F4RuBz.mjs.map} +1 -1
- package/dist/{publish-k38S418e.mjs → publish-BHDG4BpU.mjs} +2 -2
- package/dist/{publish-k38S418e.mjs.map → publish-BHDG4BpU.mjs.map} +1 -1
- package/dist/{publish-CohTrVKe.cjs → publish-DuxiXHdX.cjs} +2 -2
- package/dist/{publish-CohTrVKe.cjs.map → publish-DuxiXHdX.cjs.map} +1 -1
- package/dist/{resolve-YMxlYJtO.mjs → resolve-BeQfBSEY.mjs} +4 -4
- package/dist/{resolve-YMxlYJtO.mjs.map → resolve-BeQfBSEY.mjs.map} +1 -1
- package/dist/{resolve-Cr3Qj8ch.cjs → resolve-C8nXwVaN.cjs} +4 -4
- package/dist/{resolve-Cr3Qj8ch.cjs.map → resolve-C8nXwVaN.cjs.map} +1 -1
- package/dist/{rollback-eyqvtzW_.cjs → rollback-BjZiMp-q.cjs} +5 -5
- package/dist/{rollback-eyqvtzW_.cjs.map → rollback-BjZiMp-q.cjs.map} +1 -1
- package/dist/{rollback-DIoyVrQI.mjs → rollback-Cjb-B6EE.mjs} +5 -5
- package/dist/{rollback-DIoyVrQI.mjs.map → rollback-Cjb-B6EE.mjs.map} +1 -1
- package/dist/{s3-Cl3tRemt.mjs → s3-DIdC6s_w.mjs} +2 -2
- package/dist/{s3-Cl3tRemt.mjs.map → s3-DIdC6s_w.mjs.map} +1 -1
- package/dist/{s3-CegRM8Sa.cjs → s3-TVjKnrNI.cjs} +2 -2
- package/dist/{s3-CegRM8Sa.cjs.map → s3-TVjKnrNI.cjs.map} +1 -1
- package/dist/{serverSetup-BwfMgz3W.cjs → serverSetup-CBuIdnai.cjs} +5 -5
- package/dist/{serverSetup-BwfMgz3W.cjs.map → serverSetup-CBuIdnai.cjs.map} +1 -1
- package/dist/{serverSetup-fQwkJ_EI.mjs → serverSetup-D-GxmelJ.mjs} +5 -5
- package/dist/{serverSetup-fQwkJ_EI.mjs.map → serverSetup-D-GxmelJ.mjs.map} +1 -1
- package/dist/{sniffer-FF7mfuR8.mjs → sniffer-CsGTdVPU.mjs} +6 -6
- package/dist/{sniffer-FF7mfuR8.mjs.map → sniffer-CsGTdVPU.mjs.map} +1 -1
- package/dist/{sniffer-BgdVvvzU.cjs → sniffer-D5e7wfCY.cjs} +6 -6
- package/dist/{sniffer-BgdVvvzU.cjs.map → sniffer-D5e7wfCY.cjs.map} +1 -1
- package/dist/{snsSubscriptions-DUY-Tu6J.cjs → snsSubscriptions-BQhty6C4.cjs} +2 -2
- package/dist/{snsSubscriptions-DUY-Tu6J.cjs.map → snsSubscriptions-BQhty6C4.cjs.map} +1 -1
- package/dist/{snsSubscriptions-B_WH4o1S.mjs → snsSubscriptions-CM6Nt0LA.mjs} +2 -2
- package/dist/{snsSubscriptions-B_WH4o1S.mjs.map → snsSubscriptions-CM6Nt0LA.mjs.map} +1 -1
- package/dist/{sst-BkTtncop.mjs → sst-BTGhWE7P.mjs} +4 -4
- package/dist/{sst-BkTtncop.mjs.map → sst-BTGhWE7P.mjs.map} +1 -1
- package/dist/{sst-BEXeTgDQ.cjs → sst-D8CkxxJw.cjs} +4 -4
- package/dist/{sst-BEXeTgDQ.cjs.map → sst-D8CkxxJw.cjs.map} +1 -1
- package/dist/{stack-CqfBL5LA.mjs → stack-CixS_Cl_.mjs} +66 -373
- package/dist/stack-CixS_Cl_.mjs.map +1 -0
- package/dist/{stack-CcFgY4sJ.cjs → stack-WvoaO-LP.cjs} +68 -447
- package/dist/stack-WvoaO-LP.cjs.map +1 -0
- package/dist/{stage-4ZtteXz8.mjs → stage-B9pNkpNb.mjs} +16 -13
- package/dist/stage-B9pNkpNb.mjs.map +1 -0
- package/dist/{stage-C19XRx7W.cjs → stage-BgVVIkAt.cjs} +17 -14
- package/dist/stage-BgVVIkAt.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-EbVciuKO.mjs} +2 -2
- package/dist/{terminal-KVX_MmCR.mjs.map → terminal-EbVciuKO.mjs.map} +1 -1
- package/dist/{terminal-BkyVVOb-.cjs → terminal-b15JatW5.cjs} +2 -2
- package/dist/{terminal-BkyVVOb-.cjs.map → terminal-b15JatW5.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/compose-CZU60dwb.mjs.map +0 -1
- package/dist/compose-CnNmDNph.cjs.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-D4_8P1n4.cjs");
|
|
4
4
|
const require_workspace = require("./workspace-1szcahj9.cjs");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const require_apps = require("./apps-DwSctcdn.cjs");
|
|
6
|
+
const require_compose = require("./compose-DwDO8HCV.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-BUcrKh85.cjs");
|
|
11
|
+
const require_docker = require("./docker-Dh_6VdKL.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
|
}
|
|
@@ -786,17 +470,29 @@ function saltFor(password) {
|
|
|
786
470
|
* project (`<project>-api`), because the network is shared: a bare service
|
|
787
471
|
* name there would be answered by every stack's `api`.
|
|
788
472
|
*
|
|
789
|
-
* Pure
|
|
473
|
+
* Pure but for the edge's name, read from the environment once (see
|
|
474
|
+
* {@link EDGE_PROJECT_ENV}): the documents are data, and the edge's side
|
|
475
|
+
* effects are `edge.ts`'s.
|
|
790
476
|
*/
|
|
791
477
|
/**
|
|
792
478
|
* The image, pinned: the edge is every stack's way in, so a new version is a
|
|
793
479
|
* change to this line, not whatever `latest` is on the day a server starts.
|
|
794
480
|
*/
|
|
795
481
|
const TRAEFIK_IMAGE = "traefik:v3.7.13";
|
|
796
|
-
/** The edge's compose project
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
482
|
+
/** The edge's compose project: `GKM_EDGE_PROJECT`, else `gkm-edge`. */
|
|
483
|
+
function edgeProject(env = process.env) {
|
|
484
|
+
return env["GKM_EDGE_PROJECT"] || "gkm-edge";
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* The edge's compose project, one per server — read once, when gkm starts,
|
|
488
|
+
* so every step of a run names the same edge.
|
|
489
|
+
*/
|
|
490
|
+
const EDGE_PROJECT = edgeProject();
|
|
491
|
+
/**
|
|
492
|
+
* The external network the edge and every stack's public services share:
|
|
493
|
+
* named after the edge, so a renamed edge has a network of its own.
|
|
494
|
+
*/
|
|
495
|
+
const EDGE_NETWORK = EDGE_PROJECT;
|
|
800
496
|
/** The edge's compose service. */
|
|
801
497
|
const EDGE_SERVICE = "traefik";
|
|
802
498
|
/** Inside the edge's container: what it watches, and where certificates are. */
|
|
@@ -925,7 +621,7 @@ function edgeCompose(options) {
|
|
|
925
621
|
}
|
|
926
622
|
/** A stack's dynamic configuration, as an object. */
|
|
927
623
|
function traefikDynamic(routes, options) {
|
|
928
|
-
const { project, tls } = options;
|
|
624
|
+
const { project, tls, edgeToken } = options;
|
|
929
625
|
const name = (route, suffix) => `${project}-${route.name}${suffix ? `-${suffix}` : ""}`;
|
|
930
626
|
const url = ({ service, port }) => `http://${edgeAlias(project, service)}:${port}`;
|
|
931
627
|
const routers = {};
|
|
@@ -967,14 +663,23 @@ function traefikDynamic(routes, options) {
|
|
|
967
663
|
};
|
|
968
664
|
services[handlerName] = { loadBalancer: { servers: handler.upstreams.map((upstream) => ({ url: url(upstream) })) } };
|
|
969
665
|
}
|
|
666
|
+
const rule = `${hostRule(route)}${paths}${header}`;
|
|
970
667
|
routers[name(route)] = {
|
|
971
|
-
rule
|
|
668
|
+
rule,
|
|
972
669
|
...route.wildcard ? { priority: 1 } : {},
|
|
973
670
|
entryPoints: ["websecure"],
|
|
974
671
|
service: name(route),
|
|
975
672
|
middlewares: chain,
|
|
976
673
|
tls: certificate()
|
|
977
674
|
};
|
|
675
|
+
if (edgeToken && !route.prefix) routers[name(route, "stack")] = {
|
|
676
|
+
rule: `${rule} && Header(\`${_geekmidas_manifest.EDGE_TOKEN_HEADER}\`, \`${edgeToken}\`)`,
|
|
677
|
+
...route.wildcard ? { priority: 2 } : {},
|
|
678
|
+
entryPoints: ["websecure"],
|
|
679
|
+
service: name(route),
|
|
680
|
+
...chain.length > 1 ? { middlewares: chain.slice(1) } : {},
|
|
681
|
+
tls: certificate()
|
|
682
|
+
};
|
|
978
683
|
services[name(route)] = { loadBalancer: {
|
|
979
684
|
servers: route.upstreams.map((upstream) => ({ url: url(upstream) })),
|
|
980
685
|
...route.prefix ? { passHostHeader: false } : {},
|
|
@@ -1043,16 +748,17 @@ function yaml$1(value) {
|
|
|
1043
748
|
* The stack a workspace runs as for one stage — pure.
|
|
1044
749
|
*
|
|
1045
750
|
* Everything `gkm compose` writes is decided here, as data: the compose file,
|
|
1046
|
-
* the Caddyfile, one env file per
|
|
751
|
+
* the Caddyfile, one env file per process that reads one — each backend,
|
|
752
|
+
* worker and site that runs a server — and the image each app runs. The
|
|
1047
753
|
* command around it reads the workspace, asks the registry, writes the files
|
|
1048
754
|
* and starts Docker; none of those decide anything, so all of it can be
|
|
1049
755
|
* asserted without a daemon.
|
|
1050
756
|
*
|
|
1051
757
|
* 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
|
|
758
|
+
* plan is reconcile's `planFor`, the keys a process reads are
|
|
759
|
+
* `processEnvKeys` — the rule `gkm dev` and `gkm exec` apply — and every URL
|
|
760
|
+
* is `envFor`'s, with each app at its public address: a browser and a sibling
|
|
761
|
+
* service reach an API by the same name, through the edge.
|
|
1056
762
|
*/
|
|
1057
763
|
/** Where a stack's files are written, relative to the workspace root. */
|
|
1058
764
|
function stackDir(stage) {
|
|
@@ -1556,12 +1262,6 @@ function composeStack(input) {
|
|
|
1556
1262
|
...derivation,
|
|
1557
1263
|
addresses: publicAddresses
|
|
1558
1264
|
}, 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
1265
|
/**
|
|
1566
1266
|
* What a key resolves to for one app, from the stage's secrets where only
|
|
1567
1267
|
* they can hold it, and the derivations otherwise.
|
|
@@ -1596,8 +1296,6 @@ function composeStack(input) {
|
|
|
1596
1296
|
if (custom[key] !== void 0) return custom[key];
|
|
1597
1297
|
if (owner?.kind === "cache") return redis?.urls[key];
|
|
1598
1298
|
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
1299
|
return outside[key];
|
|
1602
1300
|
};
|
|
1603
1301
|
const telemetryValues = logs ? require_workspace.telemetryEnv({
|
|
@@ -1620,28 +1318,21 @@ function composeStack(input) {
|
|
|
1620
1318
|
}
|
|
1621
1319
|
return values;
|
|
1622
1320
|
};
|
|
1321
|
+
const stageKeys = Object.keys(custom);
|
|
1623
1322
|
for (const app of apps) {
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
if (site?.kind !== "site") continue;
|
|
1323
|
+
const site = manifest[app.id];
|
|
1324
|
+
if (site?.kind === "site") {
|
|
1627
1325
|
const args = require_apps.publicBuildValues(site, manifest, (key) => valueFor(app, key, owners.get(key)), custom);
|
|
1628
1326
|
if (app.build && Object.keys(args).length > 0) app.build.args = args;
|
|
1629
1327
|
const offline = require_apps.offlineBuildHosts(site, manifest, (key) => valueFor(app, key, owners.get(key)));
|
|
1630
1328
|
if (app.build && offline.length > 0) app.build.offlineHosts = offline;
|
|
1631
|
-
continue;
|
|
1329
|
+
if (!app.runtime) continue;
|
|
1632
1330
|
}
|
|
1633
1331
|
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
|
-
}
|
|
1332
|
+
const values = valuesFor(app, require_apps.processEnvKeys(manifest, { app: app.name }, stageKeys) ?? /* @__PURE__ */ new Set());
|
|
1642
1333
|
app.env = {
|
|
1643
1334
|
...require_apps.scopeTelemetryEnv(values, {
|
|
1644
|
-
uses: require_apps.telemetryOf(manifest, app.id) !== void 0,
|
|
1335
|
+
uses: app.kind !== "site" && require_apps.telemetryOf(manifest, app.id) !== void 0,
|
|
1645
1336
|
serviceName: app.name,
|
|
1646
1337
|
...telemetryValues ? { telemetry: telemetryValues } : {}
|
|
1647
1338
|
}),
|
|
@@ -1666,7 +1357,7 @@ function composeStack(input) {
|
|
|
1666
1357
|
});
|
|
1667
1358
|
}
|
|
1668
1359
|
for (const worker of input.buildOnly ? [] : workers) {
|
|
1669
|
-
const keys = require_apps.
|
|
1360
|
+
const keys = require_apps.processEnvKeys(manifest, { workers: [worker.id] }, stageKeys) ?? /* @__PURE__ */ new Set();
|
|
1670
1361
|
const resolved = valuesFor({
|
|
1671
1362
|
name: worker.name,
|
|
1672
1363
|
id: worker.id,
|
|
@@ -1708,17 +1399,17 @@ function composeStack(input) {
|
|
|
1708
1399
|
};
|
|
1709
1400
|
else if (!local && !input.buildOnly) {
|
|
1710
1401
|
if (!domain) throw new require_compose.NoDomainForStage(stage);
|
|
1711
|
-
const key =
|
|
1402
|
+
const key = require_apps.originSecretKey(unit.id);
|
|
1712
1403
|
const secret = custom[key];
|
|
1713
1404
|
if (!secret) throw new ProcessorOriginSecretMissing(unit.id, key, stage);
|
|
1714
1405
|
unit.origin = {
|
|
1715
|
-
host:
|
|
1406
|
+
host: require_apps.processorOriginHost(unit.id, domain),
|
|
1716
1407
|
secret
|
|
1717
1408
|
};
|
|
1718
1409
|
}
|
|
1719
1410
|
if (proxy === "traefik" && (served || unit.origin)) edgeServices.add(unit.name);
|
|
1720
1411
|
if (input.buildOnly) continue;
|
|
1721
|
-
const keys = require_apps.
|
|
1412
|
+
const keys = require_apps.processEnvKeys(manifest, { processors: [unit.id] }, stageKeys) ?? /* @__PURE__ */ new Set();
|
|
1722
1413
|
unit.env = {
|
|
1723
1414
|
...require_apps.scopeTelemetryEnv(valuesFor({
|
|
1724
1415
|
name: unit.name,
|
|
@@ -1766,8 +1457,8 @@ function composeStack(input) {
|
|
|
1766
1457
|
} : { kind: "acme" };
|
|
1767
1458
|
const authority = local && !certificate ? input.localAuthority ?? require_apps.localAuthorityPaths() : void 0;
|
|
1768
1459
|
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({
|
|
1460
|
+
const backupsChoice = input.buildOnly ? void 0 : require_apps.stageBackups(workspace, manifest, stage);
|
|
1461
|
+
const backups = backupsChoice?.mode === "on" && infra.includes("postgres") ? require_apps.stackBackups({
|
|
1771
1462
|
workspace,
|
|
1772
1463
|
stage,
|
|
1773
1464
|
project,
|
|
@@ -1820,7 +1511,7 @@ function composeStack(input) {
|
|
|
1820
1511
|
streaming: false,
|
|
1821
1512
|
prefixes,
|
|
1822
1513
|
requireHeader: {
|
|
1823
|
-
name:
|
|
1514
|
+
name: require_apps.ORIGIN_VERIFY_HEADER,
|
|
1824
1515
|
value: origin.secret
|
|
1825
1516
|
},
|
|
1826
1517
|
health: "/health"
|
|
@@ -1946,10 +1637,12 @@ function composeStack(input) {
|
|
|
1946
1637
|
} } : {},
|
|
1947
1638
|
...proxy === "caddy" ? { caddyfile: edgeCaddyfile(routes, {
|
|
1948
1639
|
tls,
|
|
1640
|
+
edgeToken: outside[_geekmidas_manifest.EDGE_TOKEN_KEY],
|
|
1949
1641
|
...local ? { redirects: false } : {}
|
|
1950
1642
|
}) } : { traefik: traefikDynamicFile(routes, {
|
|
1951
1643
|
project,
|
|
1952
|
-
tls
|
|
1644
|
+
tls,
|
|
1645
|
+
edgeToken: outside[_geekmidas_manifest.EDGE_TOKEN_KEY]
|
|
1953
1646
|
}) },
|
|
1954
1647
|
...certificate ? { tls: certificate } : {},
|
|
1955
1648
|
dockerfiles,
|
|
@@ -1994,7 +1687,8 @@ function stackApps(workspace, manifest, plan, options) {
|
|
|
1994
1687
|
const resource = resources.get(id);
|
|
1995
1688
|
if (!app || !resource || !app.port) continue;
|
|
1996
1689
|
const host = hostOf(name, app, workspace, resource, options);
|
|
1997
|
-
const
|
|
1690
|
+
const site = declaration.kind === "site";
|
|
1691
|
+
const tag = site ? siteTag(options.images.tag, options.stage) : options.images.tag;
|
|
1998
1692
|
const ref = require_docker.validateImageRef(require_credentials.imageRef(options.identity, name, options.images.registry, tag));
|
|
1999
1693
|
apps.push({
|
|
2000
1694
|
app: name,
|
|
@@ -2003,6 +1697,7 @@ function stackApps(workspace, manifest, plan, options) {
|
|
|
2003
1697
|
kind: declaration.kind,
|
|
2004
1698
|
...declaration.kind === "site" ? { variant: declaration.variant } : {},
|
|
2005
1699
|
replicas: declaration.kind === "websocket-api" ? declaration.replicas ?? 1 : 1,
|
|
1700
|
+
runtime: !site || require_apps.runsServer(declaration),
|
|
2006
1701
|
path: app.path,
|
|
2007
1702
|
port: app.port,
|
|
2008
1703
|
host,
|
|
@@ -2297,7 +1992,7 @@ function stackFile(options) {
|
|
|
2297
1992
|
};
|
|
2298
1993
|
if (services["redis"] && options.redis) services[require_compose.REDIS_SERVICE] = require_compose.redisService(options.redis);
|
|
2299
1994
|
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);
|
|
1995
|
+
if (options.backups) services[require_apps.BACKUPS_SERVICE] = require_apps.backupsService(options.backups, options.envFiles);
|
|
2301
1996
|
for (const app of apps) {
|
|
2302
1997
|
const definition = {
|
|
2303
1998
|
image: app.ref,
|
|
@@ -2312,13 +2007,11 @@ function stackFile(options) {
|
|
|
2312
2007
|
...app.build.offlineHosts ? { extra_hosts: app.build.offlineHosts.map((host) => `${host}:${require_apps.OFFLINE_BUILD_ADDRESS}`) } : {}
|
|
2313
2008
|
} } : {},
|
|
2314
2009
|
restart: "unless-stopped",
|
|
2315
|
-
...app.
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
...infra.length ? { depends_on: Object.fromEntries(infra.map((name) => [name, HEALTHY])) } : {}
|
|
2321
|
-
} : {},
|
|
2010
|
+
...app.runtime ? { env_file: [{
|
|
2011
|
+
path: `./${app.name}.env`,
|
|
2012
|
+
format: "raw"
|
|
2013
|
+
}] } : {},
|
|
2014
|
+
...app.kind !== "site" && infra.length ? { depends_on: Object.fromEntries(infra.map((name) => [name, HEALTHY])) } : {},
|
|
2322
2015
|
healthcheck: probe(app.port, app.kind === "site" ? "/" : "/health"),
|
|
2323
2016
|
...app.kind === "websocket-api" ? { ulimits: { nofile: NOFILE } } : {}
|
|
2324
2017
|
};
|
|
@@ -2428,18 +2121,6 @@ function envFile(env) {
|
|
|
2428
2121
|
return `${Object.entries(env).sort(([a], [b]) => a.localeCompare(b)).map(([key, value]) => `${key}=${value}`).join("\n")}\n`;
|
|
2429
2122
|
}
|
|
2430
2123
|
//#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
2124
|
Object.defineProperty(exports, "EDGE_AWS_CREDENTIALS", {
|
|
2444
2125
|
enumerable: true,
|
|
2445
2126
|
get: function() {
|
|
@@ -2500,12 +2181,6 @@ Object.defineProperty(exports, "LOOPBACK_SERVICES", {
|
|
|
2500
2181
|
return LOOPBACK_SERVICES;
|
|
2501
2182
|
}
|
|
2502
2183
|
});
|
|
2503
|
-
Object.defineProperty(exports, "RUNNER_PATH", {
|
|
2504
|
-
enumerable: true,
|
|
2505
|
-
get: function() {
|
|
2506
|
-
return RUNNER_PATH;
|
|
2507
|
-
}
|
|
2508
|
-
});
|
|
2509
2184
|
Object.defineProperty(exports, "RegistryRequired", {
|
|
2510
2185
|
enumerable: true,
|
|
2511
2186
|
get: function() {
|
|
@@ -2524,36 +2199,6 @@ Object.defineProperty(exports, "assertSitePasswords", {
|
|
|
2524
2199
|
return assertSitePasswords;
|
|
2525
2200
|
}
|
|
2526
2201
|
});
|
|
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
2202
|
Object.defineProperty(exports, "composeProject", {
|
|
2558
2203
|
enumerable: true,
|
|
2559
2204
|
get: function() {
|
|
@@ -2572,24 +2217,12 @@ Object.defineProperty(exports, "deployedInboxEnv", {
|
|
|
2572
2217
|
return deployedInboxEnv;
|
|
2573
2218
|
}
|
|
2574
2219
|
});
|
|
2575
|
-
Object.defineProperty(exports, "deploysWithCompose", {
|
|
2576
|
-
enumerable: true,
|
|
2577
|
-
get: function() {
|
|
2578
|
-
return deploysWithCompose;
|
|
2579
|
-
}
|
|
2580
|
-
});
|
|
2581
2220
|
Object.defineProperty(exports, "derivedCredentials", {
|
|
2582
2221
|
enumerable: true,
|
|
2583
2222
|
get: function() {
|
|
2584
2223
|
return derivedCredentials;
|
|
2585
2224
|
}
|
|
2586
2225
|
});
|
|
2587
|
-
Object.defineProperty(exports, "edgeAlias", {
|
|
2588
|
-
enumerable: true,
|
|
2589
|
-
get: function() {
|
|
2590
|
-
return edgeAlias;
|
|
2591
|
-
}
|
|
2592
|
-
});
|
|
2593
2226
|
Object.defineProperty(exports, "edgeComposeFile", {
|
|
2594
2227
|
enumerable: true,
|
|
2595
2228
|
get: function() {
|
|
@@ -2626,12 +2259,6 @@ Object.defineProperty(exports, "replicaNames", {
|
|
|
2626
2259
|
return replicaNames;
|
|
2627
2260
|
}
|
|
2628
2261
|
});
|
|
2629
|
-
Object.defineProperty(exports, "runTime", {
|
|
2630
|
-
enumerable: true,
|
|
2631
|
-
get: function() {
|
|
2632
|
-
return runTime;
|
|
2633
|
-
}
|
|
2634
|
-
});
|
|
2635
2262
|
Object.defineProperty(exports, "stackDir", {
|
|
2636
2263
|
enumerable: true,
|
|
2637
2264
|
get: function() {
|
|
@@ -2644,12 +2271,6 @@ Object.defineProperty(exports, "stackPlan", {
|
|
|
2644
2271
|
return stackPlan;
|
|
2645
2272
|
}
|
|
2646
2273
|
});
|
|
2647
|
-
Object.defineProperty(exports, "stageBackups", {
|
|
2648
|
-
enumerable: true,
|
|
2649
|
-
get: function() {
|
|
2650
|
-
return stageBackups;
|
|
2651
|
-
}
|
|
2652
|
-
});
|
|
2653
2274
|
Object.defineProperty(exports, "traefikStaticFile", {
|
|
2654
2275
|
enumerable: true,
|
|
2655
2276
|
get: function() {
|
|
@@ -2663,4 +2284,4 @@ Object.defineProperty(exports, "withCaddyConfigs", {
|
|
|
2663
2284
|
}
|
|
2664
2285
|
});
|
|
2665
2286
|
|
|
2666
|
-
//# sourceMappingURL=stack-
|
|
2287
|
+
//# sourceMappingURL=stack-WvoaO-LP.cjs.map
|