redkite 0.1.6
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/LICENSE +21 -0
- package/README.md +819 -0
- package/bin/redkite.mjs +12 -0
- package/dist/build.d.ts +27 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/build.js +132 -0
- package/dist/build.js.map +1 -0
- package/dist/checks.d.ts +4 -0
- package/dist/checks.d.ts.map +1 -0
- package/dist/checks.js +49 -0
- package/dist/checks.js.map +1 -0
- package/dist/cli/agent.d.ts +2 -0
- package/dist/cli/agent.d.ts.map +1 -0
- package/dist/cli/agent.js +24 -0
- package/dist/cli/agent.js.map +1 -0
- package/dist/cli/config.d.ts +5 -0
- package/dist/cli/config.d.ts.map +1 -0
- package/dist/cli/config.js +217 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/index.d.ts +11 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +438 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/log.d.ts +9 -0
- package/dist/cli/log.d.ts.map +1 -0
- package/dist/cli/log.js +128 -0
- package/dist/cli/log.js.map +1 -0
- package/dist/cli/screen.d.ts +34 -0
- package/dist/cli/screen.d.ts.map +1 -0
- package/dist/cli/screen.js +298 -0
- package/dist/cli/screen.js.map +1 -0
- package/dist/cli/viewer.d.ts +9 -0
- package/dist/cli/viewer.d.ts.map +1 -0
- package/dist/cli/viewer.js +139 -0
- package/dist/cli/viewer.js.map +1 -0
- package/dist/config.d.ts +7 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +79 -0
- package/dist/config.js.map +1 -0
- package/dist/deploy.d.ts +19 -0
- package/dist/deploy.d.ts.map +1 -0
- package/dist/deploy.js +275 -0
- package/dist/deploy.js.map +1 -0
- package/dist/docker.d.ts +96 -0
- package/dist/docker.d.ts.map +1 -0
- package/dist/docker.js +325 -0
- package/dist/docker.js.map +1 -0
- package/dist/dockerfile.d.ts +14 -0
- package/dist/dockerfile.d.ts.map +1 -0
- package/dist/dockerfile.js +160 -0
- package/dist/dockerfile.js.map +1 -0
- package/dist/health.d.ts +13 -0
- package/dist/health.d.ts.map +1 -0
- package/dist/health.js +54 -0
- package/dist/health.js.map +1 -0
- package/dist/host.d.ts +21 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +27 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/layout.d.ts +5 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +45 -0
- package/dist/layout.js.map +1 -0
- package/dist/localHost.d.ts +7 -0
- package/dist/localHost.d.ts.map +1 -0
- package/dist/localHost.js +32 -0
- package/dist/localHost.js.map +1 -0
- package/dist/log.d.ts +14 -0
- package/dist/log.d.ts.map +1 -0
- package/dist/log.js +15 -0
- package/dist/log.js.map +1 -0
- package/dist/nginx.d.ts +4 -0
- package/dist/nginx.d.ts.map +1 -0
- package/dist/nginx.js +53 -0
- package/dist/nginx.js.map +1 -0
- package/dist/pipeline.d.ts +103 -0
- package/dist/pipeline.d.ts.map +1 -0
- package/dist/pipeline.js +142 -0
- package/dist/pipeline.js.map +1 -0
- package/dist/presets/index.d.ts +3 -0
- package/dist/presets/index.d.ts.map +1 -0
- package/dist/presets/index.js +3 -0
- package/dist/presets/index.js.map +1 -0
- package/dist/presets/nextApp.d.ts +15 -0
- package/dist/presets/nextApp.d.ts.map +1 -0
- package/dist/presets/nextApp.js +53 -0
- package/dist/presets/nextApp.js.map +1 -0
- package/dist/presets/nodeApp.d.ts +19 -0
- package/dist/presets/nodeApp.d.ts.map +1 -0
- package/dist/presets/nodeApp.js +29 -0
- package/dist/presets/nodeApp.js.map +1 -0
- package/dist/secrets/bitwarden.d.ts +3 -0
- package/dist/secrets/bitwarden.d.ts.map +1 -0
- package/dist/secrets/bitwarden.js +6 -0
- package/dist/secrets/bitwarden.js.map +1 -0
- package/dist/secrets/refs.d.ts +9 -0
- package/dist/secrets/refs.d.ts.map +1 -0
- package/dist/secrets/refs.js +20 -0
- package/dist/secrets/refs.js.map +1 -0
- package/dist/secrets/store.d.ts +9 -0
- package/dist/secrets/store.d.ts.map +1 -0
- package/dist/secrets/store.js +104 -0
- package/dist/secrets/store.js.map +1 -0
- package/dist/services/ensure.d.ts +18 -0
- package/dist/services/ensure.d.ts.map +1 -0
- package/dist/services/ensure.js +93 -0
- package/dist/services/ensure.js.map +1 -0
- package/dist/services/index.d.ts +19 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +27 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/planned.d.ts +20 -0
- package/dist/services/planned.d.ts.map +1 -0
- package/dist/services/planned.js +77 -0
- package/dist/services/planned.js.map +1 -0
- package/dist/shell.d.ts +11 -0
- package/dist/shell.d.ts.map +1 -0
- package/dist/shell.js +65 -0
- package/dist/shell.js.map +1 -0
- package/dist/source.d.ts +16 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +108 -0
- package/dist/source.js.map +1 -0
- package/dist/sshHost.d.ts +15 -0
- package/dist/sshHost.d.ts.map +1 -0
- package/dist/sshHost.js +91 -0
- package/dist/sshHost.js.map +1 -0
- package/dist/steps.d.ts +27 -0
- package/dist/steps.d.ts.map +1 -0
- package/dist/steps.js +69 -0
- package/dist/steps.js.map +1 -0
- package/dist/topology.d.ts +40 -0
- package/dist/topology.d.ts.map +1 -0
- package/dist/topology.js +113 -0
- package/dist/topology.js.map +1 -0
- package/dist/types.d.ts +100 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +64 -0
- package/src/build.ts +236 -0
- package/src/checks.ts +65 -0
- package/src/cli/agent.ts +28 -0
- package/src/cli/config.ts +275 -0
- package/src/cli/index.ts +559 -0
- package/src/cli/log.ts +168 -0
- package/src/cli/screen.ts +409 -0
- package/src/cli/viewer.ts +192 -0
- package/src/config.ts +90 -0
- package/src/deploy.ts +409 -0
- package/src/docker.ts +433 -0
- package/src/dockerfile.ts +228 -0
- package/src/health.ts +83 -0
- package/src/host.ts +54 -0
- package/src/index.ts +25 -0
- package/src/layout.ts +41 -0
- package/src/localHost.ts +50 -0
- package/src/log.ts +38 -0
- package/src/nginx.ts +63 -0
- package/src/pipeline.ts +335 -0
- package/src/presets/index.ts +2 -0
- package/src/presets/nextApp.ts +70 -0
- package/src/presets/nodeApp.ts +46 -0
- package/src/secrets/bitwarden.ts +7 -0
- package/src/secrets/refs.ts +32 -0
- package/src/secrets/store.ts +147 -0
- package/src/services/ensure.ts +160 -0
- package/src/services/index.ts +48 -0
- package/src/services/planned.ts +119 -0
- package/src/shell.ts +95 -0
- package/src/source.ts +171 -0
- package/src/sshHost.ts +145 -0
- package/src/steps.ts +101 -0
- package/src/topology.ts +199 -0
- package/src/types.ts +243 -0
package/dist/host.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// The machine the containers run on. Every command a deploy issues goes through
|
|
2
|
+
// this, so the rest of the library is exercised against a recorder rather than
|
|
3
|
+
// against a host. Two implementations: one over ssh, one on this machine.
|
|
4
|
+
// A streamed command keeps this many lines, so a build that prints tens of
|
|
5
|
+
// megabytes still fits in the error a failure reports
|
|
6
|
+
const TAIL = 200;
|
|
7
|
+
export function tail(lines) {
|
|
8
|
+
return lines.slice(-TAIL).join("\n");
|
|
9
|
+
}
|
|
10
|
+
// Splits a chunked stream into lines, holding the partial last one back
|
|
11
|
+
export function lineReader(onLine) {
|
|
12
|
+
let rest = "";
|
|
13
|
+
return {
|
|
14
|
+
push(chunk) {
|
|
15
|
+
const parts = (rest + chunk).split("\n");
|
|
16
|
+
rest = parts.pop() ?? "";
|
|
17
|
+
for (const line of parts)
|
|
18
|
+
onLine(line);
|
|
19
|
+
},
|
|
20
|
+
flush() {
|
|
21
|
+
if (rest)
|
|
22
|
+
onLine(rest);
|
|
23
|
+
rest = "";
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=host.js.map
|
package/dist/host.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.js","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,+EAA+E;AAC/E,0EAA0E;AA4B1E,2EAA2E;AAC3E,sDAAsD;AACtD,MAAM,IAAI,GAAG,GAAG,CAAC;AAEjB,MAAM,UAAU,IAAI,CAAC,KAAe;IAClC,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,UAAU,CAAC,MAAc;IACvC,IAAI,IAAI,GAAG,EAAE,CAAC;IAEd,OAAO;QACL,IAAI,CAAC,KAAa;YAChB,MAAM,KAAK,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACzC,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;YACzB,KAAK,MAAM,IAAI,IAAI,KAAK;gBAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QACzC,CAAC;QACD,KAAK;YACH,IAAI,IAAI;gBAAE,MAAM,CAAC,IAAI,CAAC,CAAC;YACvB,IAAI,GAAG,EAAE,CAAC;QACZ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export * from "./build.js";
|
|
2
|
+
export * from "./config.js";
|
|
3
|
+
export * from "./deploy.js";
|
|
4
|
+
export * from "./docker.js";
|
|
5
|
+
export * from "./dockerfile.js";
|
|
6
|
+
export * from "./health.js";
|
|
7
|
+
export * from "./host.js";
|
|
8
|
+
export * from "./layout.js";
|
|
9
|
+
export * from "./localHost.js";
|
|
10
|
+
export * from "./log.js";
|
|
11
|
+
export * from "./nginx.js";
|
|
12
|
+
export * from "./pipeline.js";
|
|
13
|
+
export * from "./presets/index.js";
|
|
14
|
+
export * from "./secrets/bitwarden.js";
|
|
15
|
+
export * from "./secrets/refs.js";
|
|
16
|
+
export * from "./secrets/store.js";
|
|
17
|
+
export * from "./shell.js";
|
|
18
|
+
export * from "./services/ensure.js";
|
|
19
|
+
export * from "./services/index.js";
|
|
20
|
+
export * from "./services/planned.js";
|
|
21
|
+
export * from "./source.js";
|
|
22
|
+
export * from "./sshHost.js";
|
|
23
|
+
export * from "./steps.js";
|
|
24
|
+
export * from "./topology.js";
|
|
25
|
+
export * from "./types.js";
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export * from "./build.js";
|
|
2
|
+
export * from "./config.js";
|
|
3
|
+
export * from "./deploy.js";
|
|
4
|
+
export * from "./docker.js";
|
|
5
|
+
export * from "./dockerfile.js";
|
|
6
|
+
export * from "./health.js";
|
|
7
|
+
export * from "./host.js";
|
|
8
|
+
export * from "./layout.js";
|
|
9
|
+
export * from "./localHost.js";
|
|
10
|
+
export * from "./log.js";
|
|
11
|
+
export * from "./nginx.js";
|
|
12
|
+
export * from "./pipeline.js";
|
|
13
|
+
export * from "./presets/index.js";
|
|
14
|
+
export * from "./secrets/bitwarden.js";
|
|
15
|
+
export * from "./secrets/refs.js";
|
|
16
|
+
export * from "./secrets/store.js";
|
|
17
|
+
export * from "./shell.js";
|
|
18
|
+
export * from "./services/ensure.js";
|
|
19
|
+
export * from "./services/index.js";
|
|
20
|
+
export * from "./services/planned.js";
|
|
21
|
+
export * from "./source.js";
|
|
22
|
+
export * from "./sshHost.js";
|
|
23
|
+
export * from "./steps.js";
|
|
24
|
+
export * from "./topology.js";
|
|
25
|
+
export * from "./types.js";
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
|
package/dist/layout.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function mountFor(name: string, dir?: string): string;
|
|
2
|
+
export declare function appRoot(dir?: string): string;
|
|
3
|
+
export declare function rootedAt(path: string, dir?: string): string;
|
|
4
|
+
export declare function destinationFor(path: string, output: string): string;
|
|
5
|
+
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAOA,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,UAWlD;AAID,wBAAgB,OAAO,CAAC,GAAG,CAAC,EAAE,MAAM,UAEnC;AAID,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,UAGlD;AAMD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAG1D"}
|
package/dist/layout.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Where a cache is mounted and where a carried directory lands. The renderer
|
|
2
|
+
// and the topology have to agree on these, and a second copy of them is a
|
|
3
|
+
// drift waiting to happen.
|
|
4
|
+
// A package manager's own cache is global; everything else is a path inside the
|
|
5
|
+
// project. Both managers are listed because a preset does not know which the
|
|
6
|
+
// repository uses, and mounting the wrong one is a cache that never hits
|
|
7
|
+
export function mountFor(name, dir) {
|
|
8
|
+
if (name === "yarn")
|
|
9
|
+
return "/root/.yarn";
|
|
10
|
+
if (name === "npm")
|
|
11
|
+
return "/root/.npm";
|
|
12
|
+
// A workspace resolves one lockfile at the repository root and hoists there
|
|
13
|
+
if (name === "modules")
|
|
14
|
+
return "/app/node_modules";
|
|
15
|
+
// An app that installs against its own manifest puts them beside it instead.
|
|
16
|
+
// Both are mounted, because only the install command knows which it does, and
|
|
17
|
+
// mounting the wrong one alone is a cache that never hits
|
|
18
|
+
if (name === "app-modules")
|
|
19
|
+
return `${appRoot(dir)}/node_modules`;
|
|
20
|
+
if (name === "next-app")
|
|
21
|
+
return rootedAt("/app/.next/cache", dir);
|
|
22
|
+
return rootedAt(`/app/.cache/${name}`, dir);
|
|
23
|
+
}
|
|
24
|
+
// Where the app itself sits. The whole repository is copied to /app, and dir is
|
|
25
|
+
// the app's own place in it
|
|
26
|
+
export function appRoot(dir) {
|
|
27
|
+
return dir ? `/app/${dir}` : "/app";
|
|
28
|
+
}
|
|
29
|
+
// A path under /app belongs to the app, so it moves with it. Bare /app is the
|
|
30
|
+
// repository itself and stays: that is what a build shipping its whole tree copies
|
|
31
|
+
export function rootedAt(path, dir) {
|
|
32
|
+
if (!dir || !path.startsWith("/app/"))
|
|
33
|
+
return path;
|
|
34
|
+
return `${appRoot(dir)}/${path.slice("/app/".length)}`;
|
|
35
|
+
}
|
|
36
|
+
// A directory inside the output root moves with it, because the output becomes
|
|
37
|
+
// /app in the runtime. Anything else keeps the position it had in the builder:
|
|
38
|
+
// flattening it to a basename is what put Next's static assets at /app/static,
|
|
39
|
+
// where the server looks for them under .next and answers 404
|
|
40
|
+
export function destinationFor(path, output) {
|
|
41
|
+
if (path.startsWith(`${output}/`))
|
|
42
|
+
return `/app/${path.slice(output.length + 1)}`;
|
|
43
|
+
return path;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,0EAA0E;AAC1E,2BAA2B;AAE3B,gFAAgF;AAChF,6EAA6E;AAC7E,yEAAyE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CAAC,EAAE,CAAC;IAClF,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localHost.d.ts","sourceRoot":"","sources":["../src/localHost.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAOtC,MAAM,MAAM,YAAY,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE,CAAC;AAEpE,wBAAsB,SAAS,CAAC,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCzE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
2
|
+
import { homedir, tmpdir } from "node:os";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { signalEverything, spawnCollect } from "./shell.js";
|
|
5
|
+
export async function localHost(options = {}) {
|
|
6
|
+
const directory = await mkdtemp(join(tmpdir(), "redkite-"));
|
|
7
|
+
const cache = options.cache ?? join(homedir(), ".cache", "redkite");
|
|
8
|
+
await mkdir(cache, { recursive: true });
|
|
9
|
+
return {
|
|
10
|
+
directory,
|
|
11
|
+
cache,
|
|
12
|
+
sh: async (command, onLine) => await spawnCollect("sh", ["-c", command], { onLine, signal: options.signal }),
|
|
13
|
+
write: async (name, contents) => {
|
|
14
|
+
const path = join(directory, name);
|
|
15
|
+
await mkdir(dirname(path), { recursive: true });
|
|
16
|
+
await writeFile(path, contents, { mode: 0o600 });
|
|
17
|
+
return path;
|
|
18
|
+
},
|
|
19
|
+
// Both ends are this machine, so the pipe is one shell away
|
|
20
|
+
pipe: async (local, remote, onLine) => await spawnCollect("sh", ["-c", `${local} | ${remote}`], {
|
|
21
|
+
onLine,
|
|
22
|
+
signal: options.signal,
|
|
23
|
+
}),
|
|
24
|
+
// The build is a grandchild of the shell that was spawned, and every child
|
|
25
|
+
// is a process group leader, so one signal reaches the whole tree
|
|
26
|
+
stop: async (name) => signalEverything(name === "KILL" ? "SIGKILL" : "SIGTERM"),
|
|
27
|
+
close: async () => {
|
|
28
|
+
await rm(directory, { recursive: true, force: true });
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=localHost.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localHost.js","sourceRoot":"","sources":["../src/localHost.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAG1C,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAQ5D,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,UAAwB,EAAE;IACxD,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC;IAC5D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IAEpE,MAAM,KAAK,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAExC,OAAO;QACL,SAAS;QACT,KAAK;QACL,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAC5B,MAAM,YAAY,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;QAE/E,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;YAC9B,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;YAEnC,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAChD,MAAM,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;YAEjD,OAAO,IAAI,CAAC;QACd,CAAC;QAED,4DAA4D;QAC5D,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,CACpC,MAAM,YAAY,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,MAAM,MAAM,EAAE,CAAC,EAAE;YACvD,MAAM;YACN,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC;QAEJ,2EAA2E;QAC3E,kEAAkE;QAClE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;QAE/E,KAAK,EAAE,KAAK,IAAI,EAAE;YAChB,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACxD,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/log.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type Task = {
|
|
2
|
+
detail(message: string): void;
|
|
3
|
+
line(message: string): void;
|
|
4
|
+
done(message?: string): void;
|
|
5
|
+
fail(message: string): void;
|
|
6
|
+
};
|
|
7
|
+
export type Log = ((message: string) => void) & {
|
|
8
|
+
warn(message: string): void;
|
|
9
|
+
fail(message: string): void;
|
|
10
|
+
done(message: string): void;
|
|
11
|
+
step(label: string): Task;
|
|
12
|
+
};
|
|
13
|
+
export declare const silent: Log;
|
|
14
|
+
//# sourceMappingURL=log.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,IAAI,GAAG;IAEjB,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAG9B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG;IAE9C,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AASF,eAAO,MAAM,MAAM,EAAE,GAKnB,CAAC"}
|
package/dist/log.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// The shape progress is reported through. The library only knows this much, so
|
|
2
|
+
// a deploy driven from somewhere without a terminal supplies its own.
|
|
3
|
+
const NOTHING = {
|
|
4
|
+
detail: () => { },
|
|
5
|
+
line: () => { },
|
|
6
|
+
done: () => { },
|
|
7
|
+
fail: () => { },
|
|
8
|
+
};
|
|
9
|
+
export const silent = Object.assign(() => { }, {
|
|
10
|
+
warn: () => { },
|
|
11
|
+
fail: () => { },
|
|
12
|
+
done: () => { },
|
|
13
|
+
step: () => NOTHING,
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=log.js.map
|
package/dist/log.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,sEAAsE;AAwBtE,MAAM,OAAO,GAAS;IACpB,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;IAChB,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;CACf,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAQ,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,GAAE,CAAC,EAAE;IACjD,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO;CACpB,CAAC,CAAC"}
|
package/dist/nginx.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nginx.d.ts","sourceRoot":"","sources":["../src/nginx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,QAAQ,EAAE,MAAM,eAAe,CAAC;AAsB3D,eAAO,MAAM,WAAW,OAAO,CAAC;AAEhC,wBAAgB,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,CAAC,EAAE,MAAM,UAoBnE"}
|
package/dist/nginx.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// The nginx configuration is a function of the app list. Header policy is set
|
|
2
|
+
// here once rather than per location, which is what let the two blocks drift
|
|
3
|
+
// apart and lose X-Forwarded-For on one of them.
|
|
4
|
+
const FORWARDING = [
|
|
5
|
+
"proxy_set_header Host $http_host;",
|
|
6
|
+
"proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;",
|
|
7
|
+
"proxy_set_header X-Forwarded-Host $http_host;",
|
|
8
|
+
"proxy_set_header X-Forwarded-Proto $scheme;",
|
|
9
|
+
];
|
|
10
|
+
const FAILOVER = [
|
|
11
|
+
"proxy_connect_timeout 2s;",
|
|
12
|
+
"proxy_read_timeout 30s;",
|
|
13
|
+
"proxy_next_upstream error timeout http_502 http_503;",
|
|
14
|
+
"proxy_next_upstream_tries 2;",
|
|
15
|
+
];
|
|
16
|
+
// The port the proxy listens on inside its container. The published port maps
|
|
17
|
+
// onto this one, so both sides have to agree and only one of them may say it
|
|
18
|
+
export const LISTEN_PORT = 3000;
|
|
19
|
+
export function renderNginx(topology, maxBodySize) {
|
|
20
|
+
const upstreams = topology.apps.map((app) => upstream(app)).join("\n\n");
|
|
21
|
+
// Longest route first, so "/api/" is not shadowed by the "/" catch-all
|
|
22
|
+
const ordered = [...topology.apps].sort((a, b) => b.route.length - a.route.length);
|
|
23
|
+
const locations = ordered.map((app) => location(app)).join("\n\n");
|
|
24
|
+
return `resolver 127.0.0.1 valid=5s;
|
|
25
|
+
|
|
26
|
+
${upstreams}
|
|
27
|
+
|
|
28
|
+
server {
|
|
29
|
+
listen ${LISTEN_PORT};
|
|
30
|
+
merge_slashes off;
|
|
31
|
+
|
|
32
|
+
client_max_body_size ${maxBodySize ?? "1M"};
|
|
33
|
+
|
|
34
|
+
${locations}
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
}
|
|
38
|
+
function upstream(app) {
|
|
39
|
+
return `upstream ${app.name} {
|
|
40
|
+
server ${app.container}:${app.port} max_fails=1 fail_timeout=2s;
|
|
41
|
+
server ${app.retired}:${app.port} backup;
|
|
42
|
+
}`;
|
|
43
|
+
}
|
|
44
|
+
function location(app) {
|
|
45
|
+
// A trailing slash on proxy_pass strips the location prefix. The catch-all
|
|
46
|
+
// must not carry one, a mounted route must
|
|
47
|
+
const target = app.route === "/" ? `http://${app.name}` : `http://${app.name}/`;
|
|
48
|
+
const body = [`proxy_pass ${target};`, ...FAILOVER, ...FORWARDING];
|
|
49
|
+
return ` location ${app.route} {
|
|
50
|
+
${body.map((line) => ` ${line}`).join("\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;aAChB,GAAG,CAAC,SAAS,IAAI,GAAG,CAAC,IAAI;aACzB,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,IAAI;EAClC,CAAC;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,GAAgB;IAChC,2EAA2E;IAC3E,2CAA2C;IAC3C,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,KAAK,GAAG,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,IAAI,GAAG,CAAC;IAChF,MAAM,IAAI,GAAG,CAAC,cAAc,MAAM,GAAG,EAAE,GAAG,QAAQ,EAAE,GAAG,UAAU,CAAC,CAAC;IAEnE,OAAO,gBAAgB,GAAG,CAAC,KAAK;EAChC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;MAC5C,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { Docker } from "./docker.js";
|
|
2
|
+
import type { Host } from "./host.js";
|
|
3
|
+
import type { Log, Task } from "./log.js";
|
|
4
|
+
import type { SecretStores } from "./secrets/refs.js";
|
|
5
|
+
import type { Topology } from "./topology.js";
|
|
6
|
+
import type { Deployment } from "./types.js";
|
|
7
|
+
export declare const PHASES: readonly ["setup", "build", "verify", "swap", "cleanup"];
|
|
8
|
+
export type Phase = (typeof PHASES)[number];
|
|
9
|
+
export declare const RUNS: {
|
|
10
|
+
readonly deploy: readonly ["setup", "build", "swap", "cleanup"];
|
|
11
|
+
readonly verify: readonly ["setup", "build", "verify", "cleanup"];
|
|
12
|
+
};
|
|
13
|
+
export type Run = keyof typeof RUNS;
|
|
14
|
+
export declare const SLOTS: readonly ["before", "main", "after"];
|
|
15
|
+
export type Slot = (typeof SLOTS)[number];
|
|
16
|
+
export type Point = Phase | `${Phase}:${string}`;
|
|
17
|
+
export type Hook = Exclude<Point, Phase>;
|
|
18
|
+
export type Start = {
|
|
19
|
+
environment: string;
|
|
20
|
+
};
|
|
21
|
+
export type Prepared = Start & {
|
|
22
|
+
network: string;
|
|
23
|
+
services: string[];
|
|
24
|
+
};
|
|
25
|
+
export type BuiltApp = {
|
|
26
|
+
name: string;
|
|
27
|
+
container: string;
|
|
28
|
+
release: string;
|
|
29
|
+
fingerprint: string;
|
|
30
|
+
cached: boolean;
|
|
31
|
+
builderTag: string;
|
|
32
|
+
};
|
|
33
|
+
export type Built = Prepared & {
|
|
34
|
+
apps: BuiltApp[];
|
|
35
|
+
};
|
|
36
|
+
export type Released = Built & {
|
|
37
|
+
ok: boolean;
|
|
38
|
+
released: string[];
|
|
39
|
+
reverted: string[];
|
|
40
|
+
checked: string[];
|
|
41
|
+
};
|
|
42
|
+
export type Finished = Released & {
|
|
43
|
+
removed: string[];
|
|
44
|
+
reclaimed: string[];
|
|
45
|
+
};
|
|
46
|
+
export type Context = {
|
|
47
|
+
config: Deployment;
|
|
48
|
+
environment: string;
|
|
49
|
+
run: Run;
|
|
50
|
+
topology: Topology;
|
|
51
|
+
host: Host;
|
|
52
|
+
docker: Docker;
|
|
53
|
+
secrets: SecretStores;
|
|
54
|
+
log: Log;
|
|
55
|
+
task: Task;
|
|
56
|
+
};
|
|
57
|
+
type PhaseInput = {
|
|
58
|
+
setup: Start;
|
|
59
|
+
build: Prepared;
|
|
60
|
+
verify: Built;
|
|
61
|
+
swap: Built;
|
|
62
|
+
cleanup: Released;
|
|
63
|
+
};
|
|
64
|
+
type PhaseOutput = {
|
|
65
|
+
setup: Prepared;
|
|
66
|
+
build: Built;
|
|
67
|
+
verify: Released;
|
|
68
|
+
swap: Released;
|
|
69
|
+
cleanup: Finished;
|
|
70
|
+
};
|
|
71
|
+
type PhaseOf<P extends Point> = P extends Phase ? P : P extends `${infer F extends Phase}:${string}` ? F : never;
|
|
72
|
+
export type InputAt<P extends Point> = P extends Phase ? PhaseInput[P] : P extends `${string}:before:${string}` ? PhaseInput[PhaseOf<P>] : PhaseOutput[PhaseOf<P>];
|
|
73
|
+
export type OutputAt<P extends Point> = P extends Phase ? PhaseOutput[P] : P extends `${string}:before:${string}` ? PhaseInput[PhaseOf<P>] : PhaseOutput[PhaseOf<P>];
|
|
74
|
+
export type Plan = {
|
|
75
|
+
config: Deployment;
|
|
76
|
+
environment: string;
|
|
77
|
+
};
|
|
78
|
+
export type Step<P extends Point = Point> = {
|
|
79
|
+
point: P;
|
|
80
|
+
check?: (plan: Plan) => void;
|
|
81
|
+
run: (input: InputAt<P>, context: Context) => OutputAt<P> | Promise<OutputAt<P>>;
|
|
82
|
+
};
|
|
83
|
+
export type AnyStep = {
|
|
84
|
+
point: Point;
|
|
85
|
+
check?: (plan: Plan) => void;
|
|
86
|
+
run: (input: never, context: Context) => unknown;
|
|
87
|
+
};
|
|
88
|
+
export declare function defineStep<const P extends Point>(point: P, run: Step<P>["run"], check?: Step<P>["check"]): Step<P>;
|
|
89
|
+
export declare function merge(supplied: AnyStep[], added: AnyStep[]): AnyStep[];
|
|
90
|
+
export declare class Aborted extends Error {
|
|
91
|
+
constructor(point: string);
|
|
92
|
+
}
|
|
93
|
+
export declare function runPipeline(run: Run, steps: AnyStep[], setting: Omit<Context, "task">, signal?: AbortSignal): Promise<Finished>;
|
|
94
|
+
export declare function sequence(steps: AnyStep[], phases?: readonly Phase[]): AnyStep[];
|
|
95
|
+
export type Address = {
|
|
96
|
+
phase: Phase;
|
|
97
|
+
slot: Slot;
|
|
98
|
+
name: string;
|
|
99
|
+
};
|
|
100
|
+
export declare function addressOf(point: string): Address;
|
|
101
|
+
export declare function assertSteps(steps: AnyStep[]): void;
|
|
102
|
+
export {};
|
|
103
|
+
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../src/pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAA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AU,CAAC,KAAK,CAAC,CAAC,SAAS,KAAK,EAC9C,KAAK,EAAE,CAAC,EACR,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EACnB,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GACvB,IAAI,CAAC,CAAC,CAAC,CAET;AAKD,wBAAgB,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAQtE;AAID,qBAAa,OAAQ,SAAQ,KAAK;gBACpB,KAAK,EAAE,MAAM;CAI1B;AAED,wBAAsB,WAAW,CAC/B,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,OAAO,EAAE,EAChB,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,EAC9B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,QAAQ,CAAC,CAsCnB;AAKD,wBAAgB,QAAQ,CACtB,KAAK,EAAE,OAAO,EAAE,EAChB,MAAM,GAAE,SAAS,KAAK,EAAgB,GACrC,OAAO,EAAE,CAUX;AAOD,MAAM,MAAM,OAAO,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AASjE,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CA+BhD;AAKD,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,QAY3C"}
|
package/dist/pipeline.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
// Capistrano's shape: work addressed by where it runs rather than by who calls
|
|
2
|
+
// it, so a plugin or a config adds a step without any file here knowing it
|
|
3
|
+
// exists. A run is a list of steps, each handed what the one before it answered
|
|
4
|
+
// with. Redkite's own four are ordinary members of that list.
|
|
5
|
+
// Every phase redkite supplies a step for. Each is also the name of the point
|
|
6
|
+
// that step sits at. No run walks all of them: swap and verify are alternatives
|
|
7
|
+
export const PHASES = ["setup", "build", "verify", "swap", "cleanup"];
|
|
8
|
+
// The phases each command walks, in the order it walks them. A phase left out
|
|
9
|
+
// is not run, and a step hung on one of its slots never fires
|
|
10
|
+
export const RUNS = {
|
|
11
|
+
deploy: ["setup", "build", "swap", "cleanup"],
|
|
12
|
+
verify: ["setup", "build", "verify", "cleanup"],
|
|
13
|
+
};
|
|
14
|
+
// Everything before the phase's own step, the phase's own slot, everything after
|
|
15
|
+
export const SLOTS = ["before", "main", "after"];
|
|
16
|
+
// Identity, but it pins the point so a typo fails to compile and the input is
|
|
17
|
+
// inferred from where the step runs rather than annotated
|
|
18
|
+
export function defineStep(point, run, check) {
|
|
19
|
+
return { point, run, check };
|
|
20
|
+
}
|
|
21
|
+
// A step at the same point as one redkite supplies replaces it, in the place redkite
|
|
22
|
+
// had it. That is the whole of turning one of redkite's four off: put something
|
|
23
|
+
// there that does less, or nothing
|
|
24
|
+
export function merge(supplied, added) {
|
|
25
|
+
const overrides = new Map(added.map((step) => [step.point, step]));
|
|
26
|
+
const claimed = new Set(supplied.map((step) => step.point));
|
|
27
|
+
return [
|
|
28
|
+
...supplied.map((step) => overrides.get(step.point) ?? step),
|
|
29
|
+
...added.filter((step) => !claimed.has(step.point)),
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
// Stopping between steps, rather than in the middle of one. A step is the unit
|
|
33
|
+
// that leaves the host in a state the next deploy can read
|
|
34
|
+
export class Aborted extends Error {
|
|
35
|
+
constructor(point) {
|
|
36
|
+
super(`Stopped before ${point}`);
|
|
37
|
+
this.name = "Aborted";
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export async function runPipeline(run, steps, setting, signal) {
|
|
41
|
+
const ordered = sequence(steps, RUNS[run]);
|
|
42
|
+
const plan = { config: setting.config, environment: setting.environment };
|
|
43
|
+
// Every check before any step, so a run that is going to fail on a config
|
|
44
|
+
// mistake fails before it has created a network or built an image. Nothing
|
|
45
|
+
// wraps what a check throws: it is about the config, and the config is what
|
|
46
|
+
// the reader has in front of them
|
|
47
|
+
for (const step of ordered)
|
|
48
|
+
step.check?.(plan);
|
|
49
|
+
// Every step is handed what the one before it answered with, so the whole run
|
|
50
|
+
// is a fold over one list. Running part of it at once is a change here alone
|
|
51
|
+
let value = { environment: setting.environment };
|
|
52
|
+
for (const step of ordered) {
|
|
53
|
+
if (signal?.aborted)
|
|
54
|
+
throw new Aborted(step.point);
|
|
55
|
+
const task = setting.log.step(step.point);
|
|
56
|
+
// A step declares what it takes and answers with through its point, and a
|
|
57
|
+
// list assembled from a config cannot carry that through. The declared
|
|
58
|
+
// types are the contract, and this is the one place they are taken on trust
|
|
59
|
+
const run = step.run;
|
|
60
|
+
try {
|
|
61
|
+
value = await run(value, { ...setting, task });
|
|
62
|
+
task.done();
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
// One step throwing ends the run. Everything after it was written
|
|
66
|
+
// assuming the steps before did what they said they would
|
|
67
|
+
task.fail(`${step.point} failed`);
|
|
68
|
+
throw new Error(`Step ${step.point} failed`, { cause: error });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// Every run ends at cleanup, and a step there answers with a Finished or does
|
|
72
|
+
// not compile
|
|
73
|
+
return value;
|
|
74
|
+
}
|
|
75
|
+
// The order a run walks: for each of its phases, everything before it, the
|
|
76
|
+
// phase's own slot, then everything after. Redkite's own step leads its slot
|
|
77
|
+
// because merge keeps the supplied list first
|
|
78
|
+
export function sequence(steps, phases = RUNS.deploy) {
|
|
79
|
+
const ordered = [];
|
|
80
|
+
for (const phase of phases) {
|
|
81
|
+
for (const slot of SLOTS) {
|
|
82
|
+
ordered.push(...steps.filter((step) => runsAt(step, phase, slot)));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return ordered;
|
|
86
|
+
}
|
|
87
|
+
function runsAt(step, phase, slot) {
|
|
88
|
+
const address = addressOf(step.point);
|
|
89
|
+
return address.phase === phase && address.slot === slot;
|
|
90
|
+
}
|
|
91
|
+
// The names everything else in redkite derives, so a step reads like the container
|
|
92
|
+
// and cache keys beside it
|
|
93
|
+
const NAME = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
94
|
+
// Points a config may still be written against, and what they became
|
|
95
|
+
const RENAMED = { deploy: "swap" };
|
|
96
|
+
export function addressOf(point) {
|
|
97
|
+
const parts = point.split(":");
|
|
98
|
+
const phase = parts[0];
|
|
99
|
+
const renamed = phase ? RENAMED[phase] : undefined;
|
|
100
|
+
if (renamed) {
|
|
101
|
+
throw new Error(`${point} names the phase ${phase}, which is now ${renamed}`);
|
|
102
|
+
}
|
|
103
|
+
if (!phase || !isPhase(phase)) {
|
|
104
|
+
throw new Error(`${point} names no phase, expected one of ${PHASES.join(", ")}`);
|
|
105
|
+
}
|
|
106
|
+
// The point redkite's own step sits at, and the one a deployment claims to
|
|
107
|
+
// replace it
|
|
108
|
+
if (parts.length === 1)
|
|
109
|
+
return { phase, slot: "main", name: phase };
|
|
110
|
+
if (parts.length === 2)
|
|
111
|
+
return { phase, slot: "main", name: named(point, parts[1]) };
|
|
112
|
+
if (parts.length !== 3) {
|
|
113
|
+
throw new Error(`${point} is not a point, expected ${phase}, ${phase}:… or ${phase}:before|after:…`);
|
|
114
|
+
}
|
|
115
|
+
const slot = parts[1];
|
|
116
|
+
if (slot !== "before" && slot !== "after") {
|
|
117
|
+
throw new Error(`${point} names no slot, expected ${phase}:before:… or ${phase}:after:…`);
|
|
118
|
+
}
|
|
119
|
+
return { phase, slot, name: named(point, parts[2]) };
|
|
120
|
+
}
|
|
121
|
+
// Checked where the config is defined rather than where it runs, so a typo or a
|
|
122
|
+
// collision is a config that fails to load rather than a deploy that stops half
|
|
123
|
+
// way through with the host already changed
|
|
124
|
+
export function assertSteps(steps) {
|
|
125
|
+
const seen = new Set();
|
|
126
|
+
for (const step of steps) {
|
|
127
|
+
addressOf(step.point);
|
|
128
|
+
if (seen.has(step.point)) {
|
|
129
|
+
throw new Error(`Two steps share the point ${step.point}`);
|
|
130
|
+
}
|
|
131
|
+
seen.add(step.point);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function named(point, name) {
|
|
135
|
+
if (name && NAME.test(name))
|
|
136
|
+
return name;
|
|
137
|
+
throw new Error(`${point} needs a kebab-case name`);
|
|
138
|
+
}
|
|
139
|
+
function isPhase(value) {
|
|
140
|
+
return PHASES.includes(value);
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=pipeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../src/pipeline.ts"],"names":[],"mappings":"AAOA,+EAA+E;AAC/E,2EAA2E;AAC3E,gFAAgF;AAChF,8DAA8D;AAE9D,8EAA8E;AAC9E,gFAAgF;AAChF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAU,CAAC;AAG/E,8EAA8E;AAC9E,8DAA8D;AAC9D,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC;IAC7C,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC;CACI,CAAC;AAItD,iFAAiF;AACjF,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAU,CAAC;AA6I1D,8EAA8E;AAC9E,0DAA0D;AAC1D,MAAM,UAAU,UAAU,CACxB,KAAQ,EACR,GAAmB,EACnB,KAAwB;IAExB,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;AAC/B,CAAC;AAED,qFAAqF;AACrF,gFAAgF;AAChF,mCAAmC;AACnC,MAAM,UAAU,KAAK,CAAC,QAAmB,EAAE,KAAgB;IACzD,MAAM,SA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,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACzC,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,0BAA0B,CAAC,CAAC;AACtD,CAAC;AAED,SAAS,OAAO,CAAC,KAAa;IAC5B,OAAQ,MAA4B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/presets/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/presets/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { BuildSpec } from "../types.js";
|
|
2
|
+
type NextAppOptions = {
|
|
3
|
+
builder?: string;
|
|
4
|
+
runtime?: string;
|
|
5
|
+
port?: number;
|
|
6
|
+
steps?: string[];
|
|
7
|
+
dependencies?: {
|
|
8
|
+
files: string[];
|
|
9
|
+
step: string;
|
|
10
|
+
} | false;
|
|
11
|
+
standalone?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare function nextApp(options?: NextAppOptions): BuildSpec;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=nextApp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nextApp.d.ts","sourceRoot":"","sources":["../../src/presets/nextApp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,KAAK,cAAc,GAAG;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,YAAY,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,KAAK,CAAC;IAGzD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAIF,wBAAgB,OAAO,CAAC,OAAO,GAAE,cAAmB,GAAG,SAAS,CAqD/D"}
|