@platforma-sdk/bootstrap 2.1.1 → 2.2.0
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/block.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +164 -158
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var er = Object.defineProperty;
|
|
2
2
|
var rr = (a, e, r) => e in a ? er(a, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : a[e] = r;
|
|
3
3
|
var m = (a, e, r) => rr(a, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
-
import { Flags as y, Command as
|
|
4
|
+
import { Flags as y, Command as $ } from "@oclif/core";
|
|
5
5
|
import _ from "node:os";
|
|
6
6
|
import l, { createWriteStream as tr } from "node:fs";
|
|
7
|
-
import
|
|
7
|
+
import u, { resolve as ar } from "node:path";
|
|
8
8
|
import { execSync as Me, spawn as ir, spawnSync as H } from "node:child_process";
|
|
9
|
-
import
|
|
9
|
+
import W from "winston";
|
|
10
10
|
import { randomBytes as sr } from "node:crypto";
|
|
11
11
|
import V from "readline-sync";
|
|
12
12
|
import { Writable as cr } from "node:stream";
|
|
@@ -14,7 +14,7 @@ import { z as K } from "zod";
|
|
|
14
14
|
import nr from "decompress";
|
|
15
15
|
import Ce from "yaml";
|
|
16
16
|
import lr from "node:https";
|
|
17
|
-
import * as
|
|
17
|
+
import * as or from "tar";
|
|
18
18
|
const T = {
|
|
19
19
|
"log-level": y.string({
|
|
20
20
|
description: "logging level",
|
|
@@ -63,7 +63,7 @@ const T = {
|
|
|
63
63
|
description: "full listen addr for Platforma Backend debug API. Default is 127.0.0.1:9091",
|
|
64
64
|
env: "PLATFORMA_DEBUG_LISTEN"
|
|
65
65
|
})
|
|
66
|
-
},
|
|
66
|
+
}, dr = {
|
|
67
67
|
"s3-address-port": y.integer({
|
|
68
68
|
description: "port that S3 will listen, default is 9000",
|
|
69
69
|
default: 9e3,
|
|
@@ -78,11 +78,11 @@ const T = {
|
|
|
78
78
|
storage: y.string({
|
|
79
79
|
description: "specify path on host to be used as storage for all Platforma Backend data"
|
|
80
80
|
})
|
|
81
|
-
},
|
|
81
|
+
}, je = {
|
|
82
82
|
"pl-log-file": y.file({
|
|
83
83
|
description: "specify path for Platforma Backend log file"
|
|
84
84
|
})
|
|
85
|
-
},
|
|
85
|
+
}, We = {
|
|
86
86
|
"pl-workdir": y.file({
|
|
87
87
|
description: "specify working directory for Platforma Backend process"
|
|
88
88
|
})
|
|
@@ -155,18 +155,18 @@ function Y(a) {
|
|
|
155
155
|
throw new Error("this should never happen");
|
|
156
156
|
}
|
|
157
157
|
function E(a = "debug") {
|
|
158
|
-
return
|
|
158
|
+
return W.createLogger({
|
|
159
159
|
level: a,
|
|
160
|
-
format:
|
|
161
|
-
|
|
160
|
+
format: W.format.combine(
|
|
161
|
+
W.format.printf(({ level: e, message: r }) => {
|
|
162
162
|
const t = " ".repeat(e.length + 2), i = r.split(`
|
|
163
163
|
`).map((c, n) => n === 0 ? c : t + c).join(`
|
|
164
164
|
`);
|
|
165
|
-
return `${((c) =>
|
|
165
|
+
return `${((c) => W.format.colorize().colorize(c, c))(e)}: ${i}`;
|
|
166
166
|
})
|
|
167
167
|
),
|
|
168
168
|
transports: [
|
|
169
|
-
new
|
|
169
|
+
new W.transports.Console({
|
|
170
170
|
stderrLevels: ["error", "warn", "info", "debug"],
|
|
171
171
|
handleExceptions: !0
|
|
172
172
|
})
|
|
@@ -177,7 +177,7 @@ function yr(a) {
|
|
|
177
177
|
return sr(Math.ceil(a / 2)).toString("hex").slice(0, a);
|
|
178
178
|
}
|
|
179
179
|
function Pr(a) {
|
|
180
|
-
return a.startsWith("~") ?
|
|
180
|
+
return a.startsWith("~") ? u.join(_.homedir(), a.slice(1)) : a;
|
|
181
181
|
}
|
|
182
182
|
function q(a, e) {
|
|
183
183
|
l.existsSync(a) || (l.mkdirSync(a, { recursive: !0 }), e != null && e.mode && l.chmodSync(a, e.mode));
|
|
@@ -199,43 +199,49 @@ const vr = K.object({
|
|
|
199
199
|
blockName: K.string().min(1)
|
|
200
200
|
});
|
|
201
201
|
async function wr(a) {
|
|
202
|
-
const e = kr(), r =
|
|
202
|
+
const e = kr(), r = u.join(process.cwd(), e.blockName);
|
|
203
203
|
a.info("Downloading boilerplate code..."), await Sr(
|
|
204
204
|
"https://github.com/milaboratory/platforma-block-boilerplate/archive/refs/heads/main.zip",
|
|
205
205
|
"platforma-block-boilerplate-main",
|
|
206
206
|
r
|
|
207
207
|
), a.info("Replace everything in the template with provided options..."), Ar(
|
|
208
208
|
r,
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
209
|
+
[
|
|
210
|
+
{ from: /platforma-open/g, to: e.npmOrgName },
|
|
211
|
+
{ from: /my-org/g, to: e.orgName },
|
|
212
|
+
{ from: /block-boilerplate/g, to: e.blockName }
|
|
213
|
+
]
|
|
214
|
+
), a.info("Remove github actions directory"), l.rmSync(u.join(r, ".github"), { recursive: !0, force: !0 });
|
|
212
215
|
}
|
|
213
216
|
function kr() {
|
|
214
|
-
let a = V.question('Write an organization name for npm. Default is "
|
|
215
|
-
a === "" && (a = "
|
|
217
|
+
let a = V.question('Write an organization name for npm. Default is "platforma-open": ');
|
|
218
|
+
a === "" && (a = "platforma-open");
|
|
216
219
|
const e = V.question('Write an organization name, e.g. "my-org": '), r = V.question('Write a name of the block, e.g. "hello-world": ');
|
|
217
220
|
return vr.parse({ npmOrgName: a, orgName: e, blockName: r });
|
|
218
221
|
}
|
|
219
222
|
async function Sr(a, e, r) {
|
|
220
|
-
const i = await (await fetch(a)).blob(), s = l.mkdtempSync(
|
|
223
|
+
const i = await (await fetch(a)).blob(), s = l.mkdtempSync(u.join(_.tmpdir(), "create-repo")), c = u.join(s, "packed-repo.zip"), n = cr.toWeb(tr(c));
|
|
221
224
|
await i.stream().pipeTo(n);
|
|
222
|
-
const h =
|
|
223
|
-
l.mkdirSync(h), await nr(c, h), l.cpSync(
|
|
225
|
+
const h = u.join(s, "unpacked-repo");
|
|
226
|
+
l.mkdirSync(h), await nr(c, h), l.cpSync(u.join(h, e), r, { recursive: !0 });
|
|
224
227
|
}
|
|
225
|
-
function Ar(a, e
|
|
226
|
-
Lr(a)
|
|
228
|
+
function Ar(a, e) {
|
|
229
|
+
const r = Lr(a);
|
|
230
|
+
e.forEach(({ from: t, to: i }) => {
|
|
231
|
+
r.forEach((s) => Rr(s, t, i));
|
|
232
|
+
});
|
|
227
233
|
}
|
|
228
234
|
function Lr(a) {
|
|
229
235
|
return l.readdirSync(a, {
|
|
230
236
|
withFileTypes: !0,
|
|
231
237
|
recursive: !0
|
|
232
|
-
}).filter((r) => r.isFile()).map((r) =>
|
|
238
|
+
}).filter((r) => r.isFile()).map((r) => u.join(r.parentPath, r.name));
|
|
233
239
|
}
|
|
234
240
|
function Rr(a, e, r) {
|
|
235
241
|
const i = l.readFileSync(a).toString().replaceAll(e, r);
|
|
236
242
|
l.writeFileSync(a, i);
|
|
237
243
|
}
|
|
238
|
-
const I = class I extends
|
|
244
|
+
const I = class I extends $ {
|
|
239
245
|
async run() {
|
|
240
246
|
const { flags: e } = await this.parse(I), r = E(e["log-level"]);
|
|
241
247
|
await wr(r);
|
|
@@ -248,11 +254,11 @@ let se = I;
|
|
|
248
254
|
function ze(...a) {
|
|
249
255
|
return ar(__dirname, "..", ...a);
|
|
250
256
|
}
|
|
251
|
-
function
|
|
257
|
+
function O(...a) {
|
|
252
258
|
return ze("assets", ...a);
|
|
253
259
|
}
|
|
254
260
|
function _r() {
|
|
255
|
-
return l.readdirSync(
|
|
261
|
+
return l.readdirSync(O()).filter((e) => e.startsWith("compose-") && e.endsWith(".yaml")).map((e) => O(e));
|
|
256
262
|
}
|
|
257
263
|
function Ke(...a) {
|
|
258
264
|
return l.readFileSync(ze(...a));
|
|
@@ -272,15 +278,15 @@ const F = class F {
|
|
|
272
278
|
});
|
|
273
279
|
m(this, "filePath");
|
|
274
280
|
m(this, "dirPath");
|
|
275
|
-
e = e ??
|
|
276
|
-
const r =
|
|
281
|
+
e = e ?? u.resolve(_.homedir(), ".config", "pl-bootstrap");
|
|
282
|
+
const r = u.join(e, "state.json");
|
|
277
283
|
this.dirPath = e, this.filePath = r, l.existsSync(e) || l.mkdirSync(e, { recursive: !0 }), l.existsSync(r) && (this.state = JSON.parse(Ke(r).toString()));
|
|
278
284
|
}
|
|
279
285
|
static getInstance() {
|
|
280
286
|
return F.instance || (F.instance = new F()), F.instance;
|
|
281
287
|
}
|
|
282
288
|
path(...e) {
|
|
283
|
-
return
|
|
289
|
+
return u.join(this.dirPath, ...e);
|
|
284
290
|
}
|
|
285
291
|
data(...e) {
|
|
286
292
|
return this.path("data", ...e);
|
|
@@ -314,55 +320,55 @@ const F = class F {
|
|
|
314
320
|
};
|
|
315
321
|
m(F, "instance");
|
|
316
322
|
let ce = F;
|
|
317
|
-
const
|
|
323
|
+
const o = ce.getInstance();
|
|
318
324
|
function Be(a, e, r, t) {
|
|
319
325
|
var i;
|
|
320
|
-
return
|
|
321
|
-
...
|
|
326
|
+
return o.lastRun = {
|
|
327
|
+
...o.lastRun,
|
|
322
328
|
mode: "docker",
|
|
323
329
|
cmd: "docker",
|
|
324
330
|
args: e,
|
|
325
331
|
workdir: r.cwd,
|
|
326
332
|
envs: r.env,
|
|
327
333
|
docker: {
|
|
328
|
-
...(i =
|
|
334
|
+
...(i = o.lastRun) == null ? void 0 : i.docker,
|
|
329
335
|
...t
|
|
330
336
|
}
|
|
331
337
|
}, qe(a, "docker", e, r);
|
|
332
338
|
}
|
|
333
339
|
function pr(a, e, r, t, i) {
|
|
334
340
|
var c;
|
|
335
|
-
|
|
336
|
-
...
|
|
341
|
+
o.lastRun = {
|
|
342
|
+
...o.lastRun,
|
|
337
343
|
mode: "process",
|
|
338
344
|
cmd: e,
|
|
339
345
|
args: r,
|
|
340
346
|
workdir: t.cwd,
|
|
341
347
|
envs: t.env,
|
|
342
348
|
process: {
|
|
343
|
-
...(c =
|
|
349
|
+
...(c = o.lastRun) == null ? void 0 : c.process,
|
|
344
350
|
...i
|
|
345
351
|
}
|
|
346
352
|
};
|
|
347
|
-
const s =
|
|
348
|
-
return
|
|
349
|
-
...
|
|
353
|
+
const s = $r(a, e, r, t);
|
|
354
|
+
return o.lastRun.process = {
|
|
355
|
+
...o.lastRun.process,
|
|
350
356
|
pid: s.pid
|
|
351
357
|
}, s;
|
|
352
358
|
}
|
|
353
|
-
function
|
|
354
|
-
if (!
|
|
359
|
+
function Or(a, e) {
|
|
360
|
+
if (!o.lastRun)
|
|
355
361
|
throw new Error("no previous run info found: this is the first run after package installation");
|
|
356
362
|
return e = {
|
|
357
|
-
cwd:
|
|
363
|
+
cwd: o.lastRun.workdir,
|
|
358
364
|
env: {
|
|
359
|
-
...
|
|
365
|
+
...o.lastRun.envs,
|
|
360
366
|
...e.env
|
|
361
367
|
},
|
|
362
368
|
...e
|
|
363
|
-
}, qe(a,
|
|
369
|
+
}, qe(a, o.lastRun.cmd, o.lastRun.args, e);
|
|
364
370
|
}
|
|
365
|
-
function
|
|
371
|
+
function $r(a, e, r, t) {
|
|
366
372
|
a.debug(
|
|
367
373
|
`Running:
|
|
368
374
|
env: ${JSON.stringify(t.env)}
|
|
@@ -458,16 +464,16 @@ function N(a, e, r) {
|
|
|
458
464
|
}
|
|
459
465
|
}
|
|
460
466
|
function Er(a, e) {
|
|
461
|
-
var
|
|
462
|
-
const r = (e == null ? void 0 : e.localRoot) ??
|
|
463
|
-
level: ((
|
|
467
|
+
var d, b, w, S, L, k, p, j, A, ye, Pe, be, ve, we, ke, Se, Ae, Le, Re, _e, pe, Oe, $e, Te, Ee, Fe, De, Ne, Ie, xe;
|
|
468
|
+
const r = (e == null ? void 0 : e.localRoot) ?? o.data("local-custom"), t = {
|
|
469
|
+
level: ((d = e == null ? void 0 : e.log) == null ? void 0 : d.level) ?? "info",
|
|
464
470
|
path: ((b = e == null ? void 0 : e.log) == null ? void 0 : b.path) ?? `${r}/platforma.log`
|
|
465
471
|
}, i = {
|
|
466
472
|
listen: ((w = e == null ? void 0 : e.grpc) == null ? void 0 : w.listen) ?? "localhost:6345",
|
|
467
473
|
tls: {
|
|
468
474
|
enable: z((L = (S = e == null ? void 0 : e.grpc) == null ? void 0 : S.tls) == null ? void 0 : L.enable, !1),
|
|
469
475
|
clientAuthMode: ((p = (k = e == null ? void 0 : e.grpc) == null ? void 0 : k.tls) == null ? void 0 : p.clientAuthMode) ?? "NoAuth",
|
|
470
|
-
certFile: ((A = (
|
|
476
|
+
certFile: ((A = (j = e == null ? void 0 : e.grpc) == null ? void 0 : j.tls) == null ? void 0 : A.certFile) ?? `${r}/certs/tls.cert`,
|
|
471
477
|
keyFile: ((Pe = (ye = e == null ? void 0 : e.grpc) == null ? void 0 : ye.tls) == null ? void 0 : Pe.keyFile) ?? `${r}/certs/tls.key`,
|
|
472
478
|
...(be = e == null ? void 0 : e.grpc) == null ? void 0 : be.tls
|
|
473
479
|
}
|
|
@@ -492,12 +498,12 @@ function Er(a, e) {
|
|
|
492
498
|
switch ((Re = (Le = e == null ? void 0 : e.storages) == null ? void 0 : Le.work) == null ? void 0 : Re.type) {
|
|
493
499
|
case void 0:
|
|
494
500
|
case "FS":
|
|
495
|
-
n = Ve("work"), n.rootPath = ((pe = (_e = e == null ? void 0 : e.storages) == null ? void 0 : _e.work) == null ? void 0 : pe.rootPath) ?? `${r}/storages/work`, n.indexCachePeriod = ((
|
|
501
|
+
n = Ve("work"), n.rootPath = ((pe = (_e = e == null ? void 0 : e.storages) == null ? void 0 : _e.work) == null ? void 0 : pe.rootPath) ?? `${r}/storages/work`, n.indexCachePeriod = (($e = (Oe = e == null ? void 0 : e.storages) == null ? void 0 : Oe.work) == null ? void 0 : $e.indexCachePeriod) ?? "1m";
|
|
496
502
|
break;
|
|
497
503
|
default:
|
|
498
504
|
throw new Error("work storage MUST have 'FS' type as it is used for working directories management");
|
|
499
505
|
}
|
|
500
|
-
const
|
|
506
|
+
const f = Ge(
|
|
501
507
|
"library",
|
|
502
508
|
`${r}/storages/library`,
|
|
503
509
|
"library-bucket",
|
|
@@ -520,7 +526,7 @@ function Er(a, e) {
|
|
|
520
526
|
core: s,
|
|
521
527
|
monitoring: g,
|
|
522
528
|
debug: v,
|
|
523
|
-
storages: { primary: c, work: n, library:
|
|
529
|
+
storages: { primary: c, work: n, library: f },
|
|
524
530
|
hacks: { libraryDownloadable: !0 }
|
|
525
531
|
};
|
|
526
532
|
}
|
|
@@ -647,36 +653,36 @@ function Qe(a) {
|
|
|
647
653
|
}
|
|
648
654
|
}
|
|
649
655
|
function xr(a, e) {
|
|
650
|
-
const r = (e == null ? void 0 : e.version) ?? te()["pl-version"], t = (e == null ? void 0 : e.showProgress) ?? process.stdout.isTTY, i = `pl-${r}-${Qe()}.tgz`, s = (e == null ? void 0 : e.downloadURL) ?? `https://cdn.platforma.bio/software/pl/${Nr()}/${i}`, c = (e == null ? void 0 : e.saveTo) ??
|
|
656
|
+
const r = (e == null ? void 0 : e.version) ?? te()["pl-version"], t = (e == null ? void 0 : e.showProgress) ?? process.stdout.isTTY, i = `pl-${r}-${Qe()}.tgz`, s = (e == null ? void 0 : e.downloadURL) ?? `https://cdn.platforma.bio/software/pl/${Nr()}/${i}`, c = (e == null ? void 0 : e.saveTo) ?? o.binaries(i);
|
|
651
657
|
if (l.existsSync(c))
|
|
652
658
|
return a.info(`Platforma Backend archive download skipped: '${c}' already exists`), Promise.resolve(c);
|
|
653
|
-
l.mkdirSync(
|
|
659
|
+
l.mkdirSync(u.dirname(c), { recursive: !0 }), a.info(`Downloading Platforma Backend archive:
|
|
654
660
|
URL: ${s}
|
|
655
661
|
Save to: ${c}`);
|
|
656
662
|
const n = lr.get(s);
|
|
657
|
-
return new Promise((h,
|
|
663
|
+
return new Promise((h, f) => {
|
|
658
664
|
n.on("response", (g) => {
|
|
659
665
|
if (!g.statusCode) {
|
|
660
666
|
const b = new Error("failed to download archive: no HTTP status code in response from server");
|
|
661
|
-
n.destroy(),
|
|
667
|
+
n.destroy(), f(b);
|
|
662
668
|
return;
|
|
663
669
|
}
|
|
664
670
|
if (g.statusCode !== 200) {
|
|
665
671
|
const b = new Error(`failed to download archive: ${g.statusCode} ${g.statusMessage}`);
|
|
666
|
-
n.destroy(),
|
|
672
|
+
n.destroy(), f(b);
|
|
667
673
|
return;
|
|
668
674
|
}
|
|
669
675
|
const v = parseInt(g.headers["content-length"] || "0", 10);
|
|
670
676
|
let P = 0;
|
|
671
|
-
const
|
|
672
|
-
g.pipe(
|
|
677
|
+
const d = l.createWriteStream(c);
|
|
678
|
+
g.pipe(d), g.on("data", (b) => {
|
|
673
679
|
P += b.length;
|
|
674
680
|
const w = P / v * 100;
|
|
675
681
|
t && process.stdout.write(` downloading: ${w.toFixed(2)}%\r`);
|
|
676
682
|
}), g.on("error", (b) => {
|
|
677
|
-
l.unlinkSync(c), a.error(`Failed to download Platforma Binary: ${b.message}`), n.destroy(),
|
|
678
|
-
}),
|
|
679
|
-
|
|
683
|
+
l.unlinkSync(c), a.error(`Failed to download Platforma Binary: ${b.message}`), n.destroy(), f(b);
|
|
684
|
+
}), d.on("finish", () => {
|
|
685
|
+
d.close(), a.info(" ... download done."), n.destroy(), h(c);
|
|
680
686
|
});
|
|
681
687
|
});
|
|
682
688
|
});
|
|
@@ -685,7 +691,7 @@ function Mr(a, e) {
|
|
|
685
691
|
a.debug("extracting archive...");
|
|
686
692
|
const r = (e == null ? void 0 : e.version) ?? te()["pl-version"];
|
|
687
693
|
a.debug(` version: '${r}'`);
|
|
688
|
-
const t = `${Ze({ version: r })}.tgz`, i = (e == null ? void 0 : e.archivePath) ??
|
|
694
|
+
const t = `${Ze({ version: r })}.tgz`, i = (e == null ? void 0 : e.archivePath) ?? o.binaries(t);
|
|
689
695
|
a.debug(` archive path: '${i}'`);
|
|
690
696
|
const s = (e == null ? void 0 : e.extractTo) ?? Br(i);
|
|
691
697
|
if (a.debug(` target dir: '${s}'`), l.existsSync(s))
|
|
@@ -696,7 +702,7 @@ function Mr(a, e) {
|
|
|
696
702
|
}
|
|
697
703
|
return l.existsSync(s) || (a.debug(` creating target dir '${s}'`), l.mkdirSync(s, { recursive: !0 })), a.info(`Unpacking Platforma Backend archive:
|
|
698
704
|
Archive: ${i}
|
|
699
|
-
Target dir: ${s}`),
|
|
705
|
+
Target dir: ${s}`), or.x({
|
|
700
706
|
file: i,
|
|
701
707
|
cwd: s,
|
|
702
708
|
gzip: !0,
|
|
@@ -710,7 +716,7 @@ function Ze(a) {
|
|
|
710
716
|
return `pl-${(a == null ? void 0 : a.version) ?? te()["pl-version"]}-${Qe()}`;
|
|
711
717
|
}
|
|
712
718
|
function Cr(a, ...e) {
|
|
713
|
-
return
|
|
719
|
+
return o.binaries(Ze({ version: a }), ...e);
|
|
714
720
|
}
|
|
715
721
|
function Br(a) {
|
|
716
722
|
const e = a.lastIndexOf(".");
|
|
@@ -721,25 +727,25 @@ class D {
|
|
|
721
727
|
this.logger = e;
|
|
722
728
|
}
|
|
723
729
|
startLast() {
|
|
724
|
-
const e =
|
|
730
|
+
const e = Or(this.logger, { stdio: "inherit" });
|
|
725
731
|
J(e, "failed to bring back Platforma Backend in the last started configuration");
|
|
726
732
|
}
|
|
727
733
|
startLocal(e) {
|
|
728
|
-
var h,
|
|
734
|
+
var h, f, g, v, P, d, b, w, S, L;
|
|
729
735
|
const r = (e == null ? void 0 : e.binaryPath) ?? Cr(e == null ? void 0 : e.version, "binaries", "platforma");
|
|
730
736
|
var t = e == null ? void 0 : e.configPath;
|
|
731
|
-
const i = (e == null ? void 0 : e.workdir) ?? (t ? process.cwd() :
|
|
737
|
+
const i = (e == null ? void 0 : e.workdir) ?? (t ? process.cwd() : o.path());
|
|
732
738
|
e != null && e.primaryURL && (e.configOptions = {
|
|
733
739
|
...e.configOptions,
|
|
734
740
|
storages: {
|
|
735
741
|
...(h = e.configOptions) == null ? void 0 : h.storages,
|
|
736
|
-
primary: N(e.primaryURL, i, (g = (
|
|
742
|
+
primary: N(e.primaryURL, i, (g = (f = e.configOptions) == null ? void 0 : f.storages) == null ? void 0 : g.primary)
|
|
737
743
|
}
|
|
738
744
|
}), e != null && e.libraryURL && (e.configOptions = {
|
|
739
745
|
...e.configOptions,
|
|
740
746
|
storages: {
|
|
741
747
|
...(v = e.configOptions) == null ? void 0 : v.storages,
|
|
742
|
-
library: N(e.libraryURL, i, (
|
|
748
|
+
library: N(e.libraryURL, i, (d = (P = e.configOptions) == null ? void 0 : P.storages) == null ? void 0 : d.library)
|
|
743
749
|
}
|
|
744
750
|
});
|
|
745
751
|
const s = Er(this.getLastJwt(), e == null ? void 0 : e.configOptions);
|
|
@@ -753,8 +759,8 @@ class D {
|
|
|
753
759
|
for (const k of c)
|
|
754
760
|
l.existsSync(k) || (this.logger.debug(` '${k}'`), l.mkdirSync(k, { recursive: !0 }));
|
|
755
761
|
for (const k of s.core.auth.drivers)
|
|
756
|
-
k.driver === "htpasswd" && (l.existsSync(k.path) || (this.logger.debug(` installing default 'users.htpasswd' to ${k.path}...`), l.copyFileSync(
|
|
757
|
-
t || (t =
|
|
762
|
+
k.driver === "htpasswd" && (l.existsSync(k.path) || (this.logger.debug(` installing default 'users.htpasswd' to ${k.path}...`), l.copyFileSync(O("users.htpasswd"), k.path)));
|
|
763
|
+
t || (t = u.join(s.localRoot, "config.yaml"), this.logger.debug(` rendering configuration '${t}'...`), l.writeFileSync(t, Fr(s)));
|
|
758
764
|
const n = this.renderRunInfo({
|
|
759
765
|
configPath: t,
|
|
760
766
|
dbPath: s.core.db.path,
|
|
@@ -785,7 +791,7 @@ ${n}`), pr(
|
|
|
785
791
|
return this.startMinio({
|
|
786
792
|
minioPort: r,
|
|
787
793
|
minioConsolePort: e == null ? void 0 : e.minioConsolePort,
|
|
788
|
-
storage: t ?
|
|
794
|
+
storage: t ? u.join(t, "minio") : void 0
|
|
789
795
|
}), this.startLocal({
|
|
790
796
|
...e,
|
|
791
797
|
primaryURL: (e == null ? void 0 : e.primaryURL) ?? `s3e://testuser:testpassword@localhost:${r}/main-bucket/?region=no-region`,
|
|
@@ -794,18 +800,18 @@ ${n}`), pr(
|
|
|
794
800
|
}
|
|
795
801
|
startMinio(e) {
|
|
796
802
|
this.logger.debug(" starting minio...");
|
|
797
|
-
var r =
|
|
803
|
+
var r = O("compose-backend.yaml");
|
|
798
804
|
const t = e != null && e.version ? `:${e.version}` : "";
|
|
799
805
|
this.logger.debug(` minio version: ${t}`);
|
|
800
806
|
const i = (e == null ? void 0 : e.image) ?? `quay.io/minio/minio${t}`;
|
|
801
807
|
this.logger.debug(` minio image: ${i}`);
|
|
802
|
-
const s = (e == null ? void 0 : e.storage) ??
|
|
808
|
+
const s = (e == null ? void 0 : e.storage) ?? o.data("minio");
|
|
803
809
|
q(s, { mode: "0775" });
|
|
804
|
-
const c =
|
|
810
|
+
const c = o.data("stub");
|
|
805
811
|
q(c);
|
|
806
|
-
const n = (e == null ? void 0 : e.minioPort) ?? 9e3, h = (e == null ? void 0 : e.minioConsolePort) ?? 9001,
|
|
812
|
+
const n = (e == null ? void 0 : e.minioPort) ?? 9e3, h = (e == null ? void 0 : e.minioConsolePort) ?? 9001, f = {
|
|
807
813
|
MINIO_IMAGE: i,
|
|
808
|
-
MINIO_STORAGE:
|
|
814
|
+
MINIO_STORAGE: u.resolve(s),
|
|
809
815
|
MINIO_PORT: n.toString(),
|
|
810
816
|
MINIO_CONSOLE_PORT: h.toString(),
|
|
811
817
|
PL_DATA_DB_ROOT: c,
|
|
@@ -822,7 +828,7 @@ ${n}`), pr(
|
|
|
822
828
|
{
|
|
823
829
|
env: {
|
|
824
830
|
...process.env,
|
|
825
|
-
...
|
|
831
|
+
...f
|
|
826
832
|
},
|
|
827
833
|
stdio: "inherit"
|
|
828
834
|
}
|
|
@@ -830,7 +836,7 @@ ${n}`), pr(
|
|
|
830
836
|
J(g, "failed to start MinIO service in docker");
|
|
831
837
|
}
|
|
832
838
|
buildPlatforma(e) {
|
|
833
|
-
const r =
|
|
839
|
+
const r = u.resolve(e.repoRoot, "cmd", "platforma"), t = e.binPath ?? u.join(_.tmpdir(), "platforma-local-build");
|
|
834
840
|
this.logger.info("Building Platforma Backend binary from sources"), this.logger.info(` sources path: ${e.repoRoot}`), this.logger.info(` binary path: ${t}`);
|
|
835
841
|
const i = H("go", ["build", "-o", t, "."], {
|
|
836
842
|
cwd: r,
|
|
@@ -839,24 +845,24 @@ ${n}`), pr(
|
|
|
839
845
|
return J(i, "failed to build platforma binary from sources using 'go build' command"), t;
|
|
840
846
|
}
|
|
841
847
|
startDockerS3(e, r) {
|
|
842
|
-
const t =
|
|
848
|
+
const t = O("compose-backend.yaml"), i = (r == null ? void 0 : r.image) ?? ie(r == null ? void 0 : r.version);
|
|
843
849
|
this.checkLicense(r == null ? void 0 : r.license, r == null ? void 0 : r.licenseFile);
|
|
844
|
-
const s = (S) =>
|
|
850
|
+
const s = (S) => u.join(e, S), c = (S) => {
|
|
845
851
|
const L = s(S);
|
|
846
852
|
return q(L, { mode: "0775" }), L;
|
|
847
853
|
}, n = s("platforma.log");
|
|
848
|
-
l.existsSync(n) || (l.mkdirSync(
|
|
854
|
+
l.existsSync(n) || (l.mkdirSync(u.dirname(n), { recursive: !0 }), l.writeFileSync(n, ""));
|
|
849
855
|
const h = N("s3e://testuser:testpassword@minio:9000/main-bucket");
|
|
850
856
|
if (h.type !== "S3")
|
|
851
857
|
throw new Error("primary storage must have 'S3' type in 'docker s3' configuration");
|
|
852
858
|
h.presignEndpoint = "http://localhost:9000";
|
|
853
|
-
const
|
|
854
|
-
if (
|
|
855
|
-
throw new Error(`${
|
|
856
|
-
|
|
859
|
+
const f = N("s3e://testuser:testpassword@minio:9000/library-bucket");
|
|
860
|
+
if (f.type !== "S3")
|
|
861
|
+
throw new Error(`${f.type} storage type is not supported for library storage`);
|
|
862
|
+
f.presignEndpoint = "http://localhost:9000";
|
|
857
863
|
const g = c("db"), v = c("work"), P = s("users.htpasswd");
|
|
858
|
-
l.existsSync(P) || l.copyFileSync(
|
|
859
|
-
const
|
|
864
|
+
l.existsSync(P) || l.copyFileSync(O("users.htpasswd"), P);
|
|
865
|
+
const d = {
|
|
860
866
|
MINIO_IMAGE: "quay.io/minio/minio",
|
|
861
867
|
MINIO_STORAGE: c("minio"),
|
|
862
868
|
PL_IMAGE: i,
|
|
@@ -871,12 +877,12 @@ ${n}`), pr(
|
|
|
871
877
|
PL_DATA_WORKDIR_ROOT: v,
|
|
872
878
|
PL_DATA_PACKAGE_ROOT: c("packages"),
|
|
873
879
|
...this.configureDockerStorage("primary", h),
|
|
874
|
-
...this.configureDockerStorage("library",
|
|
880
|
+
...this.configureDockerStorage("library", f)
|
|
875
881
|
};
|
|
876
|
-
if (r != null && r.grpcAddr && (
|
|
882
|
+
if (r != null && r.grpcAddr && (d.PL_GRPC_ADDR = r.grpcAddr), r != null && r.grpcPort && (d.PL_GRPC_PORT = r.grpcPort.toString()), r != null && r.monitoringAddr && (d.PL_MONITORING_ADDR = r.monitoringAddr), r != null && r.monitoringPort && (d.PL_MONITORING_PORT = r.monitoringPort.toString()), r != null && r.debugAddr && (d.PL_DEBUG_ADDR = r.debugAddr), r != null && r.debugPort && (d.PL_DEBUG_PORT = r.debugPort.toString()), r != null && r.auth && (r.auth.enabled && (d.PL_AUTH_ENABLED = "true"), r.auth.drivers)) {
|
|
877
883
|
for (const S of r.auth.drivers)
|
|
878
|
-
S.driver === "htpasswd" && (
|
|
879
|
-
|
|
884
|
+
S.driver === "htpasswd" && (d.PL_AUTH_HTPASSWD_PATH = u.resolve(S.path), S.path = "/etc/platforma/users.htpasswd");
|
|
885
|
+
d.PL_AUTH_DRIVERS = JSON.stringify(r.auth.drivers);
|
|
880
886
|
}
|
|
881
887
|
const b = Be(
|
|
882
888
|
this.logger,
|
|
@@ -891,7 +897,7 @@ ${n}`), pr(
|
|
|
891
897
|
"backend"
|
|
892
898
|
],
|
|
893
899
|
{
|
|
894
|
-
env:
|
|
900
|
+
env: d,
|
|
895
901
|
stdio: "inherit"
|
|
896
902
|
},
|
|
897
903
|
{
|
|
@@ -899,31 +905,31 @@ ${n}`), pr(
|
|
|
899
905
|
composePath: t
|
|
900
906
|
}
|
|
901
907
|
);
|
|
902
|
-
J(b, "failed to start Platforma Backend in Docker"),
|
|
908
|
+
J(b, "failed to start Platforma Backend in Docker"), o.isActive = !0;
|
|
903
909
|
const w = this.renderRunInfo({
|
|
904
910
|
apiPort: r == null ? void 0 : r.grpcPort,
|
|
905
911
|
apiAddr: r == null ? void 0 : r.grpcAddr,
|
|
906
912
|
logPath: n,
|
|
907
913
|
primary: h,
|
|
908
914
|
work: { type: "FS", rootPath: v },
|
|
909
|
-
library:
|
|
915
|
+
library: f,
|
|
910
916
|
dbPath: g
|
|
911
917
|
});
|
|
912
918
|
this.logger.info(`Started platforma:
|
|
913
919
|
${w}`);
|
|
914
920
|
}
|
|
915
921
|
startDocker(e, r) {
|
|
916
|
-
var t =
|
|
922
|
+
var t = O("compose-backend.yaml");
|
|
917
923
|
const i = (r == null ? void 0 : r.image) ?? ie(r == null ? void 0 : r.version);
|
|
918
924
|
this.checkLicense(r == null ? void 0 : r.license, r == null ? void 0 : r.licenseFile);
|
|
919
|
-
const s = (k) =>
|
|
925
|
+
const s = (k) => u.join(e, k), c = (k) => {
|
|
920
926
|
const p = s(k);
|
|
921
927
|
return q(p, { mode: "0775" }), p;
|
|
922
928
|
}, n = s("platforma.log");
|
|
923
|
-
l.existsSync(n) || (l.mkdirSync(
|
|
924
|
-
const h = c("db"),
|
|
925
|
-
l.existsSync(P) || l.copyFileSync(
|
|
926
|
-
const
|
|
929
|
+
l.existsSync(n) || (l.mkdirSync(u.dirname(n), { recursive: !0 }), l.writeFileSync(n, ""));
|
|
930
|
+
const h = c("db"), f = c("primary"), g = c("library"), v = c("work"), P = s("users.htpasswd");
|
|
931
|
+
l.existsSync(P) || l.copyFileSync(O("users.htpasswd"), P);
|
|
932
|
+
const d = N((r == null ? void 0 : r.primaryStorageURL) ?? `file:${f}`, "."), b = N((r == null ? void 0 : r.libraryStorageURL) ?? `file:${g}`, "."), w = {
|
|
927
933
|
MINIO_IMAGE: "quay.io/minio/minio",
|
|
928
934
|
MINIO_STORAGE: c("minio"),
|
|
929
935
|
PL_IMAGE: i,
|
|
@@ -933,16 +939,16 @@ ${w}`);
|
|
|
933
939
|
PL_LOG_LEVEL: "info",
|
|
934
940
|
PL_LOG_FILE: n,
|
|
935
941
|
PL_DATA_DB_ROOT: h,
|
|
936
|
-
PL_DATA_PRIMARY_ROOT:
|
|
942
|
+
PL_DATA_PRIMARY_ROOT: f,
|
|
937
943
|
PL_DATA_LIBRARY_ROOT: g,
|
|
938
944
|
PL_DATA_WORKDIR_ROOT: v,
|
|
939
945
|
PL_DATA_PACKAGE_ROOT: c("packages"),
|
|
940
|
-
...this.configureDockerStorage("primary",
|
|
946
|
+
...this.configureDockerStorage("primary", d),
|
|
941
947
|
...this.configureDockerStorage("library", b)
|
|
942
948
|
};
|
|
943
949
|
if (r != null && r.grpcAddr && (w.PL_GRPC_ADDR = r.grpcAddr), r != null && r.grpcPort && (w.PL_GRPC_PORT = r.grpcPort.toString()), r != null && r.monitoringAddr && (w.PL_MONITORING_ADDR = r.monitoringAddr), r != null && r.monitoringPort && (w.PL_MONITORING_PORT = r.monitoringPort.toString()), r != null && r.debugAddr && (w.PL_DEBUG_ADDR = r.debugAddr), r != null && r.debugPort && (w.PL_DEBUG_PORT = r.debugPort.toString()), r != null && r.auth && (r.auth.enabled && (w.PL_AUTH_ENABLED = "true"), r.auth.drivers)) {
|
|
944
950
|
for (const k of r.auth.drivers)
|
|
945
|
-
k.driver === "htpasswd" && (w.PL_AUTH_HTPASSWD_PATH =
|
|
951
|
+
k.driver === "htpasswd" && (w.PL_AUTH_HTPASSWD_PATH = u.resolve(k.path), k.path = "/etc/platforma/users.htpasswd");
|
|
946
952
|
w.PL_AUTH_DRIVERS = JSON.stringify(r.auth.drivers);
|
|
947
953
|
}
|
|
948
954
|
const S = Be(
|
|
@@ -955,17 +961,17 @@ ${w}`);
|
|
|
955
961
|
{
|
|
956
962
|
plImage: i,
|
|
957
963
|
composePath: t,
|
|
958
|
-
primaryPath:
|
|
964
|
+
primaryPath: f,
|
|
959
965
|
workPath: v,
|
|
960
966
|
libraryPath: g
|
|
961
967
|
}
|
|
962
968
|
);
|
|
963
|
-
J(S, "failed to start Platforma Backend in Docker"),
|
|
969
|
+
J(S, "failed to start Platforma Backend in Docker"), o.isActive = !0;
|
|
964
970
|
const L = this.renderRunInfo({
|
|
965
971
|
apiPort: r == null ? void 0 : r.grpcPort,
|
|
966
972
|
apiAddr: r == null ? void 0 : r.grpcAddr,
|
|
967
973
|
logPath: n,
|
|
968
|
-
primary:
|
|
974
|
+
primary: d,
|
|
969
975
|
work: { type: "FS", rootPath: v },
|
|
970
976
|
library: b,
|
|
971
977
|
dbPath: h
|
|
@@ -974,11 +980,11 @@ ${w}`);
|
|
|
974
980
|
${L}`);
|
|
975
981
|
}
|
|
976
982
|
stop() {
|
|
977
|
-
if (!
|
|
983
|
+
if (!o.isActive) {
|
|
978
984
|
console.log("no running service detected");
|
|
979
985
|
return;
|
|
980
986
|
}
|
|
981
|
-
const e =
|
|
987
|
+
const e = o.lastRun;
|
|
982
988
|
switch (e.mode) {
|
|
983
989
|
case "docker":
|
|
984
990
|
const r = H("docker", ["compose", "--file", e.docker.composePath, "down"], {
|
|
@@ -988,31 +994,31 @@ ${L}`);
|
|
|
988
994
|
},
|
|
989
995
|
stdio: "inherit"
|
|
990
996
|
});
|
|
991
|
-
|
|
997
|
+
o.isActive = !1, r.status !== 0 && process.exit(r.status);
|
|
992
998
|
return;
|
|
993
999
|
case "process":
|
|
994
|
-
|
|
1000
|
+
o.isValidPID && process.kill(e.process.pid), o.isActive = !1;
|
|
995
1001
|
return;
|
|
996
1002
|
default:
|
|
997
1003
|
Y(e.mode);
|
|
998
1004
|
}
|
|
999
1005
|
}
|
|
1000
1006
|
cleanup() {
|
|
1001
|
-
var n, h,
|
|
1007
|
+
var n, h, f, g, v, P, d, b, w, S, L, k, p, j;
|
|
1002
1008
|
const e = [
|
|
1003
1009
|
"last command run cache ('pl-service start' shorthand will stop working until next full start command call)",
|
|
1004
1010
|
"'platforma' docker compose service containers and volumes"
|
|
1005
|
-
], r =
|
|
1006
|
-
if ((h = (n =
|
|
1007
|
-
const A = (g = (
|
|
1011
|
+
], r = o.data(), t = [r];
|
|
1012
|
+
if ((h = (n = o.lastRun) == null ? void 0 : n.docker) != null && h.primaryPath) {
|
|
1013
|
+
const A = (g = (f = o.lastRun) == null ? void 0 : f.docker) == null ? void 0 : g.primaryPath;
|
|
1008
1014
|
A.startsWith(r) || t.push(A);
|
|
1009
1015
|
}
|
|
1010
|
-
if ((P = (v =
|
|
1011
|
-
const A = (b = (
|
|
1016
|
+
if ((P = (v = o.lastRun) == null ? void 0 : v.docker) != null && P.workPath) {
|
|
1017
|
+
const A = (b = (d = o.lastRun) == null ? void 0 : d.docker) == null ? void 0 : b.workPath;
|
|
1012
1018
|
A.startsWith(r) || t.push(A);
|
|
1013
1019
|
}
|
|
1014
|
-
if ((S = (w =
|
|
1015
|
-
const A = (k = (L =
|
|
1020
|
+
if ((S = (w = o.lastRun) == null ? void 0 : w.process) != null && S.storagePath) {
|
|
1021
|
+
const A = (k = (L = o.lastRun) == null ? void 0 : L.process) == null ? void 0 : k.storagePath;
|
|
1016
1022
|
A.startsWith(r) || t.push(A);
|
|
1017
1023
|
}
|
|
1018
1024
|
const i = t.length > 0 ? ` - storages (you'll loose all projects and calculation results stored in service instances):
|
|
@@ -1030,25 +1036,25 @@ ${i}
|
|
|
1030
1036
|
return;
|
|
1031
1037
|
}
|
|
1032
1038
|
const c = new Set(_r());
|
|
1033
|
-
(
|
|
1039
|
+
(j = (p = o.lastRun) == null ? void 0 : p.docker) != null && j.composePath && c.add(o.lastRun.docker.composePath);
|
|
1034
1040
|
for (const A of c)
|
|
1035
1041
|
this.logger.info(`Destroying docker compose '${A}'`), this.destroyDocker(A, ie());
|
|
1036
1042
|
for (const A of t)
|
|
1037
1043
|
this.logger.info(`Destroying '${A}'`), l.rmSync(A, { recursive: !0, force: !0 });
|
|
1038
|
-
this.logger.info(`Destroying state dir '${
|
|
1044
|
+
this.logger.info(`Destroying state dir '${o.path()}'`), l.rmSync(o.path(), { recursive: !0, force: !0 }), this.logger.info(
|
|
1039
1045
|
`
|
|
1040
|
-
If you want to remove all downloaded platforma binaries, delete '${
|
|
1046
|
+
If you want to remove all downloaded platforma binaries, delete '${o.binaries()}' dir manually
|
|
1041
1047
|
`
|
|
1042
1048
|
);
|
|
1043
1049
|
}
|
|
1044
1050
|
mergeLicenseEnvs(e) {
|
|
1045
|
-
e.license === void 0 && ((process.env.MI_LICENSE ?? "") != "" ? e.license = process.env.MI_LICENSE : (process.env.PL_LICENSE ?? "") != "" && (e.license = process.env.PL_LICENSE)), e["license-file"] === void 0 && e.license === void 0 && ((process.env.MI_LICENSE_FILE ?? "") != "" ? e["license-file"] = process.env.MI_LICENSE_FILE : (process.env.PL_LICENSE_FILE ?? "") != "" ? e["license-file"] = process.env.PL_LICENSE_FILE : l.existsSync(
|
|
1051
|
+
e.license === void 0 && ((process.env.MI_LICENSE ?? "") != "" ? e.license = process.env.MI_LICENSE : (process.env.PL_LICENSE ?? "") != "" && (e.license = process.env.PL_LICENSE)), e["license-file"] === void 0 && e.license === void 0 && ((process.env.MI_LICENSE_FILE ?? "") != "" ? e["license-file"] = process.env.MI_LICENSE_FILE : (process.env.PL_LICENSE_FILE ?? "") != "" ? e["license-file"] = process.env.PL_LICENSE_FILE : l.existsSync(u.resolve(_.homedir(), ".pl.license")) && (e["license-file"] = u.resolve(_.homedir(), ".pl.license")));
|
|
1046
1052
|
}
|
|
1047
1053
|
initAuthDriversList(e, r) {
|
|
1048
1054
|
var t = [];
|
|
1049
1055
|
if (e["auth-htpasswd-file"] && t.push({
|
|
1050
1056
|
driver: "htpasswd",
|
|
1051
|
-
path:
|
|
1057
|
+
path: u.resolve(r, e["auth-htpasswd-file"])
|
|
1052
1058
|
}), !!e["auth-ldap-server"] != !!e["auth-ldap-default-dn"])
|
|
1053
1059
|
throw new Error("LDAP auth settings require both 'server' and 'default DN' options to be set");
|
|
1054
1060
|
if (e["auth-ldap-server"] && t.push({
|
|
@@ -1060,7 +1066,7 @@ If you want to remove all downloaded platforma binaries, delete '${d.binaries()}
|
|
|
1060
1066
|
}
|
|
1061
1067
|
/** Gets the last stored JWT secret key or generates it and stores in a file. */
|
|
1062
1068
|
getLastJwt() {
|
|
1063
|
-
const e =
|
|
1069
|
+
const e = o.path("auth.jwt"), r = "utf-8";
|
|
1064
1070
|
let t = "";
|
|
1065
1071
|
try {
|
|
1066
1072
|
t = l.readFileSync(e, { encoding: r });
|
|
@@ -1069,7 +1075,7 @@ If you want to remove all downloaded platforma binaries, delete '${d.binaries()}
|
|
|
1069
1075
|
return t == "" && (t = yr(64), l.writeFileSync(e, t, { encoding: r })), t;
|
|
1070
1076
|
}
|
|
1071
1077
|
destroyDocker(e, r) {
|
|
1072
|
-
const t =
|
|
1078
|
+
const t = o.data("stub"), i = H("docker", ["compose", "--file", e, "down", "--volumes", "--remove-orphans"], {
|
|
1073
1079
|
env: {
|
|
1074
1080
|
...process.env,
|
|
1075
1081
|
PL_IMAGE: "scratch",
|
|
@@ -1113,7 +1119,7 @@ You can obtain the license from "https://licensing.milaboratories.com".`), new E
|
|
|
1113
1119
|
}
|
|
1114
1120
|
renderRunInfo(e, r = 10) {
|
|
1115
1121
|
var n, h;
|
|
1116
|
-
const t = [], i = (
|
|
1122
|
+
const t = [], i = (f) => f.padStart(r, " ");
|
|
1117
1123
|
switch (e.configPath && t.push(`${i("config")}: ${e.configPath}`), e.apiAddr ? t.push(`${i("API")}: ${e.apiAddr}`) : e.apiPort ? t.push(`${i("API")}: 127.0.0.1:${e.apiPort.toString()}`) : t.push(`${i("API")}: 127.0.0.1:6345`), e.logPath && t.push(`${i("log")}: ${e.logPath}`), (n = e.primary) == null ? void 0 : n.type) {
|
|
1118
1124
|
case void 0:
|
|
1119
1125
|
break;
|
|
@@ -1160,7 +1166,7 @@ function J(a, e) {
|
|
|
1160
1166
|
if (a.status !== 0)
|
|
1161
1167
|
throw new Error(`${r}, process exited with code '${a.status}'`);
|
|
1162
1168
|
}
|
|
1163
|
-
const x = class x extends
|
|
1169
|
+
const x = class x extends $ {
|
|
1164
1170
|
async run() {
|
|
1165
1171
|
const { flags: e } = await this.parse(x), r = E(e["log-level"]);
|
|
1166
1172
|
new D(r).cleanup();
|
|
@@ -1170,7 +1176,7 @@ m(x, "description", "Clear service state (forget last run command, destroy docke
|
|
|
1170
1176
|
...T
|
|
1171
1177
|
});
|
|
1172
1178
|
let ne = x;
|
|
1173
|
-
const M = class M extends
|
|
1179
|
+
const M = class M extends $ {
|
|
1174
1180
|
async run() {
|
|
1175
1181
|
const { flags: e } = await this.parse(M), r = E(e["log-level"]);
|
|
1176
1182
|
new D(r).startLast();
|
|
@@ -1180,7 +1186,7 @@ m(M, "description", "Start last run service configuraiton"), m(M, "examples", ["
|
|
|
1180
1186
|
...T
|
|
1181
1187
|
});
|
|
1182
1188
|
let le = M;
|
|
1183
|
-
const C = class C extends
|
|
1189
|
+
const C = class C extends $ {
|
|
1184
1190
|
async run() {
|
|
1185
1191
|
const { flags: e } = await this.parse(C), r = E(e["log-level"]);
|
|
1186
1192
|
new D(r).stop();
|
|
@@ -1189,15 +1195,15 @@ const C = class C extends O {
|
|
|
1189
1195
|
m(C, "description", "Stop platforma service"), m(C, "examples", ["<%= config.bin %> <%= command.id %>"]), m(C, "flags", {
|
|
1190
1196
|
...T
|
|
1191
1197
|
});
|
|
1192
|
-
let
|
|
1193
|
-
const B = class B extends
|
|
1198
|
+
let oe = C;
|
|
1199
|
+
const B = class B extends $ {
|
|
1194
1200
|
async run() {
|
|
1195
1201
|
const { flags: e } = await this.parse(B), r = E(e["log-level"]), t = new D(r);
|
|
1196
1202
|
t.mergeLicenseEnvs(e);
|
|
1197
1203
|
const i = e["auth-enabled"], s = i ? {
|
|
1198
1204
|
enabled: i,
|
|
1199
1205
|
drivers: t.initAuthDriversList(e, ".")
|
|
1200
|
-
} : void 0, c = e.storage ?
|
|
1206
|
+
} : void 0, c = e.storage ? u.join(".", e.storage) : o.data("docker");
|
|
1201
1207
|
t.startDocker(c, {
|
|
1202
1208
|
primaryStorageURL: e["storage-primary"],
|
|
1203
1209
|
workStoragePath: e["storage-work"],
|
|
@@ -1228,22 +1234,22 @@ m(B, "description", "Run platforma backend service with 'FS' primary storage typ
|
|
|
1228
1234
|
...fe,
|
|
1229
1235
|
...me
|
|
1230
1236
|
});
|
|
1231
|
-
let
|
|
1232
|
-
const G = class G extends
|
|
1237
|
+
let de = B;
|
|
1238
|
+
const G = class G extends $ {
|
|
1233
1239
|
async run() {
|
|
1234
1240
|
const { flags: e } = await this.parse(G), r = E(e["log-level"]), t = new D(r);
|
|
1235
1241
|
t.mergeLicenseEnvs(e);
|
|
1236
|
-
const i = e["pl-workdir"] ?? ".", s = e.storage ?
|
|
1237
|
-
var
|
|
1238
|
-
e["pl-sources"] && (
|
|
1242
|
+
const i = e["pl-workdir"] ?? ".", s = e.storage ? u.join(i, e.storage) : o.data("local"), c = e["pl-log-file"] ? u.join(i, e["pl-log-file"]) : void 0, n = t.initAuthDriversList(e, i), h = e["auth-enabled"] ?? n !== void 0;
|
|
1243
|
+
var f = e["pl-binary"];
|
|
1244
|
+
e["pl-sources"] && (f = t.buildPlatforma({ repoRoot: e["pl-sources"] }));
|
|
1239
1245
|
var g = "127.0.0.1:6345";
|
|
1240
1246
|
e["grpc-listen"] ? g = e["grpc-listen"] : e["grpc-port"] && (g = `127.0.0.1:${e["grpc-port"]}`);
|
|
1241
1247
|
var v = "127.0.0.1:9090";
|
|
1242
1248
|
e["monitoring-listen"] ? v = e["monitoring-listen"] : e["monitoring-port"] && (v = `127.0.0.1:${e["monitoring-port"]}`);
|
|
1243
1249
|
var P = "127.0.0.1:9091";
|
|
1244
1250
|
e["debug-listen"] ? P = e["debug-listen"] : e["debug-port"] && (P = `127.0.0.1:${e["debug-port"]}`);
|
|
1245
|
-
const
|
|
1246
|
-
binaryPath:
|
|
1251
|
+
const d = {
|
|
1252
|
+
binaryPath: f,
|
|
1247
1253
|
version: e.version,
|
|
1248
1254
|
configPath: e.config,
|
|
1249
1255
|
workdir: e["pl-workdir"],
|
|
@@ -1262,7 +1268,7 @@ const G = class G extends O {
|
|
|
1262
1268
|
}
|
|
1263
1269
|
}
|
|
1264
1270
|
};
|
|
1265
|
-
|
|
1271
|
+
d.binaryPath ? t.startLocal(d) : Xe(r, { version: e.version }).then(() => t.startLocal(d)).catch(function(b) {
|
|
1266
1272
|
r.error(b.message);
|
|
1267
1273
|
});
|
|
1268
1274
|
}
|
|
@@ -1279,20 +1285,20 @@ m(G, "description", "Run Platforma Backend service as local process on current h
|
|
|
1279
1285
|
...he,
|
|
1280
1286
|
...fe,
|
|
1281
1287
|
...me,
|
|
1282
|
-
...We,
|
|
1283
1288
|
...je,
|
|
1289
|
+
...We,
|
|
1284
1290
|
...re
|
|
1285
1291
|
});
|
|
1286
1292
|
let ge = G;
|
|
1287
1293
|
var R;
|
|
1288
|
-
let Gr = (R = class extends
|
|
1294
|
+
let Gr = (R = class extends $ {
|
|
1289
1295
|
async run() {
|
|
1290
1296
|
const { flags: e } = await this.parse(R), r = E(e["log-level"]), t = new D(r);
|
|
1291
1297
|
t.mergeLicenseEnvs(e);
|
|
1292
1298
|
const i = e["auth-enabled"], s = i ? {
|
|
1293
1299
|
enabled: i,
|
|
1294
1300
|
drivers: t.initAuthDriversList(e, ".")
|
|
1295
|
-
} : void 0, c = e.storage ?
|
|
1301
|
+
} : void 0, c = e.storage ? u.join(".", e.storage) : o.data("docker-s3");
|
|
1296
1302
|
t.startDockerS3(c, {
|
|
1297
1303
|
image: e.image,
|
|
1298
1304
|
version: e.version,
|
|
@@ -1316,21 +1322,21 @@ let Gr = (R = class extends O {
|
|
|
1316
1322
|
...X,
|
|
1317
1323
|
...re
|
|
1318
1324
|
}), R);
|
|
1319
|
-
const U = class U extends
|
|
1325
|
+
const U = class U extends $ {
|
|
1320
1326
|
async run() {
|
|
1321
1327
|
const { flags: e } = await this.parse(U), r = E(e["log-level"]), t = new D(r);
|
|
1322
1328
|
t.mergeLicenseEnvs(e);
|
|
1323
|
-
const i = e["pl-workdir"] ?? ".", s = e.storage ?
|
|
1324
|
-
var
|
|
1325
|
-
e["pl-sources"] && (
|
|
1329
|
+
const i = e["pl-workdir"] ?? ".", s = e.storage ? u.join(i, e.storage) : o.data("local-s3"), c = e["pl-log-file"] ? u.join(i, e["pl-log-file"]) : void 0, n = t.initAuthDriversList(e, i), h = e["auth-enabled"] ?? n !== void 0;
|
|
1330
|
+
var f = e["pl-binary"];
|
|
1331
|
+
e["pl-sources"] && (f = t.buildPlatforma({ repoRoot: e["pl-sources"] }));
|
|
1326
1332
|
var g = "127.0.0.1:6345";
|
|
1327
1333
|
e["grpc-listen"] ? g = e["grpc-listen"] : e["grpc-port"] && (g = `127.0.0.1:${e["grpc-port"]}`);
|
|
1328
1334
|
var v = "127.0.0.1:9090";
|
|
1329
1335
|
e["monitoring-listen"] ? v = e["monitoring-listen"] : e["monitoring-port"] && (v = `127.0.0.1:${e["monitoring-port"]}`);
|
|
1330
1336
|
var P = "127.0.0.1:9091";
|
|
1331
1337
|
e["debug-listen"] ? P = e["debug-listen"] : e["debug-port"] && (P = `127.0.0.1:${e["debug-port"]}`);
|
|
1332
|
-
const
|
|
1333
|
-
binaryPath:
|
|
1338
|
+
const d = {
|
|
1339
|
+
binaryPath: f,
|
|
1334
1340
|
version: e.version,
|
|
1335
1341
|
configPath: e.config,
|
|
1336
1342
|
workdir: e["pl-workdir"],
|
|
@@ -1353,7 +1359,7 @@ const U = class U extends O {
|
|
|
1353
1359
|
}
|
|
1354
1360
|
}
|
|
1355
1361
|
};
|
|
1356
|
-
|
|
1362
|
+
d.binaryPath ? t.startLocalS3(d) : Xe(r, { version: e.version }).then(() => t.startLocalS3(d)).catch(function(b) {
|
|
1357
1363
|
r.error(b.message);
|
|
1358
1364
|
});
|
|
1359
1365
|
}
|
|
@@ -1362,7 +1368,7 @@ m(U, "description", "Run Platforma Backend service as local process on current h
|
|
|
1362
1368
|
...T,
|
|
1363
1369
|
...Q,
|
|
1364
1370
|
...Z,
|
|
1365
|
-
...
|
|
1371
|
+
...dr,
|
|
1366
1372
|
...Je,
|
|
1367
1373
|
...He,
|
|
1368
1374
|
...Ye,
|
|
@@ -1371,8 +1377,8 @@ m(U, "description", "Run Platforma Backend service as local process on current h
|
|
|
1371
1377
|
...he,
|
|
1372
1378
|
...fe,
|
|
1373
1379
|
...me,
|
|
1374
|
-
...We,
|
|
1375
1380
|
...je,
|
|
1381
|
+
...We,
|
|
1376
1382
|
...re
|
|
1377
1383
|
});
|
|
1378
1384
|
let ue = U;
|
|
@@ -1380,8 +1386,8 @@ const rt = {
|
|
|
1380
1386
|
"create-block": se,
|
|
1381
1387
|
reset: ne,
|
|
1382
1388
|
start: le,
|
|
1383
|
-
stop:
|
|
1384
|
-
"start:docker":
|
|
1389
|
+
stop: oe,
|
|
1390
|
+
"start:docker": de,
|
|
1385
1391
|
"start:local": ge,
|
|
1386
1392
|
"start:docker:s3": Gr,
|
|
1387
1393
|
"start:local:s3": ue
|