@platforma-sdk/bootstrap 3.4.12 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/start/docker/s3.d.ts +2 -0
- package/dist/commands/start/docker/s3.d.ts.map +1 -1
- package/dist/commands/svc/create/docker/s3.d.ts +2 -0
- package/dist/commands/svc/create/docker/s3.d.ts.map +1 -1
- package/dist/core.d.ts +2 -0
- package/dist/core.d.ts.map +1 -1
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +258 -252
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var Sr = Object.defineProperty;
|
|
2
2
|
var $r = (a, e, t) => e in a ? Sr(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
|
|
3
3
|
var l = (a, e, t) => $r(a, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { Flags as
|
|
4
|
+
import { Flags as p, Command as L, Args as Q } from "@oclif/core";
|
|
5
5
|
import * as me from "node:os";
|
|
6
6
|
import N from "node:os";
|
|
7
7
|
import f, { createWriteStream as Lr } from "node:fs";
|
|
8
8
|
import m, { resolve as Ar } from "node:path";
|
|
9
|
-
import { execSync as
|
|
9
|
+
import { execSync as xe, spawn as Ir, spawnSync as Or } from "node:child_process";
|
|
10
10
|
import fe from "winston";
|
|
11
11
|
import { randomBytes as Er } from "node:crypto";
|
|
12
12
|
import re from "readline-sync";
|
|
@@ -15,124 +15,124 @@ import { Writable as Rr } from "node:stream";
|
|
|
15
15
|
import { z as C } from "zod";
|
|
16
16
|
import xr from "decompress";
|
|
17
17
|
import { getDefaultPlVersion as he } from "@milaboratories/pl-deployments";
|
|
18
|
-
import
|
|
18
|
+
import ur from "yaml";
|
|
19
19
|
import Tr from "node:https";
|
|
20
20
|
import * as Fr from "tar";
|
|
21
21
|
const A = {
|
|
22
|
-
"log-level":
|
|
22
|
+
"log-level": p.string({
|
|
23
23
|
description: "logging level",
|
|
24
24
|
default: "info",
|
|
25
25
|
options: ["error", "warn", "info", "debug"],
|
|
26
26
|
required: !1
|
|
27
27
|
})
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
p.string({
|
|
30
30
|
description: "name of instance",
|
|
31
31
|
required: !1
|
|
32
32
|
});
|
|
33
33
|
const ye = {
|
|
34
|
-
image:
|
|
34
|
+
image: p.string({
|
|
35
35
|
description: "use custom docker image to run platforma"
|
|
36
36
|
})
|
|
37
37
|
}, j = {
|
|
38
|
-
version:
|
|
38
|
+
version: p.string({
|
|
39
39
|
description: "use custom platforma release (official docker image or binary package)"
|
|
40
40
|
})
|
|
41
|
-
},
|
|
42
|
-
arch:
|
|
41
|
+
}, be = {
|
|
42
|
+
arch: p.string({
|
|
43
43
|
description: "override architecture. You can start amd64 linux image on arm-based host (say, Apple M family processor). I.e. arm64, amd64, amd64/v2"
|
|
44
44
|
})
|
|
45
45
|
}, B = {
|
|
46
|
-
license:
|
|
46
|
+
license: p.string({
|
|
47
47
|
description: 'pass a license code. The license can be got from "https://licensing.milaboratories.com".'
|
|
48
48
|
}),
|
|
49
|
-
"license-file":
|
|
49
|
+
"license-file": p.file({
|
|
50
50
|
exists: !0,
|
|
51
51
|
description: "specify a path to the file with a license. The license can be got from 'https://licensing.milaboratories.com'."
|
|
52
52
|
})
|
|
53
53
|
}, U = {
|
|
54
|
-
"grpc-port":
|
|
54
|
+
"grpc-port": p.integer({
|
|
55
55
|
description: "port for Platforma Backend gRPC API. Default is 6345",
|
|
56
56
|
env: "PLATFORMA_GRPC_PORT"
|
|
57
57
|
}),
|
|
58
|
-
"grpc-listen":
|
|
58
|
+
"grpc-listen": p.string({
|
|
59
59
|
description: "full listen addr for Platforma Backend gRPC API. Default is 127.0.0.1:6345",
|
|
60
60
|
env: "PLATFORMA_GRPC_LISTEN"
|
|
61
61
|
}),
|
|
62
|
-
"monitoring-port":
|
|
62
|
+
"monitoring-port": p.integer({
|
|
63
63
|
description: "port for Platforma Backend monitoring API. Default is 9090",
|
|
64
64
|
env: "PLATFORMA_MONITORING_PORT"
|
|
65
65
|
}),
|
|
66
|
-
"monitoring-listen":
|
|
66
|
+
"monitoring-listen": p.string({
|
|
67
67
|
description: "full listen addr for Platforma Backend monitoring API. Default is 127.0.0.1:9090",
|
|
68
68
|
env: "PLATFORMA_MONITORING_LISTEN"
|
|
69
69
|
}),
|
|
70
|
-
"debug-port":
|
|
70
|
+
"debug-port": p.integer({
|
|
71
71
|
description: "port for Platforma Backend debug API. Default is 9091",
|
|
72
72
|
env: "PLATFORMA_DEBUG_PORT"
|
|
73
73
|
}),
|
|
74
|
-
"debug-listen":
|
|
74
|
+
"debug-listen": p.string({
|
|
75
75
|
description: "full listen addr for Platforma Backend debug API. Default is 127.0.0.1:9091",
|
|
76
76
|
env: "PLATFORMA_DEBUG_LISTEN"
|
|
77
77
|
})
|
|
78
|
-
},
|
|
79
|
-
"s3-port":
|
|
78
|
+
}, we = {
|
|
79
|
+
"s3-port": p.integer({
|
|
80
80
|
description: "port that S3 will listen, default is 9000",
|
|
81
81
|
default: 9e3,
|
|
82
82
|
env: "PLATFORMA_S3_PORT"
|
|
83
83
|
}),
|
|
84
|
-
"s3-console-port":
|
|
84
|
+
"s3-console-port": p.integer({
|
|
85
85
|
description: "port that a console of S3 will listen, default is 9001",
|
|
86
86
|
default: 9001,
|
|
87
87
|
env: "PLATFORMA_S3_CONSOLE_PORT"
|
|
88
88
|
})
|
|
89
89
|
}, G = {
|
|
90
|
-
storage:
|
|
90
|
+
storage: p.string({
|
|
91
91
|
description: "specify path on host to be used as storage for all Platforma Backend data"
|
|
92
92
|
})
|
|
93
93
|
}, yr = {
|
|
94
|
-
"minio-presign-host":
|
|
94
|
+
"minio-presign-host": p.boolean({
|
|
95
95
|
description: "use 'minio' host instead of 'localhost' in presign URLs"
|
|
96
96
|
})
|
|
97
|
-
},
|
|
98
|
-
mount:
|
|
97
|
+
}, pe = {
|
|
98
|
+
mount: p.string({
|
|
99
99
|
multiple: !0,
|
|
100
100
|
description: "things to be mounted into platforma docker container. Targets will appear inside the container under the same absolute paths"
|
|
101
101
|
})
|
|
102
|
-
},
|
|
103
|
-
"pl-log-file":
|
|
102
|
+
}, Pe = {
|
|
103
|
+
"pl-log-file": p.file({
|
|
104
104
|
description: "specify path for Platforma Backend log file"
|
|
105
105
|
})
|
|
106
106
|
}, ve = {
|
|
107
|
-
"pl-workdir":
|
|
107
|
+
"pl-workdir": p.file({
|
|
108
108
|
description: "specify working directory for Platforma Backend process"
|
|
109
109
|
})
|
|
110
|
-
},
|
|
111
|
-
"pl-binary":
|
|
110
|
+
}, ke = {
|
|
111
|
+
"pl-binary": p.file({
|
|
112
112
|
description: "start given Platforma Backend binary instead of automatically downloaded version"
|
|
113
113
|
})
|
|
114
|
-
},
|
|
115
|
-
"pl-sources":
|
|
114
|
+
}, Se = {
|
|
115
|
+
"pl-sources": p.file({
|
|
116
116
|
description: "path to pl repository root: build Platforma Backend from sources and start the resulting binary"
|
|
117
117
|
})
|
|
118
|
-
},
|
|
119
|
-
config:
|
|
118
|
+
}, $e = {
|
|
119
|
+
config: p.string({
|
|
120
120
|
description: "use custom Platforma Backend config"
|
|
121
121
|
})
|
|
122
122
|
};
|
|
123
|
-
|
|
123
|
+
p.file({
|
|
124
124
|
description: "specify path on host to be used as 'primary' storage"
|
|
125
125
|
});
|
|
126
126
|
const oe = {
|
|
127
|
-
"storage-work":
|
|
127
|
+
"storage-work": p.file({
|
|
128
128
|
description: "specify path on host to be used as 'work' storage"
|
|
129
129
|
})
|
|
130
130
|
};
|
|
131
|
-
|
|
131
|
+
p.file({
|
|
132
132
|
description: "specify path on host to be used as 'library' storage"
|
|
133
133
|
});
|
|
134
134
|
const le = {
|
|
135
|
-
"storage-primary":
|
|
135
|
+
"storage-primary": p.string({
|
|
136
136
|
description: `specify 'primary' storage destination URL.
|
|
137
137
|
file:/path/to/dir for directory on local FS
|
|
138
138
|
s3://<bucket>/?region=<name> for real AWS bucket
|
|
@@ -140,7 +140,7 @@ const le = {
|
|
|
140
140
|
s3es://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via https`
|
|
141
141
|
})
|
|
142
142
|
}, de = {
|
|
143
|
-
"storage-library":
|
|
143
|
+
"storage-library": p.string({
|
|
144
144
|
description: `specify 'library' storage destination URL.
|
|
145
145
|
file:/path/to/dir for directory on local FS
|
|
146
146
|
s3://<bucket>/?region=<name> for real AWS bucket
|
|
@@ -148,19 +148,19 @@ const le = {
|
|
|
148
148
|
s3es://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via https`
|
|
149
149
|
})
|
|
150
150
|
}, Dr = {
|
|
151
|
-
"auth-enabled":
|
|
151
|
+
"auth-enabled": p.boolean({
|
|
152
152
|
description: "enable authorization"
|
|
153
153
|
})
|
|
154
154
|
}, Nr = {
|
|
155
|
-
"auth-htpasswd-file":
|
|
155
|
+
"auth-htpasswd-file": p.file({
|
|
156
156
|
description: "path to .htpasswd file with Platforma users (static user DB auth source)"
|
|
157
157
|
})
|
|
158
158
|
}, _r = {
|
|
159
|
-
"auth-ldap-server":
|
|
159
|
+
"auth-ldap-server": p.string({
|
|
160
160
|
description: "address of LDAP server to use for auth in Platforma (auth source)"
|
|
161
161
|
})
|
|
162
162
|
}, Cr = {
|
|
163
|
-
"auth-ldap-default-dn":
|
|
163
|
+
"auth-ldap-default-dn": p.string({
|
|
164
164
|
description: "DN to use when checking user with LDAP bind operation: e.g. cn=%u,ou=users,dc=example,dc=com"
|
|
165
165
|
})
|
|
166
166
|
}, J = {
|
|
@@ -203,14 +203,14 @@ function jr(a) {
|
|
|
203
203
|
function Br(a) {
|
|
204
204
|
return a.startsWith("~") ? m.join(N.homedir(), a.slice(1)) : a;
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function Ae(a, e) {
|
|
207
207
|
f.existsSync(a) || (f.mkdirSync(a, { recursive: !0 }), e != null && e.mode && f.chmodSync(a, e.mode));
|
|
208
208
|
}
|
|
209
209
|
function Ur(a) {
|
|
210
210
|
try {
|
|
211
211
|
if (N.platform() !== "win32")
|
|
212
|
-
return
|
|
213
|
-
const e = `wmic process where processid=${a} get Caption`, t =
|
|
212
|
+
return xe(`ps -p ${a} -o comm=`, { encoding: "utf8" }).trim();
|
|
213
|
+
const e = `wmic process where processid=${a} get Caption`, t = xe(e, { encoding: "utf8" }).split(`
|
|
214
214
|
`);
|
|
215
215
|
return t.length <= 1 ? "" : t[1].trim();
|
|
216
216
|
} catch {
|
|
@@ -218,12 +218,12 @@ function Ur(a) {
|
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
function Gr(a) {
|
|
221
|
-
const e =
|
|
221
|
+
const e = xe(`docker compose ls --filter name=${a} --format json`, { encoding: "utf8" }).trim(), t = JSON.parse(e);
|
|
222
222
|
for (const r of t)
|
|
223
223
|
if (r.Name === a)
|
|
224
224
|
return r;
|
|
225
225
|
}
|
|
226
|
-
const
|
|
226
|
+
const Te = ["Python"], br = ["Tengo", "Python"], Jr = C.union([C.literal("Tengo"), C.literal("Python")]), Hr = C.object({
|
|
227
227
|
npmOrgName: C.string().min(1),
|
|
228
228
|
orgName: C.string().min(1, { message: "Organization name must be provided" }),
|
|
229
229
|
blockName: C.string().min(1, { message: "Block name must be provided" }),
|
|
@@ -240,7 +240,7 @@ async function Wr(a) {
|
|
|
240
240
|
"platforma-block-boilerplate-main",
|
|
241
241
|
s
|
|
242
242
|
);
|
|
243
|
-
const i =
|
|
243
|
+
const i = br.filter((o) => n.indexOf(o) < 0), c = Te.length == i.length;
|
|
244
244
|
a.info(`Keep platforms '${n}', remove: '${i}'. Will remove all platforms? ${c}`);
|
|
245
245
|
for (const o of i)
|
|
246
246
|
await Yr(s, o);
|
|
@@ -267,10 +267,10 @@ function qr() {
|
|
|
267
267
|
const r = re.keyInYN("Create package for block's software?");
|
|
268
268
|
let n = ["Tengo"];
|
|
269
269
|
if (r)
|
|
270
|
-
for (; n.length <
|
|
271
|
-
const i = re.keyInSelect(
|
|
270
|
+
for (; n.length < br.length; ) {
|
|
271
|
+
const i = re.keyInSelect(Te, "Choose software platform:");
|
|
272
272
|
if (i < 0) break;
|
|
273
|
-
n.push(
|
|
273
|
+
n.push(Te[i]);
|
|
274
274
|
}
|
|
275
275
|
n = Array.from(new Set(n)).sort();
|
|
276
276
|
const s = Hr.safeParse({ npmOrgName: a, orgName: e, blockName: t, softwarePlatforms: n });
|
|
@@ -301,7 +301,7 @@ async function Yr(a, e) {
|
|
|
301
301
|
), await te(
|
|
302
302
|
m.join(a, "workflow", "src", "wf.test.ts"),
|
|
303
303
|
new RegExp(`.*${t}Message.*\\n.*expect.*\\n\\n`, "g")
|
|
304
|
-
), await M.rm(m.join(a, "software", `src_${t}`), { recursive: !0 }), await
|
|
304
|
+
), await M.rm(m.join(a, "software", `src_${t}`), { recursive: !0 }), await We(
|
|
305
305
|
m.join(a, "software", "package.json"),
|
|
306
306
|
(r) => {
|
|
307
307
|
const n = JSON.parse(r);
|
|
@@ -310,7 +310,7 @@ async function Yr(a, e) {
|
|
|
310
310
|
);
|
|
311
311
|
}
|
|
312
312
|
async function Vr(a) {
|
|
313
|
-
await M.rm(m.join(a, "software"), { recursive: !0 }), await
|
|
313
|
+
await M.rm(m.join(a, "software"), { recursive: !0 }), await We(
|
|
314
314
|
m.join(a, "workflow", "package.json"),
|
|
315
315
|
(e) => {
|
|
316
316
|
const t = JSON.parse(e);
|
|
@@ -325,7 +325,7 @@ async function Kr(a, e) {
|
|
|
325
325
|
const t = await Xr(a);
|
|
326
326
|
for (const { from: r, to: n } of e)
|
|
327
327
|
for (const s of t)
|
|
328
|
-
await
|
|
328
|
+
await wr(s, r, n);
|
|
329
329
|
}
|
|
330
330
|
async function Xr(a) {
|
|
331
331
|
return (await M.readdir(a, {
|
|
@@ -333,15 +333,15 @@ async function Xr(a) {
|
|
|
333
333
|
recursive: !0
|
|
334
334
|
})).filter((t) => t.isFile()).map((t) => m.join(t.parentPath, t.name));
|
|
335
335
|
}
|
|
336
|
-
async function
|
|
336
|
+
async function We(a, e) {
|
|
337
337
|
const t = await M.readFile(a), r = e(t.toString());
|
|
338
338
|
await M.writeFile(a, r);
|
|
339
339
|
}
|
|
340
|
-
async function
|
|
341
|
-
return await
|
|
340
|
+
async function wr(a, e, t) {
|
|
341
|
+
return await We(a, (r) => r.replaceAll(e, t));
|
|
342
342
|
}
|
|
343
343
|
async function te(a, e) {
|
|
344
|
-
return await
|
|
344
|
+
return await wr(a, e, "");
|
|
345
345
|
}
|
|
346
346
|
const ae = class ae extends L {
|
|
347
347
|
async run() {
|
|
@@ -352,17 +352,17 @@ const ae = class ae extends L {
|
|
|
352
352
|
l(ae, "description", "Helps to create a new block by downloading a block's template."), l(ae, "examples", ["<%= name %>"]), l(ae, "flags", {
|
|
353
353
|
...A
|
|
354
354
|
});
|
|
355
|
-
let
|
|
356
|
-
function
|
|
355
|
+
let Fe = ae;
|
|
356
|
+
function pr(...a) {
|
|
357
357
|
return Ar(__dirname, "..", ...a);
|
|
358
358
|
}
|
|
359
359
|
function Z(...a) {
|
|
360
|
-
return
|
|
360
|
+
return pr("assets", ...a);
|
|
361
361
|
}
|
|
362
|
-
function
|
|
363
|
-
return f.readFileSync(
|
|
362
|
+
function Ie(...a) {
|
|
363
|
+
return f.readFileSync(pr(...a));
|
|
364
364
|
}
|
|
365
|
-
function
|
|
365
|
+
function fr(a) {
|
|
366
366
|
return a || (a = he()), `quay.io/milaboratories/platforma:${a}`;
|
|
367
367
|
}
|
|
368
368
|
const W = class W {
|
|
@@ -374,7 +374,7 @@ const W = class W {
|
|
|
374
374
|
l(this, "dirPath");
|
|
375
375
|
e = e ?? m.resolve(N.homedir(), ".config", "pl-bootstrap");
|
|
376
376
|
const t = m.join(e, "state.json");
|
|
377
|
-
this.dirPath = e, this.filePath = t, f.existsSync(e) || f.mkdirSync(e, { recursive: !0 }), f.existsSync(t) && (this.state = JSON.parse(
|
|
377
|
+
this.dirPath = e, this.filePath = t, f.existsSync(e) || f.mkdirSync(e, { recursive: !0 }), f.existsSync(t) && (this.state = JSON.parse(Ie(t).toString()));
|
|
378
378
|
}
|
|
379
379
|
static getStateInstance() {
|
|
380
380
|
return W.instance || (W.instance = new W()), W.instance;
|
|
@@ -401,7 +401,7 @@ const W = class W {
|
|
|
401
401
|
const t = this.instanceDir(e, "instance.json");
|
|
402
402
|
if (!f.existsSync(t))
|
|
403
403
|
throw new Error(`platforma backend instance '${e}' does not exist or is corrupted`);
|
|
404
|
-
const r = JSON.parse(
|
|
404
|
+
const r = JSON.parse(Ie(t).toString());
|
|
405
405
|
return {
|
|
406
406
|
name: e,
|
|
407
407
|
...r
|
|
@@ -411,7 +411,7 @@ const W = class W {
|
|
|
411
411
|
f.existsSync(this.instanceDir(e)) || f.mkdirSync(this.instanceDir(e), { recursive: !0 });
|
|
412
412
|
const r = this.instanceDir(e, "instance.json");
|
|
413
413
|
let n = {};
|
|
414
|
-
f.existsSync(r) && (n = JSON.parse(
|
|
414
|
+
f.existsSync(r) && (n = JSON.parse(Ie(r).toString())), f.writeFileSync(r, JSON.stringify({ ...n, ...t }));
|
|
415
415
|
}
|
|
416
416
|
isInstanceActive(e) {
|
|
417
417
|
switch (e.type) {
|
|
@@ -420,7 +420,7 @@ const W = class W {
|
|
|
420
420
|
return r ? r.Status.trim().startsWith("running") : !1;
|
|
421
421
|
}
|
|
422
422
|
case "process":
|
|
423
|
-
return e.pid ?
|
|
423
|
+
return e.pid ? mr(e.pid) : !1;
|
|
424
424
|
default:
|
|
425
425
|
throw H(), new Error("cli logic error: unknown service type, cannot check its state");
|
|
426
426
|
}
|
|
@@ -434,7 +434,7 @@ const W = class W {
|
|
|
434
434
|
return !1;
|
|
435
435
|
}
|
|
436
436
|
isValidPID(e) {
|
|
437
|
-
return
|
|
437
|
+
return mr(e);
|
|
438
438
|
}
|
|
439
439
|
get currentInstance() {
|
|
440
440
|
const e = this.state.currentInstance;
|
|
@@ -454,13 +454,13 @@ const W = class W {
|
|
|
454
454
|
}
|
|
455
455
|
};
|
|
456
456
|
l(W, "instance");
|
|
457
|
-
let
|
|
458
|
-
function
|
|
457
|
+
let De = W;
|
|
458
|
+
function mr(a) {
|
|
459
459
|
const e = Ur(a);
|
|
460
460
|
return e === "platforma" || e.endsWith("/platforma") || e.endsWith("\\platforma");
|
|
461
461
|
}
|
|
462
|
-
const u =
|
|
463
|
-
function
|
|
462
|
+
const u = De.getStateInstance();
|
|
463
|
+
function Oe(a, e, t) {
|
|
464
464
|
const r = [], n = [];
|
|
465
465
|
for (const s of e) {
|
|
466
466
|
const i = {
|
|
@@ -509,8 +509,8 @@ function Zr(a, e, t, r) {
|
|
|
509
509
|
opts: ${JSON.stringify(r)}`
|
|
510
510
|
), r.env = { ...process.env, ...r.env }, Or(e, t, r);
|
|
511
511
|
}
|
|
512
|
-
function
|
|
513
|
-
const s = f.readFileSync(a, { encoding: "utf-8" }), i =
|
|
512
|
+
function Ee(a, e, t, r, n) {
|
|
513
|
+
const s = f.readFileSync(a, { encoding: "utf-8" }), i = ur.parse(s.toString());
|
|
514
514
|
if (!i.services)
|
|
515
515
|
throw new Error(`file '${a}' seems to be not a docker-compose file or has unsupported version`);
|
|
516
516
|
if (r)
|
|
@@ -524,10 +524,10 @@ function Oe(a, e, t, r, n) {
|
|
|
524
524
|
if (o.platform && (g.platform = o.platform), o.envs) {
|
|
525
525
|
g.environment || (g.environment = []);
|
|
526
526
|
for (let d = 0; d < ((g == null ? void 0 : g.environment.length) ?? 0); ) {
|
|
527
|
-
const
|
|
528
|
-
if (o.envs[
|
|
529
|
-
const
|
|
530
|
-
|
|
527
|
+
const b = g.environment[d].split("=")[0];
|
|
528
|
+
if (o.envs[b]) {
|
|
529
|
+
const w = g.environment.pop();
|
|
530
|
+
w && g.environment.length !== d && (g.environment[d] = w);
|
|
531
531
|
} else
|
|
532
532
|
d++;
|
|
533
533
|
}
|
|
@@ -540,7 +540,7 @@ function Oe(a, e, t, r, n) {
|
|
|
540
540
|
g.volumes.push(`${d.hostPath}:${d.containerPath}`);
|
|
541
541
|
}
|
|
542
542
|
}
|
|
543
|
-
n != null && n.dropVolumes && delete i.volumes, f.writeFileSync(e,
|
|
543
|
+
n != null && n.dropVolumes && delete i.volumes, f.writeFileSync(e, ur.stringify(i));
|
|
544
544
|
}
|
|
545
545
|
function et(a) {
|
|
546
546
|
return {
|
|
@@ -559,7 +559,7 @@ function et(a) {
|
|
|
559
559
|
uploadKeyPrefix: ""
|
|
560
560
|
};
|
|
561
561
|
}
|
|
562
|
-
function
|
|
562
|
+
function Pr(a) {
|
|
563
563
|
return {
|
|
564
564
|
id: a,
|
|
565
565
|
type: "FS",
|
|
@@ -617,23 +617,23 @@ function ee(a, e, t) {
|
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
619
|
function rt(a, e) {
|
|
620
|
-
var
|
|
620
|
+
var w, y, v, $, k, P, S, _, ge, E, qe, ze, Ye, Ve, Ke, Xe, Qe, Ze, er, rr, tr, ar, nr, sr, ir, cr, or, lr, dr, gr;
|
|
621
621
|
const t = (e == null ? void 0 : e.localRoot) ?? u.instanceDir("default"), r = {
|
|
622
|
-
level: ((
|
|
622
|
+
level: ((w = e == null ? void 0 : e.log) == null ? void 0 : w.level) ?? "info",
|
|
623
623
|
path: ((y = e == null ? void 0 : e.log) == null ? void 0 : y.path) ?? `${t}/logs/platforma.log`
|
|
624
624
|
}, n = {
|
|
625
|
-
listen: ((
|
|
625
|
+
listen: ((v = e == null ? void 0 : e.grpc) == null ? void 0 : v.listen) ?? "localhost:6345",
|
|
626
626
|
tls: {
|
|
627
627
|
enable: ue((k = ($ = e == null ? void 0 : e.grpc) == null ? void 0 : $.tls) == null ? void 0 : k.enable, !1),
|
|
628
|
-
clientAuthMode: ((S = (
|
|
628
|
+
clientAuthMode: ((S = (P = e == null ? void 0 : e.grpc) == null ? void 0 : P.tls) == null ? void 0 : S.clientAuthMode) ?? "NoAuth",
|
|
629
629
|
certFile: ((ge = (_ = e == null ? void 0 : e.grpc) == null ? void 0 : _.tls) == null ? void 0 : ge.certFile) ?? `${t}/certs/tls.cert`,
|
|
630
|
-
keyFile: ((
|
|
631
|
-
...(
|
|
630
|
+
keyFile: ((qe = (E = e == null ? void 0 : e.grpc) == null ? void 0 : E.tls) == null ? void 0 : qe.keyFile) ?? `${t}/certs/tls.key`,
|
|
631
|
+
...(ze = e == null ? void 0 : e.grpc) == null ? void 0 : ze.tls
|
|
632
632
|
}
|
|
633
633
|
}, s = {
|
|
634
634
|
auth: {
|
|
635
|
-
enabled: ((
|
|
636
|
-
drivers: ((
|
|
635
|
+
enabled: ((Ve = (Ye = e == null ? void 0 : e.core) == null ? void 0 : Ye.auth) == null ? void 0 : Ve.enabled) ?? !1,
|
|
636
|
+
drivers: ((Xe = (Ke = e == null ? void 0 : e.core) == null ? void 0 : Ke.auth) == null ? void 0 : Xe.drivers) ?? [
|
|
637
637
|
{ driver: "jwt", key: a },
|
|
638
638
|
{ driver: "htpasswd", path: `${t}/users.htpasswd` }
|
|
639
639
|
]
|
|
@@ -641,39 +641,39 @@ function rt(a, e) {
|
|
|
641
641
|
db: {
|
|
642
642
|
path: `${t}/db`
|
|
643
643
|
}
|
|
644
|
-
}, i =
|
|
644
|
+
}, i = hr(
|
|
645
645
|
"main",
|
|
646
646
|
`${t}/storages/main`,
|
|
647
647
|
"main-bucket",
|
|
648
|
-
(
|
|
648
|
+
(Qe = e == null ? void 0 : e.storages) == null ? void 0 : Qe.primary
|
|
649
649
|
);
|
|
650
650
|
let c;
|
|
651
|
-
switch ((
|
|
651
|
+
switch ((er = (Ze = e == null ? void 0 : e.storages) == null ? void 0 : Ze.work) == null ? void 0 : er.type) {
|
|
652
652
|
case void 0:
|
|
653
653
|
case "FS":
|
|
654
|
-
c =
|
|
654
|
+
c = Pr("work"), c.rootPath = ((tr = (rr = e == null ? void 0 : e.storages) == null ? void 0 : rr.work) == null ? void 0 : tr.rootPath) ?? `${t}/storages/work`, c.indexCachePeriod = ((nr = (ar = e == null ? void 0 : e.storages) == null ? void 0 : ar.work) == null ? void 0 : nr.indexCachePeriod) ?? "1m";
|
|
655
655
|
break;
|
|
656
656
|
default:
|
|
657
657
|
throw new Error("work storage MUST have 'FS' type as it is used for working directories management");
|
|
658
658
|
}
|
|
659
|
-
const g =
|
|
659
|
+
const g = hr(
|
|
660
660
|
"library",
|
|
661
661
|
`${t}/storages/library`,
|
|
662
662
|
"library-bucket",
|
|
663
|
-
(
|
|
663
|
+
(sr = e == null ? void 0 : e.storages) == null ? void 0 : sr.library
|
|
664
664
|
), d = {
|
|
665
|
-
enabled: ue((
|
|
666
|
-
listen: ((
|
|
665
|
+
enabled: ue((ir = e == null ? void 0 : e.monitoring) == null ? void 0 : ir.enabled, !0),
|
|
666
|
+
listen: ((cr = e == null ? void 0 : e.monitoring) == null ? void 0 : cr.listen) ?? "127.0.0.1:9090"
|
|
667
667
|
}, h = {
|
|
668
|
-
enabled: ue((
|
|
669
|
-
listen: ((
|
|
670
|
-
},
|
|
671
|
-
value: ((
|
|
672
|
-
file: ((
|
|
668
|
+
enabled: ue((or = e == null ? void 0 : e.debug) == null ? void 0 : or.enabled, !0),
|
|
669
|
+
listen: ((lr = e == null ? void 0 : e.debug) == null ? void 0 : lr.listen) ?? "127.0.0.1:9091"
|
|
670
|
+
}, b = {
|
|
671
|
+
value: ((dr = e == null ? void 0 : e.license) == null ? void 0 : dr.value) ?? "",
|
|
672
|
+
file: ((gr = e == null ? void 0 : e.license) == null ? void 0 : gr.file) ?? ""
|
|
673
673
|
};
|
|
674
674
|
return {
|
|
675
675
|
localRoot: t,
|
|
676
|
-
license:
|
|
676
|
+
license: b,
|
|
677
677
|
log: r,
|
|
678
678
|
grpc: n,
|
|
679
679
|
core: s,
|
|
@@ -684,12 +684,12 @@ function rt(a, e) {
|
|
|
684
684
|
hacks: { libraryDownloadable: !0 }
|
|
685
685
|
};
|
|
686
686
|
}
|
|
687
|
-
function
|
|
687
|
+
function hr(a, e, t, r) {
|
|
688
688
|
let n;
|
|
689
689
|
switch (r == null ? void 0 : r.type) {
|
|
690
690
|
case void 0:
|
|
691
691
|
case "FS":
|
|
692
|
-
n =
|
|
692
|
+
n = Pr(a), n.rootPath = (r == null ? void 0 : r.rootPath) ?? e;
|
|
693
693
|
break;
|
|
694
694
|
case "S3":
|
|
695
695
|
n = et(a), n.endpoint = r == null ? void 0 : r.endpoint, n.region = r == null ? void 0 : r.region, n.presignEndpoint = (r == null ? void 0 : r.presignEndpoint) ?? (r == null ? void 0 : r.endpoint), n.bucketName = (r == null ? void 0 : r.bucketName) ?? t, n.createBucket = ue(r == null ? void 0 : r.createBucket, !0), n.forcePathStyle = ue(r == null ? void 0 : r.forcePathStyle, !0), n.key = (r == null ? void 0 : r.key) ?? "", n.secret = (r == null ? void 0 : r.secret) ?? "", n.keyPrefix = (r == null ? void 0 : r.keyPrefix) ?? "", n.accessPrefixes = (r == null ? void 0 : r.accessPrefixes) ?? [""], n.uploadKeyPrefix = (r == null ? void 0 : r.uploadKeyPrefix) ?? "";
|
|
@@ -810,7 +810,7 @@ function nt(a) {
|
|
|
810
810
|
}
|
|
811
811
|
}
|
|
812
812
|
const st = ["amd64", "arm64"];
|
|
813
|
-
function
|
|
813
|
+
function vr(a) {
|
|
814
814
|
const e = N.arch();
|
|
815
815
|
switch (e) {
|
|
816
816
|
case "arm64":
|
|
@@ -824,7 +824,7 @@ function Pr(a) {
|
|
|
824
824
|
}
|
|
825
825
|
}
|
|
826
826
|
function it(a, e) {
|
|
827
|
-
const t = (e == null ? void 0 : e.version) ?? he(), r = (e == null ? void 0 : e.showProgress) ?? process.stdout.isTTY, n = `pl-${t}-${
|
|
827
|
+
const t = (e == null ? void 0 : e.version) ?? he(), r = (e == null ? void 0 : e.showProgress) ?? process.stdout.isTTY, n = `pl-${t}-${vr()}.tgz`, s = (e == null ? void 0 : e.downloadURL) ?? `https://cdn.platforma.bio/software/pl/${nt()}/${n}`, i = (e == null ? void 0 : e.saveTo) ?? u.binaries(n);
|
|
828
828
|
if (f.existsSync(i))
|
|
829
829
|
return a.info(`Platforma Backend archive download skipped: '${i}' already exists`), Promise.resolve(i);
|
|
830
830
|
f.mkdirSync(m.dirname(i), { recursive: !0 }), a.info(`Downloading Platforma Backend archive:
|
|
@@ -844,16 +844,16 @@ function it(a, e) {
|
|
|
844
844
|
return;
|
|
845
845
|
}
|
|
846
846
|
const h = parseInt(d.headers["content-length"] || "0", 10);
|
|
847
|
-
let
|
|
848
|
-
const
|
|
849
|
-
d.pipe(
|
|
850
|
-
|
|
851
|
-
const
|
|
852
|
-
r && process.stdout.write(` downloading: ${
|
|
847
|
+
let b = 0;
|
|
848
|
+
const w = f.createWriteStream(i);
|
|
849
|
+
d.pipe(w), d.on("data", (y) => {
|
|
850
|
+
b += y.length;
|
|
851
|
+
const v = b / h * 100;
|
|
852
|
+
r && process.stdout.write(` downloading: ${v.toFixed(2)}%\r`);
|
|
853
853
|
}), d.on("error", (y) => {
|
|
854
854
|
f.unlinkSync(i), a.error(`Failed to download Platforma Binary: ${y.message}`), c.destroy(), g(y);
|
|
855
|
-
}),
|
|
856
|
-
|
|
855
|
+
}), w.on("finish", () => {
|
|
856
|
+
w.close(), a.info(" ... download done."), c.destroy(), o(i);
|
|
857
857
|
});
|
|
858
858
|
});
|
|
859
859
|
});
|
|
@@ -880,11 +880,11 @@ function ct(a, e) {
|
|
|
880
880
|
sync: !0
|
|
881
881
|
}), a.info(" ... unpack done."), s;
|
|
882
882
|
}
|
|
883
|
-
function
|
|
883
|
+
function Le(a, e) {
|
|
884
884
|
return it(a, e).then((t) => ct(a, { archivePath: t }));
|
|
885
885
|
}
|
|
886
886
|
function kr(a) {
|
|
887
|
-
return `pl-${(a == null ? void 0 : a.version) ?? he()}-${
|
|
887
|
+
return `pl-${(a == null ? void 0 : a.version) ?? he()}-${vr()}`;
|
|
888
888
|
}
|
|
889
889
|
function ot(a, ...e) {
|
|
890
890
|
return u.binaries(kr({ version: a }), ...e);
|
|
@@ -909,16 +909,16 @@ class O {
|
|
|
909
909
|
this.logger.info(`Starting platforma backend instance '${e.name}':
|
|
910
910
|
${r}`);
|
|
911
911
|
}
|
|
912
|
-
const t =
|
|
912
|
+
const t = Oe(
|
|
913
913
|
this.logger,
|
|
914
914
|
e.upCommands
|
|
915
915
|
);
|
|
916
|
-
return
|
|
916
|
+
return Re(t.executed), t.spawned.length > 0 && e.type === "process" && (e.pid = t.spawned[t.spawned.length - 1].pid, u.setInstanceInfo(e.name, e), this.logger.info(`instance '${e.name}' started`)), u.currentInstanceName = e.name, t.spawned;
|
|
917
917
|
}
|
|
918
918
|
stopInstance(e) {
|
|
919
919
|
this.logger.info(`stopping platforma backend instance '${e.name}'...`);
|
|
920
|
-
const t =
|
|
921
|
-
switch (
|
|
920
|
+
const t = Oe(this.logger, e.downCommands);
|
|
921
|
+
switch (Re(t.executed), e.type) {
|
|
922
922
|
case "docker":
|
|
923
923
|
return;
|
|
924
924
|
case "process": {
|
|
@@ -938,7 +938,7 @@ ${r}`);
|
|
|
938
938
|
return this.startInstance(e);
|
|
939
939
|
}
|
|
940
940
|
createLocal(e, t) {
|
|
941
|
-
var d, h,
|
|
941
|
+
var d, h, b, w, y, v, $, k, P, S, _, ge;
|
|
942
942
|
let r = ot(t == null ? void 0 : t.version, "binaries", "platforma");
|
|
943
943
|
t != null && t.sourcesPath && (r = m.join(N.tmpdir(), "platforma-custom-build")), t != null && t.binaryPath && (r = t.binaryPath);
|
|
944
944
|
let n = t == null ? void 0 : t.configPath;
|
|
@@ -947,17 +947,17 @@ ${r}`);
|
|
|
947
947
|
...t.configOptions,
|
|
948
948
|
storages: {
|
|
949
949
|
...(d = t.configOptions) == null ? void 0 : d.storages,
|
|
950
|
-
primary: ee(t.primaryURL, s, (
|
|
950
|
+
primary: ee(t.primaryURL, s, (b = (h = t.configOptions) == null ? void 0 : h.storages) == null ? void 0 : b.primary)
|
|
951
951
|
}
|
|
952
952
|
}), t != null && t.libraryURL && (t.configOptions = {
|
|
953
953
|
...t.configOptions,
|
|
954
954
|
storages: {
|
|
955
|
-
...(
|
|
956
|
-
library: ee(t.libraryURL, s, (
|
|
955
|
+
...(w = t.configOptions) == null ? void 0 : w.storages,
|
|
956
|
+
library: ee(t.libraryURL, s, (v = (y = t.configOptions) == null ? void 0 : y.storages) == null ? void 0 : v.library)
|
|
957
957
|
}
|
|
958
958
|
});
|
|
959
959
|
const i = rt(this.getLastJwt(), t == null ? void 0 : t.configOptions);
|
|
960
|
-
this.logger.debug(" checking license..."), this.checkLicense((k = ($ = t == null ? void 0 : t.configOptions) == null ? void 0 : $.license) == null ? void 0 : k.value, (S = (
|
|
960
|
+
this.logger.debug(" checking license..."), this.checkLicense((k = ($ = t == null ? void 0 : t.configOptions) == null ? void 0 : $.license) == null ? void 0 : k.value, (S = (P = t == null ? void 0 : t.configOptions) == null ? void 0 : P.license) == null ? void 0 : S.file);
|
|
961
961
|
const c = [
|
|
962
962
|
`${i.localRoot}/packages`,
|
|
963
963
|
`${i.localRoot}/packages-local`,
|
|
@@ -1031,7 +1031,7 @@ ${r}`);
|
|
|
1031
1031
|
createMinio(e, t) {
|
|
1032
1032
|
this.logger.debug(" creating docker compose for minio service...");
|
|
1033
1033
|
const r = Z("compose-backend.yaml"), n = u.instanceDir(e, "compose-minio.yaml");
|
|
1034
|
-
|
|
1034
|
+
Ee(
|
|
1035
1035
|
r,
|
|
1036
1036
|
n,
|
|
1037
1037
|
`pl-${e}-minio`,
|
|
@@ -1045,7 +1045,7 @@ ${r}`);
|
|
|
1045
1045
|
const i = (t == null ? void 0 : t.image) ?? `quay.io/minio/minio${s}`;
|
|
1046
1046
|
this.logger.debug(` minio image: ${i}`);
|
|
1047
1047
|
const c = (t == null ? void 0 : t.storage) ?? u.instanceDir(e, "minio");
|
|
1048
|
-
|
|
1048
|
+
Ae(c, { mode: "0775" });
|
|
1049
1049
|
const o = (t == null ? void 0 : t.minioPort) ?? 9e3, g = (t == null ? void 0 : t.minioConsolePort) ?? 9001, d = {
|
|
1050
1050
|
MINIO_IMAGE: i,
|
|
1051
1051
|
MINIO_STORAGE: m.resolve(c),
|
|
@@ -1078,11 +1078,11 @@ ${r}`);
|
|
|
1078
1078
|
}
|
|
1079
1079
|
createDockerS3(e, t, r) {
|
|
1080
1080
|
this.logger.debug("creating platforma instance in 'docker s3' mode...");
|
|
1081
|
-
const n = Z("compose-backend.yaml"), s = (r == null ? void 0 : r.image) ??
|
|
1081
|
+
const n = Z("compose-backend.yaml"), s = (r == null ? void 0 : r.image) ?? fr(r == null ? void 0 : r.version);
|
|
1082
1082
|
this.checkLicense(r == null ? void 0 : r.license, r == null ? void 0 : r.licenseFile);
|
|
1083
|
-
const i = (...
|
|
1084
|
-
const S = i(
|
|
1085
|
-
return
|
|
1083
|
+
const i = (...P) => m.join(t, ...P), c = (P) => {
|
|
1084
|
+
const S = i(P);
|
|
1085
|
+
return Ae(S, { mode: "0775" }), S;
|
|
1086
1086
|
}, o = i("logs", "platforma.log");
|
|
1087
1087
|
f.existsSync(o) || (f.mkdirSync(m.dirname(o), { recursive: !0 }), f.writeFileSync(o, ""));
|
|
1088
1088
|
const g = (r == null ? void 0 : r.presignHost) ?? "localhost", d = ee("s3e://testuser:testpassword@minio:9000/main-bucket");
|
|
@@ -1093,17 +1093,17 @@ ${r}`);
|
|
|
1093
1093
|
if (h.type !== "S3")
|
|
1094
1094
|
throw new Error(`${h.type} storage type is not supported for library storage`);
|
|
1095
1095
|
h.presignEndpoint = `http://${g}:9000`;
|
|
1096
|
-
const
|
|
1096
|
+
const b = c("db"), w = c("work"), y = i("users.htpasswd");
|
|
1097
1097
|
f.existsSync(y) || f.copyFileSync(Z("users.htpasswd"), y);
|
|
1098
|
-
const
|
|
1099
|
-
f.existsSync(
|
|
1098
|
+
const v = i("compose.yaml");
|
|
1099
|
+
f.existsSync(v) && this.logger.info(`replacing docker compose file ${v}`);
|
|
1100
1100
|
const $ = [];
|
|
1101
|
-
for (const
|
|
1101
|
+
for (const P of (r == null ? void 0 : r.customMounts) ?? [])
|
|
1102
1102
|
$.push({
|
|
1103
|
-
hostPath:
|
|
1104
|
-
containerPath:
|
|
1103
|
+
hostPath: P.hostPath,
|
|
1104
|
+
containerPath: P.containerPath ?? P.hostPath
|
|
1105
1105
|
});
|
|
1106
|
-
|
|
1106
|
+
Ee(n, v, `pl-${e}`, /* @__PURE__ */ new Map([
|
|
1107
1107
|
["minio", {}],
|
|
1108
1108
|
["backend", {
|
|
1109
1109
|
platform: r == null ? void 0 : r.platformOverride,
|
|
@@ -1121,37 +1121,37 @@ ${r}`);
|
|
|
1121
1121
|
PL_LOG_DIR: m.dirname(o),
|
|
1122
1122
|
PL_LOG_ROTATION_ENABLED: "true",
|
|
1123
1123
|
PL_RUNNER_WD_CACHE_ON_FAILURE: "1h",
|
|
1124
|
-
PL_DATA_DB_ROOT:
|
|
1124
|
+
PL_DATA_DB_ROOT: b,
|
|
1125
1125
|
PL_DATA_PRIMARY_ROOT: c("primary"),
|
|
1126
1126
|
PL_DATA_LIBRARY_ROOT: c("library"),
|
|
1127
|
-
PL_DATA_WORKDIR_ROOT:
|
|
1127
|
+
PL_DATA_WORKDIR_ROOT: w,
|
|
1128
1128
|
// Mount packages storage as volume, because APFS is case-insensitive on Mac OS X and this breaks some pl software installation.
|
|
1129
1129
|
// PL_DATA_PACKAGE_ROOT: storageDir('packages'),
|
|
1130
1130
|
...this.configureDockerStorage("primary", d),
|
|
1131
1131
|
...this.configureDockerStorage("library", h)
|
|
1132
1132
|
};
|
|
1133
|
-
if (r != null && r.grpcAddr && (k.PL_GRPC_ADDR = r.grpcAddr), r != null && r.grpcPort && (k.PL_GRPC_PORT = r.grpcPort.toString()), r != null && r.monitoringAddr && (k.PL_MONITORING_ADDR = r.monitoringAddr), r != null && r.monitoringPort && (k.PL_MONITORING_PORT = r.monitoringPort.toString()), r != null && r.debugAddr && (k.PL_DEBUG_ADDR = r.debugAddr), r != null && r.debugPort && (k.PL_DEBUG_PORT = r.debugPort.toString()), r != null && r.auth && (r.auth.enabled && (k.PL_AUTH_ENABLED = "true"), r.auth.drivers)) {
|
|
1134
|
-
for (const
|
|
1135
|
-
|
|
1133
|
+
if (r != null && r.grpcAddr && (k.PL_GRPC_ADDR = r.grpcAddr), r != null && r.grpcPort && (k.PL_GRPC_PORT = r.grpcPort.toString()), r != null && r.monitoringAddr && (k.PL_MONITORING_ADDR = r.monitoringAddr), r != null && r.monitoringPort && (k.PL_MONITORING_PORT = r.monitoringPort.toString()), r != null && r.debugAddr && (k.PL_DEBUG_ADDR = r.debugAddr), r != null && r.debugPort && (k.PL_DEBUG_PORT = r.debugPort.toString()), r != null && r.s3Port && (k.MINIO_PORT = r.s3Port.toString()), r != null && r.s3ConsolePort && (k.MINIO_CONSOLE_PORT = r.s3ConsolePort.toString()), r != null && r.auth && (r.auth.enabled && (k.PL_AUTH_ENABLED = "true"), r.auth.drivers)) {
|
|
1134
|
+
for (const P of r.auth.drivers)
|
|
1135
|
+
P.driver === "htpasswd" && (k.PL_AUTH_HTPASSWD_PATH = m.resolve(P.path), P.path = "/etc/platforma/users.htpasswd");
|
|
1136
1136
|
k.PL_AUTH_DRIVERS = JSON.stringify(r.auth.drivers);
|
|
1137
1137
|
}
|
|
1138
1138
|
return u.setInstanceInfo(e, {
|
|
1139
1139
|
type: "docker",
|
|
1140
1140
|
upCommands: [{
|
|
1141
1141
|
cmd: "docker",
|
|
1142
|
-
args: ["compose", `--file=${
|
|
1142
|
+
args: ["compose", `--file=${v}`, "up", "--detach", "--remove-orphans", "--pull=missing"],
|
|
1143
1143
|
envs: k,
|
|
1144
1144
|
runOpts: { stdio: "inherit" }
|
|
1145
1145
|
}],
|
|
1146
1146
|
downCommands: [{
|
|
1147
1147
|
cmd: "docker",
|
|
1148
|
-
args: ["compose", `--file=${
|
|
1148
|
+
args: ["compose", `--file=${v}`, "down"],
|
|
1149
1149
|
envs: k,
|
|
1150
1150
|
runOpts: { stdio: "inherit" }
|
|
1151
1151
|
}],
|
|
1152
1152
|
cleanupCommands: [{
|
|
1153
1153
|
cmd: "docker",
|
|
1154
|
-
args: ["compose", `--file=${
|
|
1154
|
+
args: ["compose", `--file=${v}`, "down", "--volumes", "--remove-orphans"],
|
|
1155
1155
|
envs: k,
|
|
1156
1156
|
runOpts: { stdio: "inherit" }
|
|
1157
1157
|
}],
|
|
@@ -1160,40 +1160,40 @@ ${r}`);
|
|
|
1160
1160
|
apiAddr: r == null ? void 0 : r.grpcAddr,
|
|
1161
1161
|
logPath: o,
|
|
1162
1162
|
primary: d,
|
|
1163
|
-
work: { type: "FS", rootPath:
|
|
1163
|
+
work: { type: "FS", rootPath: w },
|
|
1164
1164
|
library: h,
|
|
1165
|
-
dbPath:
|
|
1165
|
+
dbPath: b
|
|
1166
1166
|
}
|
|
1167
1167
|
}), u.getInstanceInfo(e);
|
|
1168
1168
|
}
|
|
1169
1169
|
createDocker(e, t, r) {
|
|
1170
1170
|
this.logger.debug("creating platforma instance in 'docker' mode...");
|
|
1171
|
-
const n = Z("compose-backend.yaml"), s = (r == null ? void 0 : r.image) ??
|
|
1171
|
+
const n = Z("compose-backend.yaml"), s = (r == null ? void 0 : r.image) ?? fr(r == null ? void 0 : r.version);
|
|
1172
1172
|
this.checkLicense(r == null ? void 0 : r.license, r == null ? void 0 : r.licenseFile);
|
|
1173
1173
|
const i = (...S) => m.join(t, ...S), c = (S) => {
|
|
1174
1174
|
const _ = i(S);
|
|
1175
|
-
return
|
|
1175
|
+
return Ae(_, { mode: "0775" }), _;
|
|
1176
1176
|
}, o = i("logs", "platforma.log");
|
|
1177
1177
|
f.existsSync(o) || (f.mkdirSync(m.dirname(o), { recursive: !0 }), f.writeFileSync(o, ""));
|
|
1178
|
-
const g = c("db"), d = c("primary"), h = c("library"),
|
|
1179
|
-
f.existsSync(
|
|
1178
|
+
const g = c("db"), d = c("primary"), h = c("library"), b = c("work"), w = i("users.htpasswd");
|
|
1179
|
+
f.existsSync(w) || f.copyFileSync(Z("users.htpasswd"), w);
|
|
1180
1180
|
const y = i("compose.yaml");
|
|
1181
1181
|
f.existsSync(y) && this.logger.info(`replacing docker compose file ${y}`);
|
|
1182
|
-
const
|
|
1182
|
+
const v = [];
|
|
1183
1183
|
for (const S of (r == null ? void 0 : r.customMounts) ?? [])
|
|
1184
|
-
|
|
1184
|
+
v.push({
|
|
1185
1185
|
hostPath: S.hostPath,
|
|
1186
1186
|
containerPath: S.containerPath ?? S.hostPath
|
|
1187
1187
|
});
|
|
1188
|
-
this.logger.debug(`Rendering docker compose file '${y}' using '${n}' as base template`),
|
|
1188
|
+
this.logger.debug(`Rendering docker compose file '${y}' using '${n}' as base template`), Ee(n, y, `pl-${e}`, /* @__PURE__ */ new Map([
|
|
1189
1189
|
["backend", {
|
|
1190
1190
|
platform: r == null ? void 0 : r.platformOverride,
|
|
1191
|
-
mounts:
|
|
1191
|
+
mounts: v
|
|
1192
1192
|
}]
|
|
1193
1193
|
]));
|
|
1194
|
-
const $ = ee((r == null ? void 0 : r.primaryStorageURL) ?? `file:${d}`, "."), k = ee((r == null ? void 0 : r.libraryStorageURL) ?? `file:${h}`, "."),
|
|
1194
|
+
const $ = ee((r == null ? void 0 : r.primaryStorageURL) ?? `file:${d}`, "."), k = ee((r == null ? void 0 : r.libraryStorageURL) ?? `file:${h}`, "."), P = {
|
|
1195
1195
|
PL_IMAGE: s,
|
|
1196
|
-
PL_AUTH_HTPASSWD_PATH:
|
|
1196
|
+
PL_AUTH_HTPASSWD_PATH: w,
|
|
1197
1197
|
PL_LICENSE: r == null ? void 0 : r.license,
|
|
1198
1198
|
PL_LICENSE_FILE: r == null ? void 0 : r.licenseFile,
|
|
1199
1199
|
PL_LOG_LEVEL: "info",
|
|
@@ -1203,34 +1203,34 @@ ${r}`);
|
|
|
1203
1203
|
PL_DATA_DB_ROOT: g,
|
|
1204
1204
|
PL_DATA_PRIMARY_ROOT: d,
|
|
1205
1205
|
PL_DATA_LIBRARY_ROOT: h,
|
|
1206
|
-
PL_DATA_WORKDIR_ROOT:
|
|
1206
|
+
PL_DATA_WORKDIR_ROOT: b,
|
|
1207
1207
|
PL_DATA_PACKAGE_ROOT: c("packages"),
|
|
1208
1208
|
...this.configureDockerStorage("primary", $),
|
|
1209
1209
|
...this.configureDockerStorage("library", k)
|
|
1210
1210
|
};
|
|
1211
|
-
if (r != null && r.grpcAddr && (
|
|
1211
|
+
if (r != null && r.grpcAddr && (P.PL_GRPC_ADDR = r.grpcAddr), r != null && r.grpcPort && (P.PL_GRPC_PORT = r.grpcPort.toString()), r != null && r.monitoringAddr && (P.PL_MONITORING_ADDR = r.monitoringAddr), r != null && r.monitoringPort && (P.PL_MONITORING_PORT = r.monitoringPort.toString()), r != null && r.debugAddr && (P.PL_DEBUG_ADDR = r.debugAddr), r != null && r.debugPort && (P.PL_DEBUG_PORT = r.debugPort.toString()), r != null && r.auth && (r.auth.enabled && (P.PL_AUTH_ENABLED = "true"), r.auth.drivers)) {
|
|
1212
1212
|
for (const S of r.auth.drivers)
|
|
1213
|
-
S.driver === "htpasswd" && (
|
|
1214
|
-
|
|
1213
|
+
S.driver === "htpasswd" && (P.PL_AUTH_HTPASSWD_PATH = m.resolve(S.path), S.path = "/etc/platforma/users.htpasswd");
|
|
1214
|
+
P.PL_AUTH_DRIVERS = JSON.stringify(r.auth.drivers);
|
|
1215
1215
|
}
|
|
1216
1216
|
return u.setInstanceInfo(e, {
|
|
1217
1217
|
type: "docker",
|
|
1218
1218
|
upCommands: [{
|
|
1219
1219
|
cmd: "docker",
|
|
1220
1220
|
args: ["compose", `--file=${y}`, "up", "--detach", "--remove-orphans", "--pull=missing"],
|
|
1221
|
-
envs:
|
|
1221
|
+
envs: P,
|
|
1222
1222
|
runOpts: { stdio: "inherit" }
|
|
1223
1223
|
}],
|
|
1224
1224
|
downCommands: [{
|
|
1225
1225
|
cmd: "docker",
|
|
1226
1226
|
args: ["compose", `--file=${y}`, "down"],
|
|
1227
|
-
envs:
|
|
1227
|
+
envs: P,
|
|
1228
1228
|
runOpts: { stdio: "inherit" }
|
|
1229
1229
|
}],
|
|
1230
1230
|
cleanupCommands: [{
|
|
1231
1231
|
cmd: "docker",
|
|
1232
1232
|
args: ["compose", `--file=${y}`, "down", "--volumes", "--remove-orphans"],
|
|
1233
|
-
envs:
|
|
1233
|
+
envs: P,
|
|
1234
1234
|
runOpts: { stdio: "inherit" }
|
|
1235
1235
|
}],
|
|
1236
1236
|
runInfo: {
|
|
@@ -1238,7 +1238,7 @@ ${r}`);
|
|
|
1238
1238
|
apiAddr: r == null ? void 0 : r.grpcAddr,
|
|
1239
1239
|
logPath: o,
|
|
1240
1240
|
primary: $,
|
|
1241
|
-
work: { type: "FS", rootPath:
|
|
1241
|
+
work: { type: "FS", rootPath: b },
|
|
1242
1242
|
library: k,
|
|
1243
1243
|
dbPath: g
|
|
1244
1244
|
}
|
|
@@ -1287,8 +1287,8 @@ You are going to reset the state of all platforma services configured with pl-bo
|
|
|
1287
1287
|
for (const [s, i] of r.entries()) {
|
|
1288
1288
|
if (i.cleanupCommands.length) {
|
|
1289
1289
|
this.logger.info(`Wiping instance ${s} services`);
|
|
1290
|
-
const c =
|
|
1291
|
-
|
|
1290
|
+
const c = Oe(this.logger, i.cleanupCommands);
|
|
1291
|
+
Re(c.executed, `failed to wipe instance ${s} services`);
|
|
1292
1292
|
}
|
|
1293
1293
|
this.logger.info(`Destroying instance '${s}' data directory`), f.rmSync(u.instanceDir(s), { recursive: !0, force: !0 });
|
|
1294
1294
|
}
|
|
@@ -1382,7 +1382,7 @@ You can obtain the license from "https://licensing.milaboratories.com".`), new E
|
|
|
1382
1382
|
`);
|
|
1383
1383
|
}
|
|
1384
1384
|
}
|
|
1385
|
-
function
|
|
1385
|
+
function Re(a, e) {
|
|
1386
1386
|
for (const t of a) {
|
|
1387
1387
|
if (t.error)
|
|
1388
1388
|
throw t.error;
|
|
@@ -1400,7 +1400,7 @@ const ne = class ne extends L {
|
|
|
1400
1400
|
l(ne, "description", "Clear service state (forget last run command, destroy docker services, volumes and so on)"), l(ne, "examples", ["<%= config.bin %> <%= command.id %>"]), l(ne, "flags", {
|
|
1401
1401
|
...A
|
|
1402
1402
|
});
|
|
1403
|
-
let
|
|
1403
|
+
let Ne = ne;
|
|
1404
1404
|
const se = class se extends L {
|
|
1405
1405
|
async run() {
|
|
1406
1406
|
const { flags: e } = await this.parse(se), t = I(e["log-level"]);
|
|
@@ -1410,7 +1410,7 @@ const se = class se extends L {
|
|
|
1410
1410
|
l(se, "description", "Start last run service configuraiton"), l(se, "examples", ["<%= config.bin %> <%= command.id %>"]), l(se, "flags", {
|
|
1411
1411
|
...A
|
|
1412
1412
|
});
|
|
1413
|
-
let
|
|
1413
|
+
let _e = se;
|
|
1414
1414
|
const ie = class ie extends L {
|
|
1415
1415
|
async run() {
|
|
1416
1416
|
const { flags: e } = await this.parse(ie), t = I(e["log-level"]), r = new O(t);
|
|
@@ -1420,7 +1420,7 @@ const ie = class ie extends L {
|
|
|
1420
1420
|
l(ie, "description", "Stop platforma service"), l(ie, "examples", ["<%= config.bin %> <%= command.id %>"]), l(ie, "flags", {
|
|
1421
1421
|
...A
|
|
1422
1422
|
});
|
|
1423
|
-
let
|
|
1423
|
+
let Ce = ie;
|
|
1424
1424
|
var x;
|
|
1425
1425
|
let dt = (x = class extends L {
|
|
1426
1426
|
async run() {
|
|
@@ -1457,10 +1457,10 @@ let dt = (x = class extends L {
|
|
|
1457
1457
|
...U,
|
|
1458
1458
|
...ye,
|
|
1459
1459
|
...j,
|
|
1460
|
-
...
|
|
1460
|
+
...be,
|
|
1461
1461
|
...J,
|
|
1462
1462
|
...B,
|
|
1463
|
-
...
|
|
1463
|
+
...pe,
|
|
1464
1464
|
...G,
|
|
1465
1465
|
...le,
|
|
1466
1466
|
...oe,
|
|
@@ -1476,9 +1476,9 @@ let gt = (T = class extends L {
|
|
|
1476
1476
|
e["grpc-listen"] ? d = e["grpc-listen"] : e["grpc-port"] && (d = `127.0.0.1:${e["grpc-port"]}`);
|
|
1477
1477
|
let h = "127.0.0.1:9090";
|
|
1478
1478
|
e["monitoring-listen"] ? h = e["monitoring-listen"] : e["monitoring-port"] && (h = `127.0.0.1:${e["monitoring-port"]}`);
|
|
1479
|
-
let
|
|
1480
|
-
e["debug-listen"] ?
|
|
1481
|
-
const
|
|
1479
|
+
let b = "127.0.0.1:9091";
|
|
1480
|
+
e["debug-listen"] ? b = e["debug-listen"] : e["debug-port"] && (b = `127.0.0.1:${e["debug-port"]}`);
|
|
1481
|
+
const w = {
|
|
1482
1482
|
sourcesPath: e["pl-sources"],
|
|
1483
1483
|
binaryPath: e["pl-binary"],
|
|
1484
1484
|
version: e.version,
|
|
@@ -1489,7 +1489,7 @@ let gt = (T = class extends L {
|
|
|
1489
1489
|
configOptions: {
|
|
1490
1490
|
grpc: { listen: d },
|
|
1491
1491
|
monitoring: { listen: h },
|
|
1492
|
-
debug: { listen:
|
|
1492
|
+
debug: { listen: b },
|
|
1493
1493
|
license: { value: e.license, file: e["license-file"] },
|
|
1494
1494
|
log: { path: c },
|
|
1495
1495
|
localRoot: i,
|
|
@@ -1501,30 +1501,30 @@ let gt = (T = class extends L {
|
|
|
1501
1501
|
// we want to keep at least a couple for UI and other apps to work.
|
|
1502
1502
|
numCpu: Math.max(me.cpus().length - 2, 1)
|
|
1503
1503
|
}
|
|
1504
|
-
}, y = r.createLocal(n,
|
|
1505
|
-
|
|
1506
|
-
const
|
|
1504
|
+
}, y = r.createLocal(n, w);
|
|
1505
|
+
w.binaryPath || w.sourcesPath ? r.switchInstance(y) : Le(t, { version: e.version }).then(() => {
|
|
1506
|
+
const v = r.switchInstance(y);
|
|
1507
1507
|
setTimeout(() => {
|
|
1508
|
-
for (const $ of
|
|
1508
|
+
for (const $ of v)
|
|
1509
1509
|
$.unref();
|
|
1510
1510
|
}, 1e3);
|
|
1511
|
-
}).catch(function(
|
|
1512
|
-
t.error(
|
|
1511
|
+
}).catch(function(v) {
|
|
1512
|
+
t.error(v.message);
|
|
1513
1513
|
});
|
|
1514
1514
|
}
|
|
1515
1515
|
}, l(T, "description", "Run Platforma Backend service as local process on current host (no docker container)"), l(T, "examples", ["<%= config.bin %> <%= command.id %>"]), l(T, "flags", {
|
|
1516
1516
|
...A,
|
|
1517
1517
|
...j,
|
|
1518
1518
|
...U,
|
|
1519
|
-
...Pe,
|
|
1520
1519
|
...ke,
|
|
1521
1520
|
...Se,
|
|
1521
|
+
...$e,
|
|
1522
1522
|
...B,
|
|
1523
1523
|
...G,
|
|
1524
1524
|
...le,
|
|
1525
1525
|
...oe,
|
|
1526
1526
|
...de,
|
|
1527
|
-
...
|
|
1527
|
+
...Pe,
|
|
1528
1528
|
...ve,
|
|
1529
1529
|
...J
|
|
1530
1530
|
}), T);
|
|
@@ -1536,14 +1536,14 @@ const q = class q extends L {
|
|
|
1536
1536
|
};
|
|
1537
1537
|
l(q, "description", "List available instances"), l(q, "examples", ["<%= config.bin %> <%= command.id %>"]), l(q, "flags", {
|
|
1538
1538
|
...A,
|
|
1539
|
-
all:
|
|
1539
|
+
all: p.boolean({
|
|
1540
1540
|
description: "remove all known instances",
|
|
1541
1541
|
required: !1
|
|
1542
1542
|
})
|
|
1543
1543
|
}), l(q, "args", {
|
|
1544
1544
|
name: Q.string({ required: !1 })
|
|
1545
1545
|
});
|
|
1546
|
-
let
|
|
1546
|
+
let Me = q;
|
|
1547
1547
|
const z = class z extends L {
|
|
1548
1548
|
async run() {
|
|
1549
1549
|
const { flags: e, args: t } = await this.parse(z), r = I(e["log-level"]), n = new O(r), s = t.name ?? u.currentInstanceName;
|
|
@@ -1555,7 +1555,7 @@ l(z, "description", "List available instances"), l(z, "examples", ["<%= config.b
|
|
|
1555
1555
|
}), l(z, "args", {
|
|
1556
1556
|
name: Q.string({ required: !1 })
|
|
1557
1557
|
});
|
|
1558
|
-
let
|
|
1558
|
+
let je = z;
|
|
1559
1559
|
const ce = class ce extends L {
|
|
1560
1560
|
async run() {
|
|
1561
1561
|
await this.parse(ce);
|
|
@@ -1567,7 +1567,7 @@ const ce = class ce extends L {
|
|
|
1567
1567
|
}
|
|
1568
1568
|
};
|
|
1569
1569
|
l(ce, "description", "List available instances"), l(ce, "examples", ["<%= config.bin %> <%= command.id %>"]), l(ce, "flags", {});
|
|
1570
|
-
let
|
|
1570
|
+
let Be = ce;
|
|
1571
1571
|
const Y = class Y extends L {
|
|
1572
1572
|
async run() {
|
|
1573
1573
|
const { flags: e, args: t } = await this.parse(Y), r = I(e["log-level"]), n = new O(r), s = t.name ?? u.currentInstanceName;
|
|
@@ -1585,7 +1585,7 @@ l(Y, "description", "List available instances"), l(Y, "examples", ["<%= config.b
|
|
|
1585
1585
|
}), l(Y, "args", {
|
|
1586
1586
|
name: Q.string({ required: !1 })
|
|
1587
1587
|
});
|
|
1588
|
-
let
|
|
1588
|
+
let Ue = Y;
|
|
1589
1589
|
var F;
|
|
1590
1590
|
let ut = (F = class extends L {
|
|
1591
1591
|
async run() {
|
|
@@ -1595,8 +1595,8 @@ let ut = (F = class extends L {
|
|
|
1595
1595
|
enabled: s,
|
|
1596
1596
|
drivers: r.initAuthDriversList(e, ".")
|
|
1597
1597
|
} : void 0, c = e.storage ? m.join(".", e.storage) : u.instanceDir(n), o = [];
|
|
1598
|
-
for (const
|
|
1599
|
-
o.push({ hostPath:
|
|
1598
|
+
for (const b of e.mount ?? [])
|
|
1599
|
+
o.push({ hostPath: b });
|
|
1600
1600
|
const g = e.arch ? `linux/${e.arch}` : void 0, d = e["minio-presign-host"] ? "minio" : "localhost", h = r.createDockerS3(n, c, {
|
|
1601
1601
|
image: e.image,
|
|
1602
1602
|
version: e.version,
|
|
@@ -1611,6 +1611,8 @@ let ut = (F = class extends L {
|
|
|
1611
1611
|
monitoringPort: e["monitoring-port"],
|
|
1612
1612
|
debugAddr: e["debug-listen"],
|
|
1613
1613
|
debugPort: e["debug-port"],
|
|
1614
|
+
s3Port: e["s3-port"],
|
|
1615
|
+
s3ConsolePort: e["s3-console-port"],
|
|
1614
1616
|
presignHost: d
|
|
1615
1617
|
});
|
|
1616
1618
|
r.switchInstance(h);
|
|
@@ -1618,12 +1620,13 @@ let ut = (F = class extends L {
|
|
|
1618
1620
|
}, l(F, "description", "Run platforma backend service with 'S3' primary storage type"), l(F, "examples", ["<%= config.bin %> <%= command.id %>"]), l(F, "flags", {
|
|
1619
1621
|
...A,
|
|
1620
1622
|
...U,
|
|
1623
|
+
...we,
|
|
1621
1624
|
...ye,
|
|
1622
1625
|
...j,
|
|
1623
|
-
...
|
|
1626
|
+
...be,
|
|
1624
1627
|
...J,
|
|
1625
1628
|
...B,
|
|
1626
|
-
...
|
|
1629
|
+
...pe,
|
|
1627
1630
|
...G,
|
|
1628
1631
|
...yr
|
|
1629
1632
|
}), F);
|
|
@@ -1637,9 +1640,9 @@ let ft = (D = class extends L {
|
|
|
1637
1640
|
e["grpc-listen"] ? d = e["grpc-listen"] : e["grpc-port"] && (d = `127.0.0.1:${e["grpc-port"]}`);
|
|
1638
1641
|
let h = "127.0.0.1:9090";
|
|
1639
1642
|
e["monitoring-listen"] ? h = e["monitoring-listen"] : e["monitoring-port"] && (h = `127.0.0.1:${e["monitoring-port"]}`);
|
|
1640
|
-
let
|
|
1641
|
-
e["debug-listen"] ?
|
|
1642
|
-
const
|
|
1643
|
+
let b = "127.0.0.1:9091";
|
|
1644
|
+
e["debug-listen"] ? b = e["debug-listen"] : e["debug-port"] && (b = `127.0.0.1:${e["debug-port"]}`);
|
|
1645
|
+
const w = {
|
|
1643
1646
|
sourcesPath: e["pl-sources"],
|
|
1644
1647
|
binaryPath: e["pl-binary"],
|
|
1645
1648
|
version: e.version,
|
|
@@ -1652,7 +1655,7 @@ let ft = (D = class extends L {
|
|
|
1652
1655
|
configOptions: {
|
|
1653
1656
|
grpc: { listen: d },
|
|
1654
1657
|
monitoring: { listen: h },
|
|
1655
|
-
debug: { listen:
|
|
1658
|
+
debug: { listen: b },
|
|
1656
1659
|
license: { value: e.license, file: e["license-file"] },
|
|
1657
1660
|
log: { path: c },
|
|
1658
1661
|
localRoot: i,
|
|
@@ -1666,32 +1669,32 @@ let ft = (D = class extends L {
|
|
|
1666
1669
|
work: { type: "FS", rootPath: e["storage-work"] }
|
|
1667
1670
|
}
|
|
1668
1671
|
}
|
|
1669
|
-
}, y = r.createLocalS3(n,
|
|
1670
|
-
|
|
1671
|
-
const
|
|
1672
|
-
for (const k of
|
|
1673
|
-
$.push(new Promise((
|
|
1674
|
-
k.on("close",
|
|
1672
|
+
}, y = r.createLocalS3(n, w);
|
|
1673
|
+
w.binaryPath || w.sourcesPath ? r.switchInstance(y) : await Le(t, { version: e.version }).then(() => {
|
|
1674
|
+
const v = r.switchInstance(y), $ = [];
|
|
1675
|
+
for (const k of v)
|
|
1676
|
+
$.push(new Promise((P, S) => {
|
|
1677
|
+
k.on("close", P), k.on("error", S);
|
|
1675
1678
|
}));
|
|
1676
1679
|
return Promise.all($);
|
|
1677
|
-
}).catch(function(
|
|
1678
|
-
t.error(
|
|
1680
|
+
}).catch(function(v) {
|
|
1681
|
+
t.error(v.message);
|
|
1679
1682
|
});
|
|
1680
1683
|
}
|
|
1681
1684
|
}, l(D, "description", "Run Platforma Backend service as local process on current host (no docker container)"), l(D, "examples", ["<%= config.bin %> <%= command.id %>"]), l(D, "flags", {
|
|
1682
1685
|
...A,
|
|
1683
1686
|
...j,
|
|
1684
1687
|
...U,
|
|
1685
|
-
...
|
|
1686
|
-
...Pe,
|
|
1688
|
+
...we,
|
|
1687
1689
|
...ke,
|
|
1688
1690
|
...Se,
|
|
1691
|
+
...$e,
|
|
1689
1692
|
...B,
|
|
1690
1693
|
...G,
|
|
1691
1694
|
...le,
|
|
1692
1695
|
...oe,
|
|
1693
1696
|
...de,
|
|
1694
|
-
...
|
|
1697
|
+
...Pe,
|
|
1695
1698
|
...ve,
|
|
1696
1699
|
...J
|
|
1697
1700
|
}), D);
|
|
@@ -1731,10 +1734,10 @@ l(V, "description", "Run Platforma Backend service as docker container on curren
|
|
|
1731
1734
|
...U,
|
|
1732
1735
|
...ye,
|
|
1733
1736
|
...j,
|
|
1734
|
-
...
|
|
1737
|
+
...be,
|
|
1735
1738
|
...J,
|
|
1736
1739
|
...B,
|
|
1737
|
-
...
|
|
1740
|
+
...pe,
|
|
1738
1741
|
...G,
|
|
1739
1742
|
...le,
|
|
1740
1743
|
...oe,
|
|
@@ -1742,7 +1745,7 @@ l(V, "description", "Run Platforma Backend service as docker container on curren
|
|
|
1742
1745
|
}), l(V, "args", {
|
|
1743
1746
|
name: Q.string({ required: !0 })
|
|
1744
1747
|
});
|
|
1745
|
-
let
|
|
1748
|
+
let Ge = V;
|
|
1746
1749
|
var R;
|
|
1747
1750
|
let mt = (R = class extends L {
|
|
1748
1751
|
async run() {
|
|
@@ -1751,10 +1754,10 @@ let mt = (R = class extends L {
|
|
|
1751
1754
|
const s = t.name, i = e["pl-workdir"] ?? ".", c = e.storage ? m.join(i, e.storage) : u.instanceDir(s), o = e["pl-log-file"] ? m.join(i, e["pl-log-file"]) : void 0, g = n.initAuthDriversList(e, i), d = e["auth-enabled"] ?? g !== void 0;
|
|
1752
1755
|
let h = "127.0.0.1:6345";
|
|
1753
1756
|
e["grpc-listen"] ? h = e["grpc-listen"] : e["grpc-port"] && (h = `127.0.0.1:${e["grpc-port"]}`);
|
|
1754
|
-
let
|
|
1755
|
-
e["monitoring-listen"] ?
|
|
1756
|
-
let
|
|
1757
|
-
e["debug-listen"] ?
|
|
1757
|
+
let b = "127.0.0.1:9090";
|
|
1758
|
+
e["monitoring-listen"] ? b = e["monitoring-listen"] : e["monitoring-port"] && (b = `127.0.0.1:${e["monitoring-port"]}`);
|
|
1759
|
+
let w = "127.0.0.1:9091";
|
|
1760
|
+
e["debug-listen"] ? w = e["debug-listen"] : e["debug-port"] && (w = `127.0.0.1:${e["debug-port"]}`);
|
|
1758
1761
|
const y = {
|
|
1759
1762
|
sourcesPath: e["pl-sources"],
|
|
1760
1763
|
binaryPath: e["pl-binary"],
|
|
@@ -1765,8 +1768,8 @@ let mt = (R = class extends L {
|
|
|
1765
1768
|
libraryURL: e["storage-library"],
|
|
1766
1769
|
configOptions: {
|
|
1767
1770
|
grpc: { listen: h },
|
|
1768
|
-
monitoring: { listen:
|
|
1769
|
-
debug: { listen:
|
|
1771
|
+
monitoring: { listen: b },
|
|
1772
|
+
debug: { listen: w },
|
|
1770
1773
|
license: { value: e.license, file: e["license-file"] },
|
|
1771
1774
|
log: { path: o },
|
|
1772
1775
|
localRoot: c,
|
|
@@ -1783,23 +1786,23 @@ let mt = (R = class extends L {
|
|
|
1783
1786
|
r.info(`Instance '${s}' was created. To start it run 'up' command`);
|
|
1784
1787
|
return;
|
|
1785
1788
|
}
|
|
1786
|
-
|
|
1787
|
-
r.error(
|
|
1789
|
+
Le(r, { version: e.version }).then(() => r.info(`Instance '${s}' was created. To start it run 'svc up' command`)).catch(function(v) {
|
|
1790
|
+
r.error(v.message);
|
|
1788
1791
|
});
|
|
1789
1792
|
}
|
|
1790
1793
|
}, l(R, "description", "Run Platforma Backend service as local process on current host (no docker container)"), l(R, "examples", ["<%= config.bin %> <%= command.id %>"]), l(R, "flags", {
|
|
1791
1794
|
...A,
|
|
1792
1795
|
...j,
|
|
1793
1796
|
...U,
|
|
1794
|
-
...Pe,
|
|
1795
1797
|
...ke,
|
|
1796
1798
|
...Se,
|
|
1799
|
+
...$e,
|
|
1797
1800
|
...B,
|
|
1798
1801
|
...G,
|
|
1799
1802
|
...le,
|
|
1800
1803
|
...oe,
|
|
1801
1804
|
...de,
|
|
1802
|
-
...
|
|
1805
|
+
...Pe,
|
|
1803
1806
|
...ve,
|
|
1804
1807
|
...J
|
|
1805
1808
|
}), l(R, "args", {
|
|
@@ -1813,8 +1816,8 @@ const K = class K extends L {
|
|
|
1813
1816
|
enabled: i,
|
|
1814
1817
|
drivers: n.initAuthDriversList(e, ".")
|
|
1815
1818
|
} : void 0, o = e.storage ? m.join(".", e.storage) : u.instanceDir(s), g = [];
|
|
1816
|
-
for (const
|
|
1817
|
-
g.push({ hostPath:
|
|
1819
|
+
for (const b of e.mount ?? [])
|
|
1820
|
+
g.push({ hostPath: b });
|
|
1818
1821
|
const d = e.arch ? `linux/${e.arch}` : void 0, h = e["minio-presign-host"] ? "minio" : "localhost";
|
|
1819
1822
|
n.createDockerS3(s, o, {
|
|
1820
1823
|
image: e.image,
|
|
@@ -1830,6 +1833,8 @@ const K = class K extends L {
|
|
|
1830
1833
|
monitoringPort: e["monitoring-port"],
|
|
1831
1834
|
debugAddr: e["debug-listen"],
|
|
1832
1835
|
debugPort: e["debug-port"],
|
|
1836
|
+
s3Port: e["s3-port"],
|
|
1837
|
+
s3ConsolePort: e["s3-console-port"],
|
|
1833
1838
|
presignHost: h
|
|
1834
1839
|
}), r.info(`Instance '${s}' was created. To start it run 'up' command`), e["minio-presign-host"] && r.info(" NOTE: make sure you have 'minio' host in your hosts file as 127.0.0.1 address");
|
|
1835
1840
|
}
|
|
@@ -1837,18 +1842,19 @@ const K = class K extends L {
|
|
|
1837
1842
|
l(K, "description", "Run Platforma Backend service as docker container on current host with MinIO as local S3 storage"), l(K, "examples", ["<%= config.bin %> <%= command.id %>"]), l(K, "flags", {
|
|
1838
1843
|
...A,
|
|
1839
1844
|
...U,
|
|
1845
|
+
...we,
|
|
1840
1846
|
...ye,
|
|
1841
1847
|
...j,
|
|
1842
|
-
...
|
|
1848
|
+
...be,
|
|
1843
1849
|
...J,
|
|
1844
1850
|
...B,
|
|
1845
|
-
...
|
|
1851
|
+
...pe,
|
|
1846
1852
|
...G,
|
|
1847
1853
|
...yr
|
|
1848
1854
|
}), l(K, "args", {
|
|
1849
1855
|
name: Q.string({ required: !0 })
|
|
1850
1856
|
});
|
|
1851
|
-
let
|
|
1857
|
+
let Je = K;
|
|
1852
1858
|
const X = class X extends L {
|
|
1853
1859
|
async run() {
|
|
1854
1860
|
const { flags: e, args: t } = await this.parse(X), r = I(e["log-level"]), n = new O(r);
|
|
@@ -1856,10 +1862,10 @@ const X = class X extends L {
|
|
|
1856
1862
|
const s = t.name, i = e["pl-workdir"] ?? ".", c = e.storage ? m.join(i, e.storage) : u.instanceDir(s), o = e["pl-log-file"] ? m.join(i, e["pl-log-file"]) : void 0, g = n.initAuthDriversList(e, i), d = e["auth-enabled"] ?? g !== void 0;
|
|
1857
1863
|
let h = "127.0.0.1:6345";
|
|
1858
1864
|
e["grpc-listen"] ? h = e["grpc-listen"] : e["grpc-port"] && (h = `127.0.0.1:${e["grpc-port"]}`);
|
|
1859
|
-
let
|
|
1860
|
-
e["monitoring-listen"] ?
|
|
1861
|
-
let
|
|
1862
|
-
e["debug-listen"] ?
|
|
1865
|
+
let b = "127.0.0.1:9090";
|
|
1866
|
+
e["monitoring-listen"] ? b = e["monitoring-listen"] : e["monitoring-port"] && (b = `127.0.0.1:${e["monitoring-port"]}`);
|
|
1867
|
+
let w = "127.0.0.1:9091";
|
|
1868
|
+
e["debug-listen"] ? w = e["debug-listen"] : e["debug-port"] && (w = `127.0.0.1:${e["debug-port"]}`);
|
|
1863
1869
|
const y = {
|
|
1864
1870
|
sourcesPath: e["pl-sources"],
|
|
1865
1871
|
binaryPath: e["pl-binary"],
|
|
@@ -1872,8 +1878,8 @@ const X = class X extends L {
|
|
|
1872
1878
|
minioConsolePort: e["s3-console-port"],
|
|
1873
1879
|
configOptions: {
|
|
1874
1880
|
grpc: { listen: h },
|
|
1875
|
-
monitoring: { listen:
|
|
1876
|
-
debug: { listen:
|
|
1881
|
+
monitoring: { listen: b },
|
|
1882
|
+
debug: { listen: w },
|
|
1877
1883
|
license: { value: e.license, file: e["license-file"] },
|
|
1878
1884
|
log: { path: o },
|
|
1879
1885
|
localRoot: c,
|
|
@@ -1890,48 +1896,48 @@ const X = class X extends L {
|
|
|
1890
1896
|
r.info(`Instance '${s}' was created. To start it run 'up' command`);
|
|
1891
1897
|
return;
|
|
1892
1898
|
}
|
|
1893
|
-
|
|
1894
|
-
r.error(
|
|
1899
|
+
Le(r, { version: e.version }).then(() => r.info(`Instance '${s}' was created. To start it run 'svc up' command`)).catch(function(v) {
|
|
1900
|
+
r.error(v.message);
|
|
1895
1901
|
});
|
|
1896
1902
|
}
|
|
1897
1903
|
};
|
|
1898
1904
|
l(X, "description", "Run Platforma Backend service as local process on current host (no docker container)"), l(X, "examples", ["<%= config.bin %> <%= command.id %>"]), l(X, "flags", {
|
|
1899
1905
|
...A,
|
|
1900
1906
|
...j,
|
|
1901
|
-
...
|
|
1907
|
+
...we,
|
|
1902
1908
|
...U,
|
|
1903
|
-
...Pe,
|
|
1904
1909
|
...ke,
|
|
1905
1910
|
...Se,
|
|
1911
|
+
...$e,
|
|
1906
1912
|
...B,
|
|
1907
1913
|
...G,
|
|
1908
1914
|
...le,
|
|
1909
1915
|
...oe,
|
|
1910
1916
|
...de,
|
|
1911
|
-
...
|
|
1917
|
+
...Pe,
|
|
1912
1918
|
...ve,
|
|
1913
1919
|
...J
|
|
1914
1920
|
}), l(X, "args", {
|
|
1915
1921
|
name: Q.string({ required: !0 })
|
|
1916
1922
|
});
|
|
1917
|
-
let
|
|
1923
|
+
let He = X;
|
|
1918
1924
|
const Rt = {
|
|
1919
|
-
"create-block":
|
|
1920
|
-
reset:
|
|
1921
|
-
start:
|
|
1922
|
-
stop:
|
|
1925
|
+
"create-block": Fe,
|
|
1926
|
+
reset: Ne,
|
|
1927
|
+
start: _e,
|
|
1928
|
+
stop: Ce,
|
|
1923
1929
|
"start:docker": dt,
|
|
1924
1930
|
"start:local": gt,
|
|
1925
|
-
"svc:delete":
|
|
1926
|
-
"svc:down":
|
|
1927
|
-
"svc:list":
|
|
1928
|
-
"svc:up":
|
|
1931
|
+
"svc:delete": Me,
|
|
1932
|
+
"svc:down": je,
|
|
1933
|
+
"svc:list": Be,
|
|
1934
|
+
"svc:up": Ue,
|
|
1929
1935
|
"start:docker:s3": ut,
|
|
1930
1936
|
"start:local:s3": ft,
|
|
1931
|
-
"svc:create:docker":
|
|
1937
|
+
"svc:create:docker": Ge,
|
|
1932
1938
|
"svc:create:local": mt,
|
|
1933
|
-
"svc:create:docker:s3":
|
|
1934
|
-
"svc:create:local:s3":
|
|
1939
|
+
"svc:create:docker:s3": Je,
|
|
1940
|
+
"svc:create:local:s3": He
|
|
1935
1941
|
};
|
|
1936
1942
|
export {
|
|
1937
1943
|
Rt as COMMANDS
|