@platforma-sdk/bootstrap 2.3.0 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +23 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +206 -208
- package/dist/index.mjs.map +1 -1
- package/dist/package.d.ts +0 -4
- package/dist/package.d.ts.map +1 -1
- package/dist/platforma.d.ts.map +1 -1
- package/dist/templates/pl-config.d.ts.map +1 -1
- package/package.json +7 -6
package/dist/index.mjs
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var m = (a, e, r) =>
|
|
1
|
+
var Xe = Object.defineProperty;
|
|
2
|
+
var Ze = (a, e, r) => e in a ? Xe(a, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : a[e] = r;
|
|
3
|
+
var m = (a, e, r) => Ze(a, typeof e != "symbol" ? e + "" : e, r);
|
|
4
4
|
import { Flags as y, Command as $ } from "@oclif/core";
|
|
5
5
|
import _ from "node:os";
|
|
6
|
-
import l, { createWriteStream as
|
|
7
|
-
import u, { resolve as
|
|
8
|
-
import { execSync as
|
|
9
|
-
import
|
|
10
|
-
import { randomBytes as
|
|
6
|
+
import l, { createWriteStream as er } from "node:fs";
|
|
7
|
+
import u, { resolve as rr } from "node:path";
|
|
8
|
+
import { execSync as xe, spawn as tr, spawnSync as J } from "node:child_process";
|
|
9
|
+
import j from "winston";
|
|
10
|
+
import { randomBytes as ar } from "node:crypto";
|
|
11
11
|
import V from "readline-sync";
|
|
12
|
-
import { Writable as
|
|
12
|
+
import { Writable as ir } from "node:stream";
|
|
13
13
|
import { z as K } from "zod";
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
14
|
+
import sr from "decompress";
|
|
15
|
+
import Me from "yaml";
|
|
16
|
+
import { getPlVersion as Q } from "@milaboratories/pl-config";
|
|
17
|
+
import cr from "node:https";
|
|
18
|
+
import * as nr from "tar";
|
|
18
19
|
const T = {
|
|
19
20
|
"log-level": y.string({
|
|
20
21
|
description: "logging level",
|
|
@@ -22,15 +23,15 @@ const T = {
|
|
|
22
23
|
options: ["error", "warn", "info", "debug"],
|
|
23
24
|
required: !1
|
|
24
25
|
})
|
|
25
|
-
},
|
|
26
|
+
}, Ge = {
|
|
26
27
|
image: y.string({
|
|
27
28
|
description: "use custom docker image to run platforma"
|
|
28
29
|
})
|
|
29
|
-
},
|
|
30
|
+
}, X = {
|
|
30
31
|
version: y.string({
|
|
31
32
|
description: "use custom platforma release (official docker image or binary package)"
|
|
32
33
|
})
|
|
33
|
-
},
|
|
34
|
+
}, Z = {
|
|
34
35
|
license: y.string({
|
|
35
36
|
description: 'pass a license code. The license can be got from "https://licensing.milaboratories.com".'
|
|
36
37
|
}),
|
|
@@ -38,7 +39,7 @@ const T = {
|
|
|
38
39
|
exists: !0,
|
|
39
40
|
description: "specify a path to the file with a license. The license can be got from 'https://licensing.milaboratories.com'."
|
|
40
41
|
})
|
|
41
|
-
},
|
|
42
|
+
}, ee = {
|
|
42
43
|
"grpc-port": y.integer({
|
|
43
44
|
description: "port for Platforma Backend gRPC API. Default is 6345",
|
|
44
45
|
env: "PLATFORMA_GRPC_PORT"
|
|
@@ -63,7 +64,7 @@ const T = {
|
|
|
63
64
|
description: "full listen addr for Platforma Backend debug API. Default is 127.0.0.1:9091",
|
|
64
65
|
env: "PLATFORMA_DEBUG_LISTEN"
|
|
65
66
|
})
|
|
66
|
-
},
|
|
67
|
+
}, lr = {
|
|
67
68
|
"s3-address-port": y.integer({
|
|
68
69
|
description: "port that S3 will listen, default is 9000",
|
|
69
70
|
default: 9e3,
|
|
@@ -74,11 +75,11 @@ const T = {
|
|
|
74
75
|
default: 9001,
|
|
75
76
|
env: "PLATFORMA_S3_CONSOLE_PORT"
|
|
76
77
|
})
|
|
77
|
-
},
|
|
78
|
+
}, re = {
|
|
78
79
|
storage: y.string({
|
|
79
80
|
description: "specify path on host to be used as storage for all Platforma Backend data"
|
|
80
81
|
})
|
|
81
|
-
},
|
|
82
|
+
}, Ue = {
|
|
82
83
|
"pl-log-file": y.file({
|
|
83
84
|
description: "specify path for Platforma Backend log file"
|
|
84
85
|
})
|
|
@@ -86,7 +87,7 @@ const T = {
|
|
|
86
87
|
"pl-workdir": y.file({
|
|
87
88
|
description: "specify working directory for Platforma Backend process"
|
|
88
89
|
})
|
|
89
|
-
},
|
|
90
|
+
}, je = {
|
|
90
91
|
"pl-binary": y.file({
|
|
91
92
|
description: "start given Platforma Backend binary instead of automatically downloaded version"
|
|
92
93
|
})
|
|
@@ -94,7 +95,7 @@ const T = {
|
|
|
94
95
|
"pl-sources": y.file({
|
|
95
96
|
description: "path to pl repository root: build Platforma Backend from sources and start the resulting binary"
|
|
96
97
|
})
|
|
97
|
-
},
|
|
98
|
+
}, Je = {
|
|
98
99
|
config: y.string({
|
|
99
100
|
description: "use custom Platforma Backend config"
|
|
100
101
|
})
|
|
@@ -102,7 +103,7 @@ const T = {
|
|
|
102
103
|
y.file({
|
|
103
104
|
description: "specify path on host to be used as 'primary' storage"
|
|
104
105
|
});
|
|
105
|
-
const
|
|
106
|
+
const ue = {
|
|
106
107
|
"storage-work": y.file({
|
|
107
108
|
description: "specify path on host to be used as 'work' storage"
|
|
108
109
|
})
|
|
@@ -110,7 +111,7 @@ const fe = {
|
|
|
110
111
|
y.file({
|
|
111
112
|
description: "specify path on host to be used as 'library' storage"
|
|
112
113
|
});
|
|
113
|
-
const
|
|
114
|
+
const fe = {
|
|
114
115
|
"storage-primary": y.string({
|
|
115
116
|
description: `specify 'primary' storage destination URL.
|
|
116
117
|
file:/path/to/dir for directory on local FS
|
|
@@ -118,7 +119,7 @@ const he = {
|
|
|
118
119
|
s3e://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via http
|
|
119
120
|
s3es://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via https`
|
|
120
121
|
})
|
|
121
|
-
},
|
|
122
|
+
}, he = {
|
|
122
123
|
"storage-library": y.string({
|
|
123
124
|
description: `specify 'library' storage destination URL.
|
|
124
125
|
file:/path/to/dir for directory on local FS
|
|
@@ -126,85 +127,85 @@ const he = {
|
|
|
126
127
|
s3e://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via http
|
|
127
128
|
s3es://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via https`
|
|
128
129
|
})
|
|
129
|
-
},
|
|
130
|
+
}, or = {
|
|
130
131
|
"auth-enabled": y.boolean({
|
|
131
132
|
description: "enable authorization"
|
|
132
133
|
})
|
|
133
|
-
},
|
|
134
|
+
}, dr = {
|
|
134
135
|
"auth-htpasswd-file": y.file({
|
|
135
136
|
description: "path to .htpasswd file with Platforma users (static user DB auth source)"
|
|
136
137
|
})
|
|
137
|
-
},
|
|
138
|
+
}, gr = {
|
|
138
139
|
"auth-ldap-server": y.string({
|
|
139
140
|
description: "address of LDAP server to use for auth in Platforma (auth source)"
|
|
140
141
|
})
|
|
141
|
-
},
|
|
142
|
+
}, ur = {
|
|
142
143
|
"auth-ldap-default-dn": y.string({
|
|
143
144
|
description: "DN to use when checking user with LDAP bind operation: e.g. cn=%u,ou=users,dc=example,dc=com"
|
|
144
145
|
})
|
|
145
|
-
},
|
|
146
|
+
}, te = {
|
|
147
|
+
...or,
|
|
148
|
+
...dr,
|
|
146
149
|
...gr,
|
|
147
|
-
...ur
|
|
148
|
-
...fr,
|
|
149
|
-
...hr
|
|
150
|
+
...ur
|
|
150
151
|
};
|
|
151
|
-
function
|
|
152
|
+
function fr(a) {
|
|
152
153
|
return V.question(`${a} [y/N] `).toLowerCase() === "y";
|
|
153
154
|
}
|
|
154
155
|
function Y(a) {
|
|
155
156
|
throw new Error("this should never happen");
|
|
156
157
|
}
|
|
157
158
|
function E(a = "debug") {
|
|
158
|
-
return
|
|
159
|
+
return j.createLogger({
|
|
159
160
|
level: a,
|
|
160
|
-
format:
|
|
161
|
-
|
|
161
|
+
format: j.format.combine(
|
|
162
|
+
j.format.printf(({ level: e, message: r }) => {
|
|
162
163
|
const t = " ".repeat(e.length + 2), i = r.split(`
|
|
163
164
|
`).map((c, n) => n === 0 ? c : t + c).join(`
|
|
164
165
|
`);
|
|
165
|
-
return `${((c) =>
|
|
166
|
+
return `${((c) => j.format.colorize().colorize(c, c))(e)}: ${i}`;
|
|
166
167
|
})
|
|
167
168
|
),
|
|
168
169
|
transports: [
|
|
169
|
-
new
|
|
170
|
+
new j.transports.Console({
|
|
170
171
|
stderrLevels: ["error", "warn", "info", "debug"],
|
|
171
172
|
handleExceptions: !0
|
|
172
173
|
})
|
|
173
174
|
]
|
|
174
175
|
});
|
|
175
176
|
}
|
|
176
|
-
function
|
|
177
|
-
return
|
|
177
|
+
function hr(a) {
|
|
178
|
+
return ar(Math.ceil(a / 2)).toString("hex").slice(0, a);
|
|
178
179
|
}
|
|
179
|
-
function
|
|
180
|
+
function mr(a) {
|
|
180
181
|
return a.startsWith("~") ? u.join(_.homedir(), a.slice(1)) : a;
|
|
181
182
|
}
|
|
182
183
|
function q(a, e) {
|
|
183
184
|
l.existsSync(a) || (l.mkdirSync(a, { recursive: !0 }), e != null && e.mode && l.chmodSync(a, e.mode));
|
|
184
185
|
}
|
|
185
|
-
function
|
|
186
|
+
function yr(a) {
|
|
186
187
|
try {
|
|
187
188
|
if (_.platform() !== "win32")
|
|
188
|
-
return
|
|
189
|
-
const e = `wmic process where processid=${a} get Caption`, r =
|
|
189
|
+
return xe(`ps -p ${a} -o comm=`, { encoding: "utf8" }).trim();
|
|
190
|
+
const e = `wmic process where processid=${a} get Caption`, r = xe(e, { encoding: "utf8" }).split(`
|
|
190
191
|
`);
|
|
191
192
|
return r.length <= 1 ? "" : r[1].trim();
|
|
192
193
|
} catch {
|
|
193
194
|
return "";
|
|
194
195
|
}
|
|
195
196
|
}
|
|
196
|
-
const
|
|
197
|
+
const Pr = K.object({
|
|
197
198
|
npmOrgName: K.string().min(1),
|
|
198
199
|
orgName: K.string().min(1),
|
|
199
200
|
blockName: K.string().min(1)
|
|
200
201
|
});
|
|
201
|
-
async function
|
|
202
|
-
const e =
|
|
203
|
-
a.info("Downloading boilerplate code..."), await
|
|
202
|
+
async function br(a) {
|
|
203
|
+
const e = vr(), r = u.join(process.cwd(), e.blockName);
|
|
204
|
+
a.info("Downloading boilerplate code..."), await wr(
|
|
204
205
|
"https://github.com/milaboratory/platforma-block-boilerplate/archive/refs/heads/main.zip",
|
|
205
206
|
"platforma-block-boilerplate-main",
|
|
206
207
|
r
|
|
207
|
-
), a.info("Replace everything in the template with provided options..."),
|
|
208
|
+
), a.info("Replace everything in the template with provided options..."), kr(
|
|
208
209
|
r,
|
|
209
210
|
[
|
|
210
211
|
{ from: /platforma-open/g, to: e.npmOrgName },
|
|
@@ -213,62 +214,58 @@ async function wr(a) {
|
|
|
213
214
|
]
|
|
214
215
|
), a.info("Remove github actions directory"), l.rmSync(u.join(r, ".github"), { recursive: !0, force: !0 });
|
|
215
216
|
}
|
|
216
|
-
function
|
|
217
|
+
function vr() {
|
|
217
218
|
let a = V.question('Write an organization name for npm. Default is "platforma-open": ');
|
|
218
219
|
a === "" && (a = "platforma-open");
|
|
219
220
|
const e = V.question('Write an organization name, e.g. "my-org": '), r = V.question('Write a name of the block, e.g. "hello-world": ');
|
|
220
|
-
return
|
|
221
|
+
return Pr.parse({ npmOrgName: a, orgName: e, blockName: r });
|
|
221
222
|
}
|
|
222
|
-
async function
|
|
223
|
-
const i = await (await fetch(a)).blob(), s = l.mkdtempSync(u.join(_.tmpdir(), "create-repo")), c = u.join(s, "packed-repo.zip"), n =
|
|
223
|
+
async function wr(a, e, r) {
|
|
224
|
+
const i = await (await fetch(a)).blob(), s = l.mkdtempSync(u.join(_.tmpdir(), "create-repo")), c = u.join(s, "packed-repo.zip"), n = ir.toWeb(er(c));
|
|
224
225
|
await i.stream().pipeTo(n);
|
|
225
226
|
const h = u.join(s, "unpacked-repo");
|
|
226
|
-
l.mkdirSync(h), await
|
|
227
|
+
l.mkdirSync(h), await sr(c, h), l.cpSync(u.join(h, e), r, { recursive: !0 });
|
|
227
228
|
}
|
|
228
|
-
function
|
|
229
|
-
const r =
|
|
229
|
+
function kr(a, e) {
|
|
230
|
+
const r = Sr(a);
|
|
230
231
|
e.forEach(({ from: t, to: i }) => {
|
|
231
|
-
r.forEach((s) =>
|
|
232
|
+
r.forEach((s) => Ar(s, t, i));
|
|
232
233
|
});
|
|
233
234
|
}
|
|
234
|
-
function
|
|
235
|
+
function Sr(a) {
|
|
235
236
|
return l.readdirSync(a, {
|
|
236
237
|
withFileTypes: !0,
|
|
237
238
|
recursive: !0
|
|
238
239
|
}).filter((r) => r.isFile()).map((r) => u.join(r.parentPath, r.name));
|
|
239
240
|
}
|
|
240
|
-
function
|
|
241
|
+
function Ar(a, e, r) {
|
|
241
242
|
const i = l.readFileSync(a).toString().replaceAll(e, r);
|
|
242
243
|
l.writeFileSync(a, i);
|
|
243
244
|
}
|
|
244
245
|
const I = class I extends $ {
|
|
245
246
|
async run() {
|
|
246
247
|
const { flags: e } = await this.parse(I), r = E(e["log-level"]);
|
|
247
|
-
await
|
|
248
|
+
await br(r);
|
|
248
249
|
}
|
|
249
250
|
};
|
|
250
251
|
m(I, "description", "Helps to create a new block by downloading a block's template."), m(I, "examples", ["<%= name %>"]), m(I, "flags", {
|
|
251
252
|
...T
|
|
252
253
|
});
|
|
253
|
-
let
|
|
254
|
-
function
|
|
255
|
-
return
|
|
254
|
+
let ie = I;
|
|
255
|
+
function Ye(...a) {
|
|
256
|
+
return rr(__dirname, "..", ...a);
|
|
256
257
|
}
|
|
257
258
|
function O(...a) {
|
|
258
|
-
return
|
|
259
|
+
return Ye("assets", ...a);
|
|
259
260
|
}
|
|
260
|
-
function
|
|
261
|
+
function Lr() {
|
|
261
262
|
return l.readdirSync(O()).filter((e) => e.startsWith("compose-") && e.endsWith(".yaml")).map((e) => O(e));
|
|
262
263
|
}
|
|
263
|
-
function
|
|
264
|
-
return l.readFileSync(
|
|
264
|
+
function Rr(...a) {
|
|
265
|
+
return l.readFileSync(Ye(...a));
|
|
265
266
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
return ae || (ae = JSON.parse(Ke("package.json").toString())), ae;
|
|
269
|
-
}
|
|
270
|
-
function ie(a) {
|
|
271
|
-
return a || (a = te()["pl-version"]), `quay.io/milaboratories/platforma:${a}`;
|
|
267
|
+
function ae(a) {
|
|
268
|
+
return a || (a = Q()), `quay.io/milaboratories/platforma:${a}`;
|
|
272
269
|
}
|
|
273
270
|
const F = class F {
|
|
274
271
|
constructor(e) {
|
|
@@ -280,7 +277,7 @@ const F = class F {
|
|
|
280
277
|
m(this, "dirPath");
|
|
281
278
|
e = e ?? u.resolve(_.homedir(), ".config", "pl-bootstrap");
|
|
282
279
|
const r = u.join(e, "state.json");
|
|
283
|
-
this.dirPath = e, this.filePath = r, l.existsSync(e) || l.mkdirSync(e, { recursive: !0 }), l.existsSync(r) && (this.state = JSON.parse(
|
|
280
|
+
this.dirPath = e, this.filePath = r, l.existsSync(e) || l.mkdirSync(e, { recursive: !0 }), l.existsSync(r) && (this.state = JSON.parse(Rr(r).toString()));
|
|
284
281
|
}
|
|
285
282
|
static getInstance() {
|
|
286
283
|
return F.instance || (F.instance = new F()), F.instance;
|
|
@@ -305,7 +302,7 @@ const F = class F {
|
|
|
305
302
|
var r, t;
|
|
306
303
|
if (!((t = (r = this.state.lastRun) == null ? void 0 : r.process) != null && t.pid))
|
|
307
304
|
return !1;
|
|
308
|
-
const e =
|
|
305
|
+
const e = yr(this.state.lastRun.process.pid);
|
|
309
306
|
return e === "platforma" || e.endsWith("/platforma") || e.endsWith("\\platforma");
|
|
310
307
|
}
|
|
311
308
|
set isActive(e) {
|
|
@@ -319,9 +316,9 @@ const F = class F {
|
|
|
319
316
|
}
|
|
320
317
|
};
|
|
321
318
|
m(F, "instance");
|
|
322
|
-
let
|
|
323
|
-
const o =
|
|
324
|
-
function
|
|
319
|
+
let se = F;
|
|
320
|
+
const o = se.getInstance();
|
|
321
|
+
function Ce(a, e, r, t) {
|
|
325
322
|
var i;
|
|
326
323
|
return o.lastRun = {
|
|
327
324
|
...o.lastRun,
|
|
@@ -334,9 +331,9 @@ function Be(a, e, r, t) {
|
|
|
334
331
|
...(i = o.lastRun) == null ? void 0 : i.docker,
|
|
335
332
|
...t
|
|
336
333
|
}
|
|
337
|
-
},
|
|
334
|
+
}, ze(a, "docker", e, r);
|
|
338
335
|
}
|
|
339
|
-
function
|
|
336
|
+
function _r(a, e, r, t, i) {
|
|
340
337
|
var c;
|
|
341
338
|
o.lastRun = {
|
|
342
339
|
...o.lastRun,
|
|
@@ -350,13 +347,13 @@ function pr(a, e, r, t, i) {
|
|
|
350
347
|
...i
|
|
351
348
|
}
|
|
352
349
|
};
|
|
353
|
-
const s =
|
|
350
|
+
const s = Or(a, e, r, t);
|
|
354
351
|
return o.lastRun.process = {
|
|
355
352
|
...o.lastRun.process,
|
|
356
353
|
pid: s.pid
|
|
357
354
|
}, s;
|
|
358
355
|
}
|
|
359
|
-
function
|
|
356
|
+
function pr(a, e) {
|
|
360
357
|
if (!o.lastRun)
|
|
361
358
|
throw new Error("no previous run info found: this is the first run after package installation");
|
|
362
359
|
return e = {
|
|
@@ -366,16 +363,16 @@ function Or(a, e) {
|
|
|
366
363
|
...e.env
|
|
367
364
|
},
|
|
368
365
|
...e
|
|
369
|
-
},
|
|
366
|
+
}, ze(a, o.lastRun.cmd, o.lastRun.args, e);
|
|
370
367
|
}
|
|
371
|
-
function
|
|
368
|
+
function Or(a, e, r, t) {
|
|
372
369
|
a.debug(
|
|
373
370
|
`Running:
|
|
374
371
|
env: ${JSON.stringify(t.env)}
|
|
375
372
|
cmd: ${JSON.stringify([e, ...r])}
|
|
376
373
|
wd: ${t.cwd}`
|
|
377
374
|
), t.env = { ...process.env, ...t.env }, a.debug(" spawning child process");
|
|
378
|
-
const i =
|
|
375
|
+
const i = tr(e, r, t);
|
|
379
376
|
var s = !1;
|
|
380
377
|
const c = () => {
|
|
381
378
|
i.kill("SIGINT"), s = !0;
|
|
@@ -384,15 +381,15 @@ function $r(a, e, r, t) {
|
|
|
384
381
|
process.removeListener("SIGINT", c), s && process.exit(n);
|
|
385
382
|
}), i;
|
|
386
383
|
}
|
|
387
|
-
function
|
|
384
|
+
function ze(a, e, r, t) {
|
|
388
385
|
return a.debug(
|
|
389
386
|
`Running:
|
|
390
387
|
env: ${JSON.stringify(t.env)}
|
|
391
388
|
cmd: ${JSON.stringify([e, ...r])}
|
|
392
389
|
wd: ${t.cwd}`
|
|
393
|
-
), t.env = { ...process.env, ...t.env },
|
|
390
|
+
), t.env = { ...process.env, ...t.env }, J(e, r, t);
|
|
394
391
|
}
|
|
395
|
-
function
|
|
392
|
+
function $r(a) {
|
|
396
393
|
return {
|
|
397
394
|
id: a,
|
|
398
395
|
type: "S3",
|
|
@@ -410,7 +407,7 @@ function Tr(a) {
|
|
|
410
407
|
uploadKeyPrefix: ""
|
|
411
408
|
};
|
|
412
409
|
}
|
|
413
|
-
function
|
|
410
|
+
function Ke(a) {
|
|
414
411
|
return {
|
|
415
412
|
id: a,
|
|
416
413
|
type: "FS",
|
|
@@ -419,7 +416,7 @@ function Ve(a) {
|
|
|
419
416
|
};
|
|
420
417
|
}
|
|
421
418
|
function N(a, e, r) {
|
|
422
|
-
a =
|
|
419
|
+
a = mr(a);
|
|
423
420
|
const t = new URL(a, `file:${e}`);
|
|
424
421
|
switch (t.protocol) {
|
|
425
422
|
case "s3:":
|
|
@@ -463,8 +460,8 @@ function N(a, e, r) {
|
|
|
463
460
|
throw new Error(`storage protocol '${t.protocol}' is not supported`);
|
|
464
461
|
}
|
|
465
462
|
}
|
|
466
|
-
function
|
|
467
|
-
var d, b, w, S, L, k, p,
|
|
463
|
+
function Tr(a, e) {
|
|
464
|
+
var d, b, w, S, L, k, p, W, A, me, ye, Pe, be, ve, we, ke, Se, Ae, Le, Re, _e, pe, Oe, $e, Te, Ee, Fe, De, Ne, Ie;
|
|
468
465
|
const r = (e == null ? void 0 : e.localRoot) ?? o.data("local-custom"), t = {
|
|
469
466
|
level: ((d = e == null ? void 0 : e.log) == null ? void 0 : d.level) ?? "info",
|
|
470
467
|
path: ((b = e == null ? void 0 : e.log) == null ? void 0 : b.path) ?? `${r}/platforma.log`
|
|
@@ -473,14 +470,14 @@ function Er(a, e) {
|
|
|
473
470
|
tls: {
|
|
474
471
|
enable: z((L = (S = e == null ? void 0 : e.grpc) == null ? void 0 : S.tls) == null ? void 0 : L.enable, !1),
|
|
475
472
|
clientAuthMode: ((p = (k = e == null ? void 0 : e.grpc) == null ? void 0 : k.tls) == null ? void 0 : p.clientAuthMode) ?? "NoAuth",
|
|
476
|
-
certFile: ((A = (
|
|
477
|
-
keyFile: ((
|
|
478
|
-
...(
|
|
473
|
+
certFile: ((A = (W = e == null ? void 0 : e.grpc) == null ? void 0 : W.tls) == null ? void 0 : A.certFile) ?? `${r}/certs/tls.cert`,
|
|
474
|
+
keyFile: ((ye = (me = e == null ? void 0 : e.grpc) == null ? void 0 : me.tls) == null ? void 0 : ye.keyFile) ?? `${r}/certs/tls.key`,
|
|
475
|
+
...(Pe = e == null ? void 0 : e.grpc) == null ? void 0 : Pe.tls
|
|
479
476
|
}
|
|
480
477
|
}, s = {
|
|
481
478
|
auth: {
|
|
482
|
-
enabled: ((
|
|
483
|
-
drivers: ((
|
|
479
|
+
enabled: ((ve = (be = e == null ? void 0 : e.core) == null ? void 0 : be.auth) == null ? void 0 : ve.enabled) ?? !1,
|
|
480
|
+
drivers: ((ke = (we = e == null ? void 0 : e.core) == null ? void 0 : we.auth) == null ? void 0 : ke.drivers) ?? [
|
|
484
481
|
{ driver: "jwt", key: a },
|
|
485
482
|
{ driver: "htpasswd", path: `${r}/users.htpasswd` }
|
|
486
483
|
]
|
|
@@ -488,35 +485,35 @@ function Er(a, e) {
|
|
|
488
485
|
db: {
|
|
489
486
|
path: `${r}/db`
|
|
490
487
|
}
|
|
491
|
-
}, c =
|
|
488
|
+
}, c = Be(
|
|
492
489
|
"main",
|
|
493
490
|
`${r}/storages/main`,
|
|
494
491
|
"main-bucket",
|
|
495
|
-
(
|
|
492
|
+
(Se = e == null ? void 0 : e.storages) == null ? void 0 : Se.primary
|
|
496
493
|
);
|
|
497
494
|
var n;
|
|
498
|
-
switch ((
|
|
495
|
+
switch ((Le = (Ae = e == null ? void 0 : e.storages) == null ? void 0 : Ae.work) == null ? void 0 : Le.type) {
|
|
499
496
|
case void 0:
|
|
500
497
|
case "FS":
|
|
501
|
-
n =
|
|
498
|
+
n = Ke("work"), n.rootPath = ((_e = (Re = e == null ? void 0 : e.storages) == null ? void 0 : Re.work) == null ? void 0 : _e.rootPath) ?? `${r}/storages/work`, n.indexCachePeriod = ((Oe = (pe = e == null ? void 0 : e.storages) == null ? void 0 : pe.work) == null ? void 0 : Oe.indexCachePeriod) ?? "1m";
|
|
502
499
|
break;
|
|
503
500
|
default:
|
|
504
501
|
throw new Error("work storage MUST have 'FS' type as it is used for working directories management");
|
|
505
502
|
}
|
|
506
|
-
const f =
|
|
503
|
+
const f = Be(
|
|
507
504
|
"library",
|
|
508
505
|
`${r}/storages/library`,
|
|
509
506
|
"library-bucket",
|
|
510
|
-
(
|
|
507
|
+
($e = e == null ? void 0 : e.storages) == null ? void 0 : $e.library
|
|
511
508
|
), g = {
|
|
512
|
-
enabled: z((
|
|
513
|
-
listen: ((
|
|
509
|
+
enabled: z((Te = e == null ? void 0 : e.monitoring) == null ? void 0 : Te.enabled, !0),
|
|
510
|
+
listen: ((Ee = e == null ? void 0 : e.monitoring) == null ? void 0 : Ee.listen) ?? "127.0.0.1:9090"
|
|
514
511
|
}, v = {
|
|
515
|
-
enabled: z((
|
|
516
|
-
listen: ((
|
|
512
|
+
enabled: z((Fe = e == null ? void 0 : e.debug) == null ? void 0 : Fe.enabled, !0),
|
|
513
|
+
listen: ((De = e == null ? void 0 : e.debug) == null ? void 0 : De.listen) ?? "127.0.0.1:9091"
|
|
517
514
|
}, P = {
|
|
518
|
-
value: ((
|
|
519
|
-
file: ((
|
|
515
|
+
value: ((Ne = e == null ? void 0 : e.license) == null ? void 0 : Ne.value) ?? "",
|
|
516
|
+
file: ((Ie = e == null ? void 0 : e.license) == null ? void 0 : Ie.file) ?? ""
|
|
520
517
|
};
|
|
521
518
|
return {
|
|
522
519
|
localRoot: r,
|
|
@@ -530,22 +527,22 @@ function Er(a, e) {
|
|
|
530
527
|
hacks: { libraryDownloadable: !0 }
|
|
531
528
|
};
|
|
532
529
|
}
|
|
533
|
-
function
|
|
530
|
+
function Be(a, e, r, t) {
|
|
534
531
|
var i;
|
|
535
532
|
switch (t == null ? void 0 : t.type) {
|
|
536
533
|
case void 0:
|
|
537
534
|
case "FS":
|
|
538
|
-
i =
|
|
535
|
+
i = Ke(a), i.rootPath = (t == null ? void 0 : t.rootPath) ?? e;
|
|
539
536
|
break;
|
|
540
537
|
case "S3":
|
|
541
|
-
i =
|
|
538
|
+
i = $r(a), i.endpoint = (t == null ? void 0 : t.endpoint) ?? "http://localhost:9000", i.presignEndpoint = (t == null ? void 0 : t.presignEndpoint) ?? "http://localhost:9000", i.bucketName = (t == null ? void 0 : t.bucketName) ?? r, i.createBucket = z(t == null ? void 0 : t.createBucket, !0), i.forcePathStyle = z(t == null ? void 0 : t.forcePathStyle, !0), i.key = (t == null ? void 0 : t.key) ?? "", i.secret = (t == null ? void 0 : t.secret) ?? "", i.keyPrefix = (t == null ? void 0 : t.keyPrefix) ?? "", i.accessPrefixes = (t == null ? void 0 : t.accessPrefixes) ?? [""], i.uploadKeyPrefix = (t == null ? void 0 : t.uploadKeyPrefix) ?? "";
|
|
542
539
|
break;
|
|
543
540
|
default:
|
|
544
541
|
throw Y(), new Error("unknown storage type");
|
|
545
542
|
}
|
|
546
543
|
return i;
|
|
547
544
|
}
|
|
548
|
-
function
|
|
545
|
+
function Er(a) {
|
|
549
546
|
const e = a.monitoring.enabled ? "" : " disabled", r = a.debug.enabled ? "" : " disabled", t = a.hacks.libraryDownloadable ? "true" : "false";
|
|
550
547
|
var i = a.license.value;
|
|
551
548
|
return a.license.file != "" && (i = l.readFileSync(a.license.file).toString().trimEnd()), `
|
|
@@ -609,6 +606,7 @@ controllers:
|
|
|
609
606
|
runner:
|
|
610
607
|
type: local
|
|
611
608
|
storageRoot: '${a.storages.work.rootPath}'
|
|
609
|
+
workdirCacheOnFailure: 1h
|
|
612
610
|
secrets:
|
|
613
611
|
- map:
|
|
614
612
|
MI_LICENSE: ${JSON.stringify(i)}
|
|
@@ -622,8 +620,8 @@ controllers:
|
|
|
622
620
|
function z(a, e) {
|
|
623
621
|
return a === void 0 ? e : a;
|
|
624
622
|
}
|
|
625
|
-
const
|
|
626
|
-
function
|
|
623
|
+
const Fr = ["linux", "macos", "windows"];
|
|
624
|
+
function Dr(a) {
|
|
627
625
|
const e = _.platform();
|
|
628
626
|
switch (e) {
|
|
629
627
|
case "darwin":
|
|
@@ -634,12 +632,12 @@ function Nr(a) {
|
|
|
634
632
|
return "windows";
|
|
635
633
|
default:
|
|
636
634
|
throw new Error(
|
|
637
|
-
`operating system '${e}' is not currently supported by Platforma ecosystem. The list of OSes supported: ` + JSON.stringify(
|
|
635
|
+
`operating system '${e}' is not currently supported by Platforma ecosystem. The list of OSes supported: ` + JSON.stringify(Fr)
|
|
638
636
|
);
|
|
639
637
|
}
|
|
640
638
|
}
|
|
641
|
-
const
|
|
642
|
-
function
|
|
639
|
+
const Nr = ["amd64", "arm64"];
|
|
640
|
+
function qe(a) {
|
|
643
641
|
const e = _.arch();
|
|
644
642
|
switch (e) {
|
|
645
643
|
case "arm64":
|
|
@@ -648,18 +646,18 @@ function Qe(a) {
|
|
|
648
646
|
return "amd64";
|
|
649
647
|
default:
|
|
650
648
|
throw new Error(
|
|
651
|
-
`processor architecture '${e}' is not currently supported by Platforma ecosystem. The list of architectures supported: ` + JSON.stringify(
|
|
649
|
+
`processor architecture '${e}' is not currently supported by Platforma ecosystem. The list of architectures supported: ` + JSON.stringify(Nr)
|
|
652
650
|
);
|
|
653
651
|
}
|
|
654
652
|
}
|
|
655
|
-
function
|
|
656
|
-
const r = (e == null ? void 0 : e.version) ??
|
|
653
|
+
function Ir(a, e) {
|
|
654
|
+
const r = (e == null ? void 0 : e.version) ?? Q(), t = (e == null ? void 0 : e.showProgress) ?? process.stdout.isTTY, i = `pl-${r}-${qe()}.tgz`, s = (e == null ? void 0 : e.downloadURL) ?? `https://cdn.platforma.bio/software/pl/${Dr()}/${i}`, c = (e == null ? void 0 : e.saveTo) ?? o.binaries(i);
|
|
657
655
|
if (l.existsSync(c))
|
|
658
656
|
return a.info(`Platforma Backend archive download skipped: '${c}' already exists`), Promise.resolve(c);
|
|
659
657
|
l.mkdirSync(u.dirname(c), { recursive: !0 }), a.info(`Downloading Platforma Backend archive:
|
|
660
658
|
URL: ${s}
|
|
661
659
|
Save to: ${c}`);
|
|
662
|
-
const n =
|
|
660
|
+
const n = cr.get(s);
|
|
663
661
|
return new Promise((h, f) => {
|
|
664
662
|
n.on("response", (g) => {
|
|
665
663
|
if (!g.statusCode) {
|
|
@@ -687,13 +685,13 @@ function xr(a, e) {
|
|
|
687
685
|
});
|
|
688
686
|
});
|
|
689
687
|
}
|
|
690
|
-
function
|
|
688
|
+
function xr(a, e) {
|
|
691
689
|
a.debug("extracting archive...");
|
|
692
|
-
const r = (e == null ? void 0 : e.version) ??
|
|
690
|
+
const r = (e == null ? void 0 : e.version) ?? Q();
|
|
693
691
|
a.debug(` version: '${r}'`);
|
|
694
|
-
const t = `${
|
|
692
|
+
const t = `${Qe({ version: r })}.tgz`, i = (e == null ? void 0 : e.archivePath) ?? o.binaries(t);
|
|
695
693
|
a.debug(` archive path: '${i}'`);
|
|
696
|
-
const s = (e == null ? void 0 : e.extractTo) ??
|
|
694
|
+
const s = (e == null ? void 0 : e.extractTo) ?? Cr(i);
|
|
697
695
|
if (a.debug(` target dir: '${s}'`), l.existsSync(s))
|
|
698
696
|
return a.info(`Platforma Backend binaries unpack skipped: '${s}' exists`), s;
|
|
699
697
|
if (!l.existsSync(i)) {
|
|
@@ -702,23 +700,23 @@ function Mr(a, e) {
|
|
|
702
700
|
}
|
|
703
701
|
return l.existsSync(s) || (a.debug(` creating target dir '${s}'`), l.mkdirSync(s, { recursive: !0 })), a.info(`Unpacking Platforma Backend archive:
|
|
704
702
|
Archive: ${i}
|
|
705
|
-
Target dir: ${s}`),
|
|
703
|
+
Target dir: ${s}`), nr.x({
|
|
706
704
|
file: i,
|
|
707
705
|
cwd: s,
|
|
708
706
|
gzip: !0,
|
|
709
707
|
sync: !0
|
|
710
708
|
}), a.info(" ... unpack done."), s;
|
|
711
709
|
}
|
|
712
|
-
function
|
|
713
|
-
return
|
|
710
|
+
function Ve(a, e) {
|
|
711
|
+
return Ir(a, e).then((r) => xr(a, { archivePath: r }));
|
|
714
712
|
}
|
|
715
|
-
function
|
|
716
|
-
return `pl-${(a == null ? void 0 : a.version) ??
|
|
713
|
+
function Qe(a) {
|
|
714
|
+
return `pl-${(a == null ? void 0 : a.version) ?? Q()}-${qe()}`;
|
|
717
715
|
}
|
|
718
|
-
function
|
|
719
|
-
return o.binaries(
|
|
716
|
+
function Mr(a, ...e) {
|
|
717
|
+
return o.binaries(Qe({ version: a }), ...e);
|
|
720
718
|
}
|
|
721
|
-
function
|
|
719
|
+
function Cr(a) {
|
|
722
720
|
const e = a.lastIndexOf(".");
|
|
723
721
|
return e === -1 ? a : a.slice(0, e);
|
|
724
722
|
}
|
|
@@ -727,12 +725,12 @@ class D {
|
|
|
727
725
|
this.logger = e;
|
|
728
726
|
}
|
|
729
727
|
startLast() {
|
|
730
|
-
const e =
|
|
731
|
-
|
|
728
|
+
const e = pr(this.logger, { stdio: "inherit" });
|
|
729
|
+
H(e, "failed to bring back Platforma Backend in the last started configuration");
|
|
732
730
|
}
|
|
733
731
|
startLocal(e) {
|
|
734
732
|
var h, f, g, v, P, d, b, w, S, L;
|
|
735
|
-
const r = (e == null ? void 0 : e.binaryPath) ??
|
|
733
|
+
const r = (e == null ? void 0 : e.binaryPath) ?? Mr(e == null ? void 0 : e.version, "binaries", "platforma");
|
|
736
734
|
var t = e == null ? void 0 : e.configPath;
|
|
737
735
|
const i = (e == null ? void 0 : e.workdir) ?? (t ? process.cwd() : o.path());
|
|
738
736
|
e != null && e.primaryURL && (e.configOptions = {
|
|
@@ -748,7 +746,7 @@ class D {
|
|
|
748
746
|
library: N(e.libraryURL, i, (d = (P = e.configOptions) == null ? void 0 : P.storages) == null ? void 0 : d.library)
|
|
749
747
|
}
|
|
750
748
|
});
|
|
751
|
-
const s =
|
|
749
|
+
const s = Tr(this.getLastJwt(), e == null ? void 0 : e.configOptions);
|
|
752
750
|
this.logger.debug(" checking license..."), this.checkLicense((w = (b = e == null ? void 0 : e.configOptions) == null ? void 0 : b.license) == null ? void 0 : w.value, (L = (S = e == null ? void 0 : e.configOptions) == null ? void 0 : S.license) == null ? void 0 : L.file);
|
|
753
751
|
const c = [
|
|
754
752
|
`${s.localRoot}/packages`,
|
|
@@ -760,7 +758,7 @@ class D {
|
|
|
760
758
|
l.existsSync(k) || (this.logger.debug(` '${k}'`), l.mkdirSync(k, { recursive: !0 }));
|
|
761
759
|
for (const k of s.core.auth.drivers)
|
|
762
760
|
k.driver === "htpasswd" && (l.existsSync(k.path) || (this.logger.debug(` installing default 'users.htpasswd' to ${k.path}...`), l.copyFileSync(O("users.htpasswd"), k.path)));
|
|
763
|
-
t || (t = u.join(s.localRoot, "config.yaml"), this.logger.debug(` rendering configuration '${t}'...`), l.writeFileSync(t,
|
|
761
|
+
t || (t = u.join(s.localRoot, "config.yaml"), this.logger.debug(` rendering configuration '${t}'...`), l.writeFileSync(t, Er(s)));
|
|
764
762
|
const n = this.renderRunInfo({
|
|
765
763
|
configPath: t,
|
|
766
764
|
dbPath: s.core.db.path,
|
|
@@ -771,7 +769,7 @@ class D {
|
|
|
771
769
|
library: s.storages.library
|
|
772
770
|
});
|
|
773
771
|
return this.logger.info(`Starting platforma:
|
|
774
|
-
${n}`),
|
|
772
|
+
${n}`), _r(
|
|
775
773
|
this.logger,
|
|
776
774
|
r,
|
|
777
775
|
["-config", t],
|
|
@@ -822,7 +820,7 @@ ${n}`), pr(
|
|
|
822
820
|
PL_IMAGE: "scratch"
|
|
823
821
|
};
|
|
824
822
|
this.logger.debug(" spawning child 'docker' process...");
|
|
825
|
-
const g =
|
|
823
|
+
const g = J(
|
|
826
824
|
"docker",
|
|
827
825
|
["compose", `--file=${r}`, "up", "--detach", "--remove-orphans", "--pull=missing", "minio"],
|
|
828
826
|
{
|
|
@@ -833,19 +831,19 @@ ${n}`), pr(
|
|
|
833
831
|
stdio: "inherit"
|
|
834
832
|
}
|
|
835
833
|
);
|
|
836
|
-
|
|
834
|
+
H(g, "failed to start MinIO service in docker");
|
|
837
835
|
}
|
|
838
836
|
buildPlatforma(e) {
|
|
839
837
|
const r = u.resolve(e.repoRoot, "cmd", "platforma"), t = e.binPath ?? u.join(_.tmpdir(), "platforma-local-build");
|
|
840
838
|
this.logger.info("Building Platforma Backend binary from sources"), this.logger.info(` sources path: ${e.repoRoot}`), this.logger.info(` binary path: ${t}`);
|
|
841
|
-
const i =
|
|
839
|
+
const i = J("go", ["build", "-o", t, "."], {
|
|
842
840
|
cwd: r,
|
|
843
841
|
stdio: "inherit"
|
|
844
842
|
});
|
|
845
|
-
return
|
|
843
|
+
return H(i, "failed to build platforma binary from sources using 'go build' command"), t;
|
|
846
844
|
}
|
|
847
845
|
startDockerS3(e, r) {
|
|
848
|
-
const t = O("compose-backend.yaml"), i = (r == null ? void 0 : r.image) ??
|
|
846
|
+
const t = O("compose-backend.yaml"), i = (r == null ? void 0 : r.image) ?? ae(r == null ? void 0 : r.version);
|
|
849
847
|
this.checkLicense(r == null ? void 0 : r.license, r == null ? void 0 : r.licenseFile);
|
|
850
848
|
const s = (S) => u.join(e, S), c = (S) => {
|
|
851
849
|
const L = s(S);
|
|
@@ -884,7 +882,7 @@ ${n}`), pr(
|
|
|
884
882
|
S.driver === "htpasswd" && (d.PL_AUTH_HTPASSWD_PATH = u.resolve(S.path), S.path = "/etc/platforma/users.htpasswd");
|
|
885
883
|
d.PL_AUTH_DRIVERS = JSON.stringify(r.auth.drivers);
|
|
886
884
|
}
|
|
887
|
-
const b =
|
|
885
|
+
const b = Ce(
|
|
888
886
|
this.logger,
|
|
889
887
|
[
|
|
890
888
|
"compose",
|
|
@@ -905,7 +903,7 @@ ${n}`), pr(
|
|
|
905
903
|
composePath: t
|
|
906
904
|
}
|
|
907
905
|
);
|
|
908
|
-
|
|
906
|
+
H(b, "failed to start Platforma Backend in Docker"), o.isActive = !0;
|
|
909
907
|
const w = this.renderRunInfo({
|
|
910
908
|
apiPort: r == null ? void 0 : r.grpcPort,
|
|
911
909
|
apiAddr: r == null ? void 0 : r.grpcAddr,
|
|
@@ -920,7 +918,7 @@ ${w}`);
|
|
|
920
918
|
}
|
|
921
919
|
startDocker(e, r) {
|
|
922
920
|
var t = O("compose-backend.yaml");
|
|
923
|
-
const i = (r == null ? void 0 : r.image) ??
|
|
921
|
+
const i = (r == null ? void 0 : r.image) ?? ae(r == null ? void 0 : r.version);
|
|
924
922
|
this.checkLicense(r == null ? void 0 : r.license, r == null ? void 0 : r.licenseFile);
|
|
925
923
|
const s = (k) => u.join(e, k), c = (k) => {
|
|
926
924
|
const p = s(k);
|
|
@@ -951,7 +949,7 @@ ${w}`);
|
|
|
951
949
|
k.driver === "htpasswd" && (w.PL_AUTH_HTPASSWD_PATH = u.resolve(k.path), k.path = "/etc/platforma/users.htpasswd");
|
|
952
950
|
w.PL_AUTH_DRIVERS = JSON.stringify(r.auth.drivers);
|
|
953
951
|
}
|
|
954
|
-
const S =
|
|
952
|
+
const S = Ce(
|
|
955
953
|
this.logger,
|
|
956
954
|
["compose", `--file=${t}`, "up", "--detach", "--remove-orphans", "--pull=missing", "backend"],
|
|
957
955
|
{
|
|
@@ -966,7 +964,7 @@ ${w}`);
|
|
|
966
964
|
libraryPath: g
|
|
967
965
|
}
|
|
968
966
|
);
|
|
969
|
-
|
|
967
|
+
H(S, "failed to start Platforma Backend in Docker"), o.isActive = !0;
|
|
970
968
|
const L = this.renderRunInfo({
|
|
971
969
|
apiPort: r == null ? void 0 : r.grpcPort,
|
|
972
970
|
apiAddr: r == null ? void 0 : r.grpcAddr,
|
|
@@ -987,7 +985,7 @@ ${L}`);
|
|
|
987
985
|
const e = o.lastRun;
|
|
988
986
|
switch (e.mode) {
|
|
989
987
|
case "docker":
|
|
990
|
-
const r =
|
|
988
|
+
const r = J("docker", ["compose", "--file", e.docker.composePath, "down"], {
|
|
991
989
|
env: {
|
|
992
990
|
...process.env,
|
|
993
991
|
...e.envs
|
|
@@ -1004,7 +1002,7 @@ ${L}`);
|
|
|
1004
1002
|
}
|
|
1005
1003
|
}
|
|
1006
1004
|
cleanup() {
|
|
1007
|
-
var n, h, f, g, v, P, d, b, w, S, L, k, p,
|
|
1005
|
+
var n, h, f, g, v, P, d, b, w, S, L, k, p, W;
|
|
1008
1006
|
const e = [
|
|
1009
1007
|
"last command run cache ('pl-service start' shorthand will stop working until next full start command call)",
|
|
1010
1008
|
"'platforma' docker compose service containers and volumes"
|
|
@@ -1031,14 +1029,14 @@ Things to be removed:
|
|
|
1031
1029
|
- `)}
|
|
1032
1030
|
${i}
|
|
1033
1031
|
`;
|
|
1034
|
-
if (this.logger.warn(s), !
|
|
1032
|
+
if (this.logger.warn(s), !fr("Are you sure?")) {
|
|
1035
1033
|
this.logger.info("Reset action was canceled");
|
|
1036
1034
|
return;
|
|
1037
1035
|
}
|
|
1038
|
-
const c = new Set(
|
|
1039
|
-
(
|
|
1036
|
+
const c = new Set(Lr());
|
|
1037
|
+
(W = (p = o.lastRun) == null ? void 0 : p.docker) != null && W.composePath && c.add(o.lastRun.docker.composePath);
|
|
1040
1038
|
for (const A of c)
|
|
1041
|
-
this.logger.info(`Destroying docker compose '${A}'`), this.destroyDocker(A,
|
|
1039
|
+
this.logger.info(`Destroying docker compose '${A}'`), this.destroyDocker(A, ae());
|
|
1042
1040
|
for (const A of t)
|
|
1043
1041
|
this.logger.info(`Destroying '${A}'`), l.rmSync(A, { recursive: !0, force: !0 });
|
|
1044
1042
|
this.logger.info(`Destroying state dir '${o.path()}'`), l.rmSync(o.path(), { recursive: !0, force: !0 }), this.logger.info(
|
|
@@ -1072,10 +1070,10 @@ If you want to remove all downloaded platforma binaries, delete '${o.binaries()}
|
|
|
1072
1070
|
t = l.readFileSync(e, { encoding: r });
|
|
1073
1071
|
} catch {
|
|
1074
1072
|
}
|
|
1075
|
-
return t == "" && (t =
|
|
1073
|
+
return t == "" && (t = hr(64), l.writeFileSync(e, t, { encoding: r })), t;
|
|
1076
1074
|
}
|
|
1077
1075
|
destroyDocker(e, r) {
|
|
1078
|
-
const t = o.data("stub"), i =
|
|
1076
|
+
const t = o.data("stub"), i = J("docker", ["compose", "--file", e, "down", "--volumes", "--remove-orphans"], {
|
|
1079
1077
|
env: {
|
|
1080
1078
|
...process.env,
|
|
1081
1079
|
PL_IMAGE: "scratch",
|
|
@@ -1153,13 +1151,13 @@ You can obtain the license from "https://licensing.milaboratories.com".`), new E
|
|
|
1153
1151
|
}
|
|
1154
1152
|
readComposeFile(e) {
|
|
1155
1153
|
const r = l.readFileSync(e);
|
|
1156
|
-
return
|
|
1154
|
+
return Me.parse(r.toString());
|
|
1157
1155
|
}
|
|
1158
1156
|
writeComposeFile(e, r) {
|
|
1159
|
-
l.writeFileSync(e,
|
|
1157
|
+
l.writeFileSync(e, Me.stringify(r));
|
|
1160
1158
|
}
|
|
1161
1159
|
}
|
|
1162
|
-
function
|
|
1160
|
+
function H(a, e) {
|
|
1163
1161
|
if (a.error)
|
|
1164
1162
|
throw a.error;
|
|
1165
1163
|
const r = e ?? "failed to run command";
|
|
@@ -1175,7 +1173,7 @@ const x = class x extends $ {
|
|
|
1175
1173
|
m(x, "description", "Clear service state (forget last run command, destroy docker services, volumes and so on)"), m(x, "examples", ["<%= config.bin %> <%= command.id %>"]), m(x, "flags", {
|
|
1176
1174
|
...T
|
|
1177
1175
|
});
|
|
1178
|
-
let
|
|
1176
|
+
let ce = x;
|
|
1179
1177
|
const M = class M extends $ {
|
|
1180
1178
|
async run() {
|
|
1181
1179
|
const { flags: e } = await this.parse(M), r = E(e["log-level"]);
|
|
@@ -1185,7 +1183,7 @@ const M = class M extends $ {
|
|
|
1185
1183
|
m(M, "description", "Start last run service configuraiton"), m(M, "examples", ["<%= config.bin %> <%= command.id %>"]), m(M, "flags", {
|
|
1186
1184
|
...T
|
|
1187
1185
|
});
|
|
1188
|
-
let
|
|
1186
|
+
let ne = M;
|
|
1189
1187
|
const C = class C extends $ {
|
|
1190
1188
|
async run() {
|
|
1191
1189
|
const { flags: e } = await this.parse(C), r = E(e["log-level"]);
|
|
@@ -1195,7 +1193,7 @@ const C = class C extends $ {
|
|
|
1195
1193
|
m(C, "description", "Stop platforma service"), m(C, "examples", ["<%= config.bin %> <%= command.id %>"]), m(C, "flags", {
|
|
1196
1194
|
...T
|
|
1197
1195
|
});
|
|
1198
|
-
let
|
|
1196
|
+
let le = C;
|
|
1199
1197
|
const B = class B extends $ {
|
|
1200
1198
|
async run() {
|
|
1201
1199
|
const { flags: e } = await this.parse(B), r = E(e["log-level"]), t = new D(r);
|
|
@@ -1224,17 +1222,17 @@ const B = class B extends $ {
|
|
|
1224
1222
|
};
|
|
1225
1223
|
m(B, "description", "Run platforma backend service with 'FS' primary storage type"), m(B, "examples", ["<%= config.bin %> <%= command.id %>"]), m(B, "flags", {
|
|
1226
1224
|
...T,
|
|
1225
|
+
...ee,
|
|
1226
|
+
...Ge,
|
|
1227
|
+
...X,
|
|
1228
|
+
...te,
|
|
1227
1229
|
...Z,
|
|
1228
|
-
...Ue,
|
|
1229
|
-
...Q,
|
|
1230
1230
|
...re,
|
|
1231
|
-
...X,
|
|
1232
|
-
...ee,
|
|
1233
|
-
...he,
|
|
1234
1231
|
...fe,
|
|
1235
|
-
...
|
|
1232
|
+
...ue,
|
|
1233
|
+
...he
|
|
1236
1234
|
});
|
|
1237
|
-
let
|
|
1235
|
+
let oe = B;
|
|
1238
1236
|
const G = class G extends $ {
|
|
1239
1237
|
async run() {
|
|
1240
1238
|
const { flags: e } = await this.parse(G), r = E(e["log-level"]), t = new D(r);
|
|
@@ -1268,30 +1266,30 @@ const G = class G extends $ {
|
|
|
1268
1266
|
}
|
|
1269
1267
|
}
|
|
1270
1268
|
};
|
|
1271
|
-
d.binaryPath ? t.startLocal(d) :
|
|
1269
|
+
d.binaryPath ? t.startLocal(d) : Ve(r, { version: e.version }).then(() => t.startLocal(d)).catch(function(b) {
|
|
1272
1270
|
r.error(b.message);
|
|
1273
1271
|
});
|
|
1274
1272
|
}
|
|
1275
1273
|
};
|
|
1276
1274
|
m(G, "description", "Run Platforma Backend service as local process on current host (no docker container)"), m(G, "examples", ["<%= config.bin %> <%= command.id %>"]), m(G, "flags", {
|
|
1277
1275
|
...T,
|
|
1278
|
-
...Q,
|
|
1279
|
-
...Z,
|
|
1280
|
-
...Je,
|
|
1281
|
-
...He,
|
|
1282
|
-
...Ye,
|
|
1283
1276
|
...X,
|
|
1284
1277
|
...ee,
|
|
1285
|
-
...he,
|
|
1286
|
-
...fe,
|
|
1287
|
-
...me,
|
|
1288
1278
|
...je,
|
|
1279
|
+
...He,
|
|
1280
|
+
...Je,
|
|
1281
|
+
...Z,
|
|
1282
|
+
...re,
|
|
1283
|
+
...fe,
|
|
1284
|
+
...ue,
|
|
1285
|
+
...he,
|
|
1286
|
+
...Ue,
|
|
1289
1287
|
...We,
|
|
1290
|
-
...
|
|
1288
|
+
...te
|
|
1291
1289
|
});
|
|
1292
|
-
let
|
|
1290
|
+
let de = G;
|
|
1293
1291
|
var R;
|
|
1294
|
-
let
|
|
1292
|
+
let Br = (R = class extends $ {
|
|
1295
1293
|
async run() {
|
|
1296
1294
|
const { flags: e } = await this.parse(R), r = E(e["log-level"]), t = new D(r);
|
|
1297
1295
|
t.mergeLicenseEnvs(e);
|
|
@@ -1315,12 +1313,12 @@ let Gr = (R = class extends $ {
|
|
|
1315
1313
|
}
|
|
1316
1314
|
}, m(R, "description", "Run platforma backend service with 'S3' primary storage type"), m(R, "examples", ["<%= config.bin %> <%= command.id %>"]), m(R, "flags", {
|
|
1317
1315
|
...T,
|
|
1318
|
-
...Z,
|
|
1319
|
-
...Ue,
|
|
1320
|
-
...Q,
|
|
1321
1316
|
...ee,
|
|
1317
|
+
...Ge,
|
|
1322
1318
|
...X,
|
|
1323
|
-
...re
|
|
1319
|
+
...re,
|
|
1320
|
+
...Z,
|
|
1321
|
+
...te
|
|
1324
1322
|
}), R);
|
|
1325
1323
|
const U = class U extends $ {
|
|
1326
1324
|
async run() {
|
|
@@ -1359,38 +1357,38 @@ const U = class U extends $ {
|
|
|
1359
1357
|
}
|
|
1360
1358
|
}
|
|
1361
1359
|
};
|
|
1362
|
-
d.binaryPath ? t.startLocalS3(d) :
|
|
1360
|
+
d.binaryPath ? t.startLocalS3(d) : Ve(r, { version: e.version }).then(() => t.startLocalS3(d)).catch(function(b) {
|
|
1363
1361
|
r.error(b.message);
|
|
1364
1362
|
});
|
|
1365
1363
|
}
|
|
1366
1364
|
};
|
|
1367
1365
|
m(U, "description", "Run Platforma Backend service as local process on current host (no docker container)"), m(U, "examples", ["<%= config.bin %> <%= command.id %>"]), m(U, "flags", {
|
|
1368
1366
|
...T,
|
|
1369
|
-
...Q,
|
|
1370
|
-
...Z,
|
|
1371
|
-
...dr,
|
|
1372
|
-
...Je,
|
|
1373
|
-
...He,
|
|
1374
|
-
...Ye,
|
|
1375
1367
|
...X,
|
|
1376
1368
|
...ee,
|
|
1377
|
-
...
|
|
1378
|
-
...fe,
|
|
1379
|
-
...me,
|
|
1369
|
+
...lr,
|
|
1380
1370
|
...je,
|
|
1371
|
+
...He,
|
|
1372
|
+
...Je,
|
|
1373
|
+
...Z,
|
|
1374
|
+
...re,
|
|
1375
|
+
...fe,
|
|
1376
|
+
...ue,
|
|
1377
|
+
...he,
|
|
1378
|
+
...Ue,
|
|
1381
1379
|
...We,
|
|
1382
|
-
...
|
|
1380
|
+
...te
|
|
1383
1381
|
});
|
|
1384
|
-
let
|
|
1382
|
+
let ge = U;
|
|
1385
1383
|
const rt = {
|
|
1386
|
-
"create-block":
|
|
1387
|
-
reset:
|
|
1388
|
-
start:
|
|
1389
|
-
stop:
|
|
1390
|
-
"start:docker":
|
|
1391
|
-
"start:local":
|
|
1392
|
-
"start:docker:s3":
|
|
1393
|
-
"start:local:s3":
|
|
1384
|
+
"create-block": ie,
|
|
1385
|
+
reset: ce,
|
|
1386
|
+
start: ne,
|
|
1387
|
+
stop: le,
|
|
1388
|
+
"start:docker": oe,
|
|
1389
|
+
"start:local": de,
|
|
1390
|
+
"start:docker:s3": Br,
|
|
1391
|
+
"start:local:s3": ge
|
|
1394
1392
|
};
|
|
1395
1393
|
export {
|
|
1396
1394
|
rt as COMMANDS
|