@marinoscar/platform-cli 0.1.0-next.11 → 0.1.0-next.13
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/CHANGELOG.md +19 -0
- package/README.md +1 -1
- package/dist/deploy/index.d.ts +2 -2
- package/dist/deploy/index.d.ts.map +1 -1
- package/dist/deploy/index.js +1 -1
- package/dist/deploy/index.js.map +1 -1
- package/dist/engine/commands/deploy.d.ts.map +1 -1
- package/dist/engine/commands/deploy.js +19 -4
- package/dist/engine/commands/deploy.js.map +1 -1
- package/dist/engine/deploy/checks/compose.d.ts +7 -0
- package/dist/engine/deploy/checks/compose.d.ts.map +1 -0
- package/dist/engine/deploy/checks/compose.js +149 -0
- package/dist/engine/deploy/checks/compose.js.map +1 -0
- package/dist/engine/deploy/checks/index.d.ts +1 -0
- package/dist/engine/deploy/checks/index.d.ts.map +1 -1
- package/dist/engine/deploy/checks/index.js +4 -0
- package/dist/engine/deploy/checks/index.js.map +1 -1
- package/dist/engine/deploy/compose-containers.d.ts +72 -0
- package/dist/engine/deploy/compose-containers.d.ts.map +1 -0
- package/dist/engine/deploy/compose-containers.js +125 -0
- package/dist/engine/deploy/compose-containers.js.map +1 -0
- package/dist/engine/deploy/compose-project.d.ts +113 -0
- package/dist/engine/deploy/compose-project.d.ts.map +1 -0
- package/dist/engine/deploy/compose-project.js +177 -0
- package/dist/engine/deploy/compose-project.js.map +1 -0
- package/dist/engine/deploy/install.d.ts.map +1 -1
- package/dist/engine/deploy/install.js +54 -8
- package/dist/engine/deploy/install.js.map +1 -1
- package/dist/engine/deploy/testing/fake-containers.d.ts +18 -0
- package/dist/engine/deploy/testing/fake-containers.d.ts.map +1 -0
- package/dist/engine/deploy/testing/fake-containers.js +25 -0
- package/dist/engine/deploy/testing/fake-containers.js.map +1 -0
- package/dist/engine/deploy/update.d.ts.map +1 -1
- package/dist/engine/deploy/update.js +29 -2
- package/dist/engine/deploy/update.js.map +1 -1
- package/dist/engine/index.d.ts +2 -0
- package/dist/engine/index.d.ts.map +1 -1
- package/dist/engine/index.js +1 -0
- package/dist/engine/index.js.map +1 -1
- package/dist/engine/tui/screens/deploy/doctor.d.ts.map +1 -1
- package/dist/engine/tui/screens/deploy/doctor.js +10 -3
- package/dist/engine/tui/screens/deploy/doctor.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/engine/deploy/checks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9F,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,gFAAgF;AAChF,8CAA8C;AAC9C,gFAAgF;AAChF,EAAE;AACF,+EAA+E;AAC/E,4EAA4E;AAC5E,6EAA6E;AAC7E,oCAAoC;AACpC,gFAAgF;AAEhF,2EAA2E;AAC3E,mEAAmE;AACnE,MAAM,CAAC,MAAM,UAAU,GAAqB;IAC1C,GAAG,WAAW;IACd,qEAAqE;IACrE,GAAG,aAAa;IAChB,GAAG,eAAe;IAClB,GAAG,UAAU;IACb,GAAG,UAAU;CACd,CAAC;AAEF,kBAAkB,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;AAE9D;;;;GAIG;AACH,MAAM,UAAU,SAAS;IACvB,MAAM,UAAU,GAAG,0BAA0B,EAAE,CAAC;IAChD,OAAO,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+
* The command seam detection runs through: the engine's `runCommand` (or a
|
|
3
|
+
* test's fake of it). Structural, so the executor's own function is assignable
|
|
4
|
+
* and nothing of the executor leaks into the public surface. It rejects when
|
|
5
|
+
* the command fails, which detection reads as "Docker cannot be asked".
|
|
6
|
+
*
|
|
7
|
+
* @stability experimental
|
|
8
|
+
*/
|
|
9
|
+
export type ComposeProjectCommandRunner = (argv: readonly string[], options: {
|
|
10
|
+
cwd: string;
|
|
11
|
+
timeoutMs?: number | undefined;
|
|
12
|
+
}) => Promise<{
|
|
13
|
+
/** What the command printed on stdout. */
|
|
14
|
+
stdout: string;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* One container as the deploy checks and the detection see it.
|
|
18
|
+
*
|
|
19
|
+
* @stability experimental
|
|
20
|
+
*/
|
|
21
|
+
export interface ComposeContainer {
|
|
22
|
+
/** The container name, without Docker's leading slash. */
|
|
23
|
+
name: string;
|
|
24
|
+
/** Whether it is running now. */
|
|
25
|
+
running: boolean;
|
|
26
|
+
/** The host ports it is configured to publish (a range stays `8000-8010`); empty `HostPort`s are no claim and are not listed. */
|
|
27
|
+
hostPorts: string[];
|
|
28
|
+
/** Its `com.docker.compose.project` label, `''` when it is not a compose container. */
|
|
29
|
+
project: string;
|
|
30
|
+
/** Its `com.docker.compose.project.working_dir` label, `''` when absent. */
|
|
31
|
+
workingDir: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Whether `path` is `root` or inside it, by path segment: `/opt/apps/app2` is
|
|
35
|
+
* NOT under `/opt/apps/app`. Both are resolved first; nothing touches the disk,
|
|
36
|
+
* because a container's recorded directory need not exist any more.
|
|
37
|
+
*
|
|
38
|
+
* @param path - The path to test.
|
|
39
|
+
* @param root - The folder it may be under.
|
|
40
|
+
* @returns true when `path` is `root` or below it.
|
|
41
|
+
* @stability experimental
|
|
42
|
+
*/
|
|
43
|
+
export declare function isPathUnder(path: string, root: string): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* The compose project a FRESH install of `deployRoot` gets: the folder name.
|
|
46
|
+
* An existing deployment keeps the one it runs under (`composeProjectFor`);
|
|
47
|
+
* only a deployment with no record and no evidence is named this way. Install
|
|
48
|
+
* and the `bind-port-owner` check both ask here, so they cannot disagree.
|
|
49
|
+
*
|
|
50
|
+
* @param deployRoot - The deployment folder.
|
|
51
|
+
* @returns the project name a fresh install would use.
|
|
52
|
+
*/
|
|
53
|
+
export declare function freshComposeProject(deployRoot: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* Whether `container` is configured to publish host port `port`. An empty
|
|
56
|
+
* `HostPort` (Docker picks one) is no claim; a range claims every port in it.
|
|
57
|
+
*
|
|
58
|
+
* @param container - The container.
|
|
59
|
+
* @param port - The host port.
|
|
60
|
+
* @returns true when the container publishes it.
|
|
61
|
+
*/
|
|
62
|
+
export declare function publishesPort(container: Pick<ComposeContainer, 'hostPorts'>, port: number): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Every container Docker knows, in any state, with its compose labels and the
|
|
65
|
+
* host ports it is configured to publish: one `docker ps -aq` and ONE
|
|
66
|
+
* `docker inspect`, argv only, never a shell string.
|
|
67
|
+
*
|
|
68
|
+
* @param run - The command seam; pass the engine's `runCommand`.
|
|
69
|
+
* @returns the containers, or `undefined` when Docker cannot be asked.
|
|
70
|
+
*/
|
|
71
|
+
export declare function listComposeContainers(run: ComposeProjectCommandRunner): Promise<ComposeContainer[] | undefined>;
|
|
72
|
+
//# sourceMappingURL=compose-containers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose-containers.d.ts","sourceRoot":"","sources":["../../../src/engine/deploy/compose-containers.ts"],"names":[],"mappings":"AAuCA;;;;;;;GAOG;AACH,MAAM,MAAM,2BAA2B,GAAG,CACxC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,KACrD,OAAO,CAAC;IACX,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,iCAAiC;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,iIAAiI;IACjI,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,uFAAuF;IACvF,OAAO,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAG/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,gBAAgB,EAAE,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAOnG;AAED;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,2BAA2B,GAAG,OAAO,CAAC,gBAAgB,EAAE,GAAG,SAAS,CAAC,CAyCrH"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { basename, isAbsolute, relative, resolve, sep } from 'node:path';
|
|
2
|
+
// =============================================================================
|
|
3
|
+
// Which containers does Docker know, and which compose project is each in?
|
|
4
|
+
// =============================================================================
|
|
5
|
+
//
|
|
6
|
+
// The leaf under compose-project.ts (detection and reconciliation) and the
|
|
7
|
+
// `bind-port-owner` / `stray-compose-stack` deploy checks: it imports nothing
|
|
8
|
+
// from the engine, so a check can ask Docker without importing the install
|
|
9
|
+
// pipeline. Read-only (`docker ps`, `docker inspect`), argv only.
|
|
10
|
+
// =============================================================================
|
|
11
|
+
/** The label a container carries naming its compose project. */
|
|
12
|
+
const COMPOSE_PROJECT_LABEL = 'com.docker.compose.project';
|
|
13
|
+
/** The label naming the directory compose was run from. */
|
|
14
|
+
const COMPOSE_WORKING_DIR_LABEL = 'com.docker.compose.project.working_dir';
|
|
15
|
+
/** Short by design: a wedged Docker socket must cost seconds, not the command. */
|
|
16
|
+
const DOCKER_QUERY_TIMEOUT_MS = 10_000;
|
|
17
|
+
/**
|
|
18
|
+
* One line per container: name, running state, published host ports, compose
|
|
19
|
+
* project, then compose working directory.
|
|
20
|
+
*
|
|
21
|
+
* `{{if .Config.Labels}}` guards a container created without any labels, whose
|
|
22
|
+
* `Labels` is null rather than an empty map (`index` on nil renders
|
|
23
|
+
* `<no value>` into the line otherwise); the separators sit outside the guards
|
|
24
|
+
* so every line has all five fields. `PortBindings` is the CONFIGURED publish,
|
|
25
|
+
* present on a stopped or merely created container too, and a nil map ranges
|
|
26
|
+
* over nothing. The working directory comes last so a path containing the
|
|
27
|
+
* separator survives; none of the fields before it can contain one.
|
|
28
|
+
*/
|
|
29
|
+
const INSPECT_FORMAT = '{{.Name}}|{{.State.Running}}|' +
|
|
30
|
+
'{{range $port, $bindings := .HostConfig.PortBindings}}{{range $bindings}}{{.HostPort}},{{end}}{{end}}|' +
|
|
31
|
+
`{{if .Config.Labels}}{{index .Config.Labels "${COMPOSE_PROJECT_LABEL}"}}{{end}}|` +
|
|
32
|
+
`{{if .Config.Labels}}{{index .Config.Labels "${COMPOSE_WORKING_DIR_LABEL}"}}{{end}}`;
|
|
33
|
+
/**
|
|
34
|
+
* Whether `path` is `root` or inside it, by path segment: `/opt/apps/app2` is
|
|
35
|
+
* NOT under `/opt/apps/app`. Both are resolved first; nothing touches the disk,
|
|
36
|
+
* because a container's recorded directory need not exist any more.
|
|
37
|
+
*
|
|
38
|
+
* @param path - The path to test.
|
|
39
|
+
* @param root - The folder it may be under.
|
|
40
|
+
* @returns true when `path` is `root` or below it.
|
|
41
|
+
* @stability experimental
|
|
42
|
+
*/
|
|
43
|
+
export function isPathUnder(path, root) {
|
|
44
|
+
const relation = relative(resolve(root), resolve(path));
|
|
45
|
+
return relation === '' || (relation !== '..' && !relation.startsWith(`..${sep}`) && !isAbsolute(relation));
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The compose project a FRESH install of `deployRoot` gets: the folder name.
|
|
49
|
+
* An existing deployment keeps the one it runs under (`composeProjectFor`);
|
|
50
|
+
* only a deployment with no record and no evidence is named this way. Install
|
|
51
|
+
* and the `bind-port-owner` check both ask here, so they cannot disagree.
|
|
52
|
+
*
|
|
53
|
+
* @param deployRoot - The deployment folder.
|
|
54
|
+
* @returns the project name a fresh install would use.
|
|
55
|
+
*/
|
|
56
|
+
export function freshComposeProject(deployRoot) {
|
|
57
|
+
return basename(deployRoot);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Whether `container` is configured to publish host port `port`. An empty
|
|
61
|
+
* `HostPort` (Docker picks one) is no claim; a range claims every port in it.
|
|
62
|
+
*
|
|
63
|
+
* @param container - The container.
|
|
64
|
+
* @param port - The host port.
|
|
65
|
+
* @returns true when the container publishes it.
|
|
66
|
+
*/
|
|
67
|
+
export function publishesPort(container, port) {
|
|
68
|
+
return container.hostPorts.some((entry) => {
|
|
69
|
+
const [first = '', last = first] = entry.split('-');
|
|
70
|
+
const low = Number(first);
|
|
71
|
+
const high = Number(last);
|
|
72
|
+
return Number.isInteger(low) && Number.isInteger(high) && low <= port && port <= high;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Every container Docker knows, in any state, with its compose labels and the
|
|
77
|
+
* host ports it is configured to publish: one `docker ps -aq` and ONE
|
|
78
|
+
* `docker inspect`, argv only, never a shell string.
|
|
79
|
+
*
|
|
80
|
+
* @param run - The command seam; pass the engine's `runCommand`.
|
|
81
|
+
* @returns the containers, or `undefined` when Docker cannot be asked.
|
|
82
|
+
*/
|
|
83
|
+
export async function listComposeContainers(run) {
|
|
84
|
+
try {
|
|
85
|
+
const ask = (argv) => run(argv, { cwd: process.cwd(), timeoutMs: DOCKER_QUERY_TIMEOUT_MS });
|
|
86
|
+
// `-aq`: every container, whatever its state. Ids, which can never be ambiguous.
|
|
87
|
+
const ids = (await ask(['docker', 'ps', '-aq']))
|
|
88
|
+
.stdout.split('\n')
|
|
89
|
+
.map((line) => line.trim())
|
|
90
|
+
.filter((line) => line !== '');
|
|
91
|
+
if (ids.length === 0)
|
|
92
|
+
return [];
|
|
93
|
+
const { stdout } = await ask(['docker', 'inspect', '--format', INSPECT_FORMAT, ...ids]);
|
|
94
|
+
const containers = [];
|
|
95
|
+
for (const line of stdout.split('\n')) {
|
|
96
|
+
// Four separators, then the working directory (which may hold more). A
|
|
97
|
+
// line with fewer is not ours, such as the `<no value>` an unguarded
|
|
98
|
+
// template prints.
|
|
99
|
+
const fields = [];
|
|
100
|
+
let rest = line;
|
|
101
|
+
for (let index = 0; index < 4; index += 1) {
|
|
102
|
+
const separator = rest.indexOf('|');
|
|
103
|
+
if (separator === -1)
|
|
104
|
+
break;
|
|
105
|
+
fields.push(rest.slice(0, separator));
|
|
106
|
+
rest = rest.slice(separator + 1);
|
|
107
|
+
}
|
|
108
|
+
if (fields.length < 4)
|
|
109
|
+
continue;
|
|
110
|
+
const [name = '', running = '', ports = '', project = ''] = fields;
|
|
111
|
+
containers.push({
|
|
112
|
+
name: name.replace(/^\//, '').trim(),
|
|
113
|
+
running: running.trim() === 'true',
|
|
114
|
+
hostPorts: ports.split(',').map((port) => port.trim()).filter((port) => port !== ''),
|
|
115
|
+
project: project.trim(),
|
|
116
|
+
workingDir: rest.trim(),
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
return containers;
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
return undefined;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=compose-containers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose-containers.js","sourceRoot":"","sources":["../../../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IACpB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { type ComposeProjectCommandRunner } from './compose-containers.js';
|
|
2
|
+
import { type DeployState } from './state.js';
|
|
3
|
+
export { isPathUnder, type ComposeContainer, type ComposeProjectCommandRunner } from './compose-containers.js';
|
|
4
|
+
/**
|
|
5
|
+
* The evidence that decided which project a deployment folder runs under,
|
|
6
|
+
* strongest first. Lets a message say WHY a project was picked.
|
|
7
|
+
*
|
|
8
|
+
* - `bind-port`: a container of that project publishes the deployment's bind
|
|
9
|
+
* port (running ones first), which is the stack that serves the site.
|
|
10
|
+
* - `running`: it is the only project with a running container.
|
|
11
|
+
* - `only`: it is the only project with any container started from the folder.
|
|
12
|
+
*
|
|
13
|
+
* @stability experimental
|
|
14
|
+
*/
|
|
15
|
+
export type ComposeProjectBasis = 'bind-port' | 'running' | 'only';
|
|
16
|
+
/**
|
|
17
|
+
* What Docker says about the compose project of a deployment folder.
|
|
18
|
+
*
|
|
19
|
+
* @stability experimental
|
|
20
|
+
*/
|
|
21
|
+
export type ComposeProjectDetection = {
|
|
22
|
+
/** One project is decided by the strongest evidence among those started from inside the folder. */
|
|
23
|
+
kind: 'found';
|
|
24
|
+
/** That project's name. */
|
|
25
|
+
project: string;
|
|
26
|
+
/** The evidence that decided it. */
|
|
27
|
+
basis: ComposeProjectBasis;
|
|
28
|
+
} | {
|
|
29
|
+
/** No container was started from inside the folder. */
|
|
30
|
+
kind: 'none';
|
|
31
|
+
} | {
|
|
32
|
+
/** Several projects own containers started from inside the folder and no evidence separates them. */
|
|
33
|
+
kind: 'ambiguous';
|
|
34
|
+
/** Their names, sorted. */
|
|
35
|
+
projects: string[];
|
|
36
|
+
} | {
|
|
37
|
+
/** Docker could not be asked (not installed, daemon down, permission, timeout). */
|
|
38
|
+
kind: 'unavailable';
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Asks Docker which compose project the containers started from inside
|
|
42
|
+
* `deployRoot` belong to, stopped containers included. A container is the
|
|
43
|
+
* deployment's when its working-directory label is the deploy root or under it.
|
|
44
|
+
*
|
|
45
|
+
* Several projects can live in one folder (the live stack plus leftovers of
|
|
46
|
+
* another), so the answer is the project the STRONGEST evidence names, in
|
|
47
|
+
* order: (1) the project of a container that publishes `options.bindPort`
|
|
48
|
+
* (running ones first: a stopped leftover publishes it in its configuration
|
|
49
|
+
* too), (2) the only project with a running container, (3) the only project.
|
|
50
|
+
* Several projects and no evidence that separates them is `ambiguous`.
|
|
51
|
+
*
|
|
52
|
+
* Never throws: a Docker that cannot be asked is `unavailable`. Read-only
|
|
53
|
+
* (`docker ps`, `docker inspect`), and argv only, never a shell string.
|
|
54
|
+
*
|
|
55
|
+
* @param deployRoot - The deployment folder (`<apps-root>/<name>`).
|
|
56
|
+
* @param run - The command seam; pass the engine's `runCommand`.
|
|
57
|
+
* @param options - `bindPort`: the deployment's loopback port, the strongest evidence when known.
|
|
58
|
+
* @returns the project found and why, none, several, or unavailable.
|
|
59
|
+
* @stability experimental
|
|
60
|
+
*/
|
|
61
|
+
export declare function detectComposeProject(deployRoot: string, run: ComposeProjectCommandRunner, options?: {
|
|
62
|
+
bindPort?: number | undefined;
|
|
63
|
+
}): Promise<ComposeProjectDetection>;
|
|
64
|
+
/** What `reconcileComposeProject` needs. */
|
|
65
|
+
export interface ReconcileComposeProjectOptions {
|
|
66
|
+
/** The deployment folder. */
|
|
67
|
+
deployRoot: string;
|
|
68
|
+
/** The state as loaded, or undefined when there is no record (nothing to reconcile). */
|
|
69
|
+
state: DeployState | undefined;
|
|
70
|
+
/** The command seam; pass the engine's `runCommand`. */
|
|
71
|
+
runCommand: ComposeProjectCommandRunner;
|
|
72
|
+
}
|
|
73
|
+
/** What `reconcileComposeProject` decided. */
|
|
74
|
+
export interface ReconcileComposeProjectResult {
|
|
75
|
+
/** The state the caller must carry from here on: `composeProject` corrected, everything else untouched. */
|
|
76
|
+
state: DeployState | undefined;
|
|
77
|
+
/** A line for the operator (journal or stderr), when something is worth saying. */
|
|
78
|
+
message?: string | undefined;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Makes the carried compose project match the one Docker says the deployment
|
|
82
|
+
* runs under, when the record is absent or the legacy default.
|
|
83
|
+
*
|
|
84
|
+
* Docker names the project by the strongest evidence (see
|
|
85
|
+
* `detectComposeProject`), the state's bind port first: the stack that holds
|
|
86
|
+
* the port is the one that serves, whatever leftovers share the folder.
|
|
87
|
+
*
|
|
88
|
+
* Changes nothing (the state comes back as given) when there is no state, when
|
|
89
|
+
* Docker cannot be asked or knows no container of this folder, or when it
|
|
90
|
+
* already agrees. A project recorded on purpose is never overwritten; when the
|
|
91
|
+
* container holding the bind port belongs to ANOTHER project it is only
|
|
92
|
+
* reported (a warning), and the `bind-port-owner` check fails the run before
|
|
93
|
+
* anything starts. An ambiguous answer, with nothing decisive, changes nothing
|
|
94
|
+
* and returns a warning naming the projects and the state file: it is never
|
|
95
|
+
* silent, because keeping `compose` unseen is how a second stack got started.
|
|
96
|
+
*
|
|
97
|
+
* On `found` with a different project: the returned state carries it, and when
|
|
98
|
+
* a state file is on disk it is rewritten through the engine's own writer (same
|
|
99
|
+
* v2 shape, version not bumped, every other field kept) after the previous file
|
|
100
|
+
* is copied once to `.appctl-deploy.json.bak`. An in-memory state with no file
|
|
101
|
+
* (an adopted deployment) is only corrected; the pipeline records it with its
|
|
102
|
+
* first write. If the file cannot be written the corrected project is still
|
|
103
|
+
* used for this run, since running under the wrong one is the outage, and the
|
|
104
|
+
* message says it was not recorded.
|
|
105
|
+
*
|
|
106
|
+
* Never throws: it must not make a command that worked before fail.
|
|
107
|
+
*
|
|
108
|
+
* @param options - The deployment folder, the loaded state and the command seam.
|
|
109
|
+
* @returns the state to carry, and a one-line message when there is one.
|
|
110
|
+
* @stability experimental
|
|
111
|
+
*/
|
|
112
|
+
export declare function reconcileComposeProject(options: ReconcileComposeProjectOptions): Promise<ReconcileComposeProjectResult>;
|
|
113
|
+
//# sourceMappingURL=compose-project.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose-project.d.ts","sourceRoot":"","sources":["../../../src/engine/deploy/compose-project.ts"],"names":[],"mappings":"AAGA,OAAO,EAKL,KAAK,2BAA2B,EACjC,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAA+B,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAE3E,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,KAAK,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAkC/G;;;;;;;;;;GAUG;AACH,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG,SAAS,GAAG,MAAM,CAAC;AAEnE;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAC/B;IACE,mGAAmG;IACnG,IAAI,EAAE,OAAO,CAAC;IACd,2BAA2B;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,KAAK,EAAE,mBAAmB,CAAC;CAC5B,GACD;IACE,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;CACd,GACD;IACE,qGAAqG;IACrG,IAAI,EAAE,WAAW,CAAC;IAClB,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,GACD;IACE,mFAAmF;IACnF,IAAI,EAAE,aAAa,CAAC;CACrB,CAAC;AAON;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,2BAA2B,EAChC,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAO,GAC9C,OAAO,CAAC,uBAAuB,CAAC,CA6BlC;AAED,4CAA4C;AAC5C,MAAM,WAAW,8BAA8B;IAC7C,6BAA6B;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,wFAAwF;IACxF,KAAK,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,wDAAwD;IACxD,UAAU,EAAE,2BAA2B,CAAC;CACzC;AAED,8CAA8C;AAC9C,MAAM,WAAW,6BAA6B;IAC5C,2GAA2G;IAC3G,KAAK,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,mFAAmF;IACnF,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B;AAuBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,8BAA8B,GACtC,OAAO,CAAC,6BAA6B,CAAC,CAkExC"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { copyFileSync, chmodSync, constants, existsSync } from 'node:fs';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { isPathUnder, listComposeContainers, publishesPort, } from './compose-containers.js';
|
|
4
|
+
import { LEGACY_COMPOSE_PROJECT } from './install.js';
|
|
5
|
+
import { deployStatePath, writeState } from './state.js';
|
|
6
|
+
export { isPathUnder } from './compose-containers.js';
|
|
7
|
+
/** The sorted, unique project names of `containers`. */
|
|
8
|
+
function projectsOf(containers) {
|
|
9
|
+
return [...new Set(containers.map((container) => container.project))].sort();
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Asks Docker which compose project the containers started from inside
|
|
13
|
+
* `deployRoot` belong to, stopped containers included. A container is the
|
|
14
|
+
* deployment's when its working-directory label is the deploy root or under it.
|
|
15
|
+
*
|
|
16
|
+
* Several projects can live in one folder (the live stack plus leftovers of
|
|
17
|
+
* another), so the answer is the project the STRONGEST evidence names, in
|
|
18
|
+
* order: (1) the project of a container that publishes `options.bindPort`
|
|
19
|
+
* (running ones first: a stopped leftover publishes it in its configuration
|
|
20
|
+
* too), (2) the only project with a running container, (3) the only project.
|
|
21
|
+
* Several projects and no evidence that separates them is `ambiguous`.
|
|
22
|
+
*
|
|
23
|
+
* Never throws: a Docker that cannot be asked is `unavailable`. Read-only
|
|
24
|
+
* (`docker ps`, `docker inspect`), and argv only, never a shell string.
|
|
25
|
+
*
|
|
26
|
+
* @param deployRoot - The deployment folder (`<apps-root>/<name>`).
|
|
27
|
+
* @param run - The command seam; pass the engine's `runCommand`.
|
|
28
|
+
* @param options - `bindPort`: the deployment's loopback port, the strongest evidence when known.
|
|
29
|
+
* @returns the project found and why, none, several, or unavailable.
|
|
30
|
+
* @stability experimental
|
|
31
|
+
*/
|
|
32
|
+
export async function detectComposeProject(deployRoot, run, options = {}) {
|
|
33
|
+
try {
|
|
34
|
+
const listed = await listComposeContainers(run);
|
|
35
|
+
if (listed === undefined)
|
|
36
|
+
return { kind: 'unavailable' };
|
|
37
|
+
const here = listed.filter((container) => container.project !== '' && container.workingDir !== '' && isPathUnder(container.workingDir, deployRoot));
|
|
38
|
+
const projects = projectsOf(here);
|
|
39
|
+
const [only] = projects;
|
|
40
|
+
if (only === undefined)
|
|
41
|
+
return { kind: 'none' };
|
|
42
|
+
const { bindPort } = options;
|
|
43
|
+
if (bindPort !== undefined) {
|
|
44
|
+
const claimants = here.filter((container) => publishesPort(container, bindPort));
|
|
45
|
+
const serving = claimants.filter((container) => container.running);
|
|
46
|
+
const [holder, ...others] = projectsOf(serving.length > 0 ? serving : claimants);
|
|
47
|
+
if (holder !== undefined && others.length === 0)
|
|
48
|
+
return { kind: 'found', project: holder, basis: 'bind-port' };
|
|
49
|
+
}
|
|
50
|
+
if (projects.length === 1)
|
|
51
|
+
return { kind: 'found', project: only, basis: 'only' };
|
|
52
|
+
const [live, ...otherLive] = projectsOf(here.filter((container) => container.running));
|
|
53
|
+
if (live !== undefined && otherLive.length === 0)
|
|
54
|
+
return { kind: 'found', project: live, basis: 'running' };
|
|
55
|
+
return { kind: 'ambiguous', projects };
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return { kind: 'unavailable' };
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/** Why a project was picked, as a clause for the operator. */
|
|
62
|
+
function basisText(basis, bindPort) {
|
|
63
|
+
if (basis === 'bind-port')
|
|
64
|
+
return `it holds port ${bindPort ?? 'the bind port'}`;
|
|
65
|
+
if (basis === 'running')
|
|
66
|
+
return 'it is the only project with a running container here';
|
|
67
|
+
return 'it is the only project with containers here';
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Copies the previous state file once to `<file>.bak` (mode 0600) and keeps an
|
|
71
|
+
* existing backup: the one from before the first change is the one worth having.
|
|
72
|
+
*/
|
|
73
|
+
function keepBackup(path) {
|
|
74
|
+
const backup = `${path}.bak`;
|
|
75
|
+
try {
|
|
76
|
+
copyFileSync(path, backup, constants.COPYFILE_EXCL);
|
|
77
|
+
chmodSync(backup, 0o600);
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
if (error.code !== 'EEXIST')
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Makes the carried compose project match the one Docker says the deployment
|
|
86
|
+
* runs under, when the record is absent or the legacy default.
|
|
87
|
+
*
|
|
88
|
+
* Docker names the project by the strongest evidence (see
|
|
89
|
+
* `detectComposeProject`), the state's bind port first: the stack that holds
|
|
90
|
+
* the port is the one that serves, whatever leftovers share the folder.
|
|
91
|
+
*
|
|
92
|
+
* Changes nothing (the state comes back as given) when there is no state, when
|
|
93
|
+
* Docker cannot be asked or knows no container of this folder, or when it
|
|
94
|
+
* already agrees. A project recorded on purpose is never overwritten; when the
|
|
95
|
+
* container holding the bind port belongs to ANOTHER project it is only
|
|
96
|
+
* reported (a warning), and the `bind-port-owner` check fails the run before
|
|
97
|
+
* anything starts. An ambiguous answer, with nothing decisive, changes nothing
|
|
98
|
+
* and returns a warning naming the projects and the state file: it is never
|
|
99
|
+
* silent, because keeping `compose` unseen is how a second stack got started.
|
|
100
|
+
*
|
|
101
|
+
* On `found` with a different project: the returned state carries it, and when
|
|
102
|
+
* a state file is on disk it is rewritten through the engine's own writer (same
|
|
103
|
+
* v2 shape, version not bumped, every other field kept) after the previous file
|
|
104
|
+
* is copied once to `.appctl-deploy.json.bak`. An in-memory state with no file
|
|
105
|
+
* (an adopted deployment) is only corrected; the pipeline records it with its
|
|
106
|
+
* first write. If the file cannot be written the corrected project is still
|
|
107
|
+
* used for this run, since running under the wrong one is the outage, and the
|
|
108
|
+
* message says it was not recorded.
|
|
109
|
+
*
|
|
110
|
+
* Never throws: it must not make a command that worked before fail.
|
|
111
|
+
*
|
|
112
|
+
* @param options - The deployment folder, the loaded state and the command seam.
|
|
113
|
+
* @returns the state to carry, and a one-line message when there is one.
|
|
114
|
+
* @stability experimental
|
|
115
|
+
*/
|
|
116
|
+
export async function reconcileComposeProject(options) {
|
|
117
|
+
const { state } = options;
|
|
118
|
+
try {
|
|
119
|
+
if (state === undefined)
|
|
120
|
+
return { state };
|
|
121
|
+
const root = resolve(options.deployRoot);
|
|
122
|
+
const bindPort = typeof state.bindPort === 'number' ? state.bindPort : undefined;
|
|
123
|
+
const detection = await detectComposeProject(root, options.runCommand, { bindPort });
|
|
124
|
+
const recorded = state.composeProject;
|
|
125
|
+
const shown = recorded ?? 'none';
|
|
126
|
+
const path = deployStatePath(root);
|
|
127
|
+
// A recorded, non-legacy project is a decision: never overwritten. But the
|
|
128
|
+
// stack that holds the port living under ANOTHER project is worth saying,
|
|
129
|
+
// since this run would start a second one beside it.
|
|
130
|
+
if (recorded !== undefined && recorded !== LEGACY_COMPOSE_PROJECT) {
|
|
131
|
+
if (detection.kind === 'found' && detection.basis === 'bind-port' && detection.project !== recorded) {
|
|
132
|
+
return {
|
|
133
|
+
state,
|
|
134
|
+
message: `warning: the state file records compose project ${recorded} for ${root}, but the stack holding port ${bindPort ?? ''} ` +
|
|
135
|
+
`runs under ${detection.project}; the record was not changed. Set "composeProject" to ${detection.project} in ${path}, ` +
|
|
136
|
+
`or remove the leftover containers of ${detection.project} if they are not the live stack.`,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
return { state };
|
|
140
|
+
}
|
|
141
|
+
if (detection.kind === 'ambiguous') {
|
|
142
|
+
return {
|
|
143
|
+
state,
|
|
144
|
+
message: `warning: containers of ${root} run under several compose projects ` +
|
|
145
|
+
`(${detection.projects.join(', ')}) and none of them holds port ${bindPort ?? 'the bind port'} alone or is the only one running; ` +
|
|
146
|
+
`the state file records ${shown}, so the compose project was not changed. ` +
|
|
147
|
+
`Set "composeProject" in ${path} to the right one, or remove the leftover containers.`,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
if (detection.kind !== 'found' || detection.project === LEGACY_COMPOSE_PROJECT)
|
|
151
|
+
return { state };
|
|
152
|
+
const reconciled = { ...state, composeProject: detection.project };
|
|
153
|
+
const note = `note: recorded compose project ${detection.project} for ${root} ` +
|
|
154
|
+
`(${basisText(detection.basis, bindPort)}; the state file had ${shown}).`;
|
|
155
|
+
// No file on disk, or one whose recorded root is elsewhere (a moved
|
|
156
|
+
// folder): `writeState` writes to `state.deployRoot`, and creating that
|
|
157
|
+
// directory somewhere else is worse than not recording. Carry it in memory.
|
|
158
|
+
if (!existsSync(path) || resolve(state.deployRoot) !== root)
|
|
159
|
+
return { state: reconciled, message: note };
|
|
160
|
+
try {
|
|
161
|
+
keepBackup(path);
|
|
162
|
+
writeState(reconciled);
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
return {
|
|
166
|
+
state: reconciled,
|
|
167
|
+
message: `warning: containers of ${root} run under compose project ${detection.project}, which is used for this run, ` +
|
|
168
|
+
`but it could not be recorded in ${path}: ${error instanceof Error ? error.message : String(error)}`,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
return { state: reconciled, message: note };
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
return { state };
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=compose-project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose-project.js","sourceRoot":"","sources":["../../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