@marinoscar/platform-cli 0.1.0-next.14 → 0.1.0-next.15
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 +17 -0
- package/dist/engine/commands/deploy.d.ts +7 -0
- package/dist/engine/commands/deploy.d.ts.map +1 -1
- package/dist/engine/commands/deploy.js +5 -2
- package/dist/engine/commands/deploy.js.map +1 -1
- package/dist/engine/deploy/checks/stack-ports.d.ts.map +1 -1
- package/dist/engine/deploy/checks/stack-ports.js +38 -11
- package/dist/engine/deploy/checks/stack-ports.js.map +1 -1
- package/dist/engine/deploy/compose-port-variables.d.ts +40 -0
- package/dist/engine/deploy/compose-port-variables.d.ts.map +1 -1
- package/dist/engine/deploy/compose-port-variables.js +62 -14
- package/dist/engine/deploy/compose-port-variables.js.map +1 -1
- package/dist/engine/deploy/free-ports.d.ts +145 -0
- package/dist/engine/deploy/free-ports.d.ts.map +1 -0
- package/dist/engine/deploy/free-ports.js +235 -0
- package/dist/engine/deploy/free-ports.js.map +1 -0
- package/dist/engine/deploy/install.d.ts +14 -0
- package/dist/engine/deploy/install.d.ts.map +1 -1
- package/dist/engine/deploy/install.js +100 -2
- package/dist/engine/deploy/install.js.map +1 -1
- package/dist/engine/deploy/update.d.ts +2 -0
- package/dist/engine/deploy/update.d.ts.map +1 -1
- package/dist/engine/deploy/update.js +45 -1
- package/dist/engine/deploy/update.js.map +1 -1
- package/dist/engine/tui/screens/deploy/install.d.ts.map +1 -1
- package/dist/engine/tui/screens/deploy/install.js +4 -0
- package/dist/engine/tui/screens/deploy/install.js.map +1 -1
- package/package.json +3 -3
|
@@ -46,17 +46,19 @@ function itemValue(line) {
|
|
|
46
46
|
return rest.replace(/\s+#.*$/, '').trim();
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
|
-
* The raw `ports:` entries of
|
|
49
|
+
* The raw `ports:` entries of every service after applying every file in order:
|
|
50
50
|
* `ports: !override` / `!reset` drops what the earlier files listed (as compose
|
|
51
|
-
* does), a plain `ports:` adds to it.
|
|
51
|
+
* does), a plain `ports:` adds to it. Services appear in the order they are
|
|
52
|
+
* first seen with a `ports:` key.
|
|
52
53
|
*/
|
|
53
|
-
function
|
|
54
|
-
|
|
54
|
+
function rawPortsByService(texts) {
|
|
55
|
+
const byService = new Map();
|
|
55
56
|
for (const text of texts) {
|
|
56
57
|
let inServices = false;
|
|
57
58
|
let serviceIndent = -1;
|
|
58
|
-
let
|
|
59
|
-
let
|
|
59
|
+
let current;
|
|
60
|
+
let entries; // the list being filled while inside a `ports:` list
|
|
61
|
+
let portsIndent = -1; // >= 0 while inside a service's `ports:` list
|
|
60
62
|
for (const line of text.split(/\r?\n/)) {
|
|
61
63
|
const trimmed = line.trim();
|
|
62
64
|
if (trimmed === '' || trimmed.startsWith('#'))
|
|
@@ -64,7 +66,7 @@ function rawPortsOf(service, texts) {
|
|
|
64
66
|
const indent = indentOf(line);
|
|
65
67
|
if (indent === 0) {
|
|
66
68
|
inServices = /^services:\s*(#.*)?$/.test(trimmed);
|
|
67
|
-
|
|
69
|
+
current = undefined;
|
|
68
70
|
portsIndent = -1;
|
|
69
71
|
continue;
|
|
70
72
|
}
|
|
@@ -79,29 +81,33 @@ function rawPortsOf(service, texts) {
|
|
|
79
81
|
const value = itemValue(line);
|
|
80
82
|
const split = value === undefined ? undefined : splitPortSpec(value);
|
|
81
83
|
if (split !== undefined)
|
|
82
|
-
entries
|
|
84
|
+
entries?.push(split);
|
|
83
85
|
continue;
|
|
84
86
|
}
|
|
85
87
|
// The first key under `services:` fixes the indent of the service names.
|
|
86
88
|
if (serviceIndent === -1)
|
|
87
89
|
serviceIndent = indent;
|
|
88
90
|
if (indent === serviceIndent) {
|
|
89
|
-
|
|
90
|
-
inService = name === service;
|
|
91
|
+
current = /^([A-Za-z0-9_.-]+):/.exec(trimmed)?.[1];
|
|
91
92
|
continue;
|
|
92
93
|
}
|
|
93
|
-
if (
|
|
94
|
+
if (current === undefined)
|
|
94
95
|
continue;
|
|
95
96
|
const ports = /^ports:\s*(!override|!reset)?\s*(\[\s*\])?\s*(#.*)?$/.exec(trimmed);
|
|
96
97
|
if (ports === null)
|
|
97
98
|
continue;
|
|
98
|
-
if (ports[1] !== undefined)
|
|
99
|
-
|
|
99
|
+
if (ports[1] !== undefined || !byService.has(current))
|
|
100
|
+
byService.set(current, []);
|
|
101
|
+
entries = byService.get(current);
|
|
100
102
|
if (ports[2] === undefined)
|
|
101
103
|
portsIndent = indent;
|
|
102
104
|
}
|
|
103
105
|
}
|
|
104
|
-
return
|
|
106
|
+
return byService;
|
|
107
|
+
}
|
|
108
|
+
/** The raw `ports:` entries of one service after applying every file in order. */
|
|
109
|
+
function rawPortsOf(service, texts) {
|
|
110
|
+
return rawPortsByService(texts).get(service) ?? [];
|
|
105
111
|
}
|
|
106
112
|
/** Whether an interpolated published token (`14003`, `8000-8010`) covers `port`. */
|
|
107
113
|
function covers(published, port) {
|
|
@@ -133,4 +139,46 @@ export function portVariableFor(options) {
|
|
|
133
139
|
const last = matching[matching.length - 1];
|
|
134
140
|
return last === undefined ? undefined : variableOf(last.published);
|
|
135
141
|
}
|
|
142
|
+
// A published token that is exactly one variable: ${NAME}, ${NAME:-14003}, ${NAME-14003}, ${NAME:?message} or $NAME.
|
|
143
|
+
const WHOLE_VARIABLE = /^(?:\$\{([A-Za-z_][A-Za-z0-9_]*)(?:(:?)([-?])([^}]*))?\}|\$([A-Za-z_][A-Za-z0-9_]*))$/;
|
|
144
|
+
/**
|
|
145
|
+
* Every environment variable that sets ONE published host port, derived from
|
|
146
|
+
* the compose files the run uses (the same raw scan as `portVariableFor`, in the
|
|
147
|
+
* other direction: from the files to the variables, with no compose render
|
|
148
|
+
* needed, so it works before the `.env` is complete).
|
|
149
|
+
*
|
|
150
|
+
* Only a published side that is exactly one variable counts. A literal port, a
|
|
151
|
+
* range, or a token that mixes text and a variable (`${A}0`) has no single
|
|
152
|
+
* variable an installer could pick a value for, and is left to the
|
|
153
|
+
* `stack-ports-free` check. A variable that publishes the same port twice (TCP
|
|
154
|
+
* and UDP) is one entry with two claims.
|
|
155
|
+
*
|
|
156
|
+
* @param options - The compose files' text in merge order, and the environment
|
|
157
|
+
* used to interpolate the host address (`${BIND_ADDRESS:-127.0.0.1}`).
|
|
158
|
+
* @returns the variables, by the order in which the files first list their services.
|
|
159
|
+
* @stability experimental
|
|
160
|
+
*/
|
|
161
|
+
export function publishedPortVariables(options) {
|
|
162
|
+
const found = new Map();
|
|
163
|
+
for (const [service, entries] of rawPortsByService(options.files)) {
|
|
164
|
+
for (const entry of entries) {
|
|
165
|
+
const match = WHOLE_VARIABLE.exec(entry.published.trim());
|
|
166
|
+
const variable = match?.[1] ?? match?.[5];
|
|
167
|
+
if (match === null || variable === undefined)
|
|
168
|
+
continue;
|
|
169
|
+
const argument = (match[4] ?? '').trim();
|
|
170
|
+
const defaultPort = match[3] === '-' && /^[0-9]+$/.test(argument) ? Number(argument) : undefined;
|
|
171
|
+
const hostIp = interpolate(entry.hostIp, options.env).replace(/^\[|\]$/g, '');
|
|
172
|
+
const known = found.get(variable);
|
|
173
|
+
if (known === undefined) {
|
|
174
|
+
found.set(variable, { variable, claims: [{ service, hostIp, protocol: entry.protocol }], defaultPort });
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
known.claims.push({ service, hostIp, protocol: entry.protocol });
|
|
178
|
+
known.defaultPort ??= defaultPort;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return [...found.values()];
|
|
183
|
+
}
|
|
136
184
|
//# sourceMappingURL=compose-port-variables.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose-port-variables.js","sourceRoot":"","sources":["../../../src/engine/deploy/compose-port-variables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAsB,MAAM,oBAAoB,CAAC;AA4BvE,+EAA+E;AAC/E,MAAM,aAAa,GAAG,wFAAwF,CAAC;AAE/G;;;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AC;YAE9E,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAClC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;YAC1G,CAAC;iBAAM,CAAC;gBACN,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;gBACjE,KAAK,CAAC,WAAW,KAAK,WAAW,CAAC;YACpC,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { type ComposeContainer } from './compose-containers.js';
|
|
2
|
+
/** How far above the default a search walks before giving up. */
|
|
3
|
+
export declare const DEFAULT_PORT_SEARCH_LIMIT = 200;
|
|
4
|
+
/** Where a port is published: the address and protocol a clash is judged on. */
|
|
5
|
+
export interface PortClaim {
|
|
6
|
+
/** The host address; `''` (and `0.0.0.0`, `::`) is every interface. */
|
|
7
|
+
hostIp: string;
|
|
8
|
+
/** `tcp`, `udp` or `sctp`. */
|
|
9
|
+
protocol: string;
|
|
10
|
+
}
|
|
11
|
+
/** Why a candidate port was passed over. */
|
|
12
|
+
export interface SkippedPort {
|
|
13
|
+
port: number;
|
|
14
|
+
/** `listener`: a process listens on it; `container`: a container is configured to publish it; `taken`: another variable of this run has it. */
|
|
15
|
+
reason: 'listener' | 'container' | 'taken';
|
|
16
|
+
/** The container that holds it, for `container`. A running one is preferred over a stopped one. */
|
|
17
|
+
holder?: string | undefined;
|
|
18
|
+
}
|
|
19
|
+
/** The port found, and the ones passed over on the way. */
|
|
20
|
+
export interface PortPick {
|
|
21
|
+
port: number;
|
|
22
|
+
skipped: SkippedPort[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Whether `value` is an integer port number (1 to 65535).
|
|
26
|
+
*
|
|
27
|
+
* @param value - Any number.
|
|
28
|
+
* @returns true for a usable port.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isPort(value: number): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* The first free host port at or above `preferred`.
|
|
33
|
+
*
|
|
34
|
+
* `options` carries:
|
|
35
|
+
*
|
|
36
|
+
* - `preferred`: where the search starts (the template default).
|
|
37
|
+
* - `hostIp` and `protocol`: where the port will be published.
|
|
38
|
+
* - `also`: more places the SAME port number is published (a variable that
|
|
39
|
+
* feeds a TCP and a UDP mapping); all of them must be free.
|
|
40
|
+
* - `taken`: ports already chosen for other variables of this run. Not
|
|
41
|
+
* changed; the caller adds the result.
|
|
42
|
+
* - `containers`: every container Docker knows, in any state. A container claims
|
|
43
|
+
* a port when it is configured to publish it on an address that overlaps (a
|
|
44
|
+
* wildcard clashes with every address) and the same protocol.
|
|
45
|
+
* - `probe`: says whether nothing listens on the port (true = free).
|
|
46
|
+
* - `limit`: how many ports to try (default 200); the search never goes above
|
|
47
|
+
* 65535.
|
|
48
|
+
* - `label`: names the variable in the error.
|
|
49
|
+
*
|
|
50
|
+
* @param options - The search, as above.
|
|
51
|
+
* @returns the port and the candidates passed over.
|
|
52
|
+
* @throws PreconditionError when `preferred` is not a port, or none is free.
|
|
53
|
+
*/
|
|
54
|
+
export declare function pickFreePort(options: {
|
|
55
|
+
preferred: number;
|
|
56
|
+
hostIp: string;
|
|
57
|
+
protocol: string;
|
|
58
|
+
also?: readonly PortClaim[] | undefined;
|
|
59
|
+
taken?: ReadonlySet<number> | undefined;
|
|
60
|
+
containers: readonly ComposeContainer[];
|
|
61
|
+
probe: (port: number) => Promise<boolean>;
|
|
62
|
+
limit?: number | undefined;
|
|
63
|
+
label?: string | undefined;
|
|
64
|
+
}): Promise<PortPick>;
|
|
65
|
+
/**
|
|
66
|
+
* The sentence for a pick that did not land on the default:
|
|
67
|
+
* `GREPTIME_BIND_PG_PORT=14013 (14003 is held by evopath-greptimedb-1)`.
|
|
68
|
+
*
|
|
69
|
+
* @param variable - The variable the port is for.
|
|
70
|
+
* @param pick - What `pickFreePort` returned.
|
|
71
|
+
* @param preferred - The default the search started from.
|
|
72
|
+
* @returns the text, or `undefined` when the default was free (nothing to say).
|
|
73
|
+
*/
|
|
74
|
+
export declare function describePick(variable: string, pick: PortPick, preferred: number): string | undefined;
|
|
75
|
+
/** A port variable decided by `planPortValues`. */
|
|
76
|
+
export interface PortDecision {
|
|
77
|
+
variable: string;
|
|
78
|
+
port: number;
|
|
79
|
+
/** The default the search started from. */
|
|
80
|
+
preferred: number;
|
|
81
|
+
/** What `describePick` says, or `undefined` when the default was free. */
|
|
82
|
+
message: string | undefined;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Decides a value for every published-port variable that needs one.
|
|
86
|
+
*
|
|
87
|
+
* The variables come from the compose files (`publishedPortVariables`), so an
|
|
88
|
+
* app overlay that publishes a new port is covered without a list to keep. A
|
|
89
|
+
* variable is decided only when it is in `eligible`, has no non-blank value in
|
|
90
|
+
* `given`, is not in `exclude`, and a starting point is known (the template
|
|
91
|
+
* default, else the compose file's). Everything else is left exactly as it is.
|
|
92
|
+
* Variables are decided in the order the files publish them; each choice is
|
|
93
|
+
* `taken` for the next, and so are the ports the `given` values already use.
|
|
94
|
+
*
|
|
95
|
+
* `options` carries:
|
|
96
|
+
*
|
|
97
|
+
* - `files`: the compose files' text, in merge order.
|
|
98
|
+
* - `eligible`: the keys this run may decide (the template's, or for an update
|
|
99
|
+
* the keys it is adding).
|
|
100
|
+
* - `given`: values that stay as they are, the `.env` on disk and the
|
|
101
|
+
* operator's answers. A key with a value here is never moved.
|
|
102
|
+
* - `defaults`: the template default of each key, where the search starts.
|
|
103
|
+
* - `exclude`: keys decided elsewhere (`APP_BIND_PORT`).
|
|
104
|
+
* - `taken`: ports already in use by this run.
|
|
105
|
+
* - `containers`: every container Docker knows, or `undefined` when Docker
|
|
106
|
+
* cannot be asked (probe-only).
|
|
107
|
+
* - `probe`: says whether nothing listens on a port (default: the loopback bind
|
|
108
|
+
* probe).
|
|
109
|
+
* - `limit`: the search bound per variable.
|
|
110
|
+
*
|
|
111
|
+
* @param options - The decision inputs, as above.
|
|
112
|
+
* @returns one decision per variable decided, in file order.
|
|
113
|
+
* @throws PreconditionError when a variable has no free port within the bound.
|
|
114
|
+
*/
|
|
115
|
+
export declare function planPortValues(options: {
|
|
116
|
+
files: readonly string[];
|
|
117
|
+
eligible: ReadonlySet<string>;
|
|
118
|
+
given: ReadonlyMap<string, string>;
|
|
119
|
+
defaults: ReadonlyMap<string, string>;
|
|
120
|
+
exclude?: ReadonlySet<string> | undefined;
|
|
121
|
+
taken?: Iterable<number> | undefined;
|
|
122
|
+
containers: readonly ComposeContainer[] | undefined;
|
|
123
|
+
probe?: ((port: number) => Promise<boolean>) | undefined;
|
|
124
|
+
limit?: number | undefined;
|
|
125
|
+
}): Promise<PortDecision[]>;
|
|
126
|
+
/**
|
|
127
|
+
* The containers a pick must avoid: every one except those of the run's own
|
|
128
|
+
* compose project, which `up -d` recreates (the rule `stack-ports-free` applies).
|
|
129
|
+
*
|
|
130
|
+
* @param containers - What `listComposeContainers` returned, or `undefined`.
|
|
131
|
+
* @param project - The deployment's compose project.
|
|
132
|
+
* @returns the other projects' containers, or `undefined` when Docker could not be asked.
|
|
133
|
+
*/
|
|
134
|
+
export declare function foreignContainers(containers: readonly ComposeContainer[] | undefined, project: string): ComposeContainer[] | undefined;
|
|
135
|
+
/**
|
|
136
|
+
* The text of the deployment's compose files, in the order compose merges them
|
|
137
|
+
* (the same list `up -d` uses, app overlays last). A file that cannot be read
|
|
138
|
+
* is an empty string: a missing checkout is the compose call's error to report.
|
|
139
|
+
*
|
|
140
|
+
* @param deployRoot - The deployment folder.
|
|
141
|
+
* @param groups - The deployment's groups.
|
|
142
|
+
* @returns one text per compose file.
|
|
143
|
+
*/
|
|
144
|
+
export declare function readComposeFileTexts(deployRoot: string, groups?: readonly string[] | undefined): string[];
|
|
145
|
+
//# sourceMappingURL=free-ports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"free-ports.d.ts","sourceRoot":"","sources":["../../../src/engine/deploy/free-ports.ts"],"names":[],"mappings":"AAMA,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AA+B/E,iEAAiE;AACjE,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAK7C,gFAAgF;AAChF,MAAM,WAAW,SAAS;IACxB,uEAAuE;IACvE,MAAM,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,4CAA4C;AAC5C,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,+IAA+I;IAC/I,MAAM,EAAE,UAAU,GAAG,WAAW,GAAG,OAAO,CAAC;IAC3C,mGAAmG;IACnG,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B;AAED,2DAA2D;AAC3D,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE7C;AAOD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,SAAS,EAAE,GAAG,SAAS,CAAC;IACxC,KAAK,CAAC,EAAE,WAAW,CAAC,MAAM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AG,SAAS,CAAC;IACzD,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CA0C1B;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,SAAS,gBAAgB,EAAE,GAAG,SAAS,EACnD,OAAO,EAAE,MAAM,GACd,gBAAgB,EAAE,GAAG,SAAS,CAEhC;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GAAG,MAAM,EAAE,CASzG"}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { PreconditionError } from '../errors.js';
|
|
4
|
+
import { isLoopbackPortFree } from './checks/types.js';
|
|
5
|
+
import { composeCwd } from './compose-command.js';
|
|
6
|
+
import { publishesPort } from './compose-containers.js';
|
|
7
|
+
import { composeFilesFor } from './compose-files.js';
|
|
8
|
+
import { publishedPortVariables } from './compose-port-variables.js';
|
|
9
|
+
// =============================================================================
|
|
10
|
+
// Free host ports for the variables the CLI writes (#1027)
|
|
11
|
+
// =============================================================================
|
|
12
|
+
//
|
|
13
|
+
// Every app the platform deploys publishes the same default host ports
|
|
14
|
+
// (`APP_BIND_PORT=3535`, `GREPTIME_BIND_PG_PORT=14003`), so the SECOND app on a
|
|
15
|
+
// server collided with the first on its telemetry port and `stack-ports-free`
|
|
16
|
+
// (#1024) stopped it, leaving the operator to hand-edit `.env`. When the CLI is
|
|
17
|
+
// about to WRITE a value for a published-port variable it now picks one that is
|
|
18
|
+
// actually free:
|
|
19
|
+
//
|
|
20
|
+
// - FREE means no container in ANY state is configured to publish it on an
|
|
21
|
+
// address that can clash (the source `stack-ports-free` uses), nothing
|
|
22
|
+
// listens on it (the same loopback bind probe as `bind-port-free`), and it
|
|
23
|
+
// is not already chosen for another variable of the same run.
|
|
24
|
+
// - THE SEARCH STARTS AT THE DEFAULT AND WALKS UP, bounded, so a lone app
|
|
25
|
+
// keeps the familiar numbers and says nothing extra.
|
|
26
|
+
// - AN EXISTING VALUE IS NEVER MOVED. Only a variable with no value yet gets a
|
|
27
|
+
// pick: an SSH tunnel or a BI tool may depend on the number, and
|
|
28
|
+
// `stack-ports-free` still reports a clash with the fix.
|
|
29
|
+
// - DOCKER UNREACHABLE (`containers` undefined) is probe-only: still picks.
|
|
30
|
+
//
|
|
31
|
+
// `stack-ports-free` stays the final guard; this module only chooses what the
|
|
32
|
+
// guard is then asked about. It reads Docker and probes sockets and writes
|
|
33
|
+
// nothing: the callers decide where a value goes.
|
|
34
|
+
// =============================================================================
|
|
35
|
+
/** How far above the default a search walks before giving up. */
|
|
36
|
+
export const DEFAULT_PORT_SEARCH_LIMIT = 200;
|
|
37
|
+
/** The highest port number. */
|
|
38
|
+
const MAX_PORT = 65535;
|
|
39
|
+
/**
|
|
40
|
+
* Whether `value` is an integer port number (1 to 65535).
|
|
41
|
+
*
|
|
42
|
+
* @param value - Any number.
|
|
43
|
+
* @returns true for a usable port.
|
|
44
|
+
*/
|
|
45
|
+
export function isPort(value) {
|
|
46
|
+
return Number.isInteger(value) && value >= 1 && value <= MAX_PORT;
|
|
47
|
+
}
|
|
48
|
+
/** Whether the listener probe says something about this claim: it binds TCP on the loopback. */
|
|
49
|
+
function probeable(claim) {
|
|
50
|
+
return claim.protocol === 'tcp' && ['', '0.0.0.0', '::', '[::]', '127.0.0.1'].includes(claim.hostIp);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The first free host port at or above `preferred`.
|
|
54
|
+
*
|
|
55
|
+
* `options` carries:
|
|
56
|
+
*
|
|
57
|
+
* - `preferred`: where the search starts (the template default).
|
|
58
|
+
* - `hostIp` and `protocol`: where the port will be published.
|
|
59
|
+
* - `also`: more places the SAME port number is published (a variable that
|
|
60
|
+
* feeds a TCP and a UDP mapping); all of them must be free.
|
|
61
|
+
* - `taken`: ports already chosen for other variables of this run. Not
|
|
62
|
+
* changed; the caller adds the result.
|
|
63
|
+
* - `containers`: every container Docker knows, in any state. A container claims
|
|
64
|
+
* a port when it is configured to publish it on an address that overlaps (a
|
|
65
|
+
* wildcard clashes with every address) and the same protocol.
|
|
66
|
+
* - `probe`: says whether nothing listens on the port (true = free).
|
|
67
|
+
* - `limit`: how many ports to try (default 200); the search never goes above
|
|
68
|
+
* 65535.
|
|
69
|
+
* - `label`: names the variable in the error.
|
|
70
|
+
*
|
|
71
|
+
* @param options - The search, as above.
|
|
72
|
+
* @returns the port and the candidates passed over.
|
|
73
|
+
* @throws PreconditionError when `preferred` is not a port, or none is free.
|
|
74
|
+
*/
|
|
75
|
+
export async function pickFreePort(options) {
|
|
76
|
+
const { preferred, taken = new Set(), containers, probe, limit = DEFAULT_PORT_SEARCH_LIMIT } = options;
|
|
77
|
+
const label = options.label ?? 'a host port';
|
|
78
|
+
const claims = [{ hostIp: options.hostIp, protocol: options.protocol }, ...(options.also ?? [])];
|
|
79
|
+
if (!isPort(preferred)) {
|
|
80
|
+
throw new PreconditionError(`Cannot pick a free port for ${label}: ${String(preferred)} is not a port number.`);
|
|
81
|
+
}
|
|
82
|
+
const last = Math.min(MAX_PORT, preferred + Math.max(1, limit) - 1);
|
|
83
|
+
const skipped = [];
|
|
84
|
+
for (let port = preferred; port <= last; port += 1) {
|
|
85
|
+
if (taken.has(port)) {
|
|
86
|
+
skipped.push({ port, reason: 'taken' });
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
const claimants = containers.filter((container) => claims.some((claim) => publishesPort(container, port, claim)));
|
|
90
|
+
if (claimants.length > 0) {
|
|
91
|
+
const holder = claimants.find((container) => container.running) ?? claimants[0];
|
|
92
|
+
skipped.push({ port, reason: 'container', holder: holder?.name });
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
// Probed once per port, and only where the probe is honest: it binds TCP on
|
|
96
|
+
// the loopback, which sees a listener on 127.0.0.1 or on every interface.
|
|
97
|
+
if (claims.some(probeable) && !(await probe(port))) {
|
|
98
|
+
skipped.push({ port, reason: 'listener' });
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
return { port, skipped };
|
|
102
|
+
}
|
|
103
|
+
throw new PreconditionError(`No free host port for ${label} from ${preferred} to ${last} (${skipped.length} tried). ` +
|
|
104
|
+
`Free one of them, or set ${options.label ?? 'the variable'} to a free port in the environment file by hand.`);
|
|
105
|
+
}
|
|
106
|
+
/** How many skipped candidates a message spells out. */
|
|
107
|
+
const MAX_PHRASES = 3;
|
|
108
|
+
/**
|
|
109
|
+
* The sentence for a pick that did not land on the default:
|
|
110
|
+
* `GREPTIME_BIND_PG_PORT=14013 (14003 is held by evopath-greptimedb-1)`.
|
|
111
|
+
*
|
|
112
|
+
* @param variable - The variable the port is for.
|
|
113
|
+
* @param pick - What `pickFreePort` returned.
|
|
114
|
+
* @param preferred - The default the search started from.
|
|
115
|
+
* @returns the text, or `undefined` when the default was free (nothing to say).
|
|
116
|
+
*/
|
|
117
|
+
export function describePick(variable, pick, preferred) {
|
|
118
|
+
if (pick.port === preferred && pick.skipped.length === 0)
|
|
119
|
+
return undefined;
|
|
120
|
+
const phrase = (entry) => entry.reason === 'container'
|
|
121
|
+
? `${entry.port} is held by ${entry.holder ?? 'another container'}`
|
|
122
|
+
: entry.reason === 'listener'
|
|
123
|
+
? `${entry.port} has a listener`
|
|
124
|
+
: `${entry.port} is used by another variable of this run`;
|
|
125
|
+
const shown = pick.skipped.slice(0, MAX_PHRASES).map(phrase);
|
|
126
|
+
if (pick.skipped.length > MAX_PHRASES)
|
|
127
|
+
shown.push(`${pick.skipped.length - MAX_PHRASES} more in use`);
|
|
128
|
+
return `${variable}=${pick.port} (${shown.join(', ')})`;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Decides a value for every published-port variable that needs one.
|
|
132
|
+
*
|
|
133
|
+
* The variables come from the compose files (`publishedPortVariables`), so an
|
|
134
|
+
* app overlay that publishes a new port is covered without a list to keep. A
|
|
135
|
+
* variable is decided only when it is in `eligible`, has no non-blank value in
|
|
136
|
+
* `given`, is not in `exclude`, and a starting point is known (the template
|
|
137
|
+
* default, else the compose file's). Everything else is left exactly as it is.
|
|
138
|
+
* Variables are decided in the order the files publish them; each choice is
|
|
139
|
+
* `taken` for the next, and so are the ports the `given` values already use.
|
|
140
|
+
*
|
|
141
|
+
* `options` carries:
|
|
142
|
+
*
|
|
143
|
+
* - `files`: the compose files' text, in merge order.
|
|
144
|
+
* - `eligible`: the keys this run may decide (the template's, or for an update
|
|
145
|
+
* the keys it is adding).
|
|
146
|
+
* - `given`: values that stay as they are, the `.env` on disk and the
|
|
147
|
+
* operator's answers. A key with a value here is never moved.
|
|
148
|
+
* - `defaults`: the template default of each key, where the search starts.
|
|
149
|
+
* - `exclude`: keys decided elsewhere (`APP_BIND_PORT`).
|
|
150
|
+
* - `taken`: ports already in use by this run.
|
|
151
|
+
* - `containers`: every container Docker knows, or `undefined` when Docker
|
|
152
|
+
* cannot be asked (probe-only).
|
|
153
|
+
* - `probe`: says whether nothing listens on a port (default: the loopback bind
|
|
154
|
+
* probe).
|
|
155
|
+
* - `limit`: the search bound per variable.
|
|
156
|
+
*
|
|
157
|
+
* @param options - The decision inputs, as above.
|
|
158
|
+
* @returns one decision per variable decided, in file order.
|
|
159
|
+
* @throws PreconditionError when a variable has no free port within the bound.
|
|
160
|
+
*/
|
|
161
|
+
export async function planPortValues(options) {
|
|
162
|
+
const { given, defaults, eligible, exclude = new Set() } = options;
|
|
163
|
+
const probe = options.probe ?? isLoopbackPortFree;
|
|
164
|
+
const containers = options.containers ?? [];
|
|
165
|
+
const variables = publishedPortVariables({ files: options.files, env: new Map([...defaults, ...given]) });
|
|
166
|
+
// What the run already uses: the ports it was told about, and every value
|
|
167
|
+
// another published-port variable keeps.
|
|
168
|
+
const taken = new Set(options.taken ?? []);
|
|
169
|
+
for (const { variable } of variables) {
|
|
170
|
+
const value = Number(given.get(variable));
|
|
171
|
+
if (given.get(variable) !== undefined && isPort(value))
|
|
172
|
+
taken.add(value);
|
|
173
|
+
}
|
|
174
|
+
const decisions = [];
|
|
175
|
+
for (const candidate of variables) {
|
|
176
|
+
const { variable } = candidate;
|
|
177
|
+
if (!eligible.has(variable) || exclude.has(variable))
|
|
178
|
+
continue;
|
|
179
|
+
if ((given.get(variable) ?? '') !== '')
|
|
180
|
+
continue;
|
|
181
|
+
const fromTemplate = Number(defaults.get(variable));
|
|
182
|
+
const preferred = isPort(fromTemplate) ? fromTemplate : candidate.defaultPort;
|
|
183
|
+
if (preferred === undefined)
|
|
184
|
+
continue;
|
|
185
|
+
const [first, ...rest] = candidate.claims;
|
|
186
|
+
if (first === undefined)
|
|
187
|
+
continue;
|
|
188
|
+
const pick = await pickFreePort({
|
|
189
|
+
preferred,
|
|
190
|
+
hostIp: first.hostIp,
|
|
191
|
+
protocol: first.protocol,
|
|
192
|
+
also: rest,
|
|
193
|
+
taken,
|
|
194
|
+
containers,
|
|
195
|
+
probe,
|
|
196
|
+
limit: options.limit,
|
|
197
|
+
label: variable,
|
|
198
|
+
});
|
|
199
|
+
taken.add(pick.port);
|
|
200
|
+
decisions.push({ variable, port: pick.port, preferred, message: describePick(variable, pick, preferred) });
|
|
201
|
+
}
|
|
202
|
+
return decisions;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* The containers a pick must avoid: every one except those of the run's own
|
|
206
|
+
* compose project, which `up -d` recreates (the rule `stack-ports-free` applies).
|
|
207
|
+
*
|
|
208
|
+
* @param containers - What `listComposeContainers` returned, or `undefined`.
|
|
209
|
+
* @param project - The deployment's compose project.
|
|
210
|
+
* @returns the other projects' containers, or `undefined` when Docker could not be asked.
|
|
211
|
+
*/
|
|
212
|
+
export function foreignContainers(containers, project) {
|
|
213
|
+
return containers?.filter((container) => container.project !== project);
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* The text of the deployment's compose files, in the order compose merges them
|
|
217
|
+
* (the same list `up -d` uses, app overlays last). A file that cannot be read
|
|
218
|
+
* is an empty string: a missing checkout is the compose call's error to report.
|
|
219
|
+
*
|
|
220
|
+
* @param deployRoot - The deployment folder.
|
|
221
|
+
* @param groups - The deployment's groups.
|
|
222
|
+
* @returns one text per compose file.
|
|
223
|
+
*/
|
|
224
|
+
export function readComposeFileTexts(deployRoot, groups) {
|
|
225
|
+
const composeDir = composeCwd(deployRoot);
|
|
226
|
+
return composeFilesFor(groups, composeDir).map((file) => {
|
|
227
|
+
try {
|
|
228
|
+
return readFileSync(join(composeDir, file), 'utf8');
|
|
229
|
+
}
|
|
230
|
+
catch {
|
|
231
|
+
return '';
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
//# sourceMappingURL=free-ports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"free-ports.js","sourceRoot":"","sources":["../../../src/engine/deploy/free-ports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAyB,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,gFAAgF;AAChF,4DAA4D;AAC5D,gFAAgF;AAChF,EAAE;AACF,uEAAuE;AACvE,gFAAgF;AAChF,8EAA8E;AAC9E,gFAAgF;AAChF,gFAAgF;AAChF,iBAAiB;AACjB,EAAE;AACF,6EAA6E;AAC7E,2EAA2E;AAC3E,+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AM,UAAU,oBAAoB,CAAC,UAAkB,EAAE,MAAsC;IAC7F,MAAM,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IAC1C,OAAO,eAAe,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACtD,IAAI,CAAC;YACH,OAAO,YAAY,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;QACtD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -16,6 +16,20 @@ export interface InstallOptions extends AppRoleOptions {
|
|
|
16
16
|
deployRoot: string;
|
|
17
17
|
domain?: string | undefined;
|
|
18
18
|
bindPort: number;
|
|
19
|
+
/**
|
|
20
|
+
* True when `bindPort` is the default nobody asked for (`--port` was not
|
|
21
|
+
* passed), so a fresh install may move it to a free port (#1027): it walks up
|
|
22
|
+
* from `bindPort` past a port another app holds, and the CHOSEN number is what
|
|
23
|
+
* `.env`, the state, the vhost and the health probe then use. Absent or false
|
|
24
|
+
* means the operator named the port: it is kept, and the preflight fails if it
|
|
25
|
+
* is taken. A deployment that already has an `APP_BIND_PORT` keeps it either way.
|
|
26
|
+
*/
|
|
27
|
+
bindPortIsDefault?: boolean | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Says whether nothing listens on a loopback port (true = free). Test seam
|
|
30
|
+
* for the free-port search and the port checks; defaults to a real bind.
|
|
31
|
+
*/
|
|
32
|
+
portFree?: ((port: number) => Promise<boolean>) | undefined;
|
|
19
33
|
proxyRoot: string;
|
|
20
34
|
/**
|
|
21
35
|
* How the shared proxy runs. Absent means "as recorded, else detected" --
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/engine/deploy/install.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,WAAW,EAAE,U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