@platforma-sdk/bootstrap 3.1.4 → 3.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/compose-backend.yaml +2 -0
- package/dist/core.d.ts +5 -7
- package/dist/core.d.ts.map +1 -1
- package/dist/index.js +10 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +225 -230
- package/dist/index.mjs.map +1 -1
- package/dist/templates/pl-config.d.ts.map +1 -1
- package/dist/templates/types.d.ts +3 -3
- package/dist/templates/types.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -2,10 +2,10 @@ 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
4
|
import { Flags as v, Command as L, Args as K } from "@oclif/core";
|
|
5
|
-
import
|
|
5
|
+
import F from "node:os";
|
|
6
6
|
import f, { createWriteStream as Lr } from "node:fs";
|
|
7
|
-
import m, { resolve as
|
|
8
|
-
import { execSync as
|
|
7
|
+
import m, { resolve as Ar } from "node:path";
|
|
8
|
+
import { execSync as Ie, spawn as Ir, spawnSync as mr } from "node:child_process";
|
|
9
9
|
import ge from "winston";
|
|
10
10
|
import { randomBytes as Or } from "node:crypto";
|
|
11
11
|
import Z from "readline-sync";
|
|
@@ -13,11 +13,11 @@ import * as _ from "node:fs/promises";
|
|
|
13
13
|
import { Writable as Rr } from "node:stream";
|
|
14
14
|
import { z as N } from "zod";
|
|
15
15
|
import Er from "decompress";
|
|
16
|
-
import fe from "
|
|
17
|
-
import
|
|
16
|
+
import { getDefaultPlVersion as fe } from "@milaboratories/pl-deployments";
|
|
17
|
+
import dr from "yaml";
|
|
18
18
|
import Tr from "node:https";
|
|
19
|
-
import * as
|
|
20
|
-
const
|
|
19
|
+
import * as xr from "tar";
|
|
20
|
+
const A = {
|
|
21
21
|
"log-level": v.string({
|
|
22
22
|
description: "logging level",
|
|
23
23
|
default: "info",
|
|
@@ -29,7 +29,7 @@ v.string({
|
|
|
29
29
|
description: "name of instance",
|
|
30
30
|
required: !1
|
|
31
31
|
});
|
|
32
|
-
const
|
|
32
|
+
const me = {
|
|
33
33
|
image: v.string({
|
|
34
34
|
description: "use custom docker image to run platforma"
|
|
35
35
|
})
|
|
@@ -37,7 +37,7 @@ const he = {
|
|
|
37
37
|
version: v.string({
|
|
38
38
|
description: "use custom platforma release (official docker image or binary package)"
|
|
39
39
|
})
|
|
40
|
-
},
|
|
40
|
+
}, he = {
|
|
41
41
|
arch: v.string({
|
|
42
42
|
description: "override architecture. You can start amd64 linux image on arm-based host (say, Apple M family processor). I.e. arm64, amd64, amd64/v2"
|
|
43
43
|
})
|
|
@@ -89,7 +89,7 @@ const he = {
|
|
|
89
89
|
storage: v.string({
|
|
90
90
|
description: "specify path on host to be used as storage for all Platforma Backend data"
|
|
91
91
|
})
|
|
92
|
-
},
|
|
92
|
+
}, yr = {
|
|
93
93
|
"minio-presign-host": v.boolean({
|
|
94
94
|
description: "use 'minio' host instead of 'localhost' in presign URLs"
|
|
95
95
|
})
|
|
@@ -98,23 +98,23 @@ const he = {
|
|
|
98
98
|
multiple: !0,
|
|
99
99
|
description: "things to be mounted into platforma docker container. Targets will appear inside the container under the same absolute paths"
|
|
100
100
|
})
|
|
101
|
-
},
|
|
101
|
+
}, pe = {
|
|
102
102
|
"pl-log-file": v.file({
|
|
103
103
|
description: "specify path for Platforma Backend log file"
|
|
104
104
|
})
|
|
105
|
-
},
|
|
105
|
+
}, be = {
|
|
106
106
|
"pl-workdir": v.file({
|
|
107
107
|
description: "specify working directory for Platforma Backend process"
|
|
108
108
|
})
|
|
109
|
-
},
|
|
109
|
+
}, we = {
|
|
110
110
|
"pl-binary": v.file({
|
|
111
111
|
description: "start given Platforma Backend binary instead of automatically downloaded version"
|
|
112
112
|
})
|
|
113
|
-
},
|
|
113
|
+
}, ve = {
|
|
114
114
|
"pl-sources": v.file({
|
|
115
115
|
description: "path to pl repository root: build Platforma Backend from sources and start the resulting binary"
|
|
116
116
|
})
|
|
117
|
-
},
|
|
117
|
+
}, Pe = {
|
|
118
118
|
config: v.string({
|
|
119
119
|
description: "use custom Platforma Backend config"
|
|
120
120
|
})
|
|
@@ -146,11 +146,11 @@ const ce = {
|
|
|
146
146
|
s3e://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via http
|
|
147
147
|
s3es://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via https`
|
|
148
148
|
})
|
|
149
|
-
},
|
|
149
|
+
}, Dr = {
|
|
150
150
|
"auth-enabled": v.boolean({
|
|
151
151
|
description: "enable authorization"
|
|
152
152
|
})
|
|
153
|
-
},
|
|
153
|
+
}, Fr = {
|
|
154
154
|
"auth-htpasswd-file": v.file({
|
|
155
155
|
description: "path to .htpasswd file with Platforma users (static user DB auth source)"
|
|
156
156
|
})
|
|
@@ -163,8 +163,8 @@ const ce = {
|
|
|
163
163
|
description: "DN to use when checking user with LDAP bind operation: e.g. cn=%u,ou=users,dc=example,dc=com"
|
|
164
164
|
})
|
|
165
165
|
}, U = {
|
|
166
|
-
...xr,
|
|
167
166
|
...Dr,
|
|
167
|
+
...Fr,
|
|
168
168
|
...Nr,
|
|
169
169
|
..._r
|
|
170
170
|
};
|
|
@@ -174,7 +174,7 @@ function Cr(a) {
|
|
|
174
174
|
function G(a) {
|
|
175
175
|
throw new Error("this should never happen");
|
|
176
176
|
}
|
|
177
|
-
function
|
|
177
|
+
function I(a = "debug") {
|
|
178
178
|
return ge.createLogger({
|
|
179
179
|
level: a,
|
|
180
180
|
format: ge.format.printf(({ level: e, message: t }) => {
|
|
@@ -200,16 +200,16 @@ function Mr(a) {
|
|
|
200
200
|
return Or(Math.ceil(a / 2)).toString("hex").slice(0, a);
|
|
201
201
|
}
|
|
202
202
|
function jr(a) {
|
|
203
|
-
return a.startsWith("~") ? m.join(
|
|
203
|
+
return a.startsWith("~") ? m.join(F.homedir(), a.slice(1)) : a;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function Se(a, e) {
|
|
206
206
|
f.existsSync(a) || (f.mkdirSync(a, { recursive: !0 }), e != null && e.mode && f.chmodSync(a, e.mode));
|
|
207
207
|
}
|
|
208
208
|
function Br(a) {
|
|
209
209
|
try {
|
|
210
|
-
if (
|
|
211
|
-
return
|
|
212
|
-
const e = `wmic process where processid=${a} get Caption`, t =
|
|
210
|
+
if (F.platform() !== "win32")
|
|
211
|
+
return Ie(`ps -p ${a} -o comm=`, { encoding: "utf8" }).trim();
|
|
212
|
+
const e = `wmic process where processid=${a} get Caption`, t = Ie(e, { encoding: "utf8" }).split(`
|
|
213
213
|
`);
|
|
214
214
|
return t.length <= 1 ? "" : t[1].trim();
|
|
215
215
|
} catch {
|
|
@@ -217,12 +217,12 @@ function Br(a) {
|
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
function Ur(a) {
|
|
220
|
-
const e =
|
|
220
|
+
const e = Ie(`docker compose ls --filter name=${a} --format json`, { encoding: "utf8" }).trim(), t = JSON.parse(e);
|
|
221
221
|
for (const r of t)
|
|
222
222
|
if (r.Name === a)
|
|
223
223
|
return r;
|
|
224
224
|
}
|
|
225
|
-
const
|
|
225
|
+
const Oe = ["Python"], pr = ["Tengo", "Python"], Gr = N.union([N.literal("Tengo"), N.literal("Python")]), Jr = N.object({
|
|
226
226
|
npmOrgName: N.string().min(1),
|
|
227
227
|
orgName: N.string().min(1),
|
|
228
228
|
blockName: N.string().min(1),
|
|
@@ -239,7 +239,7 @@ async function Hr(a) {
|
|
|
239
239
|
"platforma-block-boilerplate-main",
|
|
240
240
|
s
|
|
241
241
|
);
|
|
242
|
-
const i =
|
|
242
|
+
const i = pr.filter((o) => n.indexOf(o) < 0), c = Oe.length == i.length;
|
|
243
243
|
a.info(`Keep platforms '${n}', remove: '${i}'. Will remove all platforms? ${c}`);
|
|
244
244
|
for (const o of i)
|
|
245
245
|
await zr(s, o);
|
|
@@ -260,15 +260,15 @@ function Wr() {
|
|
|
260
260
|
const e = Z.question('Write an organization name, e.g. "my-org": '), t = Z.question('Write a name of the block, e.g. "hello-world": '), r = Z.keyInYN("Create package for block's software?");
|
|
261
261
|
let n = ["Tengo"];
|
|
262
262
|
if (r)
|
|
263
|
-
for (; n.length <
|
|
264
|
-
const s = Z.keyInSelect(
|
|
263
|
+
for (; n.length < pr.length; ) {
|
|
264
|
+
const s = Z.keyInSelect(Oe, "Choose software platform:");
|
|
265
265
|
if (s < 0) break;
|
|
266
|
-
n.push(
|
|
266
|
+
n.push(Oe[s]);
|
|
267
267
|
}
|
|
268
268
|
return n = Array.from(new Set(n)).sort(), Jr.parse({ npmOrgName: a, orgName: e, blockName: t, softwarePlatforms: n });
|
|
269
269
|
}
|
|
270
270
|
async function qr(a, e, t) {
|
|
271
|
-
const n = await (await fetch(a)).blob(), s = await _.mkdtemp(m.join(
|
|
271
|
+
const n = await (await fetch(a)).blob(), s = await _.mkdtemp(m.join(F.tmpdir(), "create-repo")), i = m.join(s, "packed-repo.zip"), c = Rr.toWeb(Lr(i));
|
|
272
272
|
await n.stream().pipeTo(c);
|
|
273
273
|
const o = m.join(s, "unpacked-repo");
|
|
274
274
|
await _.mkdir(o), await Er(i, o), await _.cp(m.join(o, e), t, { recursive: !0 });
|
|
@@ -290,7 +290,7 @@ async function zr(a, e) {
|
|
|
290
290
|
), await ee(
|
|
291
291
|
m.join(a, "workflow", "src", "wf.test.ts"),
|
|
292
292
|
new RegExp(`.*${t}Message.*\\n.*expect.*\\n\\n`, "g")
|
|
293
|
-
), await _.rm(m.join(a, "software", `src_${t}`), { recursive: !0 }), await
|
|
293
|
+
), await _.rm(m.join(a, "software", `src_${t}`), { recursive: !0 }), await Ue(
|
|
294
294
|
m.join(a, "software", "package.json"),
|
|
295
295
|
(r) => {
|
|
296
296
|
const n = JSON.parse(r);
|
|
@@ -299,7 +299,7 @@ async function zr(a, e) {
|
|
|
299
299
|
);
|
|
300
300
|
}
|
|
301
301
|
async function Yr(a) {
|
|
302
|
-
await _.rm(m.join(a, "software"), { recursive: !0 }), await
|
|
302
|
+
await _.rm(m.join(a, "software"), { recursive: !0 }), await Ue(
|
|
303
303
|
m.join(a, "workflow", "package.json"),
|
|
304
304
|
(e) => {
|
|
305
305
|
const t = JSON.parse(e);
|
|
@@ -322,37 +322,37 @@ async function Kr(a) {
|
|
|
322
322
|
recursive: !0
|
|
323
323
|
})).filter((t) => t.isFile()).map((t) => m.join(t.parentPath, t.name));
|
|
324
324
|
}
|
|
325
|
-
async function
|
|
325
|
+
async function Ue(a, e) {
|
|
326
326
|
const t = await _.readFile(a), r = e(t.toString());
|
|
327
327
|
await _.writeFile(a, r);
|
|
328
328
|
}
|
|
329
329
|
async function br(a, e, t) {
|
|
330
|
-
return await
|
|
330
|
+
return await Ue(a, (r) => r.replaceAll(e, t));
|
|
331
331
|
}
|
|
332
332
|
async function ee(a, e) {
|
|
333
333
|
return await br(a, e, "");
|
|
334
334
|
}
|
|
335
335
|
const re = class re extends L {
|
|
336
336
|
async run() {
|
|
337
|
-
const { flags: e } = await this.parse(re), t =
|
|
337
|
+
const { flags: e } = await this.parse(re), t = I(e["log-level"]);
|
|
338
338
|
await Hr(t);
|
|
339
339
|
}
|
|
340
340
|
};
|
|
341
341
|
l(re, "description", "Helps to create a new block by downloading a block's template."), l(re, "examples", ["<%= name %>"]), l(re, "flags", {
|
|
342
|
-
...
|
|
342
|
+
...A
|
|
343
343
|
});
|
|
344
|
-
let
|
|
344
|
+
let Re = re;
|
|
345
345
|
function wr(...a) {
|
|
346
|
-
return
|
|
346
|
+
return Ar(__dirname, "..", ...a);
|
|
347
347
|
}
|
|
348
348
|
function Q(...a) {
|
|
349
349
|
return wr("assets", ...a);
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function $e(...a) {
|
|
352
352
|
return f.readFileSync(wr(...a));
|
|
353
353
|
}
|
|
354
354
|
function gr(a) {
|
|
355
|
-
return a || (a =
|
|
355
|
+
return a || (a = fe()), `quay.io/milaboratories/platforma:${a}`;
|
|
356
356
|
}
|
|
357
357
|
const J = class J {
|
|
358
358
|
constructor(e) {
|
|
@@ -361,9 +361,9 @@ const J = class J {
|
|
|
361
361
|
});
|
|
362
362
|
l(this, "filePath");
|
|
363
363
|
l(this, "dirPath");
|
|
364
|
-
e = e ?? m.resolve(
|
|
364
|
+
e = e ?? m.resolve(F.homedir(), ".config", "pl-bootstrap");
|
|
365
365
|
const t = m.join(e, "state.json");
|
|
366
|
-
this.dirPath = e, this.filePath = t, f.existsSync(e) || f.mkdirSync(e, { recursive: !0 }), f.existsSync(t) && (this.state = JSON.parse(
|
|
366
|
+
this.dirPath = e, this.filePath = t, f.existsSync(e) || f.mkdirSync(e, { recursive: !0 }), f.existsSync(t) && (this.state = JSON.parse($e(t).toString()));
|
|
367
367
|
}
|
|
368
368
|
static getStateInstance() {
|
|
369
369
|
return J.instance || (J.instance = new J()), J.instance;
|
|
@@ -390,7 +390,7 @@ const J = class J {
|
|
|
390
390
|
const t = this.instanceDir(e, "instance.json");
|
|
391
391
|
if (!f.existsSync(t))
|
|
392
392
|
throw new Error(`platforma backend instance '${e}' does not exist or is corrupted`);
|
|
393
|
-
const r = JSON.parse(
|
|
393
|
+
const r = JSON.parse($e(t).toString());
|
|
394
394
|
return {
|
|
395
395
|
name: e,
|
|
396
396
|
...r
|
|
@@ -400,7 +400,7 @@ const J = class J {
|
|
|
400
400
|
f.existsSync(this.instanceDir(e)) || f.mkdirSync(this.instanceDir(e), { recursive: !0 });
|
|
401
401
|
const r = this.instanceDir(e, "instance.json");
|
|
402
402
|
let n = {};
|
|
403
|
-
f.existsSync(r) && (n = JSON.parse(
|
|
403
|
+
f.existsSync(r) && (n = JSON.parse($e(r).toString())), f.writeFileSync(r, JSON.stringify({ ...n, ...t }));
|
|
404
404
|
}
|
|
405
405
|
isInstanceActive(e) {
|
|
406
406
|
switch (e.type) {
|
|
@@ -443,13 +443,13 @@ const J = class J {
|
|
|
443
443
|
}
|
|
444
444
|
};
|
|
445
445
|
l(J, "instance");
|
|
446
|
-
let
|
|
446
|
+
let Ee = J;
|
|
447
447
|
function ur(a) {
|
|
448
448
|
const e = Br(a);
|
|
449
449
|
return e === "platforma" || e.endsWith("/platforma") || e.endsWith("\\platforma");
|
|
450
450
|
}
|
|
451
|
-
const u =
|
|
452
|
-
function
|
|
451
|
+
const u = Ee.getStateInstance();
|
|
452
|
+
function Le(a, e, t) {
|
|
453
453
|
const r = [], n = [];
|
|
454
454
|
for (const s of e)
|
|
455
455
|
if (t = {
|
|
@@ -481,7 +481,7 @@ function Qr(a, e, t, r) {
|
|
|
481
481
|
cmd: ${JSON.stringify([e, ...t])}
|
|
482
482
|
wd: ${(c = r.cwd) == null ? void 0 : c.toString()}`
|
|
483
483
|
), r.env = { ...process.env, ...r.env }, a.debug(" spawning child process");
|
|
484
|
-
const n =
|
|
484
|
+
const n = Ir(e, t, r);
|
|
485
485
|
let s = !1;
|
|
486
486
|
const i = () => {
|
|
487
487
|
n.kill("SIGINT"), s = !0;
|
|
@@ -498,7 +498,7 @@ function Xr(a, e, t, r) {
|
|
|
498
498
|
), r.env = { ...process.env, ...r.env }, mr(e, t, r);
|
|
499
499
|
}
|
|
500
500
|
function Ae(a, e, t, r, n) {
|
|
501
|
-
const s = f.readFileSync(a, { encoding: "utf-8" }), i =
|
|
501
|
+
const s = f.readFileSync(a, { encoding: "utf-8" }), i = dr.parse(s.toString());
|
|
502
502
|
if (!i.services)
|
|
503
503
|
throw new Error(`file '${a}' seems to be not a docker-compose file or has unsupported version`);
|
|
504
504
|
if (r)
|
|
@@ -528,7 +528,7 @@ function Ae(a, e, t, r, n) {
|
|
|
528
528
|
d.volumes.push(`${g.hostPath}:${g.containerPath}`);
|
|
529
529
|
}
|
|
530
530
|
}
|
|
531
|
-
n != null && n.dropVolumes && delete i.volumes, f.writeFileSync(e,
|
|
531
|
+
n != null && n.dropVolumes && delete i.volumes, f.writeFileSync(e, dr.stringify(i));
|
|
532
532
|
}
|
|
533
533
|
function Zr(a) {
|
|
534
534
|
return {
|
|
@@ -537,7 +537,6 @@ function Zr(a) {
|
|
|
537
537
|
indexCachePeriod: "0s",
|
|
538
538
|
endpoint: "",
|
|
539
539
|
region: "",
|
|
540
|
-
presignEndpoint: "",
|
|
541
540
|
bucketName: "",
|
|
542
541
|
createBucket: !1,
|
|
543
542
|
forcePathStyle: !1,
|
|
@@ -560,38 +559,42 @@ function X(a, e, t) {
|
|
|
560
559
|
a = jr(a);
|
|
561
560
|
const r = new URL(a, `file:${e}`);
|
|
562
561
|
switch (r.protocol) {
|
|
563
|
-
case "s3:":
|
|
564
|
-
|
|
562
|
+
case "s3:": {
|
|
563
|
+
const n = r.hostname, s = r.searchParams.get("region"), i = r.pathname.slice(1);
|
|
565
564
|
return {
|
|
566
565
|
...t,
|
|
567
566
|
type: "S3",
|
|
568
|
-
bucketName:
|
|
569
|
-
region:
|
|
567
|
+
bucketName: n,
|
|
568
|
+
region: s,
|
|
569
|
+
keyPrefix: i
|
|
570
570
|
};
|
|
571
|
-
|
|
572
|
-
|
|
571
|
+
}
|
|
572
|
+
case "s3e:": {
|
|
573
|
+
const n = r.pathname.split("/").slice(1), s = n[0], i = n.length > 1 ? n.slice(1).join("/") : "";
|
|
573
574
|
return {
|
|
574
575
|
...t,
|
|
575
576
|
type: "S3",
|
|
576
577
|
endpoint: `http://${r.host}/`,
|
|
577
|
-
bucketName:
|
|
578
|
-
keyPrefix:
|
|
578
|
+
bucketName: s,
|
|
579
|
+
keyPrefix: i,
|
|
579
580
|
region: r.searchParams.get("region"),
|
|
580
581
|
key: r.username ? `static:${r.username}` : "",
|
|
581
582
|
secret: r.password ? `static:${r.password}` : ""
|
|
582
583
|
};
|
|
583
|
-
|
|
584
|
-
|
|
584
|
+
}
|
|
585
|
+
case "s3es:": {
|
|
586
|
+
const n = r.pathname.split("/").slice(1), s = n[0], i = n.length > 1 ? n.slice(1).join("/") : "";
|
|
585
587
|
return {
|
|
586
588
|
...t,
|
|
587
589
|
type: "S3",
|
|
588
590
|
endpoint: `https://${r.host}/`,
|
|
589
|
-
bucketName:
|
|
590
|
-
keyPrefix:
|
|
591
|
+
bucketName: s,
|
|
592
|
+
keyPrefix: i,
|
|
591
593
|
region: r.searchParams.get("region"),
|
|
592
594
|
key: r.username ? `static:${r.username}` : "",
|
|
593
595
|
secret: r.password ? `static:${r.password}` : ""
|
|
594
596
|
};
|
|
597
|
+
}
|
|
595
598
|
case "file:":
|
|
596
599
|
return {
|
|
597
600
|
type: "FS",
|
|
@@ -602,23 +605,23 @@ function X(a, e, t) {
|
|
|
602
605
|
}
|
|
603
606
|
}
|
|
604
607
|
function et(a, e) {
|
|
605
|
-
var w,
|
|
608
|
+
var w, y, P, S, k, p, $, le, Ge, Je, He, We, qe, ze, Ye, Ve, Ke, Qe, Xe, Ze, er, rr, tr, ar, nr, sr, ir, cr, or, lr;
|
|
606
609
|
const t = (e == null ? void 0 : e.localRoot) ?? u.instanceDir("default"), r = {
|
|
607
610
|
level: ((w = e == null ? void 0 : e.log) == null ? void 0 : w.level) ?? "info",
|
|
608
|
-
path: ((
|
|
611
|
+
path: ((y = e == null ? void 0 : e.log) == null ? void 0 : y.path) ?? `${t}/logs/platforma.log`
|
|
609
612
|
}, n = {
|
|
610
613
|
listen: ((P = e == null ? void 0 : e.grpc) == null ? void 0 : P.listen) ?? "localhost:6345",
|
|
611
614
|
tls: {
|
|
612
615
|
enable: de((k = (S = e == null ? void 0 : e.grpc) == null ? void 0 : S.tls) == null ? void 0 : k.enable, !1),
|
|
613
|
-
clientAuthMode: (($ = (
|
|
614
|
-
certFile: ((
|
|
615
|
-
keyFile: ((
|
|
616
|
-
...(
|
|
616
|
+
clientAuthMode: (($ = (p = e == null ? void 0 : e.grpc) == null ? void 0 : p.tls) == null ? void 0 : $.clientAuthMode) ?? "NoAuth",
|
|
617
|
+
certFile: ((Ge = (le = e == null ? void 0 : e.grpc) == null ? void 0 : le.tls) == null ? void 0 : Ge.certFile) ?? `${t}/certs/tls.cert`,
|
|
618
|
+
keyFile: ((He = (Je = e == null ? void 0 : e.grpc) == null ? void 0 : Je.tls) == null ? void 0 : He.keyFile) ?? `${t}/certs/tls.key`,
|
|
619
|
+
...(We = e == null ? void 0 : e.grpc) == null ? void 0 : We.tls
|
|
617
620
|
}
|
|
618
621
|
}, s = {
|
|
619
622
|
auth: {
|
|
620
|
-
enabled: ((
|
|
621
|
-
drivers: ((
|
|
623
|
+
enabled: ((ze = (qe = e == null ? void 0 : e.core) == null ? void 0 : qe.auth) == null ? void 0 : ze.enabled) ?? !1,
|
|
624
|
+
drivers: ((Ve = (Ye = e == null ? void 0 : e.core) == null ? void 0 : Ye.auth) == null ? void 0 : Ve.drivers) ?? [
|
|
622
625
|
{ driver: "jwt", key: a },
|
|
623
626
|
{ driver: "htpasswd", path: `${t}/users.htpasswd` }
|
|
624
627
|
]
|
|
@@ -630,13 +633,13 @@ function et(a, e) {
|
|
|
630
633
|
"main",
|
|
631
634
|
`${t}/storages/main`,
|
|
632
635
|
"main-bucket",
|
|
633
|
-
(
|
|
636
|
+
(Ke = e == null ? void 0 : e.storages) == null ? void 0 : Ke.primary
|
|
634
637
|
);
|
|
635
638
|
let c;
|
|
636
|
-
switch ((
|
|
639
|
+
switch ((Xe = (Qe = e == null ? void 0 : e.storages) == null ? void 0 : Qe.work) == null ? void 0 : Xe.type) {
|
|
637
640
|
case void 0:
|
|
638
641
|
case "FS":
|
|
639
|
-
c = vr("work"), c.rootPath = ((
|
|
642
|
+
c = vr("work"), c.rootPath = ((er = (Ze = e == null ? void 0 : e.storages) == null ? void 0 : Ze.work) == null ? void 0 : er.rootPath) ?? `${t}/storages/work`, c.indexCachePeriod = ((tr = (rr = e == null ? void 0 : e.storages) == null ? void 0 : rr.work) == null ? void 0 : tr.indexCachePeriod) ?? "1m";
|
|
640
643
|
break;
|
|
641
644
|
default:
|
|
642
645
|
throw new Error("work storage MUST have 'FS' type as it is used for working directories management");
|
|
@@ -645,16 +648,16 @@ function et(a, e) {
|
|
|
645
648
|
"library",
|
|
646
649
|
`${t}/storages/library`,
|
|
647
650
|
"library-bucket",
|
|
648
|
-
(
|
|
651
|
+
(ar = e == null ? void 0 : e.storages) == null ? void 0 : ar.library
|
|
649
652
|
), g = {
|
|
650
|
-
enabled: de((
|
|
651
|
-
listen: ((
|
|
653
|
+
enabled: de((nr = e == null ? void 0 : e.monitoring) == null ? void 0 : nr.enabled, !0),
|
|
654
|
+
listen: ((sr = e == null ? void 0 : e.monitoring) == null ? void 0 : sr.listen) ?? "127.0.0.1:9090"
|
|
652
655
|
}, h = {
|
|
653
|
-
enabled: de((
|
|
654
|
-
listen: ((
|
|
656
|
+
enabled: de((ir = e == null ? void 0 : e.debug) == null ? void 0 : ir.enabled, !0),
|
|
657
|
+
listen: ((cr = e == null ? void 0 : e.debug) == null ? void 0 : cr.listen) ?? "127.0.0.1:9091"
|
|
655
658
|
}, b = {
|
|
656
|
-
value: ((
|
|
657
|
-
file: ((
|
|
659
|
+
value: ((or = e == null ? void 0 : e.license) == null ? void 0 : or.value) ?? "",
|
|
660
|
+
file: ((lr = e == null ? void 0 : e.license) == null ? void 0 : lr.file) ?? ""
|
|
658
661
|
};
|
|
659
662
|
return {
|
|
660
663
|
localRoot: t,
|
|
@@ -676,7 +679,7 @@ function fr(a, e, t, r) {
|
|
|
676
679
|
n = vr(a), n.rootPath = (r == null ? void 0 : r.rootPath) ?? e;
|
|
677
680
|
break;
|
|
678
681
|
case "S3":
|
|
679
|
-
n = Zr(a), n.endpoint =
|
|
682
|
+
n = Zr(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 = de(r == null ? void 0 : r.createBucket, !0), n.forcePathStyle = de(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) ?? "";
|
|
680
683
|
break;
|
|
681
684
|
default:
|
|
682
685
|
throw G(), new Error("unknown storage type");
|
|
@@ -767,7 +770,7 @@ function de(a, e) {
|
|
|
767
770
|
}
|
|
768
771
|
const tt = ["linux", "macos", "windows"];
|
|
769
772
|
function at(a) {
|
|
770
|
-
const e =
|
|
773
|
+
const e = F.platform();
|
|
771
774
|
switch (e) {
|
|
772
775
|
case "darwin":
|
|
773
776
|
return "macos";
|
|
@@ -783,7 +786,7 @@ function at(a) {
|
|
|
783
786
|
}
|
|
784
787
|
const nt = ["amd64", "arm64"];
|
|
785
788
|
function Pr(a) {
|
|
786
|
-
const e =
|
|
789
|
+
const e = F.arch();
|
|
787
790
|
switch (e) {
|
|
788
791
|
case "arm64":
|
|
789
792
|
return "arm64";
|
|
@@ -796,7 +799,7 @@ function Pr(a) {
|
|
|
796
799
|
}
|
|
797
800
|
}
|
|
798
801
|
function st(a, e) {
|
|
799
|
-
const t = (e == null ? void 0 : e.version) ??
|
|
802
|
+
const t = (e == null ? void 0 : e.version) ?? fe(), r = (e == null ? void 0 : e.showProgress) ?? process.stdout.isTTY, n = `pl-${t}-${Pr()}.tgz`, s = (e == null ? void 0 : e.downloadURL) ?? `https://cdn.platforma.bio/software/pl/${at()}/${n}`, i = (e == null ? void 0 : e.saveTo) ?? u.binaries(n);
|
|
800
803
|
if (f.existsSync(i))
|
|
801
804
|
return a.info(`Platforma Backend archive download skipped: '${i}' already exists`), Promise.resolve(i);
|
|
802
805
|
f.mkdirSync(m.dirname(i), { recursive: !0 }), a.info(`Downloading Platforma Backend archive:
|
|
@@ -806,24 +809,24 @@ function st(a, e) {
|
|
|
806
809
|
return new Promise((o, d) => {
|
|
807
810
|
c.on("response", (g) => {
|
|
808
811
|
if (!g.statusCode) {
|
|
809
|
-
const
|
|
810
|
-
c.destroy(), d(
|
|
812
|
+
const y = new Error("failed to download archive: no HTTP status code in response from server");
|
|
813
|
+
c.destroy(), d(y);
|
|
811
814
|
return;
|
|
812
815
|
}
|
|
813
816
|
if (g.statusCode !== 200) {
|
|
814
|
-
const
|
|
815
|
-
c.destroy(), d(
|
|
817
|
+
const y = new Error(`failed to download archive: ${g.statusCode} ${g.statusMessage}`);
|
|
818
|
+
c.destroy(), d(y);
|
|
816
819
|
return;
|
|
817
820
|
}
|
|
818
821
|
const h = parseInt(g.headers["content-length"] || "0", 10);
|
|
819
822
|
let b = 0;
|
|
820
823
|
const w = f.createWriteStream(i);
|
|
821
|
-
g.pipe(w), g.on("data", (
|
|
822
|
-
b +=
|
|
824
|
+
g.pipe(w), g.on("data", (y) => {
|
|
825
|
+
b += y.length;
|
|
823
826
|
const P = b / h * 100;
|
|
824
827
|
r && process.stdout.write(` downloading: ${P.toFixed(2)}%\r`);
|
|
825
|
-
}), g.on("error", (
|
|
826
|
-
f.unlinkSync(i), a.error(`Failed to download Platforma Binary: ${
|
|
828
|
+
}), g.on("error", (y) => {
|
|
829
|
+
f.unlinkSync(i), a.error(`Failed to download Platforma Binary: ${y.message}`), c.destroy(), d(y);
|
|
827
830
|
}), w.on("finish", () => {
|
|
828
831
|
w.close(), a.info(" ... download done."), c.destroy(), o(i);
|
|
829
832
|
});
|
|
@@ -832,7 +835,7 @@ function st(a, e) {
|
|
|
832
835
|
}
|
|
833
836
|
function it(a, e) {
|
|
834
837
|
a.debug("extracting archive...");
|
|
835
|
-
const t = (e == null ? void 0 : e.version) ??
|
|
838
|
+
const t = (e == null ? void 0 : e.version) ?? fe();
|
|
836
839
|
a.debug(` version: '${t}'`);
|
|
837
840
|
const r = `${kr({ version: t })}.tgz`, n = (e == null ? void 0 : e.archivePath) ?? u.binaries(r);
|
|
838
841
|
a.debug(` archive path: '${n}'`);
|
|
@@ -845,18 +848,18 @@ function it(a, e) {
|
|
|
845
848
|
}
|
|
846
849
|
return f.existsSync(s) || (a.debug(` creating target dir '${s}'`), f.mkdirSync(s, { recursive: !0 })), a.info(`Unpacking Platforma Backend archive:
|
|
847
850
|
Archive: ${n}
|
|
848
|
-
Target dir: ${s}`),
|
|
851
|
+
Target dir: ${s}`), xr.x({
|
|
849
852
|
file: n,
|
|
850
853
|
cwd: s,
|
|
851
854
|
gzip: !0,
|
|
852
855
|
sync: !0
|
|
853
856
|
}), a.info(" ... unpack done."), s;
|
|
854
857
|
}
|
|
855
|
-
function
|
|
858
|
+
function ke(a, e) {
|
|
856
859
|
return st(a, e).then((t) => it(a, { archivePath: t }));
|
|
857
860
|
}
|
|
858
861
|
function kr(a) {
|
|
859
|
-
return `pl-${(a == null ? void 0 : a.version) ??
|
|
862
|
+
return `pl-${(a == null ? void 0 : a.version) ?? fe()}-${Pr()}`;
|
|
860
863
|
}
|
|
861
864
|
function ct(a, ...e) {
|
|
862
865
|
return u.binaries(kr({ version: a }), ...e);
|
|
@@ -881,7 +884,7 @@ class O {
|
|
|
881
884
|
this.logger.info(`Starting platforma backend instance '${e.name}':
|
|
882
885
|
${r}`);
|
|
883
886
|
}
|
|
884
|
-
const t =
|
|
887
|
+
const t = Le(
|
|
885
888
|
this.logger,
|
|
886
889
|
e.upCommands
|
|
887
890
|
);
|
|
@@ -893,7 +896,7 @@ ${r}`);
|
|
|
893
896
|
return;
|
|
894
897
|
}
|
|
895
898
|
this.logger.info(`stopping platforma backend instance '${e.name}'...`);
|
|
896
|
-
const t =
|
|
899
|
+
const t = Le(this.logger, e.downCommands);
|
|
897
900
|
switch (ue(t.executed), e.type) {
|
|
898
901
|
case "docker":
|
|
899
902
|
return;
|
|
@@ -914,7 +917,7 @@ ${r}`);
|
|
|
914
917
|
return this.startInstance(e);
|
|
915
918
|
}
|
|
916
919
|
createLocal(e, t) {
|
|
917
|
-
var o, d, g, h, b, w,
|
|
920
|
+
var o, d, g, h, b, w, y, P, S, k;
|
|
918
921
|
const r = (t == null ? void 0 : t.binaryPath) ?? ct(t == null ? void 0 : t.version, "binaries", "platforma");
|
|
919
922
|
let n = t == null ? void 0 : t.configPath;
|
|
920
923
|
const s = (t == null ? void 0 : t.workdir) ?? (n ? process.cwd() : u.instanceDir(e));
|
|
@@ -932,17 +935,17 @@ ${r}`);
|
|
|
932
935
|
}
|
|
933
936
|
});
|
|
934
937
|
const i = et(this.getLastJwt(), t == null ? void 0 : t.configOptions);
|
|
935
|
-
this.logger.debug(" checking license..."), this.checkLicense((P = (
|
|
938
|
+
this.logger.debug(" checking license..."), this.checkLicense((P = (y = t == null ? void 0 : t.configOptions) == null ? void 0 : y.license) == null ? void 0 : P.value, (k = (S = t == null ? void 0 : t.configOptions) == null ? void 0 : S.license) == null ? void 0 : k.file);
|
|
936
939
|
const c = [
|
|
937
940
|
`${i.localRoot}/packages`,
|
|
938
941
|
`${i.localRoot}/packages-local`,
|
|
939
942
|
`${i.localRoot}/blocks-local`
|
|
940
943
|
];
|
|
941
944
|
i.storages.primary.type === "FS" && c.push(i.storages.primary.rootPath), i.storages.library.type === "FS" && (c.push(i.storages.library.rootPath), i.hacks.libraryDownloadable = !1), i.storages.work.type === "FS" && c.push(i.storages.work.rootPath), this.logger.debug(" creating pl state directories...");
|
|
942
|
-
for (const
|
|
943
|
-
f.existsSync(
|
|
944
|
-
for (const
|
|
945
|
-
|
|
945
|
+
for (const p of c)
|
|
946
|
+
f.existsSync(p) || (this.logger.debug(` '${p}'`), f.mkdirSync(p, { recursive: !0 }));
|
|
947
|
+
for (const p of i.core.auth.drivers)
|
|
948
|
+
p.driver === "htpasswd" && (f.existsSync(p.path) || (this.logger.debug(` installing default 'users.htpasswd' to ${p.path}...`), f.copyFileSync(Q("users.htpasswd"), p.path)));
|
|
946
949
|
return n || (n = m.join(i.localRoot, "config.yaml"), this.logger.debug(` rendering configuration '${n}'...`), f.writeFileSync(n, rt(i))), u.setInstanceInfo(e, {
|
|
947
950
|
type: "process",
|
|
948
951
|
upCommands: [
|
|
@@ -1007,7 +1010,7 @@ ${r}`);
|
|
|
1007
1010
|
const i = (t == null ? void 0 : t.image) ?? `quay.io/minio/minio${s}`;
|
|
1008
1011
|
this.logger.debug(` minio image: ${i}`);
|
|
1009
1012
|
const c = (t == null ? void 0 : t.storage) ?? u.instanceDir(e, "minio");
|
|
1010
|
-
|
|
1013
|
+
Se(c, { mode: "0775" });
|
|
1011
1014
|
const o = (t == null ? void 0 : t.minioPort) ?? 9e3, d = (t == null ? void 0 : t.minioConsolePort) ?? 9001, g = {
|
|
1012
1015
|
MINIO_IMAGE: i,
|
|
1013
1016
|
MINIO_STORAGE: m.resolve(c),
|
|
@@ -1039,7 +1042,7 @@ ${r}`);
|
|
|
1039
1042
|
};
|
|
1040
1043
|
}
|
|
1041
1044
|
buildPlatforma(e) {
|
|
1042
|
-
const t = m.resolve(e.repoRoot, "cmd", "platforma"), r = e.binPath ?? m.join(
|
|
1045
|
+
const t = m.resolve(e.repoRoot, "cmd", "platforma"), r = e.binPath ?? m.join(F.tmpdir(), "platforma-local-build");
|
|
1043
1046
|
this.logger.info("Building Platforma Backend binary from sources"), this.logger.info(` sources path: ${e.repoRoot}`), this.logger.info(` binary path: ${r}`);
|
|
1044
1047
|
const n = mr("go", ["build", "-o", r, "."], {
|
|
1045
1048
|
cwd: t,
|
|
@@ -1051,9 +1054,9 @@ ${r}`);
|
|
|
1051
1054
|
this.logger.debug("creating platforma instance in 'docker s3' mode...");
|
|
1052
1055
|
const n = Q("compose-backend.yaml"), s = (r == null ? void 0 : r.image) ?? gr(r == null ? void 0 : r.version);
|
|
1053
1056
|
this.checkLicense(r == null ? void 0 : r.license, r == null ? void 0 : r.licenseFile);
|
|
1054
|
-
const i = (...
|
|
1055
|
-
const $ = i(
|
|
1056
|
-
return
|
|
1057
|
+
const i = (...p) => m.join(t, ...p), c = (p) => {
|
|
1058
|
+
const $ = i(p);
|
|
1059
|
+
return Se($, { mode: "0775" }), $;
|
|
1057
1060
|
}, o = i("logs", "platforma.log");
|
|
1058
1061
|
f.existsSync(o) || (f.mkdirSync(m.dirname(o), { recursive: !0 }), f.writeFileSync(o, ""));
|
|
1059
1062
|
const d = (r == null ? void 0 : r.presignHost) ?? "localhost", g = X("s3e://testuser:testpassword@minio:9000/main-bucket");
|
|
@@ -1064,15 +1067,15 @@ ${r}`);
|
|
|
1064
1067
|
if (h.type !== "S3")
|
|
1065
1068
|
throw new Error(`${h.type} storage type is not supported for library storage`);
|
|
1066
1069
|
h.presignEndpoint = `http://${d}:9000`;
|
|
1067
|
-
const b = c("db"), w = c("work"),
|
|
1068
|
-
f.existsSync(
|
|
1070
|
+
const b = c("db"), w = c("work"), y = i("users.htpasswd");
|
|
1071
|
+
f.existsSync(y) || f.copyFileSync(Q("users.htpasswd"), y);
|
|
1069
1072
|
const P = i("compose.yaml");
|
|
1070
1073
|
f.existsSync(P) && this.logger.info(`replacing docker compose file ${P}`);
|
|
1071
1074
|
const S = [];
|
|
1072
|
-
for (const
|
|
1075
|
+
for (const p of (r == null ? void 0 : r.customMounts) ?? [])
|
|
1073
1076
|
S.push({
|
|
1074
|
-
hostPath:
|
|
1075
|
-
containerPath:
|
|
1077
|
+
hostPath: p.hostPath,
|
|
1078
|
+
containerPath: p.containerPath ?? p.hostPath
|
|
1076
1079
|
});
|
|
1077
1080
|
Ae(n, P, `pl-${e}`, /* @__PURE__ */ new Map([
|
|
1078
1081
|
["minio", {}],
|
|
@@ -1085,12 +1088,13 @@ ${r}`);
|
|
|
1085
1088
|
MINIO_IMAGE: "quay.io/minio/minio",
|
|
1086
1089
|
MINIO_STORAGE: c("minio"),
|
|
1087
1090
|
PL_IMAGE: s,
|
|
1088
|
-
PL_AUTH_HTPASSWD_PATH:
|
|
1091
|
+
PL_AUTH_HTPASSWD_PATH: y,
|
|
1089
1092
|
PL_LICENSE: r == null ? void 0 : r.license,
|
|
1090
1093
|
PL_LICENSE_FILE: r == null ? void 0 : r.licenseFile,
|
|
1091
1094
|
PL_LOG_LEVEL: (r == null ? void 0 : r.logLevel) ?? "info",
|
|
1092
1095
|
PL_LOG_DIR: m.dirname(o),
|
|
1093
1096
|
PL_LOG_ROTATION_ENABLED: "true",
|
|
1097
|
+
PL_RUNNER_WD_CACHE_ON_FAILURE: "1h",
|
|
1094
1098
|
PL_DATA_DB_ROOT: b,
|
|
1095
1099
|
PL_DATA_PRIMARY_ROOT: c("primary"),
|
|
1096
1100
|
PL_DATA_LIBRARY_ROOT: c("library"),
|
|
@@ -1101,8 +1105,8 @@ ${r}`);
|
|
|
1101
1105
|
...this.configureDockerStorage("library", h)
|
|
1102
1106
|
};
|
|
1103
1107
|
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)) {
|
|
1104
|
-
for (const
|
|
1105
|
-
|
|
1108
|
+
for (const p of r.auth.drivers)
|
|
1109
|
+
p.driver === "htpasswd" && (k.PL_AUTH_HTPASSWD_PATH = m.resolve(p.path), p.path = "/etc/platforma/users.htpasswd");
|
|
1106
1110
|
k.PL_AUTH_DRIVERS = JSON.stringify(r.auth.drivers);
|
|
1107
1111
|
}
|
|
1108
1112
|
return u.setInstanceInfo(e, {
|
|
@@ -1142,28 +1146,26 @@ ${r}`);
|
|
|
1142
1146
|
this.checkLicense(r == null ? void 0 : r.license, r == null ? void 0 : r.licenseFile);
|
|
1143
1147
|
const i = (...$) => m.join(t, ...$), c = ($) => {
|
|
1144
1148
|
const le = i($);
|
|
1145
|
-
return
|
|
1149
|
+
return Se(le, { mode: "0775" }), le;
|
|
1146
1150
|
}, o = i("logs", "platforma.log");
|
|
1147
1151
|
f.existsSync(o) || (f.mkdirSync(m.dirname(o), { recursive: !0 }), f.writeFileSync(o, ""));
|
|
1148
1152
|
const d = c("db"), g = c("primary"), h = c("library"), b = c("work"), w = i("users.htpasswd");
|
|
1149
1153
|
f.existsSync(w) || f.copyFileSync(Q("users.htpasswd"), w);
|
|
1150
|
-
const
|
|
1151
|
-
f.existsSync(
|
|
1154
|
+
const y = i("compose.yaml");
|
|
1155
|
+
f.existsSync(y) && this.logger.info(`replacing docker compose file ${y}`);
|
|
1152
1156
|
const P = [];
|
|
1153
1157
|
for (const $ of (r == null ? void 0 : r.customMounts) ?? [])
|
|
1154
1158
|
P.push({
|
|
1155
1159
|
hostPath: $.hostPath,
|
|
1156
1160
|
containerPath: $.containerPath ?? $.hostPath
|
|
1157
1161
|
});
|
|
1158
|
-
this.logger.debug(`Rendering docker compose file '${
|
|
1162
|
+
this.logger.debug(`Rendering docker compose file '${y}' using '${n}' as base template`), Ae(n, y, `pl-${e}`, /* @__PURE__ */ new Map([
|
|
1159
1163
|
["backend", {
|
|
1160
1164
|
platform: r == null ? void 0 : r.platformOverride,
|
|
1161
1165
|
mounts: P
|
|
1162
1166
|
}]
|
|
1163
1167
|
]));
|
|
1164
|
-
const S = X((r == null ? void 0 : r.primaryStorageURL) ?? `file:${g}`, "."), k = X((r == null ? void 0 : r.libraryStorageURL) ?? `file:${h}`, "."),
|
|
1165
|
-
MINIO_IMAGE: "quay.io/minio/minio",
|
|
1166
|
-
MINIO_STORAGE: c("minio"),
|
|
1168
|
+
const S = X((r == null ? void 0 : r.primaryStorageURL) ?? `file:${g}`, "."), k = X((r == null ? void 0 : r.libraryStorageURL) ?? `file:${h}`, "."), p = {
|
|
1167
1169
|
PL_IMAGE: s,
|
|
1168
1170
|
PL_AUTH_HTPASSWD_PATH: w,
|
|
1169
1171
|
PL_LICENSE: r == null ? void 0 : r.license,
|
|
@@ -1171,6 +1173,7 @@ ${r}`);
|
|
|
1171
1173
|
PL_LOG_LEVEL: "info",
|
|
1172
1174
|
PL_LOG_DIR: m.dirname(o),
|
|
1173
1175
|
PL_LOG_ROTATION_ENABLED: "true",
|
|
1176
|
+
PL_RUNNER_WD_CACHE_ON_FAILURE: "1h",
|
|
1174
1177
|
PL_DATA_DB_ROOT: d,
|
|
1175
1178
|
PL_DATA_PRIMARY_ROOT: g,
|
|
1176
1179
|
PL_DATA_LIBRARY_ROOT: h,
|
|
@@ -1179,29 +1182,29 @@ ${r}`);
|
|
|
1179
1182
|
...this.configureDockerStorage("primary", S),
|
|
1180
1183
|
...this.configureDockerStorage("library", k)
|
|
1181
1184
|
};
|
|
1182
|
-
if (r != null && r.grpcAddr && (
|
|
1185
|
+
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)) {
|
|
1183
1186
|
for (const $ of r.auth.drivers)
|
|
1184
|
-
$.driver === "htpasswd" && (
|
|
1185
|
-
|
|
1187
|
+
$.driver === "htpasswd" && (p.PL_AUTH_HTPASSWD_PATH = m.resolve($.path), $.path = "/etc/platforma/users.htpasswd");
|
|
1188
|
+
p.PL_AUTH_DRIVERS = JSON.stringify(r.auth.drivers);
|
|
1186
1189
|
}
|
|
1187
1190
|
return u.setInstanceInfo(e, {
|
|
1188
1191
|
type: "docker",
|
|
1189
1192
|
upCommands: [{
|
|
1190
1193
|
cmd: "docker",
|
|
1191
|
-
args: ["compose", `--file=${
|
|
1192
|
-
envs:
|
|
1194
|
+
args: ["compose", `--file=${y}`, "up", "--detach", "--remove-orphans", "--pull=missing"],
|
|
1195
|
+
envs: p,
|
|
1193
1196
|
runOpts: { stdio: "inherit" }
|
|
1194
1197
|
}],
|
|
1195
1198
|
downCommands: [{
|
|
1196
1199
|
cmd: "docker",
|
|
1197
|
-
args: ["compose", `--file=${
|
|
1198
|
-
envs:
|
|
1200
|
+
args: ["compose", `--file=${y}`, "down"],
|
|
1201
|
+
envs: p,
|
|
1199
1202
|
runOpts: { stdio: "inherit" }
|
|
1200
1203
|
}],
|
|
1201
1204
|
cleanupCommands: [{
|
|
1202
1205
|
cmd: "docker",
|
|
1203
|
-
args: ["compose", `--file=${
|
|
1204
|
-
envs:
|
|
1206
|
+
args: ["compose", `--file=${y}`, "down", "--volumes", "--remove-orphans"],
|
|
1207
|
+
envs: p,
|
|
1205
1208
|
runOpts: { stdio: "inherit" }
|
|
1206
1209
|
}],
|
|
1207
1210
|
runInfo: {
|
|
@@ -1258,7 +1261,7 @@ You are going to reset the state of all platforma services configured with pl-bo
|
|
|
1258
1261
|
for (const [s, i] of r.entries()) {
|
|
1259
1262
|
if (i.cleanupCommands.length) {
|
|
1260
1263
|
this.logger.info(`Wiping instance ${s} services`);
|
|
1261
|
-
const c =
|
|
1264
|
+
const c = Le(this.logger, i.cleanupCommands);
|
|
1262
1265
|
ue(c.executed, `failed to wipe instance ${s} services`);
|
|
1263
1266
|
}
|
|
1264
1267
|
this.logger.info(`Destroying instance '${s}' data directory`), f.rmSync(u.instanceDir(s), { recursive: !0, force: !0 });
|
|
@@ -1270,7 +1273,7 @@ If you want to remove all downloaded platforma binaries, delete '${u.binaries()}
|
|
|
1270
1273
|
);
|
|
1271
1274
|
}
|
|
1272
1275
|
mergeLicenseEnvs(e) {
|
|
1273
|
-
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 : f.existsSync(m.resolve(
|
|
1276
|
+
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 : f.existsSync(m.resolve(F.homedir(), ".pl.license")) && (e["license-file"] = m.resolve(F.homedir(), ".pl.license")));
|
|
1274
1277
|
}
|
|
1275
1278
|
initAuthDriversList(e, t) {
|
|
1276
1279
|
const r = [];
|
|
@@ -1352,14 +1355,6 @@ You can obtain the license from "https://licensing.milaboratories.com".`), new E
|
|
|
1352
1355
|
return e.work && r.push(`${n("workdirs")}: ${e.work.rootPath}`), e.dbPath && r.push(`${n("db")}: ${e.dbPath}`), r.join(`
|
|
1353
1356
|
`);
|
|
1354
1357
|
}
|
|
1355
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1356
|
-
readComposeFile(e) {
|
|
1357
|
-
const t = f.readFileSync(e);
|
|
1358
|
-
return fe.parse(t.toString());
|
|
1359
|
-
}
|
|
1360
|
-
writeComposeFile(e, t) {
|
|
1361
|
-
f.writeFileSync(e, fe.stringify(t));
|
|
1362
|
-
}
|
|
1363
1358
|
}
|
|
1364
1359
|
function ue(a, e) {
|
|
1365
1360
|
for (const t of a) {
|
|
@@ -1372,38 +1367,38 @@ function ue(a, e) {
|
|
|
1372
1367
|
}
|
|
1373
1368
|
const te = class te extends L {
|
|
1374
1369
|
async run() {
|
|
1375
|
-
const { flags: e } = await this.parse(te), t =
|
|
1370
|
+
const { flags: e } = await this.parse(te), t = I(e["log-level"]);
|
|
1376
1371
|
new O(t).cleanupInstance();
|
|
1377
1372
|
}
|
|
1378
1373
|
};
|
|
1379
1374
|
l(te, "description", "Clear service state (forget last run command, destroy docker services, volumes and so on)"), l(te, "examples", ["<%= config.bin %> <%= command.id %>"]), l(te, "flags", {
|
|
1380
|
-
...
|
|
1375
|
+
...A
|
|
1381
1376
|
});
|
|
1382
|
-
let
|
|
1377
|
+
let Te = te;
|
|
1383
1378
|
const ae = class ae extends L {
|
|
1384
1379
|
async run() {
|
|
1385
|
-
const { flags: e } = await this.parse(ae), t =
|
|
1380
|
+
const { flags: e } = await this.parse(ae), t = I(e["log-level"]);
|
|
1386
1381
|
new O(t).startLast();
|
|
1387
1382
|
}
|
|
1388
1383
|
};
|
|
1389
1384
|
l(ae, "description", "Start last run service configuraiton"), l(ae, "examples", ["<%= config.bin %> <%= command.id %>"]), l(ae, "flags", {
|
|
1390
|
-
...
|
|
1385
|
+
...A
|
|
1391
1386
|
});
|
|
1392
1387
|
let xe = ae;
|
|
1393
1388
|
const ne = class ne extends L {
|
|
1394
1389
|
async run() {
|
|
1395
|
-
const { flags: e } = await this.parse(ne), t =
|
|
1390
|
+
const { flags: e } = await this.parse(ne), t = I(e["log-level"]), r = new O(t);
|
|
1396
1391
|
u.currentInstance ? r.stopInstance(u.currentInstance) : t.warn("up/start command was not called for any instance, nothing to stop");
|
|
1397
1392
|
}
|
|
1398
1393
|
};
|
|
1399
1394
|
l(ne, "description", "Stop platforma service"), l(ne, "examples", ["<%= config.bin %> <%= command.id %>"]), l(ne, "flags", {
|
|
1400
|
-
...
|
|
1395
|
+
...A
|
|
1401
1396
|
});
|
|
1402
1397
|
let De = ne;
|
|
1403
1398
|
var E;
|
|
1404
1399
|
let lt = (E = class extends L {
|
|
1405
1400
|
async run() {
|
|
1406
|
-
const { flags: e } = await this.parse(E), t =
|
|
1401
|
+
const { flags: e } = await this.parse(E), t = I(e["log-level"]), r = new O(t);
|
|
1407
1402
|
r.mergeLicenseEnvs(e);
|
|
1408
1403
|
const n = "docker", s = e["auth-enabled"], i = s ? {
|
|
1409
1404
|
enabled: s,
|
|
@@ -1432,11 +1427,11 @@ let lt = (E = class extends L {
|
|
|
1432
1427
|
r.switchInstance(g);
|
|
1433
1428
|
}
|
|
1434
1429
|
}, l(E, "description", "Run platforma backend service with 'FS' primary storage type"), l(E, "examples", ["<%= config.bin %> <%= command.id %>"]), l(E, "flags", {
|
|
1435
|
-
...
|
|
1430
|
+
...A,
|
|
1436
1431
|
...j,
|
|
1437
|
-
...
|
|
1432
|
+
...me,
|
|
1438
1433
|
...C,
|
|
1439
|
-
...
|
|
1434
|
+
...he,
|
|
1440
1435
|
...U,
|
|
1441
1436
|
...M,
|
|
1442
1437
|
...ye,
|
|
@@ -1448,7 +1443,7 @@ let lt = (E = class extends L {
|
|
|
1448
1443
|
var T;
|
|
1449
1444
|
let dt = (T = class extends L {
|
|
1450
1445
|
async run() {
|
|
1451
|
-
const { flags: e } = await this.parse(T), t =
|
|
1446
|
+
const { flags: e } = await this.parse(T), t = I(e["log-level"]), r = new O(t);
|
|
1452
1447
|
r.mergeLicenseEnvs(e);
|
|
1453
1448
|
const n = "local", s = e["pl-workdir"] ?? ".", i = e.storage ? m.join(s, e.storage) : u.instanceDir(n), c = e["pl-log-file"] ? m.join(s, e["pl-log-file"]) : void 0, o = r.initAuthDriversList(e, s), d = e["auth-enabled"] ?? o !== void 0;
|
|
1454
1449
|
let g = e["pl-binary"];
|
|
@@ -1459,7 +1454,7 @@ let dt = (T = class extends L {
|
|
|
1459
1454
|
e["monitoring-listen"] ? b = e["monitoring-listen"] : e["monitoring-port"] && (b = `127.0.0.1:${e["monitoring-port"]}`);
|
|
1460
1455
|
let w = "127.0.0.1:9091";
|
|
1461
1456
|
e["debug-listen"] ? w = e["debug-listen"] : e["debug-port"] && (w = `127.0.0.1:${e["debug-port"]}`);
|
|
1462
|
-
const
|
|
1457
|
+
const y = {
|
|
1463
1458
|
binaryPath: g,
|
|
1464
1459
|
version: e.version,
|
|
1465
1460
|
configPath: e.config,
|
|
@@ -1478,8 +1473,8 @@ let dt = (T = class extends L {
|
|
|
1478
1473
|
work: { type: "FS", rootPath: e["storage-work"] }
|
|
1479
1474
|
}
|
|
1480
1475
|
}
|
|
1481
|
-
}, P = r.createLocal(n,
|
|
1482
|
-
|
|
1476
|
+
}, P = r.createLocal(n, y);
|
|
1477
|
+
y.binaryPath ? r.switchInstance(P) : ke(t, { version: e.version }).then(() => {
|
|
1483
1478
|
const S = r.switchInstance(P);
|
|
1484
1479
|
setTimeout(() => {
|
|
1485
1480
|
for (const k of S)
|
|
@@ -1490,29 +1485,29 @@ let dt = (T = class extends L {
|
|
|
1490
1485
|
});
|
|
1491
1486
|
}
|
|
1492
1487
|
}, 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", {
|
|
1493
|
-
...
|
|
1488
|
+
...A,
|
|
1494
1489
|
...C,
|
|
1495
1490
|
...j,
|
|
1491
|
+
...we,
|
|
1496
1492
|
...ve,
|
|
1497
1493
|
...Pe,
|
|
1498
|
-
...ke,
|
|
1499
1494
|
...M,
|
|
1500
1495
|
...B,
|
|
1501
1496
|
...ce,
|
|
1502
1497
|
...ie,
|
|
1503
1498
|
...oe,
|
|
1499
|
+
...pe,
|
|
1504
1500
|
...be,
|
|
1505
|
-
...we,
|
|
1506
1501
|
...U
|
|
1507
1502
|
}), T);
|
|
1508
1503
|
const H = class H extends L {
|
|
1509
1504
|
async run() {
|
|
1510
|
-
const { flags: e, args: t } = await this.parse(H), r =
|
|
1505
|
+
const { flags: e, args: t } = await this.parse(H), r = I(e["log-level"]), n = new O(r), s = t.name;
|
|
1511
1506
|
e.all && (n.cleanupInstance(), process.exit(0)), s || (r.error("Please, specify name of instance to be removed or set '--all' flag instead"), process.exit(1)), n.cleanupInstance(s);
|
|
1512
1507
|
}
|
|
1513
1508
|
};
|
|
1514
1509
|
l(H, "description", "List available instances"), l(H, "examples", ["<%= config.bin %> <%= command.id %>"]), l(H, "flags", {
|
|
1515
|
-
...
|
|
1510
|
+
...A,
|
|
1516
1511
|
all: v.boolean({
|
|
1517
1512
|
description: "remove all known instances",
|
|
1518
1513
|
required: !1
|
|
@@ -1520,19 +1515,19 @@ l(H, "description", "List available instances"), l(H, "examples", ["<%= config.b
|
|
|
1520
1515
|
}), l(H, "args", {
|
|
1521
1516
|
name: K.string({ required: !1 })
|
|
1522
1517
|
});
|
|
1523
|
-
let
|
|
1518
|
+
let Fe = H;
|
|
1524
1519
|
const W = class W extends L {
|
|
1525
1520
|
async run() {
|
|
1526
|
-
const { flags: e, args: t } = await this.parse(W), r =
|
|
1521
|
+
const { flags: e, args: t } = await this.parse(W), r = I(e["log-level"]), n = new O(r), s = t.name ?? u.currentInstanceName;
|
|
1527
1522
|
s || (r.info("no pl service instance selected. No service was stopped"), process.exit(0)), n.stopInstance(u.getInstanceInfo(s));
|
|
1528
1523
|
}
|
|
1529
1524
|
};
|
|
1530
1525
|
l(W, "description", "List available instances"), l(W, "examples", ["<%= config.bin %> <%= command.id %>"]), l(W, "flags", {
|
|
1531
|
-
...
|
|
1526
|
+
...A
|
|
1532
1527
|
}), l(W, "args", {
|
|
1533
1528
|
name: K.string({ required: !1 })
|
|
1534
1529
|
});
|
|
1535
|
-
let
|
|
1530
|
+
let Ne = W;
|
|
1536
1531
|
const se = class se extends L {
|
|
1537
1532
|
async run() {
|
|
1538
1533
|
await this.parse(se);
|
|
@@ -1544,10 +1539,10 @@ const se = class se extends L {
|
|
|
1544
1539
|
}
|
|
1545
1540
|
};
|
|
1546
1541
|
l(se, "description", "List available instances"), l(se, "examples", ["<%= config.bin %> <%= command.id %>"]), l(se, "flags", {});
|
|
1547
|
-
let
|
|
1542
|
+
let _e = se;
|
|
1548
1543
|
const q = class q extends L {
|
|
1549
1544
|
async run() {
|
|
1550
|
-
const { flags: e, args: t } = await this.parse(q), r =
|
|
1545
|
+
const { flags: e, args: t } = await this.parse(q), r = I(e["log-level"]), n = new O(r), s = t.name ?? u.currentInstanceName;
|
|
1551
1546
|
s || (r.error("no pl service instance is selected. Select instance with 'select' command or provide name to 'up'"), process.exit(1));
|
|
1552
1547
|
const i = n.switchInstance(u.getInstanceInfo(s)), c = [];
|
|
1553
1548
|
for (const o of i)
|
|
@@ -1558,15 +1553,15 @@ const q = class q extends L {
|
|
|
1558
1553
|
}
|
|
1559
1554
|
};
|
|
1560
1555
|
l(q, "description", "List available instances"), l(q, "examples", ["<%= config.bin %> <%= command.id %>"]), l(q, "flags", {
|
|
1561
|
-
...
|
|
1556
|
+
...A
|
|
1562
1557
|
}), l(q, "args", {
|
|
1563
1558
|
name: K.string({ required: !1 })
|
|
1564
1559
|
});
|
|
1565
|
-
let
|
|
1566
|
-
var
|
|
1567
|
-
let gt = (
|
|
1560
|
+
let Ce = q;
|
|
1561
|
+
var x;
|
|
1562
|
+
let gt = (x = class extends L {
|
|
1568
1563
|
async run() {
|
|
1569
|
-
const { flags: e } = await this.parse(
|
|
1564
|
+
const { flags: e } = await this.parse(x), t = I(e["log-level"]), r = new O(t);
|
|
1570
1565
|
r.mergeLicenseEnvs(e);
|
|
1571
1566
|
const n = "docker-s3", s = e["auth-enabled"], i = s ? {
|
|
1572
1567
|
enabled: s,
|
|
@@ -1592,22 +1587,22 @@ let gt = (F = class extends L {
|
|
|
1592
1587
|
});
|
|
1593
1588
|
r.switchInstance(h);
|
|
1594
1589
|
}
|
|
1595
|
-
}, l(
|
|
1596
|
-
...
|
|
1590
|
+
}, l(x, "description", "Run platforma backend service with 'S3' primary storage type"), l(x, "examples", ["<%= config.bin %> <%= command.id %>"]), l(x, "flags", {
|
|
1591
|
+
...A,
|
|
1597
1592
|
...j,
|
|
1598
|
-
...
|
|
1593
|
+
...me,
|
|
1599
1594
|
...C,
|
|
1600
|
-
...
|
|
1595
|
+
...he,
|
|
1601
1596
|
...U,
|
|
1602
1597
|
...M,
|
|
1603
1598
|
...ye,
|
|
1604
1599
|
...B,
|
|
1605
|
-
...
|
|
1606
|
-
}),
|
|
1607
|
-
var
|
|
1608
|
-
let ut = (
|
|
1600
|
+
...yr
|
|
1601
|
+
}), x);
|
|
1602
|
+
var D;
|
|
1603
|
+
let ut = (D = class extends L {
|
|
1609
1604
|
async run() {
|
|
1610
|
-
const { flags: e } = await this.parse(
|
|
1605
|
+
const { flags: e } = await this.parse(D), t = I(e["log-level"]), r = new O(t);
|
|
1611
1606
|
r.mergeLicenseEnvs(e);
|
|
1612
1607
|
const n = "local-s3", s = e["pl-workdir"] ?? ".", i = e.storage ? m.join(s, e.storage) : u.instanceDir(n), c = e["pl-log-file"] ? m.join(s, e["pl-log-file"]) : void 0, o = r.initAuthDriversList(e, s), d = e["auth-enabled"] ?? o !== void 0;
|
|
1613
1608
|
let g = e["pl-binary"];
|
|
@@ -1618,7 +1613,7 @@ let ut = (x = class extends L {
|
|
|
1618
1613
|
e["monitoring-listen"] ? b = e["monitoring-listen"] : e["monitoring-port"] && (b = `127.0.0.1:${e["monitoring-port"]}`);
|
|
1619
1614
|
let w = "127.0.0.1:9091";
|
|
1620
1615
|
e["debug-listen"] ? w = e["debug-listen"] : e["debug-port"] && (w = `127.0.0.1:${e["debug-port"]}`);
|
|
1621
|
-
const
|
|
1616
|
+
const y = {
|
|
1622
1617
|
binaryPath: g,
|
|
1623
1618
|
version: e.version,
|
|
1624
1619
|
configPath: e.config,
|
|
@@ -1641,8 +1636,8 @@ let ut = (x = class extends L {
|
|
|
1641
1636
|
work: { type: "FS", rootPath: e["storage-work"] }
|
|
1642
1637
|
}
|
|
1643
1638
|
}
|
|
1644
|
-
}, P = r.createLocalS3(n,
|
|
1645
|
-
|
|
1639
|
+
}, P = r.createLocalS3(n, y);
|
|
1640
|
+
y.binaryPath ? r.switchInstance(P) : ke(t, { version: e.version }).then(() => {
|
|
1646
1641
|
const S = r.switchInstance(P);
|
|
1647
1642
|
setTimeout(() => {
|
|
1648
1643
|
for (const k of S)
|
|
@@ -1652,26 +1647,26 @@ let ut = (x = class extends L {
|
|
|
1652
1647
|
t.error(S.message);
|
|
1653
1648
|
});
|
|
1654
1649
|
}
|
|
1655
|
-
}, l(
|
|
1656
|
-
...
|
|
1650
|
+
}, 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", {
|
|
1651
|
+
...A,
|
|
1657
1652
|
...C,
|
|
1658
1653
|
...j,
|
|
1659
1654
|
...hr,
|
|
1655
|
+
...we,
|
|
1660
1656
|
...ve,
|
|
1661
1657
|
...Pe,
|
|
1662
|
-
...ke,
|
|
1663
1658
|
...M,
|
|
1664
1659
|
...B,
|
|
1665
1660
|
...ce,
|
|
1666
1661
|
...ie,
|
|
1667
1662
|
...oe,
|
|
1663
|
+
...pe,
|
|
1668
1664
|
...be,
|
|
1669
|
-
...we,
|
|
1670
1665
|
...U
|
|
1671
|
-
}),
|
|
1666
|
+
}), D);
|
|
1672
1667
|
const z = class z extends L {
|
|
1673
1668
|
async run() {
|
|
1674
|
-
const { flags: e, args: t } = await this.parse(z), r =
|
|
1669
|
+
const { flags: e, args: t } = await this.parse(z), r = I(e["log-level"]), n = new O(r);
|
|
1675
1670
|
n.mergeLicenseEnvs(e);
|
|
1676
1671
|
const s = t.name, i = e["auth-enabled"], c = i ? {
|
|
1677
1672
|
enabled: i,
|
|
@@ -1701,11 +1696,11 @@ const z = class z extends L {
|
|
|
1701
1696
|
}
|
|
1702
1697
|
};
|
|
1703
1698
|
l(z, "description", "Run Platforma Backend service as docker container on current host"), l(z, "examples", ["<%= config.bin %> <%= command.id %>"]), l(z, "flags", {
|
|
1704
|
-
...
|
|
1699
|
+
...A,
|
|
1705
1700
|
...j,
|
|
1706
|
-
...
|
|
1701
|
+
...me,
|
|
1707
1702
|
...C,
|
|
1708
|
-
...
|
|
1703
|
+
...he,
|
|
1709
1704
|
...U,
|
|
1710
1705
|
...M,
|
|
1711
1706
|
...ye,
|
|
@@ -1716,11 +1711,11 @@ l(z, "description", "Run Platforma Backend service as docker container on curren
|
|
|
1716
1711
|
}), l(z, "args", {
|
|
1717
1712
|
name: K.string({ required: !0 })
|
|
1718
1713
|
});
|
|
1719
|
-
let
|
|
1714
|
+
let Me = z;
|
|
1720
1715
|
var R;
|
|
1721
1716
|
let ft = (R = class extends L {
|
|
1722
1717
|
async run() {
|
|
1723
|
-
const { flags: e, args: t } = await this.parse(R), r =
|
|
1718
|
+
const { flags: e, args: t } = await this.parse(R), r = I(e["log-level"]), n = new O(r);
|
|
1724
1719
|
n.mergeLicenseEnvs(e);
|
|
1725
1720
|
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, d = n.initAuthDriversList(e, i), g = e["auth-enabled"] ?? d !== void 0;
|
|
1726
1721
|
let h = e["pl-binary"];
|
|
@@ -1729,8 +1724,8 @@ let ft = (R = class extends L {
|
|
|
1729
1724
|
e["grpc-listen"] ? b = e["grpc-listen"] : e["grpc-port"] && (b = `127.0.0.1:${e["grpc-port"]}`);
|
|
1730
1725
|
let w = "127.0.0.1:9090";
|
|
1731
1726
|
e["monitoring-listen"] ? w = e["monitoring-listen"] : e["monitoring-port"] && (w = `127.0.0.1:${e["monitoring-port"]}`);
|
|
1732
|
-
let
|
|
1733
|
-
e["debug-listen"] ?
|
|
1727
|
+
let y = "127.0.0.1:9091";
|
|
1728
|
+
e["debug-listen"] ? y = e["debug-listen"] : e["debug-port"] && (y = `127.0.0.1:${e["debug-port"]}`);
|
|
1734
1729
|
const P = {
|
|
1735
1730
|
binaryPath: h,
|
|
1736
1731
|
version: e.version,
|
|
@@ -1741,7 +1736,7 @@ let ft = (R = class extends L {
|
|
|
1741
1736
|
configOptions: {
|
|
1742
1737
|
grpc: { listen: b },
|
|
1743
1738
|
monitoring: { listen: w },
|
|
1744
|
-
debug: { listen:
|
|
1739
|
+
debug: { listen: y },
|
|
1745
1740
|
license: { value: e.license, file: e["license-file"] },
|
|
1746
1741
|
log: { path: o },
|
|
1747
1742
|
localRoot: c,
|
|
@@ -1755,31 +1750,31 @@ let ft = (R = class extends L {
|
|
|
1755
1750
|
r.info(`Instance '${s}' was created. To start it run 'up' command`);
|
|
1756
1751
|
return;
|
|
1757
1752
|
}
|
|
1758
|
-
|
|
1753
|
+
ke(r, { version: e.version }).then(() => r.info(`Instance '${s}' was created. To start it run 'pl up' command`)).catch(function(S) {
|
|
1759
1754
|
r.error(S.message);
|
|
1760
1755
|
});
|
|
1761
1756
|
}
|
|
1762
1757
|
}, 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", {
|
|
1763
|
-
...
|
|
1758
|
+
...A,
|
|
1764
1759
|
...C,
|
|
1765
1760
|
...j,
|
|
1761
|
+
...we,
|
|
1766
1762
|
...ve,
|
|
1767
1763
|
...Pe,
|
|
1768
|
-
...ke,
|
|
1769
1764
|
...M,
|
|
1770
1765
|
...B,
|
|
1771
1766
|
...ce,
|
|
1772
1767
|
...ie,
|
|
1773
1768
|
...oe,
|
|
1769
|
+
...pe,
|
|
1774
1770
|
...be,
|
|
1775
|
-
...we,
|
|
1776
1771
|
...U
|
|
1777
1772
|
}), l(R, "args", {
|
|
1778
1773
|
name: K.string({ required: !0 })
|
|
1779
1774
|
}), R);
|
|
1780
1775
|
const Y = class Y extends L {
|
|
1781
1776
|
async run() {
|
|
1782
|
-
const { flags: e, args: t } = await this.parse(Y), r =
|
|
1777
|
+
const { flags: e, args: t } = await this.parse(Y), r = I(e["log-level"]), n = new O(r);
|
|
1783
1778
|
n.mergeLicenseEnvs(e);
|
|
1784
1779
|
const s = t.name, i = e["auth-enabled"], c = i ? {
|
|
1785
1780
|
enabled: i,
|
|
@@ -1807,23 +1802,23 @@ const Y = class Y extends L {
|
|
|
1807
1802
|
}
|
|
1808
1803
|
};
|
|
1809
1804
|
l(Y, "description", "Run Platforma Backend service as docker container on current host with MinIO as local S3 storage"), l(Y, "examples", ["<%= config.bin %> <%= command.id %>"]), l(Y, "flags", {
|
|
1810
|
-
...
|
|
1805
|
+
...A,
|
|
1811
1806
|
...j,
|
|
1812
|
-
...
|
|
1807
|
+
...me,
|
|
1813
1808
|
...C,
|
|
1814
|
-
...
|
|
1809
|
+
...he,
|
|
1815
1810
|
...U,
|
|
1816
1811
|
...M,
|
|
1817
1812
|
...ye,
|
|
1818
1813
|
...B,
|
|
1819
|
-
...
|
|
1814
|
+
...yr
|
|
1820
1815
|
}), l(Y, "args", {
|
|
1821
1816
|
name: K.string({ required: !0 })
|
|
1822
1817
|
});
|
|
1823
|
-
let
|
|
1818
|
+
let je = Y;
|
|
1824
1819
|
const V = class V extends L {
|
|
1825
1820
|
async run() {
|
|
1826
|
-
const { flags: e, args: t } = await this.parse(V), r =
|
|
1821
|
+
const { flags: e, args: t } = await this.parse(V), r = I(e["log-level"]), n = new O(r);
|
|
1827
1822
|
n.mergeLicenseEnvs(e);
|
|
1828
1823
|
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, d = n.initAuthDriversList(e, i), g = e["auth-enabled"] ?? d !== void 0;
|
|
1829
1824
|
let h = e["pl-binary"];
|
|
@@ -1832,8 +1827,8 @@ const V = class V extends L {
|
|
|
1832
1827
|
e["grpc-listen"] ? b = e["grpc-listen"] : e["grpc-port"] && (b = `127.0.0.1:${e["grpc-port"]}`);
|
|
1833
1828
|
let w = "127.0.0.1:9090";
|
|
1834
1829
|
e["monitoring-listen"] ? w = e["monitoring-listen"] : e["monitoring-port"] && (w = `127.0.0.1:${e["monitoring-port"]}`);
|
|
1835
|
-
let
|
|
1836
|
-
e["debug-listen"] ?
|
|
1830
|
+
let y = "127.0.0.1:9091";
|
|
1831
|
+
e["debug-listen"] ? y = e["debug-listen"] : e["debug-port"] && (y = `127.0.0.1:${e["debug-port"]}`);
|
|
1837
1832
|
const P = {
|
|
1838
1833
|
binaryPath: h,
|
|
1839
1834
|
version: e.version,
|
|
@@ -1846,7 +1841,7 @@ const V = class V extends L {
|
|
|
1846
1841
|
configOptions: {
|
|
1847
1842
|
grpc: { listen: b },
|
|
1848
1843
|
monitoring: { listen: w },
|
|
1849
|
-
debug: { listen:
|
|
1844
|
+
debug: { listen: y },
|
|
1850
1845
|
license: { value: e.license, file: e["license-file"] },
|
|
1851
1846
|
log: { path: o },
|
|
1852
1847
|
localRoot: c,
|
|
@@ -1860,48 +1855,48 @@ const V = class V extends L {
|
|
|
1860
1855
|
r.info(`Instance '${s}' was created. To start it run 'up' command`);
|
|
1861
1856
|
return;
|
|
1862
1857
|
}
|
|
1863
|
-
|
|
1858
|
+
ke(r, { version: e.version }).then(() => r.info(`Instance '${s}' was created. To start it run 'pl up' command`)).catch(function(S) {
|
|
1864
1859
|
r.error(S.message);
|
|
1865
1860
|
});
|
|
1866
1861
|
}
|
|
1867
1862
|
};
|
|
1868
1863
|
l(V, "description", "Run Platforma Backend service as local process on current host (no docker container)"), l(V, "examples", ["<%= config.bin %> <%= command.id %>"]), l(V, "flags", {
|
|
1869
|
-
...
|
|
1864
|
+
...A,
|
|
1870
1865
|
...C,
|
|
1871
1866
|
...hr,
|
|
1872
1867
|
...j,
|
|
1868
|
+
...we,
|
|
1873
1869
|
...ve,
|
|
1874
1870
|
...Pe,
|
|
1875
|
-
...ke,
|
|
1876
1871
|
...M,
|
|
1877
1872
|
...B,
|
|
1878
1873
|
...ce,
|
|
1879
1874
|
...ie,
|
|
1880
1875
|
...oe,
|
|
1876
|
+
...pe,
|
|
1881
1877
|
...be,
|
|
1882
|
-
...we,
|
|
1883
1878
|
...U
|
|
1884
1879
|
}), l(V, "args", {
|
|
1885
1880
|
name: K.string({ required: !0 })
|
|
1886
1881
|
});
|
|
1887
|
-
let
|
|
1882
|
+
let Be = V;
|
|
1888
1883
|
const Rt = {
|
|
1889
|
-
"create-block":
|
|
1890
|
-
reset:
|
|
1884
|
+
"create-block": Re,
|
|
1885
|
+
reset: Te,
|
|
1891
1886
|
start: xe,
|
|
1892
1887
|
stop: De,
|
|
1893
1888
|
"start:docker": lt,
|
|
1894
1889
|
"start:local": dt,
|
|
1895
|
-
"svc:delete":
|
|
1896
|
-
"svc:down":
|
|
1897
|
-
"svc:list":
|
|
1898
|
-
"svc:up":
|
|
1890
|
+
"svc:delete": Fe,
|
|
1891
|
+
"svc:down": Ne,
|
|
1892
|
+
"svc:list": _e,
|
|
1893
|
+
"svc:up": Ce,
|
|
1899
1894
|
"start:docker:s3": gt,
|
|
1900
1895
|
"start:local:s3": ut,
|
|
1901
|
-
"svc:create:docker":
|
|
1896
|
+
"svc:create:docker": Me,
|
|
1902
1897
|
"svc:create:local": ft,
|
|
1903
|
-
"svc:create:docker:s3":
|
|
1904
|
-
"svc:create:local:s3":
|
|
1898
|
+
"svc:create:docker:s3": je,
|
|
1899
|
+
"svc:create:local:s3": Be
|
|
1905
1900
|
};
|
|
1906
1901
|
export {
|
|
1907
1902
|
Rt as COMMANDS
|