@platforma-sdk/bootstrap 3.1.9 → 3.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/start/local/s3.d.ts.map +1 -1
- package/dist/commands/start/local.d.ts.map +1 -1
- package/dist/commands/svc/create/local/s3.d.ts.map +1 -1
- package/dist/commands/svc/create/local.d.ts.map +1 -1
- package/dist/core.d.ts +1 -4
- package/dist/core.d.ts.map +1 -1
- package/dist/index.js +14 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +391 -398
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,137 +1,137 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var l = (a, e, t) =>
|
|
4
|
-
import { Flags as
|
|
5
|
-
import
|
|
6
|
-
import f, { createWriteStream as
|
|
7
|
-
import m, { resolve as
|
|
8
|
-
import { execSync as Ie, spawn as
|
|
1
|
+
var kr = Object.defineProperty;
|
|
2
|
+
var Sr = (a, e, t) => e in a ? kr(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
|
|
3
|
+
var l = (a, e, t) => Sr(a, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Flags as w, Command as $, Args as K } from "@oclif/core";
|
|
5
|
+
import D from "node:os";
|
|
6
|
+
import f, { createWriteStream as $r } from "node:fs";
|
|
7
|
+
import m, { resolve as Lr } from "node:path";
|
|
8
|
+
import { execSync as Ie, spawn as Ar, spawnSync as Ir } 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";
|
|
12
12
|
import * as _ from "node:fs/promises";
|
|
13
|
-
import { Writable as
|
|
13
|
+
import { Writable as Er } from "node:stream";
|
|
14
14
|
import { z as N } from "zod";
|
|
15
|
-
import
|
|
16
|
-
import { getDefaultPlVersion as
|
|
15
|
+
import Rr from "decompress";
|
|
16
|
+
import { getDefaultPlVersion as ue } from "@milaboratories/pl-deployments";
|
|
17
17
|
import dr from "yaml";
|
|
18
18
|
import Tr from "node:https";
|
|
19
19
|
import * as xr from "tar";
|
|
20
20
|
const A = {
|
|
21
|
-
"log-level":
|
|
21
|
+
"log-level": w.string({
|
|
22
22
|
description: "logging level",
|
|
23
23
|
default: "info",
|
|
24
24
|
options: ["error", "warn", "info", "debug"],
|
|
25
25
|
required: !1
|
|
26
26
|
})
|
|
27
27
|
};
|
|
28
|
-
|
|
28
|
+
w.string({
|
|
29
29
|
description: "name of instance",
|
|
30
30
|
required: !1
|
|
31
31
|
});
|
|
32
|
-
const
|
|
33
|
-
image:
|
|
32
|
+
const fe = {
|
|
33
|
+
image: w.string({
|
|
34
34
|
description: "use custom docker image to run platforma"
|
|
35
35
|
})
|
|
36
36
|
}, C = {
|
|
37
|
-
version:
|
|
37
|
+
version: w.string({
|
|
38
38
|
description: "use custom platforma release (official docker image or binary package)"
|
|
39
39
|
})
|
|
40
|
-
},
|
|
41
|
-
arch:
|
|
40
|
+
}, me = {
|
|
41
|
+
arch: w.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
|
})
|
|
44
44
|
}, M = {
|
|
45
|
-
license:
|
|
45
|
+
license: w.string({
|
|
46
46
|
description: 'pass a license code. The license can be got from "https://licensing.milaboratories.com".'
|
|
47
47
|
}),
|
|
48
|
-
"license-file":
|
|
48
|
+
"license-file": w.file({
|
|
49
49
|
exists: !0,
|
|
50
50
|
description: "specify a path to the file with a license. The license can be got from 'https://licensing.milaboratories.com'."
|
|
51
51
|
})
|
|
52
52
|
}, j = {
|
|
53
|
-
"grpc-port":
|
|
53
|
+
"grpc-port": w.integer({
|
|
54
54
|
description: "port for Platforma Backend gRPC API. Default is 6345",
|
|
55
55
|
env: "PLATFORMA_GRPC_PORT"
|
|
56
56
|
}),
|
|
57
|
-
"grpc-listen":
|
|
57
|
+
"grpc-listen": w.string({
|
|
58
58
|
description: "full listen addr for Platforma Backend gRPC API. Default is 127.0.0.1:6345",
|
|
59
59
|
env: "PLATFORMA_GRPC_LISTEN"
|
|
60
60
|
}),
|
|
61
|
-
"monitoring-port":
|
|
61
|
+
"monitoring-port": w.integer({
|
|
62
62
|
description: "port for Platforma Backend monitoring API. Default is 9090",
|
|
63
63
|
env: "PLATFORMA_MONITORING_PORT"
|
|
64
64
|
}),
|
|
65
|
-
"monitoring-listen":
|
|
65
|
+
"monitoring-listen": w.string({
|
|
66
66
|
description: "full listen addr for Platforma Backend monitoring API. Default is 127.0.0.1:9090",
|
|
67
67
|
env: "PLATFORMA_MONITORING_LISTEN"
|
|
68
68
|
}),
|
|
69
|
-
"debug-port":
|
|
69
|
+
"debug-port": w.integer({
|
|
70
70
|
description: "port for Platforma Backend debug API. Default is 9091",
|
|
71
71
|
env: "PLATFORMA_DEBUG_PORT"
|
|
72
72
|
}),
|
|
73
|
-
"debug-listen":
|
|
73
|
+
"debug-listen": w.string({
|
|
74
74
|
description: "full listen addr for Platforma Backend debug API. Default is 127.0.0.1:9091",
|
|
75
75
|
env: "PLATFORMA_DEBUG_LISTEN"
|
|
76
76
|
})
|
|
77
|
-
},
|
|
78
|
-
"s3-port":
|
|
77
|
+
}, mr = {
|
|
78
|
+
"s3-port": w.integer({
|
|
79
79
|
description: "port that S3 will listen, default is 9000",
|
|
80
80
|
default: 9e3,
|
|
81
81
|
env: "PLATFORMA_S3_PORT"
|
|
82
82
|
}),
|
|
83
|
-
"s3-console-port":
|
|
83
|
+
"s3-console-port": w.integer({
|
|
84
84
|
description: "port that a console of S3 will listen, default is 9001",
|
|
85
85
|
default: 9001,
|
|
86
86
|
env: "PLATFORMA_S3_CONSOLE_PORT"
|
|
87
87
|
})
|
|
88
88
|
}, B = {
|
|
89
|
-
storage:
|
|
89
|
+
storage: w.string({
|
|
90
90
|
description: "specify path on host to be used as storage for all Platforma Backend data"
|
|
91
91
|
})
|
|
92
|
-
},
|
|
93
|
-
"minio-presign-host":
|
|
92
|
+
}, hr = {
|
|
93
|
+
"minio-presign-host": w.boolean({
|
|
94
94
|
description: "use 'minio' host instead of 'localhost' in presign URLs"
|
|
95
95
|
})
|
|
96
|
-
},
|
|
97
|
-
mount:
|
|
96
|
+
}, he = {
|
|
97
|
+
mount: w.string({
|
|
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
|
-
},
|
|
102
|
-
"pl-log-file":
|
|
101
|
+
}, ye = {
|
|
102
|
+
"pl-log-file": w.file({
|
|
103
103
|
description: "specify path for Platforma Backend log file"
|
|
104
104
|
})
|
|
105
105
|
}, be = {
|
|
106
|
-
"pl-workdir":
|
|
106
|
+
"pl-workdir": w.file({
|
|
107
107
|
description: "specify working directory for Platforma Backend process"
|
|
108
108
|
})
|
|
109
|
-
},
|
|
110
|
-
"pl-binary":
|
|
109
|
+
}, pe = {
|
|
110
|
+
"pl-binary": w.file({
|
|
111
111
|
description: "start given Platforma Backend binary instead of automatically downloaded version"
|
|
112
112
|
})
|
|
113
|
-
},
|
|
114
|
-
"pl-sources":
|
|
113
|
+
}, we = {
|
|
114
|
+
"pl-sources": w.file({
|
|
115
115
|
description: "path to pl repository root: build Platforma Backend from sources and start the resulting binary"
|
|
116
116
|
})
|
|
117
|
-
},
|
|
118
|
-
config:
|
|
117
|
+
}, ve = {
|
|
118
|
+
config: w.string({
|
|
119
119
|
description: "use custom Platforma Backend config"
|
|
120
120
|
})
|
|
121
121
|
};
|
|
122
|
-
|
|
122
|
+
w.file({
|
|
123
123
|
description: "specify path on host to be used as 'primary' storage"
|
|
124
124
|
});
|
|
125
125
|
const ie = {
|
|
126
|
-
"storage-work":
|
|
126
|
+
"storage-work": w.file({
|
|
127
127
|
description: "specify path on host to be used as 'work' storage"
|
|
128
128
|
})
|
|
129
129
|
};
|
|
130
|
-
|
|
130
|
+
w.file({
|
|
131
131
|
description: "specify path on host to be used as 'library' storage"
|
|
132
132
|
});
|
|
133
133
|
const ce = {
|
|
134
|
-
"storage-primary":
|
|
134
|
+
"storage-primary": w.string({
|
|
135
135
|
description: `specify 'primary' storage destination URL.
|
|
136
136
|
file:/path/to/dir for directory on local FS
|
|
137
137
|
s3://<bucket>/?region=<name> for real AWS bucket
|
|
@@ -139,32 +139,32 @@ const ce = {
|
|
|
139
139
|
s3es://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via https`
|
|
140
140
|
})
|
|
141
141
|
}, oe = {
|
|
142
|
-
"storage-library":
|
|
142
|
+
"storage-library": w.string({
|
|
143
143
|
description: `specify 'library' storage destination URL.
|
|
144
144
|
file:/path/to/dir for directory on local FS
|
|
145
145
|
s3://<bucket>/?region=<name> for real AWS bucket
|
|
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
|
-
},
|
|
150
|
-
"auth-enabled":
|
|
149
|
+
}, Fr = {
|
|
150
|
+
"auth-enabled": w.boolean({
|
|
151
151
|
description: "enable authorization"
|
|
152
152
|
})
|
|
153
|
-
},
|
|
154
|
-
"auth-htpasswd-file":
|
|
153
|
+
}, Dr = {
|
|
154
|
+
"auth-htpasswd-file": w.file({
|
|
155
155
|
description: "path to .htpasswd file with Platforma users (static user DB auth source)"
|
|
156
156
|
})
|
|
157
157
|
}, Nr = {
|
|
158
|
-
"auth-ldap-server":
|
|
158
|
+
"auth-ldap-server": w.string({
|
|
159
159
|
description: "address of LDAP server to use for auth in Platforma (auth source)"
|
|
160
160
|
})
|
|
161
161
|
}, _r = {
|
|
162
|
-
"auth-ldap-default-dn":
|
|
162
|
+
"auth-ldap-default-dn": w.string({
|
|
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
|
-
...Dr,
|
|
167
166
|
...Fr,
|
|
167
|
+
...Dr,
|
|
168
168
|
...Nr,
|
|
169
169
|
..._r
|
|
170
170
|
};
|
|
@@ -200,14 +200,14 @@ 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(D.homedir(), a.slice(1)) : a;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function ke(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 (
|
|
210
|
+
if (D.platform() !== "win32")
|
|
211
211
|
return Ie(`ps -p ${a} -o comm=`, { encoding: "utf8" }).trim();
|
|
212
212
|
const e = `wmic process where processid=${a} get Caption`, t = Ie(e, { encoding: "utf8" }).split(`
|
|
213
213
|
`);
|
|
@@ -222,7 +222,7 @@ function Ur(a) {
|
|
|
222
222
|
if (r.Name === a)
|
|
223
223
|
return r;
|
|
224
224
|
}
|
|
225
|
-
const Oe = ["Python"],
|
|
225
|
+
const Oe = ["Python"], yr = ["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, { message: "Organization name must be provided" }),
|
|
228
228
|
blockName: N.string().min(1, { message: "Block name must be provided" }),
|
|
@@ -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 = yr.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);
|
|
@@ -266,7 +266,7 @@ function Wr() {
|
|
|
266
266
|
const r = Z.keyInYN("Create package for block's software?");
|
|
267
267
|
let n = ["Tengo"];
|
|
268
268
|
if (r)
|
|
269
|
-
for (; n.length <
|
|
269
|
+
for (; n.length < yr.length; ) {
|
|
270
270
|
const i = Z.keyInSelect(Oe, "Choose software platform:");
|
|
271
271
|
if (i < 0) break;
|
|
272
272
|
n.push(Oe[i]);
|
|
@@ -278,10 +278,10 @@ function Wr() {
|
|
|
278
278
|
return s.data;
|
|
279
279
|
}
|
|
280
280
|
async function qr(a, e, t) {
|
|
281
|
-
const n = await (await fetch(a)).blob(), s = await _.mkdtemp(m.join(
|
|
281
|
+
const n = await (await fetch(a)).blob(), s = await _.mkdtemp(m.join(D.tmpdir(), "create-repo")), i = m.join(s, "packed-repo.zip"), c = Er.toWeb($r(i));
|
|
282
282
|
await n.stream().pipeTo(c);
|
|
283
283
|
const o = m.join(s, "unpacked-repo");
|
|
284
|
-
await _.mkdir(o), await
|
|
284
|
+
await _.mkdir(o), await Rr(i, o), await _.cp(m.join(o, e), t, { recursive: !0 });
|
|
285
285
|
}
|
|
286
286
|
async function zr(a, e) {
|
|
287
287
|
const t = e.toLowerCase();
|
|
@@ -342,7 +342,7 @@ async function br(a, e, t) {
|
|
|
342
342
|
async function ee(a, e) {
|
|
343
343
|
return await br(a, e, "");
|
|
344
344
|
}
|
|
345
|
-
const re = class re extends
|
|
345
|
+
const re = class re extends $ {
|
|
346
346
|
async run() {
|
|
347
347
|
const { flags: e } = await this.parse(re), t = I(e["log-level"]);
|
|
348
348
|
await Hr(t);
|
|
@@ -351,18 +351,18 @@ const re = class re extends L {
|
|
|
351
351
|
l(re, "description", "Helps to create a new block by downloading a block's template."), l(re, "examples", ["<%= name %>"]), l(re, "flags", {
|
|
352
352
|
...A
|
|
353
353
|
});
|
|
354
|
-
let
|
|
355
|
-
function
|
|
356
|
-
return
|
|
354
|
+
let Ee = re;
|
|
355
|
+
function pr(...a) {
|
|
356
|
+
return Lr(__dirname, "..", ...a);
|
|
357
357
|
}
|
|
358
358
|
function Q(...a) {
|
|
359
|
-
return
|
|
359
|
+
return pr("assets", ...a);
|
|
360
360
|
}
|
|
361
|
-
function
|
|
362
|
-
return f.readFileSync(
|
|
361
|
+
function Se(...a) {
|
|
362
|
+
return f.readFileSync(pr(...a));
|
|
363
363
|
}
|
|
364
364
|
function gr(a) {
|
|
365
|
-
return a || (a =
|
|
365
|
+
return a || (a = ue()), `quay.io/milaboratories/platforma:${a}`;
|
|
366
366
|
}
|
|
367
367
|
const J = class J {
|
|
368
368
|
constructor(e) {
|
|
@@ -371,9 +371,9 @@ const J = class J {
|
|
|
371
371
|
});
|
|
372
372
|
l(this, "filePath");
|
|
373
373
|
l(this, "dirPath");
|
|
374
|
-
e = e ?? m.resolve(
|
|
374
|
+
e = e ?? m.resolve(D.homedir(), ".config", "pl-bootstrap");
|
|
375
375
|
const t = m.join(e, "state.json");
|
|
376
|
-
this.dirPath = e, this.filePath = t, f.existsSync(e) || f.mkdirSync(e, { recursive: !0 }), f.existsSync(t) && (this.state = JSON.parse(
|
|
376
|
+
this.dirPath = e, this.filePath = t, f.existsSync(e) || f.mkdirSync(e, { recursive: !0 }), f.existsSync(t) && (this.state = JSON.parse(Se(t).toString()));
|
|
377
377
|
}
|
|
378
378
|
static getStateInstance() {
|
|
379
379
|
return J.instance || (J.instance = new J()), J.instance;
|
|
@@ -400,7 +400,7 @@ const J = class J {
|
|
|
400
400
|
const t = this.instanceDir(e, "instance.json");
|
|
401
401
|
if (!f.existsSync(t))
|
|
402
402
|
throw new Error(`platforma backend instance '${e}' does not exist or is corrupted`);
|
|
403
|
-
const r = JSON.parse(
|
|
403
|
+
const r = JSON.parse(Se(t).toString());
|
|
404
404
|
return {
|
|
405
405
|
name: e,
|
|
406
406
|
...r
|
|
@@ -410,7 +410,7 @@ const J = class J {
|
|
|
410
410
|
f.existsSync(this.instanceDir(e)) || f.mkdirSync(this.instanceDir(e), { recursive: !0 });
|
|
411
411
|
const r = this.instanceDir(e, "instance.json");
|
|
412
412
|
let n = {};
|
|
413
|
-
f.existsSync(r) && (n = JSON.parse(
|
|
413
|
+
f.existsSync(r) && (n = JSON.parse(Se(r).toString())), f.writeFileSync(r, JSON.stringify({ ...n, ...t }));
|
|
414
414
|
}
|
|
415
415
|
isInstanceActive(e) {
|
|
416
416
|
switch (e.type) {
|
|
@@ -453,16 +453,16 @@ const J = class J {
|
|
|
453
453
|
}
|
|
454
454
|
};
|
|
455
455
|
l(J, "instance");
|
|
456
|
-
let
|
|
456
|
+
let Re = J;
|
|
457
457
|
function ur(a) {
|
|
458
458
|
const e = Br(a);
|
|
459
459
|
return e === "platforma" || e.endsWith("/platforma") || e.endsWith("\\platforma");
|
|
460
460
|
}
|
|
461
|
-
const u =
|
|
462
|
-
function
|
|
461
|
+
const u = Re.getStateInstance();
|
|
462
|
+
function $e(a, e, t) {
|
|
463
463
|
const r = [], n = [];
|
|
464
|
-
for (const s of e)
|
|
465
|
-
|
|
464
|
+
for (const s of e) {
|
|
465
|
+
const i = {
|
|
466
466
|
cwd: s.workdir,
|
|
467
467
|
env: {
|
|
468
468
|
...s.envs,
|
|
@@ -470,14 +470,16 @@ function Le(a, e, t) {
|
|
|
470
470
|
},
|
|
471
471
|
...s.runOpts,
|
|
472
472
|
...t
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
|
|
473
|
+
};
|
|
474
|
+
if (s.async) {
|
|
475
|
+
const c = Qr(a, s.cmd, s.args, i);
|
|
476
|
+
n.push(c);
|
|
476
477
|
} else {
|
|
477
|
-
const
|
|
478
|
-
if (r.push(
|
|
478
|
+
const c = Xr(a, s.cmd, s.args, i);
|
|
479
|
+
if (r.push(c), c.error || c.status !== 0)
|
|
479
480
|
break;
|
|
480
481
|
}
|
|
482
|
+
}
|
|
481
483
|
return {
|
|
482
484
|
executed: r,
|
|
483
485
|
spawned: n
|
|
@@ -491,7 +493,7 @@ function Qr(a, e, t, r) {
|
|
|
491
493
|
cmd: ${JSON.stringify([e, ...t])}
|
|
492
494
|
wd: ${(c = r.cwd) == null ? void 0 : c.toString()}`
|
|
493
495
|
), r.env = { ...process.env, ...r.env }, a.debug(" spawning child process");
|
|
494
|
-
const n =
|
|
496
|
+
const n = Ar(e, t, r);
|
|
495
497
|
let s = !1;
|
|
496
498
|
const i = () => {
|
|
497
499
|
n.kill("SIGINT"), s = !0;
|
|
@@ -505,9 +507,9 @@ function Xr(a, e, t, r) {
|
|
|
505
507
|
`Running:
|
|
506
508
|
cmd: ${JSON.stringify([e, ...t])}
|
|
507
509
|
opts: ${JSON.stringify(r)}`
|
|
508
|
-
), r.env = { ...process.env, ...r.env },
|
|
510
|
+
), r.env = { ...process.env, ...r.env }, Ir(e, t, r);
|
|
509
511
|
}
|
|
510
|
-
function
|
|
512
|
+
function Le(a, e, t, r, n) {
|
|
511
513
|
const s = f.readFileSync(a, { encoding: "utf-8" }), i = dr.parse(s.toString());
|
|
512
514
|
if (!i.services)
|
|
513
515
|
throw new Error(`file '${a}' seems to be not a docker-compose file or has unsupported version`);
|
|
@@ -516,26 +518,26 @@ function Ae(a, e, t, r, n) {
|
|
|
516
518
|
r.has(c) || delete i.services[c];
|
|
517
519
|
i.name = t;
|
|
518
520
|
for (const [c, o] of (r == null ? void 0 : r.entries()) ?? []) {
|
|
519
|
-
const
|
|
520
|
-
if (!
|
|
521
|
+
const g = i.services[c];
|
|
522
|
+
if (!g)
|
|
521
523
|
throw new Error(`docker compose '${a}' has no declaration of service '${c}'`);
|
|
522
|
-
if (o.platform && (
|
|
523
|
-
|
|
524
|
-
for (let
|
|
525
|
-
const b =
|
|
524
|
+
if (o.platform && (g.platform = o.platform), o.envs) {
|
|
525
|
+
g.environment || (g.environment = []);
|
|
526
|
+
for (let d = 0; d < ((g == null ? void 0 : g.environment.length) ?? 0); ) {
|
|
527
|
+
const b = g.environment[d].split("=")[0];
|
|
526
528
|
if (o.envs[b]) {
|
|
527
|
-
const
|
|
528
|
-
|
|
529
|
+
const p = g.environment.pop();
|
|
530
|
+
p && g.environment.length !== d && (g.environment[d] = p);
|
|
529
531
|
} else
|
|
530
|
-
|
|
532
|
+
d++;
|
|
531
533
|
}
|
|
532
|
-
for (const [
|
|
533
|
-
|
|
534
|
+
for (const [d, h] of Object.entries(o.envs))
|
|
535
|
+
g.environment.push(`${d}=${h}`);
|
|
534
536
|
}
|
|
535
537
|
if (o.mounts) {
|
|
536
|
-
|
|
537
|
-
for (const
|
|
538
|
-
|
|
538
|
+
g.volumes || (g.volumes = []);
|
|
539
|
+
for (const d of o.mounts)
|
|
540
|
+
g.volumes.push(`${d.hostPath}:${d.containerPath}`);
|
|
539
541
|
}
|
|
540
542
|
}
|
|
541
543
|
n != null && n.dropVolumes && delete i.volumes, f.writeFileSync(e, dr.stringify(i));
|
|
@@ -557,7 +559,7 @@ function Zr(a) {
|
|
|
557
559
|
uploadKeyPrefix: ""
|
|
558
560
|
};
|
|
559
561
|
}
|
|
560
|
-
function
|
|
562
|
+
function wr(a) {
|
|
561
563
|
return {
|
|
562
564
|
id: a,
|
|
563
565
|
type: "FS",
|
|
@@ -615,15 +617,15 @@ function X(a, e, t) {
|
|
|
615
617
|
}
|
|
616
618
|
}
|
|
617
619
|
function et(a, e) {
|
|
618
|
-
var
|
|
620
|
+
var p, y, P, L, S, v, k, le, Ge, Je, He, We, qe, ze, Ye, Ve, Ke, Qe, Xe, Ze, er, rr, tr, ar, nr, sr, ir, cr, or, lr;
|
|
619
621
|
const t = (e == null ? void 0 : e.localRoot) ?? u.instanceDir("default"), r = {
|
|
620
|
-
level: ((
|
|
622
|
+
level: ((p = e == null ? void 0 : e.log) == null ? void 0 : p.level) ?? "info",
|
|
621
623
|
path: ((y = e == null ? void 0 : e.log) == null ? void 0 : y.path) ?? `${t}/logs/platforma.log`
|
|
622
624
|
}, n = {
|
|
623
625
|
listen: ((P = e == null ? void 0 : e.grpc) == null ? void 0 : P.listen) ?? "localhost:6345",
|
|
624
626
|
tls: {
|
|
625
|
-
enable: de((
|
|
626
|
-
clientAuthMode: ((
|
|
627
|
+
enable: de((S = (L = e == null ? void 0 : e.grpc) == null ? void 0 : L.tls) == null ? void 0 : S.enable, !1),
|
|
628
|
+
clientAuthMode: ((k = (v = e == null ? void 0 : e.grpc) == null ? void 0 : v.tls) == null ? void 0 : k.clientAuthMode) ?? "NoAuth",
|
|
627
629
|
certFile: ((Ge = (le = e == null ? void 0 : e.grpc) == null ? void 0 : le.tls) == null ? void 0 : Ge.certFile) ?? `${t}/certs/tls.cert`,
|
|
628
630
|
keyFile: ((He = (Je = e == null ? void 0 : e.grpc) == null ? void 0 : Je.tls) == null ? void 0 : He.keyFile) ?? `${t}/certs/tls.key`,
|
|
629
631
|
...(We = e == null ? void 0 : e.grpc) == null ? void 0 : We.tls
|
|
@@ -649,17 +651,17 @@ function et(a, e) {
|
|
|
649
651
|
switch ((Xe = (Qe = e == null ? void 0 : e.storages) == null ? void 0 : Qe.work) == null ? void 0 : Xe.type) {
|
|
650
652
|
case void 0:
|
|
651
653
|
case "FS":
|
|
652
|
-
c =
|
|
654
|
+
c = wr("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";
|
|
653
655
|
break;
|
|
654
656
|
default:
|
|
655
657
|
throw new Error("work storage MUST have 'FS' type as it is used for working directories management");
|
|
656
658
|
}
|
|
657
|
-
const
|
|
659
|
+
const g = fr(
|
|
658
660
|
"library",
|
|
659
661
|
`${t}/storages/library`,
|
|
660
662
|
"library-bucket",
|
|
661
663
|
(ar = e == null ? void 0 : e.storages) == null ? void 0 : ar.library
|
|
662
|
-
),
|
|
664
|
+
), d = {
|
|
663
665
|
enabled: de((nr = e == null ? void 0 : e.monitoring) == null ? void 0 : nr.enabled, !0),
|
|
664
666
|
listen: ((sr = e == null ? void 0 : e.monitoring) == null ? void 0 : sr.listen) ?? "127.0.0.1:9090"
|
|
665
667
|
}, h = {
|
|
@@ -675,9 +677,9 @@ function et(a, e) {
|
|
|
675
677
|
log: r,
|
|
676
678
|
grpc: n,
|
|
677
679
|
core: s,
|
|
678
|
-
monitoring:
|
|
680
|
+
monitoring: d,
|
|
679
681
|
debug: h,
|
|
680
|
-
storages: { primary: i, work: c, library:
|
|
682
|
+
storages: { primary: i, work: c, library: g },
|
|
681
683
|
hacks: { libraryDownloadable: !0 }
|
|
682
684
|
};
|
|
683
685
|
}
|
|
@@ -686,7 +688,7 @@ function fr(a, e, t, r) {
|
|
|
686
688
|
switch (r == null ? void 0 : r.type) {
|
|
687
689
|
case void 0:
|
|
688
690
|
case "FS":
|
|
689
|
-
n =
|
|
691
|
+
n = wr(a), n.rootPath = (r == null ? void 0 : r.rootPath) ?? e;
|
|
690
692
|
break;
|
|
691
693
|
case "S3":
|
|
692
694
|
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) ?? "";
|
|
@@ -780,7 +782,7 @@ function de(a, e) {
|
|
|
780
782
|
}
|
|
781
783
|
const tt = ["linux", "macos", "windows"];
|
|
782
784
|
function at(a) {
|
|
783
|
-
const e =
|
|
785
|
+
const e = D.platform();
|
|
784
786
|
switch (e) {
|
|
785
787
|
case "darwin":
|
|
786
788
|
return "macos";
|
|
@@ -795,8 +797,8 @@ function at(a) {
|
|
|
795
797
|
}
|
|
796
798
|
}
|
|
797
799
|
const nt = ["amd64", "arm64"];
|
|
798
|
-
function
|
|
799
|
-
const e =
|
|
800
|
+
function vr(a) {
|
|
801
|
+
const e = D.arch();
|
|
800
802
|
switch (e) {
|
|
801
803
|
case "arm64":
|
|
802
804
|
return "arm64";
|
|
@@ -809,45 +811,45 @@ function Pr(a) {
|
|
|
809
811
|
}
|
|
810
812
|
}
|
|
811
813
|
function st(a, e) {
|
|
812
|
-
const t = (e == null ? void 0 : e.version) ??
|
|
814
|
+
const t = (e == null ? void 0 : e.version) ?? ue(), r = (e == null ? void 0 : e.showProgress) ?? process.stdout.isTTY, n = `pl-${t}-${vr()}.tgz`, s = (e == null ? void 0 : e.downloadURL) ?? `https://cdn.platforma.bio/software/pl/${at()}/${n}`, i = (e == null ? void 0 : e.saveTo) ?? u.binaries(n);
|
|
813
815
|
if (f.existsSync(i))
|
|
814
816
|
return a.info(`Platforma Backend archive download skipped: '${i}' already exists`), Promise.resolve(i);
|
|
815
817
|
f.mkdirSync(m.dirname(i), { recursive: !0 }), a.info(`Downloading Platforma Backend archive:
|
|
816
818
|
URL: ${s}
|
|
817
819
|
Save to: ${i}`);
|
|
818
820
|
const c = Tr.get(s);
|
|
819
|
-
return new Promise((o,
|
|
820
|
-
c.on("response", (
|
|
821
|
-
if (!
|
|
821
|
+
return new Promise((o, g) => {
|
|
822
|
+
c.on("response", (d) => {
|
|
823
|
+
if (!d.statusCode) {
|
|
822
824
|
const y = new Error("failed to download archive: no HTTP status code in response from server");
|
|
823
|
-
c.destroy(),
|
|
825
|
+
c.destroy(), g(y);
|
|
824
826
|
return;
|
|
825
827
|
}
|
|
826
|
-
if (
|
|
827
|
-
const y = new Error(`failed to download archive: ${
|
|
828
|
-
c.destroy(),
|
|
828
|
+
if (d.statusCode !== 200) {
|
|
829
|
+
const y = new Error(`failed to download archive: ${d.statusCode} ${d.statusMessage}`);
|
|
830
|
+
c.destroy(), g(y);
|
|
829
831
|
return;
|
|
830
832
|
}
|
|
831
|
-
const h = parseInt(
|
|
833
|
+
const h = parseInt(d.headers["content-length"] || "0", 10);
|
|
832
834
|
let b = 0;
|
|
833
|
-
const
|
|
834
|
-
|
|
835
|
+
const p = f.createWriteStream(i);
|
|
836
|
+
d.pipe(p), d.on("data", (y) => {
|
|
835
837
|
b += y.length;
|
|
836
838
|
const P = b / h * 100;
|
|
837
839
|
r && process.stdout.write(` downloading: ${P.toFixed(2)}%\r`);
|
|
838
|
-
}),
|
|
839
|
-
f.unlinkSync(i), a.error(`Failed to download Platforma Binary: ${y.message}`), c.destroy(),
|
|
840
|
-
}),
|
|
841
|
-
|
|
840
|
+
}), d.on("error", (y) => {
|
|
841
|
+
f.unlinkSync(i), a.error(`Failed to download Platforma Binary: ${y.message}`), c.destroy(), g(y);
|
|
842
|
+
}), p.on("finish", () => {
|
|
843
|
+
p.close(), a.info(" ... download done."), c.destroy(), o(i);
|
|
842
844
|
});
|
|
843
845
|
});
|
|
844
846
|
});
|
|
845
847
|
}
|
|
846
848
|
function it(a, e) {
|
|
847
849
|
a.debug("extracting archive...");
|
|
848
|
-
const t = (e == null ? void 0 : e.version) ??
|
|
850
|
+
const t = (e == null ? void 0 : e.version) ?? ue();
|
|
849
851
|
a.debug(` version: '${t}'`);
|
|
850
|
-
const r = `${
|
|
852
|
+
const r = `${Pr({ version: t })}.tgz`, n = (e == null ? void 0 : e.archivePath) ?? u.binaries(r);
|
|
851
853
|
a.debug(` archive path: '${n}'`);
|
|
852
854
|
const s = (e == null ? void 0 : e.extractTo) ?? ot(n);
|
|
853
855
|
if (a.debug(` target dir: '${s}'`), f.existsSync(s))
|
|
@@ -865,14 +867,14 @@ function it(a, e) {
|
|
|
865
867
|
sync: !0
|
|
866
868
|
}), a.info(" ... unpack done."), s;
|
|
867
869
|
}
|
|
868
|
-
function
|
|
870
|
+
function Pe(a, e) {
|
|
869
871
|
return st(a, e).then((t) => it(a, { archivePath: t }));
|
|
870
872
|
}
|
|
871
|
-
function
|
|
872
|
-
return `pl-${(a == null ? void 0 : a.version) ??
|
|
873
|
+
function Pr(a) {
|
|
874
|
+
return `pl-${(a == null ? void 0 : a.version) ?? ue()}-${vr()}`;
|
|
873
875
|
}
|
|
874
876
|
function ct(a, ...e) {
|
|
875
|
-
return u.binaries(
|
|
877
|
+
return u.binaries(Pr({ version: a }), ...e);
|
|
876
878
|
}
|
|
877
879
|
function ot(a) {
|
|
878
880
|
const e = a.lastIndexOf(".");
|
|
@@ -894,24 +896,20 @@ class O {
|
|
|
894
896
|
this.logger.info(`Starting platforma backend instance '${e.name}':
|
|
895
897
|
${r}`);
|
|
896
898
|
}
|
|
897
|
-
const t =
|
|
899
|
+
const t = $e(
|
|
898
900
|
this.logger,
|
|
899
901
|
e.upCommands
|
|
900
902
|
);
|
|
901
|
-
return
|
|
903
|
+
return Ae(t.executed), t.spawned.length > 0 && e.type === "process" && (e.pid = t.spawned[t.spawned.length - 1].pid, u.setInstanceInfo(e.name, e), this.logger.info(`instance '${e.name}' started`)), u.currentInstanceName = e.name, t.spawned;
|
|
902
904
|
}
|
|
903
905
|
stopInstance(e) {
|
|
904
|
-
if (!u.isInstanceActive(e)) {
|
|
905
|
-
this.logger.info(`instance '${e.name}' is not running`);
|
|
906
|
-
return;
|
|
907
|
-
}
|
|
908
906
|
this.logger.info(`stopping platforma backend instance '${e.name}'...`);
|
|
909
|
-
const t =
|
|
910
|
-
switch (
|
|
907
|
+
const t = $e(this.logger, e.downCommands);
|
|
908
|
+
switch (Ae(t.executed), e.type) {
|
|
911
909
|
case "docker":
|
|
912
910
|
return;
|
|
913
911
|
case "process": {
|
|
914
|
-
e.pid && u.
|
|
912
|
+
e.pid && u.isInstanceActive(e) && process.kill(e.pid);
|
|
915
913
|
return;
|
|
916
914
|
}
|
|
917
915
|
default:
|
|
@@ -927,46 +925,54 @@ ${r}`);
|
|
|
927
925
|
return this.startInstance(e);
|
|
928
926
|
}
|
|
929
927
|
createLocal(e, t) {
|
|
930
|
-
var
|
|
931
|
-
|
|
928
|
+
var g, d, h, b, p, y, P, L, S, v;
|
|
929
|
+
let r = ct(t == null ? void 0 : t.version, "binaries", "platforma");
|
|
930
|
+
t != null && t.sourcesPath && (r = m.join(D.tmpdir(), "platforma-custom-build")), t != null && t.binaryPath && (r = t.binaryPath);
|
|
932
931
|
let n = t == null ? void 0 : t.configPath;
|
|
933
932
|
const s = (t == null ? void 0 : t.workdir) ?? (n ? process.cwd() : u.instanceDir(e));
|
|
934
933
|
t != null && t.primaryURL && (t.configOptions = {
|
|
935
934
|
...t.configOptions,
|
|
936
935
|
storages: {
|
|
937
|
-
...(
|
|
938
|
-
primary: X(t.primaryURL, s, (
|
|
936
|
+
...(g = t.configOptions) == null ? void 0 : g.storages,
|
|
937
|
+
primary: X(t.primaryURL, s, (h = (d = t.configOptions) == null ? void 0 : d.storages) == null ? void 0 : h.primary)
|
|
939
938
|
}
|
|
940
939
|
}), t != null && t.libraryURL && (t.configOptions = {
|
|
941
940
|
...t.configOptions,
|
|
942
941
|
storages: {
|
|
943
|
-
...(
|
|
944
|
-
library: X(t.libraryURL, s, (
|
|
942
|
+
...(b = t.configOptions) == null ? void 0 : b.storages,
|
|
943
|
+
library: X(t.libraryURL, s, (y = (p = t.configOptions) == null ? void 0 : p.storages) == null ? void 0 : y.library)
|
|
945
944
|
}
|
|
946
945
|
});
|
|
947
946
|
const i = et(this.getLastJwt(), t == null ? void 0 : t.configOptions);
|
|
948
|
-
this.logger.debug(" checking license..."), this.checkLicense((
|
|
947
|
+
this.logger.debug(" checking license..."), this.checkLicense((L = (P = t == null ? void 0 : t.configOptions) == null ? void 0 : P.license) == null ? void 0 : L.value, (v = (S = t == null ? void 0 : t.configOptions) == null ? void 0 : S.license) == null ? void 0 : v.file);
|
|
949
948
|
const c = [
|
|
950
949
|
`${i.localRoot}/packages`,
|
|
951
950
|
`${i.localRoot}/packages-local`,
|
|
952
951
|
`${i.localRoot}/blocks-local`
|
|
953
952
|
];
|
|
954
953
|
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...");
|
|
955
|
-
for (const
|
|
956
|
-
f.existsSync(
|
|
957
|
-
for (const
|
|
958
|
-
|
|
959
|
-
|
|
954
|
+
for (const k of c)
|
|
955
|
+
f.existsSync(k) || (this.logger.debug(` '${k}'`), f.mkdirSync(k, { recursive: !0 }));
|
|
956
|
+
for (const k of i.core.auth.drivers)
|
|
957
|
+
k.driver === "htpasswd" && (f.existsSync(k.path) || (this.logger.debug(` installing default 'users.htpasswd' to ${k.path}...`), f.copyFileSync(Q("users.htpasswd"), k.path)));
|
|
958
|
+
n || (n = m.join(i.localRoot, "config.yaml"), this.logger.debug(` rendering configuration '${n}'...`), f.writeFileSync(n, rt(i)));
|
|
959
|
+
const o = [];
|
|
960
|
+
return t != null && t.sourcesPath && o.push({
|
|
961
|
+
cmd: "go",
|
|
962
|
+
args: ["build", "-o", r, "."],
|
|
963
|
+
workdir: m.resolve(t.sourcesPath, "cmd", "platforma"),
|
|
964
|
+
runOpts: {
|
|
965
|
+
stdio: "inherit"
|
|
966
|
+
}
|
|
967
|
+
}), o.push({
|
|
968
|
+
async: !0,
|
|
969
|
+
cmd: r,
|
|
970
|
+
args: ["-config", n],
|
|
971
|
+
workdir: s,
|
|
972
|
+
runOpts: { stdio: "inherit" }
|
|
973
|
+
}), u.setInstanceInfo(e, {
|
|
960
974
|
type: "process",
|
|
961
|
-
upCommands:
|
|
962
|
-
{
|
|
963
|
-
async: !0,
|
|
964
|
-
cmd: r,
|
|
965
|
-
args: ["-config", n],
|
|
966
|
-
workdir: s,
|
|
967
|
-
runOpts: { stdio: "inherit" }
|
|
968
|
-
}
|
|
969
|
-
],
|
|
975
|
+
upCommands: o,
|
|
970
976
|
downCommands: [],
|
|
971
977
|
cleanupCommands: [],
|
|
972
978
|
runInfo: {
|
|
@@ -1006,7 +1012,7 @@ ${r}`);
|
|
|
1006
1012
|
createMinio(e, t) {
|
|
1007
1013
|
this.logger.debug(" creating docker compose for minio service...");
|
|
1008
1014
|
const r = Q("compose-backend.yaml"), n = u.instanceDir(e, "compose-minio.yaml");
|
|
1009
|
-
|
|
1015
|
+
Le(
|
|
1010
1016
|
r,
|
|
1011
1017
|
n,
|
|
1012
1018
|
`pl-${e}-minio`,
|
|
@@ -1020,81 +1026,72 @@ ${r}`);
|
|
|
1020
1026
|
const i = (t == null ? void 0 : t.image) ?? `quay.io/minio/minio${s}`;
|
|
1021
1027
|
this.logger.debug(` minio image: ${i}`);
|
|
1022
1028
|
const c = (t == null ? void 0 : t.storage) ?? u.instanceDir(e, "minio");
|
|
1023
|
-
|
|
1024
|
-
const o = (t == null ? void 0 : t.minioPort) ?? 9e3,
|
|
1029
|
+
ke(c, { mode: "0775" });
|
|
1030
|
+
const o = (t == null ? void 0 : t.minioPort) ?? 9e3, g = (t == null ? void 0 : t.minioConsolePort) ?? 9001, d = {
|
|
1025
1031
|
MINIO_IMAGE: i,
|
|
1026
1032
|
MINIO_STORAGE: m.resolve(c),
|
|
1027
1033
|
MINIO_PORT: o.toString(),
|
|
1028
|
-
MINIO_CONSOLE_PORT:
|
|
1034
|
+
MINIO_CONSOLE_PORT: g.toString()
|
|
1029
1035
|
};
|
|
1030
1036
|
return {
|
|
1031
1037
|
start: {
|
|
1032
1038
|
cmd: "docker",
|
|
1033
1039
|
args: ["compose", `--file=${n}`, "up", "--detach", "--remove-orphans", "--pull=missing"],
|
|
1034
|
-
envs:
|
|
1040
|
+
envs: d,
|
|
1035
1041
|
workdir: u.instanceDir(e),
|
|
1036
1042
|
runOpts: { stdio: "inherit" }
|
|
1037
1043
|
},
|
|
1038
1044
|
stop: {
|
|
1039
1045
|
cmd: "docker",
|
|
1040
1046
|
args: ["compose", `--file=${n}`, "down"],
|
|
1041
|
-
envs:
|
|
1047
|
+
envs: d,
|
|
1042
1048
|
workdir: u.instanceDir(e),
|
|
1043
1049
|
runOpts: { stdio: "inherit" }
|
|
1044
1050
|
},
|
|
1045
1051
|
cleanup: {
|
|
1046
1052
|
cmd: "docker",
|
|
1047
1053
|
args: ["compose", `--file=${n}`, "down", "--volumes", "--remove-orphans"],
|
|
1048
|
-
envs:
|
|
1054
|
+
envs: d,
|
|
1049
1055
|
workdir: u.instanceDir(e),
|
|
1050
1056
|
runOpts: { stdio: "inherit" }
|
|
1051
1057
|
}
|
|
1052
1058
|
};
|
|
1053
1059
|
}
|
|
1054
|
-
buildPlatforma(e) {
|
|
1055
|
-
const t = m.resolve(e.repoRoot, "cmd", "platforma"), r = e.binPath ?? m.join(F.tmpdir(), "platforma-local-build");
|
|
1056
|
-
this.logger.info("Building Platforma Backend binary from sources"), this.logger.info(` sources path: ${e.repoRoot}`), this.logger.info(` binary path: ${r}`);
|
|
1057
|
-
const n = mr("go", ["build", "-o", r, "."], {
|
|
1058
|
-
cwd: t,
|
|
1059
|
-
stdio: "inherit"
|
|
1060
|
-
});
|
|
1061
|
-
return ue([n], "failed to build platforma binary from sources using 'go build' command"), r;
|
|
1062
|
-
}
|
|
1063
1060
|
createDockerS3(e, t, r) {
|
|
1064
1061
|
this.logger.debug("creating platforma instance in 'docker s3' mode...");
|
|
1065
1062
|
const n = Q("compose-backend.yaml"), s = (r == null ? void 0 : r.image) ?? gr(r == null ? void 0 : r.version);
|
|
1066
1063
|
this.checkLicense(r == null ? void 0 : r.license, r == null ? void 0 : r.licenseFile);
|
|
1067
|
-
const i = (...
|
|
1068
|
-
const
|
|
1069
|
-
return
|
|
1064
|
+
const i = (...v) => m.join(t, ...v), c = (v) => {
|
|
1065
|
+
const k = i(v);
|
|
1066
|
+
return ke(k, { mode: "0775" }), k;
|
|
1070
1067
|
}, o = i("logs", "platforma.log");
|
|
1071
1068
|
f.existsSync(o) || (f.mkdirSync(m.dirname(o), { recursive: !0 }), f.writeFileSync(o, ""));
|
|
1072
|
-
const
|
|
1073
|
-
if (
|
|
1069
|
+
const g = (r == null ? void 0 : r.presignHost) ?? "localhost", d = X("s3e://testuser:testpassword@minio:9000/main-bucket");
|
|
1070
|
+
if (d.type !== "S3")
|
|
1074
1071
|
throw new Error("primary storage must have 'S3' type in 'docker s3' configuration");
|
|
1075
|
-
|
|
1072
|
+
d.presignEndpoint = `http://${g}:9000`;
|
|
1076
1073
|
const h = X("s3e://testuser:testpassword@minio:9000/library-bucket");
|
|
1077
1074
|
if (h.type !== "S3")
|
|
1078
1075
|
throw new Error(`${h.type} storage type is not supported for library storage`);
|
|
1079
|
-
h.presignEndpoint = `http://${
|
|
1080
|
-
const b = c("db"),
|
|
1076
|
+
h.presignEndpoint = `http://${g}:9000`;
|
|
1077
|
+
const b = c("db"), p = c("work"), y = i("users.htpasswd");
|
|
1081
1078
|
f.existsSync(y) || f.copyFileSync(Q("users.htpasswd"), y);
|
|
1082
1079
|
const P = i("compose.yaml");
|
|
1083
1080
|
f.existsSync(P) && this.logger.info(`replacing docker compose file ${P}`);
|
|
1084
|
-
const
|
|
1085
|
-
for (const
|
|
1086
|
-
|
|
1087
|
-
hostPath:
|
|
1088
|
-
containerPath:
|
|
1081
|
+
const L = [];
|
|
1082
|
+
for (const v of (r == null ? void 0 : r.customMounts) ?? [])
|
|
1083
|
+
L.push({
|
|
1084
|
+
hostPath: v.hostPath,
|
|
1085
|
+
containerPath: v.containerPath ?? v.hostPath
|
|
1089
1086
|
});
|
|
1090
|
-
|
|
1087
|
+
Le(n, P, `pl-${e}`, /* @__PURE__ */ new Map([
|
|
1091
1088
|
["minio", {}],
|
|
1092
1089
|
["backend", {
|
|
1093
1090
|
platform: r == null ? void 0 : r.platformOverride,
|
|
1094
|
-
mounts:
|
|
1091
|
+
mounts: L
|
|
1095
1092
|
}]
|
|
1096
1093
|
]));
|
|
1097
|
-
const
|
|
1094
|
+
const S = {
|
|
1098
1095
|
MINIO_IMAGE: "quay.io/minio/minio",
|
|
1099
1096
|
MINIO_STORAGE: c("minio"),
|
|
1100
1097
|
PL_IMAGE: s,
|
|
@@ -1108,43 +1105,43 @@ ${r}`);
|
|
|
1108
1105
|
PL_DATA_DB_ROOT: b,
|
|
1109
1106
|
PL_DATA_PRIMARY_ROOT: c("primary"),
|
|
1110
1107
|
PL_DATA_LIBRARY_ROOT: c("library"),
|
|
1111
|
-
PL_DATA_WORKDIR_ROOT:
|
|
1108
|
+
PL_DATA_WORKDIR_ROOT: p,
|
|
1112
1109
|
// Mount packages storage as volume, because APFS is case-insensitive on Mac OS X and this breaks some pl software installation.
|
|
1113
1110
|
// PL_DATA_PACKAGE_ROOT: storageDir('packages'),
|
|
1114
|
-
...this.configureDockerStorage("primary",
|
|
1111
|
+
...this.configureDockerStorage("primary", d),
|
|
1115
1112
|
...this.configureDockerStorage("library", h)
|
|
1116
1113
|
};
|
|
1117
|
-
if (r != null && r.grpcAddr && (
|
|
1118
|
-
for (const
|
|
1119
|
-
|
|
1120
|
-
|
|
1114
|
+
if (r != null && r.grpcAddr && (S.PL_GRPC_ADDR = r.grpcAddr), r != null && r.grpcPort && (S.PL_GRPC_PORT = r.grpcPort.toString()), r != null && r.monitoringAddr && (S.PL_MONITORING_ADDR = r.monitoringAddr), r != null && r.monitoringPort && (S.PL_MONITORING_PORT = r.monitoringPort.toString()), r != null && r.debugAddr && (S.PL_DEBUG_ADDR = r.debugAddr), r != null && r.debugPort && (S.PL_DEBUG_PORT = r.debugPort.toString()), r != null && r.auth && (r.auth.enabled && (S.PL_AUTH_ENABLED = "true"), r.auth.drivers)) {
|
|
1115
|
+
for (const v of r.auth.drivers)
|
|
1116
|
+
v.driver === "htpasswd" && (S.PL_AUTH_HTPASSWD_PATH = m.resolve(v.path), v.path = "/etc/platforma/users.htpasswd");
|
|
1117
|
+
S.PL_AUTH_DRIVERS = JSON.stringify(r.auth.drivers);
|
|
1121
1118
|
}
|
|
1122
1119
|
return u.setInstanceInfo(e, {
|
|
1123
1120
|
type: "docker",
|
|
1124
1121
|
upCommands: [{
|
|
1125
1122
|
cmd: "docker",
|
|
1126
1123
|
args: ["compose", `--file=${P}`, "up", "--detach", "--remove-orphans", "--pull=missing"],
|
|
1127
|
-
envs:
|
|
1124
|
+
envs: S,
|
|
1128
1125
|
runOpts: { stdio: "inherit" }
|
|
1129
1126
|
}],
|
|
1130
1127
|
downCommands: [{
|
|
1131
1128
|
cmd: "docker",
|
|
1132
1129
|
args: ["compose", `--file=${P}`, "down"],
|
|
1133
|
-
envs:
|
|
1130
|
+
envs: S,
|
|
1134
1131
|
runOpts: { stdio: "inherit" }
|
|
1135
1132
|
}],
|
|
1136
1133
|
cleanupCommands: [{
|
|
1137
1134
|
cmd: "docker",
|
|
1138
1135
|
args: ["compose", `--file=${P}`, "down", "--volumes", "--remove-orphans"],
|
|
1139
|
-
envs:
|
|
1136
|
+
envs: S,
|
|
1140
1137
|
runOpts: { stdio: "inherit" }
|
|
1141
1138
|
}],
|
|
1142
1139
|
runInfo: {
|
|
1143
1140
|
apiPort: r == null ? void 0 : r.grpcPort,
|
|
1144
1141
|
apiAddr: r == null ? void 0 : r.grpcAddr,
|
|
1145
1142
|
logPath: o,
|
|
1146
|
-
primary:
|
|
1147
|
-
work: { type: "FS", rootPath:
|
|
1143
|
+
primary: d,
|
|
1144
|
+
work: { type: "FS", rootPath: p },
|
|
1148
1145
|
library: h,
|
|
1149
1146
|
dbPath: b
|
|
1150
1147
|
}
|
|
@@ -1154,77 +1151,77 @@ ${r}`);
|
|
|
1154
1151
|
this.logger.debug("creating platforma instance in 'docker' mode...");
|
|
1155
1152
|
const n = Q("compose-backend.yaml"), s = (r == null ? void 0 : r.image) ?? gr(r == null ? void 0 : r.version);
|
|
1156
1153
|
this.checkLicense(r == null ? void 0 : r.license, r == null ? void 0 : r.licenseFile);
|
|
1157
|
-
const i = (
|
|
1158
|
-
const le = i(
|
|
1159
|
-
return
|
|
1154
|
+
const i = (...k) => m.join(t, ...k), c = (k) => {
|
|
1155
|
+
const le = i(k);
|
|
1156
|
+
return ke(le, { mode: "0775" }), le;
|
|
1160
1157
|
}, o = i("logs", "platforma.log");
|
|
1161
1158
|
f.existsSync(o) || (f.mkdirSync(m.dirname(o), { recursive: !0 }), f.writeFileSync(o, ""));
|
|
1162
|
-
const
|
|
1163
|
-
f.existsSync(
|
|
1159
|
+
const g = c("db"), d = c("primary"), h = c("library"), b = c("work"), p = i("users.htpasswd");
|
|
1160
|
+
f.existsSync(p) || f.copyFileSync(Q("users.htpasswd"), p);
|
|
1164
1161
|
const y = i("compose.yaml");
|
|
1165
1162
|
f.existsSync(y) && this.logger.info(`replacing docker compose file ${y}`);
|
|
1166
1163
|
const P = [];
|
|
1167
|
-
for (const
|
|
1164
|
+
for (const k of (r == null ? void 0 : r.customMounts) ?? [])
|
|
1168
1165
|
P.push({
|
|
1169
|
-
hostPath:
|
|
1170
|
-
containerPath:
|
|
1166
|
+
hostPath: k.hostPath,
|
|
1167
|
+
containerPath: k.containerPath ?? k.hostPath
|
|
1171
1168
|
});
|
|
1172
|
-
this.logger.debug(`Rendering docker compose file '${y}' using '${n}' as base template`),
|
|
1169
|
+
this.logger.debug(`Rendering docker compose file '${y}' using '${n}' as base template`), Le(n, y, `pl-${e}`, /* @__PURE__ */ new Map([
|
|
1173
1170
|
["backend", {
|
|
1174
1171
|
platform: r == null ? void 0 : r.platformOverride,
|
|
1175
1172
|
mounts: P
|
|
1176
1173
|
}]
|
|
1177
1174
|
]));
|
|
1178
|
-
const
|
|
1175
|
+
const L = X((r == null ? void 0 : r.primaryStorageURL) ?? `file:${d}`, "."), S = X((r == null ? void 0 : r.libraryStorageURL) ?? `file:${h}`, "."), v = {
|
|
1179
1176
|
PL_IMAGE: s,
|
|
1180
|
-
PL_AUTH_HTPASSWD_PATH:
|
|
1177
|
+
PL_AUTH_HTPASSWD_PATH: p,
|
|
1181
1178
|
PL_LICENSE: r == null ? void 0 : r.license,
|
|
1182
1179
|
PL_LICENSE_FILE: r == null ? void 0 : r.licenseFile,
|
|
1183
1180
|
PL_LOG_LEVEL: "info",
|
|
1184
1181
|
PL_LOG_DIR: m.dirname(o),
|
|
1185
1182
|
PL_LOG_ROTATION_ENABLED: "true",
|
|
1186
1183
|
PL_RUNNER_WD_CACHE_ON_FAILURE: "1h",
|
|
1187
|
-
PL_DATA_DB_ROOT:
|
|
1188
|
-
PL_DATA_PRIMARY_ROOT:
|
|
1184
|
+
PL_DATA_DB_ROOT: g,
|
|
1185
|
+
PL_DATA_PRIMARY_ROOT: d,
|
|
1189
1186
|
PL_DATA_LIBRARY_ROOT: h,
|
|
1190
1187
|
PL_DATA_WORKDIR_ROOT: b,
|
|
1191
1188
|
PL_DATA_PACKAGE_ROOT: c("packages"),
|
|
1192
|
-
...this.configureDockerStorage("primary",
|
|
1193
|
-
...this.configureDockerStorage("library",
|
|
1189
|
+
...this.configureDockerStorage("primary", L),
|
|
1190
|
+
...this.configureDockerStorage("library", S)
|
|
1194
1191
|
};
|
|
1195
|
-
if (r != null && r.grpcAddr && (
|
|
1196
|
-
for (const
|
|
1197
|
-
|
|
1198
|
-
|
|
1192
|
+
if (r != null && r.grpcAddr && (v.PL_GRPC_ADDR = r.grpcAddr), r != null && r.grpcPort && (v.PL_GRPC_PORT = r.grpcPort.toString()), r != null && r.monitoringAddr && (v.PL_MONITORING_ADDR = r.monitoringAddr), r != null && r.monitoringPort && (v.PL_MONITORING_PORT = r.monitoringPort.toString()), r != null && r.debugAddr && (v.PL_DEBUG_ADDR = r.debugAddr), r != null && r.debugPort && (v.PL_DEBUG_PORT = r.debugPort.toString()), r != null && r.auth && (r.auth.enabled && (v.PL_AUTH_ENABLED = "true"), r.auth.drivers)) {
|
|
1193
|
+
for (const k of r.auth.drivers)
|
|
1194
|
+
k.driver === "htpasswd" && (v.PL_AUTH_HTPASSWD_PATH = m.resolve(k.path), k.path = "/etc/platforma/users.htpasswd");
|
|
1195
|
+
v.PL_AUTH_DRIVERS = JSON.stringify(r.auth.drivers);
|
|
1199
1196
|
}
|
|
1200
1197
|
return u.setInstanceInfo(e, {
|
|
1201
1198
|
type: "docker",
|
|
1202
1199
|
upCommands: [{
|
|
1203
1200
|
cmd: "docker",
|
|
1204
1201
|
args: ["compose", `--file=${y}`, "up", "--detach", "--remove-orphans", "--pull=missing"],
|
|
1205
|
-
envs:
|
|
1202
|
+
envs: v,
|
|
1206
1203
|
runOpts: { stdio: "inherit" }
|
|
1207
1204
|
}],
|
|
1208
1205
|
downCommands: [{
|
|
1209
1206
|
cmd: "docker",
|
|
1210
1207
|
args: ["compose", `--file=${y}`, "down"],
|
|
1211
|
-
envs:
|
|
1208
|
+
envs: v,
|
|
1212
1209
|
runOpts: { stdio: "inherit" }
|
|
1213
1210
|
}],
|
|
1214
1211
|
cleanupCommands: [{
|
|
1215
1212
|
cmd: "docker",
|
|
1216
1213
|
args: ["compose", `--file=${y}`, "down", "--volumes", "--remove-orphans"],
|
|
1217
|
-
envs:
|
|
1214
|
+
envs: v,
|
|
1218
1215
|
runOpts: { stdio: "inherit" }
|
|
1219
1216
|
}],
|
|
1220
1217
|
runInfo: {
|
|
1221
1218
|
apiPort: r == null ? void 0 : r.grpcPort,
|
|
1222
1219
|
apiAddr: r == null ? void 0 : r.grpcAddr,
|
|
1223
1220
|
logPath: o,
|
|
1224
|
-
primary:
|
|
1221
|
+
primary: L,
|
|
1225
1222
|
work: { type: "FS", rootPath: b },
|
|
1226
|
-
library:
|
|
1227
|
-
dbPath:
|
|
1223
|
+
library: S,
|
|
1224
|
+
dbPath: g
|
|
1228
1225
|
}
|
|
1229
1226
|
}), u.getInstanceInfo(e);
|
|
1230
1227
|
}
|
|
@@ -1271,8 +1268,8 @@ You are going to reset the state of all platforma services configured with pl-bo
|
|
|
1271
1268
|
for (const [s, i] of r.entries()) {
|
|
1272
1269
|
if (i.cleanupCommands.length) {
|
|
1273
1270
|
this.logger.info(`Wiping instance ${s} services`);
|
|
1274
|
-
const c =
|
|
1275
|
-
|
|
1271
|
+
const c = $e(this.logger, i.cleanupCommands);
|
|
1272
|
+
Ae(c.executed, `failed to wipe instance ${s} services`);
|
|
1276
1273
|
}
|
|
1277
1274
|
this.logger.info(`Destroying instance '${s}' data directory`), f.rmSync(u.instanceDir(s), { recursive: !0, force: !0 });
|
|
1278
1275
|
}
|
|
@@ -1283,7 +1280,7 @@ If you want to remove all downloaded platforma binaries, delete '${u.binaries()}
|
|
|
1283
1280
|
);
|
|
1284
1281
|
}
|
|
1285
1282
|
mergeLicenseEnvs(e) {
|
|
1286
|
-
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(
|
|
1283
|
+
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(D.homedir(), ".pl.license")) && (e["license-file"] = m.resolve(D.homedir(), ".pl.license")));
|
|
1287
1284
|
}
|
|
1288
1285
|
initAuthDriversList(e, t) {
|
|
1289
1286
|
const r = [];
|
|
@@ -1333,7 +1330,7 @@ You can obtain the license from "https://licensing.milaboratories.com".`), new E
|
|
|
1333
1330
|
}
|
|
1334
1331
|
renderRunInfo(e, t = 10) {
|
|
1335
1332
|
var c, o;
|
|
1336
|
-
const r = [], n = (
|
|
1333
|
+
const r = [], n = (g) => g.padStart(t, " ");
|
|
1337
1334
|
switch (e.configPath && r.push(`${n("config")}: ${e.configPath}`), e.apiAddr ? r.push(`${n("API")}: ${e.apiAddr}`) : e.apiPort ? r.push(`${n("API")}: 127.0.0.1:${e.apiPort.toString()}`) : r.push(`${n("API")}: 127.0.0.1:6345`), e.logPath && r.push(`${n("log")}: ${e.logPath}`), (c = e.primary) == null ? void 0 : c.type) {
|
|
1338
1335
|
case void 0:
|
|
1339
1336
|
break;
|
|
@@ -1366,7 +1363,7 @@ You can obtain the license from "https://licensing.milaboratories.com".`), new E
|
|
|
1366
1363
|
`);
|
|
1367
1364
|
}
|
|
1368
1365
|
}
|
|
1369
|
-
function
|
|
1366
|
+
function Ae(a, e) {
|
|
1370
1367
|
for (const t of a) {
|
|
1371
1368
|
if (t.error)
|
|
1372
1369
|
throw t.error;
|
|
@@ -1375,7 +1372,7 @@ function ue(a, e) {
|
|
|
1375
1372
|
throw new Error(`${r}, process exited with code '${t.status}'`);
|
|
1376
1373
|
}
|
|
1377
1374
|
}
|
|
1378
|
-
const te = class te extends
|
|
1375
|
+
const te = class te extends $ {
|
|
1379
1376
|
async run() {
|
|
1380
1377
|
const { flags: e } = await this.parse(te), t = I(e["log-level"]);
|
|
1381
1378
|
new O(t).cleanupInstance();
|
|
@@ -1385,7 +1382,7 @@ l(te, "description", "Clear service state (forget last run command, destroy dock
|
|
|
1385
1382
|
...A
|
|
1386
1383
|
});
|
|
1387
1384
|
let Te = te;
|
|
1388
|
-
const ae = class ae extends
|
|
1385
|
+
const ae = class ae extends $ {
|
|
1389
1386
|
async run() {
|
|
1390
1387
|
const { flags: e } = await this.parse(ae), t = I(e["log-level"]);
|
|
1391
1388
|
new O(t).startLast();
|
|
@@ -1395,7 +1392,7 @@ l(ae, "description", "Start last run service configuraiton"), l(ae, "examples",
|
|
|
1395
1392
|
...A
|
|
1396
1393
|
});
|
|
1397
1394
|
let xe = ae;
|
|
1398
|
-
const ne = class ne extends
|
|
1395
|
+
const ne = class ne extends $ {
|
|
1399
1396
|
async run() {
|
|
1400
1397
|
const { flags: e } = await this.parse(ne), t = I(e["log-level"]), r = new O(t);
|
|
1401
1398
|
u.currentInstance ? r.stopInstance(u.currentInstance) : t.warn("up/start command was not called for any instance, nothing to stop");
|
|
@@ -1404,11 +1401,11 @@ const ne = class ne extends L {
|
|
|
1404
1401
|
l(ne, "description", "Stop platforma service"), l(ne, "examples", ["<%= config.bin %> <%= command.id %>"]), l(ne, "flags", {
|
|
1405
1402
|
...A
|
|
1406
1403
|
});
|
|
1407
|
-
let
|
|
1408
|
-
var
|
|
1409
|
-
let lt = (
|
|
1404
|
+
let Fe = ne;
|
|
1405
|
+
var R;
|
|
1406
|
+
let lt = (R = class extends $ {
|
|
1410
1407
|
async run() {
|
|
1411
|
-
const { flags: e } = await this.parse(
|
|
1408
|
+
const { flags: e } = await this.parse(R), t = I(e["log-level"]), r = new O(t);
|
|
1412
1409
|
r.mergeLicenseEnvs(e);
|
|
1413
1410
|
const n = "docker", s = e["auth-enabled"], i = s ? {
|
|
1414
1411
|
enabled: s,
|
|
@@ -1416,13 +1413,13 @@ let lt = (E = class extends L {
|
|
|
1416
1413
|
} : void 0, c = e.storage ? m.join(".", e.storage) : u.instanceDir(n), o = [];
|
|
1417
1414
|
for (const h of e.mount ?? [])
|
|
1418
1415
|
o.push({ hostPath: h });
|
|
1419
|
-
const
|
|
1416
|
+
const g = e.arch ? `linux/${e.arch}` : void 0, d = r.createDocker(n, c, {
|
|
1420
1417
|
primaryStorageURL: e["storage-primary"],
|
|
1421
1418
|
workStoragePath: e["storage-work"],
|
|
1422
1419
|
libraryStorageURL: e["storage-library"],
|
|
1423
1420
|
image: e.image,
|
|
1424
1421
|
version: e.version,
|
|
1425
|
-
platformOverride:
|
|
1422
|
+
platformOverride: g,
|
|
1426
1423
|
customMounts: o,
|
|
1427
1424
|
license: e.license,
|
|
1428
1425
|
licenseFile: e["license-file"],
|
|
@@ -1434,83 +1431,82 @@ let lt = (E = class extends L {
|
|
|
1434
1431
|
debugAddr: e["debug-listen"],
|
|
1435
1432
|
debugPort: e["debug-port"]
|
|
1436
1433
|
});
|
|
1437
|
-
r.switchInstance(
|
|
1434
|
+
r.switchInstance(d);
|
|
1438
1435
|
}
|
|
1439
|
-
}, l(
|
|
1436
|
+
}, l(R, "description", "Run platforma backend service with 'FS' primary storage type"), l(R, "examples", ["<%= config.bin %> <%= command.id %>"]), l(R, "flags", {
|
|
1440
1437
|
...A,
|
|
1441
1438
|
...j,
|
|
1442
|
-
...
|
|
1439
|
+
...fe,
|
|
1443
1440
|
...C,
|
|
1444
|
-
...
|
|
1441
|
+
...me,
|
|
1445
1442
|
...U,
|
|
1446
1443
|
...M,
|
|
1447
|
-
...
|
|
1444
|
+
...he,
|
|
1448
1445
|
...B,
|
|
1449
1446
|
...ce,
|
|
1450
1447
|
...ie,
|
|
1451
1448
|
...oe
|
|
1452
|
-
}),
|
|
1449
|
+
}), R);
|
|
1453
1450
|
var T;
|
|
1454
|
-
let dt = (T = class extends
|
|
1451
|
+
let dt = (T = class extends $ {
|
|
1455
1452
|
async run() {
|
|
1456
1453
|
const { flags: e } = await this.parse(T), t = I(e["log-level"]), r = new O(t);
|
|
1457
1454
|
r.mergeLicenseEnvs(e);
|
|
1458
|
-
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),
|
|
1459
|
-
let
|
|
1460
|
-
e["
|
|
1461
|
-
let h = "127.0.0.1:
|
|
1462
|
-
e["
|
|
1463
|
-
let b = "127.0.0.1:
|
|
1464
|
-
e["
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
binaryPath: g,
|
|
1455
|
+
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), g = e["auth-enabled"] ?? o !== void 0;
|
|
1456
|
+
let d = "127.0.0.1:6345";
|
|
1457
|
+
e["grpc-listen"] ? d = e["grpc-listen"] : e["grpc-port"] && (d = `127.0.0.1:${e["grpc-port"]}`);
|
|
1458
|
+
let h = "127.0.0.1:9090";
|
|
1459
|
+
e["monitoring-listen"] ? h = e["monitoring-listen"] : e["monitoring-port"] && (h = `127.0.0.1:${e["monitoring-port"]}`);
|
|
1460
|
+
let b = "127.0.0.1:9091";
|
|
1461
|
+
e["debug-listen"] ? b = e["debug-listen"] : e["debug-port"] && (b = `127.0.0.1:${e["debug-port"]}`);
|
|
1462
|
+
const p = {
|
|
1463
|
+
sourcesPath: e["pl-sources"],
|
|
1464
|
+
binaryPath: e["pl-binary"],
|
|
1469
1465
|
version: e.version,
|
|
1470
1466
|
configPath: e.config,
|
|
1471
1467
|
workdir: e["pl-workdir"],
|
|
1472
1468
|
primaryURL: e["storage-primary"],
|
|
1473
1469
|
libraryURL: e["storage-library"],
|
|
1474
1470
|
configOptions: {
|
|
1475
|
-
grpc: { listen:
|
|
1476
|
-
monitoring: { listen:
|
|
1477
|
-
debug: { listen:
|
|
1471
|
+
grpc: { listen: d },
|
|
1472
|
+
monitoring: { listen: h },
|
|
1473
|
+
debug: { listen: b },
|
|
1478
1474
|
license: { value: e.license, file: e["license-file"] },
|
|
1479
1475
|
log: { path: c },
|
|
1480
1476
|
localRoot: i,
|
|
1481
|
-
core: { auth: { enabled:
|
|
1477
|
+
core: { auth: { enabled: g, drivers: o } },
|
|
1482
1478
|
storages: {
|
|
1483
1479
|
work: { type: "FS", rootPath: e["storage-work"] }
|
|
1484
1480
|
}
|
|
1485
1481
|
}
|
|
1486
|
-
},
|
|
1487
|
-
|
|
1488
|
-
const
|
|
1482
|
+
}, y = r.createLocal(n, p);
|
|
1483
|
+
p.binaryPath || p.sourcesPath ? r.switchInstance(y) : Pe(t, { version: e.version }).then(() => {
|
|
1484
|
+
const P = r.switchInstance(y);
|
|
1489
1485
|
setTimeout(() => {
|
|
1490
|
-
for (const
|
|
1491
|
-
|
|
1486
|
+
for (const L of P)
|
|
1487
|
+
L.unref();
|
|
1492
1488
|
}, 1e3);
|
|
1493
|
-
}).catch(function(
|
|
1494
|
-
t.error(
|
|
1489
|
+
}).catch(function(P) {
|
|
1490
|
+
t.error(P.message);
|
|
1495
1491
|
});
|
|
1496
1492
|
}
|
|
1497
1493
|
}, 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", {
|
|
1498
1494
|
...A,
|
|
1499
1495
|
...C,
|
|
1500
1496
|
...j,
|
|
1497
|
+
...pe,
|
|
1501
1498
|
...we,
|
|
1502
1499
|
...ve,
|
|
1503
|
-
...Pe,
|
|
1504
1500
|
...M,
|
|
1505
1501
|
...B,
|
|
1506
1502
|
...ce,
|
|
1507
1503
|
...ie,
|
|
1508
1504
|
...oe,
|
|
1509
|
-
...
|
|
1505
|
+
...ye,
|
|
1510
1506
|
...be,
|
|
1511
1507
|
...U
|
|
1512
1508
|
}), T);
|
|
1513
|
-
const H = class H extends
|
|
1509
|
+
const H = class H extends $ {
|
|
1514
1510
|
async run() {
|
|
1515
1511
|
const { flags: e, args: t } = await this.parse(H), r = I(e["log-level"]), n = new O(r), s = t.name;
|
|
1516
1512
|
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);
|
|
@@ -1518,15 +1514,15 @@ const H = class H extends L {
|
|
|
1518
1514
|
};
|
|
1519
1515
|
l(H, "description", "List available instances"), l(H, "examples", ["<%= config.bin %> <%= command.id %>"]), l(H, "flags", {
|
|
1520
1516
|
...A,
|
|
1521
|
-
all:
|
|
1517
|
+
all: w.boolean({
|
|
1522
1518
|
description: "remove all known instances",
|
|
1523
1519
|
required: !1
|
|
1524
1520
|
})
|
|
1525
1521
|
}), l(H, "args", {
|
|
1526
1522
|
name: K.string({ required: !1 })
|
|
1527
1523
|
});
|
|
1528
|
-
let
|
|
1529
|
-
const W = class W extends
|
|
1524
|
+
let De = H;
|
|
1525
|
+
const W = class W extends $ {
|
|
1530
1526
|
async run() {
|
|
1531
1527
|
const { flags: e, args: t } = await this.parse(W), r = I(e["log-level"]), n = new O(r), s = t.name ?? u.currentInstanceName;
|
|
1532
1528
|
s || (r.info("no pl service instance selected. No service was stopped"), process.exit(0)), n.stopInstance(u.getInstanceInfo(s));
|
|
@@ -1538,7 +1534,7 @@ l(W, "description", "List available instances"), l(W, "examples", ["<%= config.b
|
|
|
1538
1534
|
name: K.string({ required: !1 })
|
|
1539
1535
|
});
|
|
1540
1536
|
let Ne = W;
|
|
1541
|
-
const se = class se extends
|
|
1537
|
+
const se = class se extends $ {
|
|
1542
1538
|
async run() {
|
|
1543
1539
|
await this.parse(se);
|
|
1544
1540
|
const e = u.instanceList, t = u.currentInstanceName;
|
|
@@ -1550,14 +1546,14 @@ const se = class se extends L {
|
|
|
1550
1546
|
};
|
|
1551
1547
|
l(se, "description", "List available instances"), l(se, "examples", ["<%= config.bin %> <%= command.id %>"]), l(se, "flags", {});
|
|
1552
1548
|
let _e = se;
|
|
1553
|
-
const q = class q extends
|
|
1549
|
+
const q = class q extends $ {
|
|
1554
1550
|
async run() {
|
|
1555
1551
|
const { flags: e, args: t } = await this.parse(q), r = I(e["log-level"]), n = new O(r), s = t.name ?? u.currentInstanceName;
|
|
1556
1552
|
s || (r.error("no pl service instance is selected. Select instance with 'select' command or provide name to 'up'"), process.exit(1));
|
|
1557
1553
|
const i = n.switchInstance(u.getInstanceInfo(s)), c = [];
|
|
1558
1554
|
for (const o of i)
|
|
1559
|
-
c.push(new Promise((
|
|
1560
|
-
o.on("close",
|
|
1555
|
+
c.push(new Promise((g, d) => {
|
|
1556
|
+
o.on("close", g), o.on("error", d);
|
|
1561
1557
|
}));
|
|
1562
1558
|
await Promise.all(c);
|
|
1563
1559
|
}
|
|
@@ -1569,7 +1565,7 @@ l(q, "description", "List available instances"), l(q, "examples", ["<%= config.b
|
|
|
1569
1565
|
});
|
|
1570
1566
|
let Ce = q;
|
|
1571
1567
|
var x;
|
|
1572
|
-
let gt = (x = class extends
|
|
1568
|
+
let gt = (x = class extends $ {
|
|
1573
1569
|
async run() {
|
|
1574
1570
|
const { flags: e } = await this.parse(x), t = I(e["log-level"]), r = new O(t);
|
|
1575
1571
|
r.mergeLicenseEnvs(e);
|
|
@@ -1579,12 +1575,12 @@ let gt = (x = class extends L {
|
|
|
1579
1575
|
} : void 0, c = e.storage ? m.join(".", e.storage) : u.instanceDir(n), o = [];
|
|
1580
1576
|
for (const b of e.mount ?? [])
|
|
1581
1577
|
o.push({ hostPath: b });
|
|
1582
|
-
const
|
|
1578
|
+
const g = e.arch ? `linux/${e.arch}` : void 0, d = e["minio-presign-host"] ? "minio" : "localhost", h = r.createDockerS3(n, c, {
|
|
1583
1579
|
image: e.image,
|
|
1584
1580
|
version: e.version,
|
|
1585
1581
|
license: e.license,
|
|
1586
1582
|
licenseFile: e["license-file"],
|
|
1587
|
-
platformOverride:
|
|
1583
|
+
platformOverride: g,
|
|
1588
1584
|
customMounts: o,
|
|
1589
1585
|
auth: i,
|
|
1590
1586
|
grpcAddr: e["grpc-listen"],
|
|
@@ -1593,38 +1589,37 @@ let gt = (x = class extends L {
|
|
|
1593
1589
|
monitoringPort: e["monitoring-port"],
|
|
1594
1590
|
debugAddr: e["debug-listen"],
|
|
1595
1591
|
debugPort: e["debug-port"],
|
|
1596
|
-
presignHost:
|
|
1592
|
+
presignHost: d
|
|
1597
1593
|
});
|
|
1598
1594
|
r.switchInstance(h);
|
|
1599
1595
|
}
|
|
1600
1596
|
}, l(x, "description", "Run platforma backend service with 'S3' primary storage type"), l(x, "examples", ["<%= config.bin %> <%= command.id %>"]), l(x, "flags", {
|
|
1601
1597
|
...A,
|
|
1602
1598
|
...j,
|
|
1603
|
-
...
|
|
1599
|
+
...fe,
|
|
1604
1600
|
...C,
|
|
1605
|
-
...
|
|
1601
|
+
...me,
|
|
1606
1602
|
...U,
|
|
1607
1603
|
...M,
|
|
1608
|
-
...
|
|
1604
|
+
...he,
|
|
1609
1605
|
...B,
|
|
1610
|
-
...
|
|
1606
|
+
...hr
|
|
1611
1607
|
}), x);
|
|
1612
|
-
var
|
|
1613
|
-
let ut = (
|
|
1608
|
+
var F;
|
|
1609
|
+
let ut = (F = class extends $ {
|
|
1614
1610
|
async run() {
|
|
1615
|
-
const { flags: e } = await this.parse(
|
|
1611
|
+
const { flags: e } = await this.parse(F), t = I(e["log-level"]), r = new O(t);
|
|
1616
1612
|
r.mergeLicenseEnvs(e);
|
|
1617
|
-
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),
|
|
1618
|
-
let
|
|
1619
|
-
e["
|
|
1620
|
-
let h = "127.0.0.1:
|
|
1621
|
-
e["
|
|
1622
|
-
let b = "127.0.0.1:
|
|
1623
|
-
e["
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
binaryPath: g,
|
|
1613
|
+
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), g = e["auth-enabled"] ?? o !== void 0;
|
|
1614
|
+
let d = "127.0.0.1:6345";
|
|
1615
|
+
e["grpc-listen"] ? d = e["grpc-listen"] : e["grpc-port"] && (d = `127.0.0.1:${e["grpc-port"]}`);
|
|
1616
|
+
let h = "127.0.0.1:9090";
|
|
1617
|
+
e["monitoring-listen"] ? h = e["monitoring-listen"] : e["monitoring-port"] && (h = `127.0.0.1:${e["monitoring-port"]}`);
|
|
1618
|
+
let b = "127.0.0.1:9091";
|
|
1619
|
+
e["debug-listen"] ? b = e["debug-listen"] : e["debug-port"] && (b = `127.0.0.1:${e["debug-port"]}`);
|
|
1620
|
+
const p = {
|
|
1621
|
+
sourcesPath: e["pl-sources"],
|
|
1622
|
+
binaryPath: e["pl-binary"],
|
|
1628
1623
|
version: e.version,
|
|
1629
1624
|
configPath: e.config,
|
|
1630
1625
|
workdir: e["pl-workdir"],
|
|
@@ -1633,66 +1628,66 @@ let ut = (D = class extends L {
|
|
|
1633
1628
|
minioPort: e["s3-port"],
|
|
1634
1629
|
minioConsolePort: e["s3-console-port"],
|
|
1635
1630
|
configOptions: {
|
|
1636
|
-
grpc: { listen:
|
|
1637
|
-
monitoring: { listen:
|
|
1638
|
-
debug: { listen:
|
|
1631
|
+
grpc: { listen: d },
|
|
1632
|
+
monitoring: { listen: h },
|
|
1633
|
+
debug: { listen: b },
|
|
1639
1634
|
license: { value: e.license, file: e["license-file"] },
|
|
1640
1635
|
log: { path: c },
|
|
1641
1636
|
localRoot: i,
|
|
1642
1637
|
core: {
|
|
1643
|
-
auth: { enabled:
|
|
1638
|
+
auth: { enabled: g, drivers: o }
|
|
1644
1639
|
},
|
|
1645
1640
|
storages: {
|
|
1646
1641
|
work: { type: "FS", rootPath: e["storage-work"] }
|
|
1647
1642
|
}
|
|
1648
1643
|
}
|
|
1649
|
-
},
|
|
1650
|
-
|
|
1651
|
-
const
|
|
1644
|
+
}, y = r.createLocalS3(n, p);
|
|
1645
|
+
p.binaryPath || p.sourcesPath ? r.switchInstance(y) : Pe(t, { version: e.version }).then(() => {
|
|
1646
|
+
const P = r.switchInstance(y);
|
|
1652
1647
|
setTimeout(() => {
|
|
1653
|
-
for (const
|
|
1654
|
-
|
|
1648
|
+
for (const L of P)
|
|
1649
|
+
L.unref();
|
|
1655
1650
|
}, 1e3);
|
|
1656
|
-
}).catch(function(
|
|
1657
|
-
t.error(
|
|
1651
|
+
}).catch(function(P) {
|
|
1652
|
+
t.error(P.message);
|
|
1658
1653
|
});
|
|
1659
1654
|
}
|
|
1660
|
-
}, l(
|
|
1655
|
+
}, l(F, "description", "Run Platforma Backend service as local process on current host (no docker container)"), l(F, "examples", ["<%= config.bin %> <%= command.id %>"]), l(F, "flags", {
|
|
1661
1656
|
...A,
|
|
1662
1657
|
...C,
|
|
1663
1658
|
...j,
|
|
1664
|
-
...
|
|
1659
|
+
...mr,
|
|
1660
|
+
...pe,
|
|
1665
1661
|
...we,
|
|
1666
1662
|
...ve,
|
|
1667
|
-
...Pe,
|
|
1668
1663
|
...M,
|
|
1669
1664
|
...B,
|
|
1670
1665
|
...ce,
|
|
1671
1666
|
...ie,
|
|
1672
1667
|
...oe,
|
|
1673
|
-
...
|
|
1668
|
+
...ye,
|
|
1674
1669
|
...be,
|
|
1675
1670
|
...U
|
|
1676
|
-
}),
|
|
1677
|
-
const z = class z extends
|
|
1671
|
+
}), F);
|
|
1672
|
+
const z = class z extends $ {
|
|
1678
1673
|
async run() {
|
|
1679
1674
|
const { flags: e, args: t } = await this.parse(z), r = I(e["log-level"]), n = new O(r);
|
|
1680
1675
|
n.mergeLicenseEnvs(e);
|
|
1681
1676
|
const s = t.name, i = e["auth-enabled"], c = i ? {
|
|
1682
1677
|
enabled: i,
|
|
1683
1678
|
drivers: n.initAuthDriversList(e, ".")
|
|
1684
|
-
} : void 0, o = e.storage ? m.join(".", e.storage) : u.instanceDir(s),
|
|
1679
|
+
} : void 0, o = e.storage ? m.join(".", e.storage) : u.instanceDir(s), g = [];
|
|
1685
1680
|
for (const h of e.mount ?? [])
|
|
1686
|
-
|
|
1687
|
-
const
|
|
1681
|
+
g.push({ hostPath: h });
|
|
1682
|
+
const d = e.arch ? `linux/${e.arch}` : void 0;
|
|
1688
1683
|
n.createDocker(s, o, {
|
|
1689
1684
|
primaryStorageURL: e["storage-primary"],
|
|
1690
1685
|
workStoragePath: e["storage-work"],
|
|
1691
1686
|
libraryStorageURL: e["storage-library"],
|
|
1692
1687
|
image: e.image,
|
|
1693
1688
|
version: e.version,
|
|
1694
|
-
platformOverride:
|
|
1695
|
-
customMounts:
|
|
1689
|
+
platformOverride: d,
|
|
1690
|
+
customMounts: g,
|
|
1696
1691
|
license: e.license,
|
|
1697
1692
|
licenseFile: e["license-file"],
|
|
1698
1693
|
auth: c,
|
|
@@ -1708,12 +1703,12 @@ const z = class z extends L {
|
|
|
1708
1703
|
l(z, "description", "Run Platforma Backend service as docker container on current host"), l(z, "examples", ["<%= config.bin %> <%= command.id %>"]), l(z, "flags", {
|
|
1709
1704
|
...A,
|
|
1710
1705
|
...j,
|
|
1711
|
-
...
|
|
1706
|
+
...fe,
|
|
1712
1707
|
...C,
|
|
1713
|
-
...
|
|
1708
|
+
...me,
|
|
1714
1709
|
...U,
|
|
1715
1710
|
...M,
|
|
1716
|
-
...
|
|
1711
|
+
...he,
|
|
1717
1712
|
...B,
|
|
1718
1713
|
...ce,
|
|
1719
1714
|
...ie,
|
|
@@ -1722,84 +1717,83 @@ l(z, "description", "Run Platforma Backend service as docker container on curren
|
|
|
1722
1717
|
name: K.string({ required: !0 })
|
|
1723
1718
|
});
|
|
1724
1719
|
let Me = z;
|
|
1725
|
-
var
|
|
1726
|
-
let ft = (
|
|
1720
|
+
var E;
|
|
1721
|
+
let ft = (E = class extends $ {
|
|
1727
1722
|
async run() {
|
|
1728
|
-
const { flags: e, args: t } = await this.parse(
|
|
1723
|
+
const { flags: e, args: t } = await this.parse(E), r = I(e["log-level"]), n = new O(r);
|
|
1729
1724
|
n.mergeLicenseEnvs(e);
|
|
1730
|
-
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,
|
|
1731
|
-
let h =
|
|
1732
|
-
e["
|
|
1733
|
-
let b = "127.0.0.1:
|
|
1734
|
-
e["
|
|
1735
|
-
let
|
|
1736
|
-
e["
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
binaryPath: h,
|
|
1725
|
+
const s = t.name, i = e["pl-workdir"] ?? ".", c = e.storage ? m.join(i, e.storage) : u.instanceDir(s), o = e["pl-log-file"] ? m.join(i, e["pl-log-file"]) : void 0, g = n.initAuthDriversList(e, i), d = e["auth-enabled"] ?? g !== void 0;
|
|
1726
|
+
let h = "127.0.0.1:6345";
|
|
1727
|
+
e["grpc-listen"] ? h = e["grpc-listen"] : e["grpc-port"] && (h = `127.0.0.1:${e["grpc-port"]}`);
|
|
1728
|
+
let b = "127.0.0.1:9090";
|
|
1729
|
+
e["monitoring-listen"] ? b = e["monitoring-listen"] : e["monitoring-port"] && (b = `127.0.0.1:${e["monitoring-port"]}`);
|
|
1730
|
+
let p = "127.0.0.1:9091";
|
|
1731
|
+
e["debug-listen"] ? p = e["debug-listen"] : e["debug-port"] && (p = `127.0.0.1:${e["debug-port"]}`);
|
|
1732
|
+
const y = {
|
|
1733
|
+
sourcesPath: e["pl-sources"],
|
|
1734
|
+
binaryPath: e["pl-binary"],
|
|
1741
1735
|
version: e.version,
|
|
1742
1736
|
configPath: e.config,
|
|
1743
1737
|
workdir: e["pl-workdir"],
|
|
1744
1738
|
primaryURL: e["storage-primary"],
|
|
1745
1739
|
libraryURL: e["storage-library"],
|
|
1746
1740
|
configOptions: {
|
|
1747
|
-
grpc: { listen:
|
|
1748
|
-
monitoring: { listen:
|
|
1749
|
-
debug: { listen:
|
|
1741
|
+
grpc: { listen: h },
|
|
1742
|
+
monitoring: { listen: b },
|
|
1743
|
+
debug: { listen: p },
|
|
1750
1744
|
license: { value: e.license, file: e["license-file"] },
|
|
1751
1745
|
log: { path: o },
|
|
1752
1746
|
localRoot: c,
|
|
1753
|
-
core: { auth: { enabled:
|
|
1747
|
+
core: { auth: { enabled: d, drivers: g } },
|
|
1754
1748
|
storages: {
|
|
1755
1749
|
work: { type: "FS", rootPath: e["storage-work"] }
|
|
1756
1750
|
}
|
|
1757
1751
|
}
|
|
1758
1752
|
};
|
|
1759
|
-
if (n.createLocal(s,
|
|
1753
|
+
if (n.createLocal(s, y), y.binaryPath || y.sourcesPath) {
|
|
1760
1754
|
r.info(`Instance '${s}' was created. To start it run 'up' command`);
|
|
1761
1755
|
return;
|
|
1762
1756
|
}
|
|
1763
|
-
|
|
1764
|
-
r.error(
|
|
1757
|
+
Pe(r, { version: e.version }).then(() => r.info(`Instance '${s}' was created. To start it run 'svc up' command`)).catch(function(P) {
|
|
1758
|
+
r.error(P.message);
|
|
1765
1759
|
});
|
|
1766
1760
|
}
|
|
1767
|
-
}, l(
|
|
1761
|
+
}, l(E, "description", "Run Platforma Backend service as local process on current host (no docker container)"), l(E, "examples", ["<%= config.bin %> <%= command.id %>"]), l(E, "flags", {
|
|
1768
1762
|
...A,
|
|
1769
1763
|
...C,
|
|
1770
1764
|
...j,
|
|
1765
|
+
...pe,
|
|
1771
1766
|
...we,
|
|
1772
1767
|
...ve,
|
|
1773
|
-
...Pe,
|
|
1774
1768
|
...M,
|
|
1775
1769
|
...B,
|
|
1776
1770
|
...ce,
|
|
1777
1771
|
...ie,
|
|
1778
1772
|
...oe,
|
|
1779
|
-
...
|
|
1773
|
+
...ye,
|
|
1780
1774
|
...be,
|
|
1781
1775
|
...U
|
|
1782
|
-
}), l(
|
|
1776
|
+
}), l(E, "args", {
|
|
1783
1777
|
name: K.string({ required: !0 })
|
|
1784
|
-
}),
|
|
1785
|
-
const Y = class Y extends
|
|
1778
|
+
}), E);
|
|
1779
|
+
const Y = class Y extends $ {
|
|
1786
1780
|
async run() {
|
|
1787
1781
|
const { flags: e, args: t } = await this.parse(Y), r = I(e["log-level"]), n = new O(r);
|
|
1788
1782
|
n.mergeLicenseEnvs(e);
|
|
1789
1783
|
const s = t.name, i = e["auth-enabled"], c = i ? {
|
|
1790
1784
|
enabled: i,
|
|
1791
1785
|
drivers: n.initAuthDriversList(e, ".")
|
|
1792
|
-
} : void 0, o = e.storage ? m.join(".", e.storage) : u.instanceDir(s),
|
|
1786
|
+
} : void 0, o = e.storage ? m.join(".", e.storage) : u.instanceDir(s), g = [];
|
|
1793
1787
|
for (const b of e.mount ?? [])
|
|
1794
|
-
|
|
1795
|
-
const
|
|
1788
|
+
g.push({ hostPath: b });
|
|
1789
|
+
const d = e.arch ? `linux/${e.arch}` : void 0, h = e["minio-presign-host"] ? "minio" : "localhost";
|
|
1796
1790
|
n.createDockerS3(s, o, {
|
|
1797
1791
|
image: e.image,
|
|
1798
1792
|
version: e.version,
|
|
1799
1793
|
license: e.license,
|
|
1800
1794
|
licenseFile: e["license-file"],
|
|
1801
|
-
platformOverride:
|
|
1802
|
-
customMounts:
|
|
1795
|
+
platformOverride: d,
|
|
1796
|
+
customMounts: g,
|
|
1803
1797
|
auth: c,
|
|
1804
1798
|
grpcAddr: e["grpc-listen"],
|
|
1805
1799
|
grpcPort: e["grpc-port"],
|
|
@@ -1814,33 +1808,32 @@ const Y = class Y extends L {
|
|
|
1814
1808
|
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", {
|
|
1815
1809
|
...A,
|
|
1816
1810
|
...j,
|
|
1817
|
-
...
|
|
1811
|
+
...fe,
|
|
1818
1812
|
...C,
|
|
1819
|
-
...
|
|
1813
|
+
...me,
|
|
1820
1814
|
...U,
|
|
1821
1815
|
...M,
|
|
1822
|
-
...
|
|
1816
|
+
...he,
|
|
1823
1817
|
...B,
|
|
1824
|
-
...
|
|
1818
|
+
...hr
|
|
1825
1819
|
}), l(Y, "args", {
|
|
1826
1820
|
name: K.string({ required: !0 })
|
|
1827
1821
|
});
|
|
1828
1822
|
let je = Y;
|
|
1829
|
-
const V = class V extends
|
|
1823
|
+
const V = class V extends $ {
|
|
1830
1824
|
async run() {
|
|
1831
1825
|
const { flags: e, args: t } = await this.parse(V), r = I(e["log-level"]), n = new O(r);
|
|
1832
1826
|
n.mergeLicenseEnvs(e);
|
|
1833
|
-
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,
|
|
1834
|
-
let h =
|
|
1835
|
-
e["
|
|
1836
|
-
let b = "127.0.0.1:
|
|
1837
|
-
e["
|
|
1838
|
-
let
|
|
1839
|
-
e["
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
binaryPath: h,
|
|
1827
|
+
const s = t.name, i = e["pl-workdir"] ?? ".", c = e.storage ? m.join(i, e.storage) : u.instanceDir(s), o = e["pl-log-file"] ? m.join(i, e["pl-log-file"]) : void 0, g = n.initAuthDriversList(e, i), d = e["auth-enabled"] ?? g !== void 0;
|
|
1828
|
+
let h = "127.0.0.1:6345";
|
|
1829
|
+
e["grpc-listen"] ? h = e["grpc-listen"] : e["grpc-port"] && (h = `127.0.0.1:${e["grpc-port"]}`);
|
|
1830
|
+
let b = "127.0.0.1:9090";
|
|
1831
|
+
e["monitoring-listen"] ? b = e["monitoring-listen"] : e["monitoring-port"] && (b = `127.0.0.1:${e["monitoring-port"]}`);
|
|
1832
|
+
let p = "127.0.0.1:9091";
|
|
1833
|
+
e["debug-listen"] ? p = e["debug-listen"] : e["debug-port"] && (p = `127.0.0.1:${e["debug-port"]}`);
|
|
1834
|
+
const y = {
|
|
1835
|
+
sourcesPath: e["pl-sources"],
|
|
1836
|
+
binaryPath: e["pl-binary"],
|
|
1844
1837
|
version: e.version,
|
|
1845
1838
|
configPath: e.config,
|
|
1846
1839
|
workdir: e["pl-workdir"],
|
|
@@ -1849,55 +1842,55 @@ const V = class V extends L {
|
|
|
1849
1842
|
minioPort: e["s3-port"],
|
|
1850
1843
|
minioConsolePort: e["s3-console-port"],
|
|
1851
1844
|
configOptions: {
|
|
1852
|
-
grpc: { listen:
|
|
1853
|
-
monitoring: { listen:
|
|
1854
|
-
debug: { listen:
|
|
1845
|
+
grpc: { listen: h },
|
|
1846
|
+
monitoring: { listen: b },
|
|
1847
|
+
debug: { listen: p },
|
|
1855
1848
|
license: { value: e.license, file: e["license-file"] },
|
|
1856
1849
|
log: { path: o },
|
|
1857
1850
|
localRoot: c,
|
|
1858
|
-
core: { auth: { enabled:
|
|
1851
|
+
core: { auth: { enabled: d, drivers: g } },
|
|
1859
1852
|
storages: {
|
|
1860
1853
|
work: { type: "FS", rootPath: e["storage-work"] }
|
|
1861
1854
|
}
|
|
1862
1855
|
}
|
|
1863
1856
|
};
|
|
1864
|
-
if (r.info("Creating instance configuration, data directory and other stuff..."), n.createLocalS3(s,
|
|
1857
|
+
if (r.info("Creating instance configuration, data directory and other stuff..."), n.createLocalS3(s, y), y.binaryPath || y.sourcesPath) {
|
|
1865
1858
|
r.info(`Instance '${s}' was created. To start it run 'up' command`);
|
|
1866
1859
|
return;
|
|
1867
1860
|
}
|
|
1868
|
-
|
|
1869
|
-
r.error(
|
|
1861
|
+
Pe(r, { version: e.version }).then(() => r.info(`Instance '${s}' was created. To start it run 'svc up' command`)).catch(function(P) {
|
|
1862
|
+
r.error(P.message);
|
|
1870
1863
|
});
|
|
1871
1864
|
}
|
|
1872
1865
|
};
|
|
1873
1866
|
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", {
|
|
1874
1867
|
...A,
|
|
1875
1868
|
...C,
|
|
1876
|
-
...
|
|
1869
|
+
...mr,
|
|
1877
1870
|
...j,
|
|
1871
|
+
...pe,
|
|
1878
1872
|
...we,
|
|
1879
1873
|
...ve,
|
|
1880
|
-
...Pe,
|
|
1881
1874
|
...M,
|
|
1882
1875
|
...B,
|
|
1883
1876
|
...ce,
|
|
1884
1877
|
...ie,
|
|
1885
1878
|
...oe,
|
|
1886
|
-
...
|
|
1879
|
+
...ye,
|
|
1887
1880
|
...be,
|
|
1888
1881
|
...U
|
|
1889
1882
|
}), l(V, "args", {
|
|
1890
1883
|
name: K.string({ required: !0 })
|
|
1891
1884
|
});
|
|
1892
1885
|
let Be = V;
|
|
1893
|
-
const
|
|
1894
|
-
"create-block":
|
|
1886
|
+
const Et = {
|
|
1887
|
+
"create-block": Ee,
|
|
1895
1888
|
reset: Te,
|
|
1896
1889
|
start: xe,
|
|
1897
|
-
stop:
|
|
1890
|
+
stop: Fe,
|
|
1898
1891
|
"start:docker": lt,
|
|
1899
1892
|
"start:local": dt,
|
|
1900
|
-
"svc:delete":
|
|
1893
|
+
"svc:delete": De,
|
|
1901
1894
|
"svc:down": Ne,
|
|
1902
1895
|
"svc:list": _e,
|
|
1903
1896
|
"svc:up": Ce,
|
|
@@ -1909,6 +1902,6 @@ const Rt = {
|
|
|
1909
1902
|
"svc:create:local:s3": Be
|
|
1910
1903
|
};
|
|
1911
1904
|
export {
|
|
1912
|
-
|
|
1905
|
+
Et as COMMANDS
|
|
1913
1906
|
};
|
|
1914
1907
|
//# sourceMappingURL=index.mjs.map
|