@platforma-sdk/bootstrap 2.4.0 → 2.4.2
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 +22 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +205 -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/package.json +6 -5
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()), `
|
|
@@ -623,8 +620,8 @@ controllers:
|
|
|
623
620
|
function z(a, e) {
|
|
624
621
|
return a === void 0 ? e : a;
|
|
625
622
|
}
|
|
626
|
-
const
|
|
627
|
-
function
|
|
623
|
+
const Fr = ["linux", "macos", "windows"];
|
|
624
|
+
function Dr(a) {
|
|
628
625
|
const e = _.platform();
|
|
629
626
|
switch (e) {
|
|
630
627
|
case "darwin":
|
|
@@ -635,12 +632,12 @@ function Nr(a) {
|
|
|
635
632
|
return "windows";
|
|
636
633
|
default:
|
|
637
634
|
throw new Error(
|
|
638
|
-
`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)
|
|
639
636
|
);
|
|
640
637
|
}
|
|
641
638
|
}
|
|
642
|
-
const
|
|
643
|
-
function
|
|
639
|
+
const Nr = ["amd64", "arm64"];
|
|
640
|
+
function qe(a) {
|
|
644
641
|
const e = _.arch();
|
|
645
642
|
switch (e) {
|
|
646
643
|
case "arm64":
|
|
@@ -649,18 +646,18 @@ function Qe(a) {
|
|
|
649
646
|
return "amd64";
|
|
650
647
|
default:
|
|
651
648
|
throw new Error(
|
|
652
|
-
`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)
|
|
653
650
|
);
|
|
654
651
|
}
|
|
655
652
|
}
|
|
656
|
-
function
|
|
657
|
-
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);
|
|
658
655
|
if (l.existsSync(c))
|
|
659
656
|
return a.info(`Platforma Backend archive download skipped: '${c}' already exists`), Promise.resolve(c);
|
|
660
657
|
l.mkdirSync(u.dirname(c), { recursive: !0 }), a.info(`Downloading Platforma Backend archive:
|
|
661
658
|
URL: ${s}
|
|
662
659
|
Save to: ${c}`);
|
|
663
|
-
const n =
|
|
660
|
+
const n = cr.get(s);
|
|
664
661
|
return new Promise((h, f) => {
|
|
665
662
|
n.on("response", (g) => {
|
|
666
663
|
if (!g.statusCode) {
|
|
@@ -688,13 +685,13 @@ function xr(a, e) {
|
|
|
688
685
|
});
|
|
689
686
|
});
|
|
690
687
|
}
|
|
691
|
-
function
|
|
688
|
+
function xr(a, e) {
|
|
692
689
|
a.debug("extracting archive...");
|
|
693
|
-
const r = (e == null ? void 0 : e.version) ??
|
|
690
|
+
const r = (e == null ? void 0 : e.version) ?? Q();
|
|
694
691
|
a.debug(` version: '${r}'`);
|
|
695
|
-
const t = `${
|
|
692
|
+
const t = `${Qe({ version: r })}.tgz`, i = (e == null ? void 0 : e.archivePath) ?? o.binaries(t);
|
|
696
693
|
a.debug(` archive path: '${i}'`);
|
|
697
|
-
const s = (e == null ? void 0 : e.extractTo) ??
|
|
694
|
+
const s = (e == null ? void 0 : e.extractTo) ?? Cr(i);
|
|
698
695
|
if (a.debug(` target dir: '${s}'`), l.existsSync(s))
|
|
699
696
|
return a.info(`Platforma Backend binaries unpack skipped: '${s}' exists`), s;
|
|
700
697
|
if (!l.existsSync(i)) {
|
|
@@ -703,23 +700,23 @@ function Mr(a, e) {
|
|
|
703
700
|
}
|
|
704
701
|
return l.existsSync(s) || (a.debug(` creating target dir '${s}'`), l.mkdirSync(s, { recursive: !0 })), a.info(`Unpacking Platforma Backend archive:
|
|
705
702
|
Archive: ${i}
|
|
706
|
-
Target dir: ${s}`),
|
|
703
|
+
Target dir: ${s}`), nr.x({
|
|
707
704
|
file: i,
|
|
708
705
|
cwd: s,
|
|
709
706
|
gzip: !0,
|
|
710
707
|
sync: !0
|
|
711
708
|
}), a.info(" ... unpack done."), s;
|
|
712
709
|
}
|
|
713
|
-
function
|
|
714
|
-
return
|
|
710
|
+
function Ve(a, e) {
|
|
711
|
+
return Ir(a, e).then((r) => xr(a, { archivePath: r }));
|
|
715
712
|
}
|
|
716
|
-
function
|
|
717
|
-
return `pl-${(a == null ? void 0 : a.version) ??
|
|
713
|
+
function Qe(a) {
|
|
714
|
+
return `pl-${(a == null ? void 0 : a.version) ?? Q()}-${qe()}`;
|
|
718
715
|
}
|
|
719
|
-
function
|
|
720
|
-
return o.binaries(
|
|
716
|
+
function Mr(a, ...e) {
|
|
717
|
+
return o.binaries(Qe({ version: a }), ...e);
|
|
721
718
|
}
|
|
722
|
-
function
|
|
719
|
+
function Cr(a) {
|
|
723
720
|
const e = a.lastIndexOf(".");
|
|
724
721
|
return e === -1 ? a : a.slice(0, e);
|
|
725
722
|
}
|
|
@@ -728,12 +725,12 @@ class D {
|
|
|
728
725
|
this.logger = e;
|
|
729
726
|
}
|
|
730
727
|
startLast() {
|
|
731
|
-
const e =
|
|
732
|
-
|
|
728
|
+
const e = pr(this.logger, { stdio: "inherit" });
|
|
729
|
+
H(e, "failed to bring back Platforma Backend in the last started configuration");
|
|
733
730
|
}
|
|
734
731
|
startLocal(e) {
|
|
735
732
|
var h, f, g, v, P, d, b, w, S, L;
|
|
736
|
-
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");
|
|
737
734
|
var t = e == null ? void 0 : e.configPath;
|
|
738
735
|
const i = (e == null ? void 0 : e.workdir) ?? (t ? process.cwd() : o.path());
|
|
739
736
|
e != null && e.primaryURL && (e.configOptions = {
|
|
@@ -749,7 +746,7 @@ class D {
|
|
|
749
746
|
library: N(e.libraryURL, i, (d = (P = e.configOptions) == null ? void 0 : P.storages) == null ? void 0 : d.library)
|
|
750
747
|
}
|
|
751
748
|
});
|
|
752
|
-
const s =
|
|
749
|
+
const s = Tr(this.getLastJwt(), e == null ? void 0 : e.configOptions);
|
|
753
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);
|
|
754
751
|
const c = [
|
|
755
752
|
`${s.localRoot}/packages`,
|
|
@@ -761,7 +758,7 @@ class D {
|
|
|
761
758
|
l.existsSync(k) || (this.logger.debug(` '${k}'`), l.mkdirSync(k, { recursive: !0 }));
|
|
762
759
|
for (const k of s.core.auth.drivers)
|
|
763
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)));
|
|
764
|
-
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)));
|
|
765
762
|
const n = this.renderRunInfo({
|
|
766
763
|
configPath: t,
|
|
767
764
|
dbPath: s.core.db.path,
|
|
@@ -772,7 +769,7 @@ class D {
|
|
|
772
769
|
library: s.storages.library
|
|
773
770
|
});
|
|
774
771
|
return this.logger.info(`Starting platforma:
|
|
775
|
-
${n}`),
|
|
772
|
+
${n}`), _r(
|
|
776
773
|
this.logger,
|
|
777
774
|
r,
|
|
778
775
|
["-config", t],
|
|
@@ -823,7 +820,7 @@ ${n}`), pr(
|
|
|
823
820
|
PL_IMAGE: "scratch"
|
|
824
821
|
};
|
|
825
822
|
this.logger.debug(" spawning child 'docker' process...");
|
|
826
|
-
const g =
|
|
823
|
+
const g = J(
|
|
827
824
|
"docker",
|
|
828
825
|
["compose", `--file=${r}`, "up", "--detach", "--remove-orphans", "--pull=missing", "minio"],
|
|
829
826
|
{
|
|
@@ -834,19 +831,19 @@ ${n}`), pr(
|
|
|
834
831
|
stdio: "inherit"
|
|
835
832
|
}
|
|
836
833
|
);
|
|
837
|
-
|
|
834
|
+
H(g, "failed to start MinIO service in docker");
|
|
838
835
|
}
|
|
839
836
|
buildPlatforma(e) {
|
|
840
837
|
const r = u.resolve(e.repoRoot, "cmd", "platforma"), t = e.binPath ?? u.join(_.tmpdir(), "platforma-local-build");
|
|
841
838
|
this.logger.info("Building Platforma Backend binary from sources"), this.logger.info(` sources path: ${e.repoRoot}`), this.logger.info(` binary path: ${t}`);
|
|
842
|
-
const i =
|
|
839
|
+
const i = J("go", ["build", "-o", t, "."], {
|
|
843
840
|
cwd: r,
|
|
844
841
|
stdio: "inherit"
|
|
845
842
|
});
|
|
846
|
-
return
|
|
843
|
+
return H(i, "failed to build platforma binary from sources using 'go build' command"), t;
|
|
847
844
|
}
|
|
848
845
|
startDockerS3(e, r) {
|
|
849
|
-
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);
|
|
850
847
|
this.checkLicense(r == null ? void 0 : r.license, r == null ? void 0 : r.licenseFile);
|
|
851
848
|
const s = (S) => u.join(e, S), c = (S) => {
|
|
852
849
|
const L = s(S);
|
|
@@ -885,7 +882,7 @@ ${n}`), pr(
|
|
|
885
882
|
S.driver === "htpasswd" && (d.PL_AUTH_HTPASSWD_PATH = u.resolve(S.path), S.path = "/etc/platforma/users.htpasswd");
|
|
886
883
|
d.PL_AUTH_DRIVERS = JSON.stringify(r.auth.drivers);
|
|
887
884
|
}
|
|
888
|
-
const b =
|
|
885
|
+
const b = Ce(
|
|
889
886
|
this.logger,
|
|
890
887
|
[
|
|
891
888
|
"compose",
|
|
@@ -906,7 +903,7 @@ ${n}`), pr(
|
|
|
906
903
|
composePath: t
|
|
907
904
|
}
|
|
908
905
|
);
|
|
909
|
-
|
|
906
|
+
H(b, "failed to start Platforma Backend in Docker"), o.isActive = !0;
|
|
910
907
|
const w = this.renderRunInfo({
|
|
911
908
|
apiPort: r == null ? void 0 : r.grpcPort,
|
|
912
909
|
apiAddr: r == null ? void 0 : r.grpcAddr,
|
|
@@ -921,7 +918,7 @@ ${w}`);
|
|
|
921
918
|
}
|
|
922
919
|
startDocker(e, r) {
|
|
923
920
|
var t = O("compose-backend.yaml");
|
|
924
|
-
const i = (r == null ? void 0 : r.image) ??
|
|
921
|
+
const i = (r == null ? void 0 : r.image) ?? ae(r == null ? void 0 : r.version);
|
|
925
922
|
this.checkLicense(r == null ? void 0 : r.license, r == null ? void 0 : r.licenseFile);
|
|
926
923
|
const s = (k) => u.join(e, k), c = (k) => {
|
|
927
924
|
const p = s(k);
|
|
@@ -952,7 +949,7 @@ ${w}`);
|
|
|
952
949
|
k.driver === "htpasswd" && (w.PL_AUTH_HTPASSWD_PATH = u.resolve(k.path), k.path = "/etc/platforma/users.htpasswd");
|
|
953
950
|
w.PL_AUTH_DRIVERS = JSON.stringify(r.auth.drivers);
|
|
954
951
|
}
|
|
955
|
-
const S =
|
|
952
|
+
const S = Ce(
|
|
956
953
|
this.logger,
|
|
957
954
|
["compose", `--file=${t}`, "up", "--detach", "--remove-orphans", "--pull=missing", "backend"],
|
|
958
955
|
{
|
|
@@ -967,7 +964,7 @@ ${w}`);
|
|
|
967
964
|
libraryPath: g
|
|
968
965
|
}
|
|
969
966
|
);
|
|
970
|
-
|
|
967
|
+
H(S, "failed to start Platforma Backend in Docker"), o.isActive = !0;
|
|
971
968
|
const L = this.renderRunInfo({
|
|
972
969
|
apiPort: r == null ? void 0 : r.grpcPort,
|
|
973
970
|
apiAddr: r == null ? void 0 : r.grpcAddr,
|
|
@@ -988,7 +985,7 @@ ${L}`);
|
|
|
988
985
|
const e = o.lastRun;
|
|
989
986
|
switch (e.mode) {
|
|
990
987
|
case "docker":
|
|
991
|
-
const r =
|
|
988
|
+
const r = J("docker", ["compose", "--file", e.docker.composePath, "down"], {
|
|
992
989
|
env: {
|
|
993
990
|
...process.env,
|
|
994
991
|
...e.envs
|
|
@@ -1005,7 +1002,7 @@ ${L}`);
|
|
|
1005
1002
|
}
|
|
1006
1003
|
}
|
|
1007
1004
|
cleanup() {
|
|
1008
|
-
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;
|
|
1009
1006
|
const e = [
|
|
1010
1007
|
"last command run cache ('pl-service start' shorthand will stop working until next full start command call)",
|
|
1011
1008
|
"'platforma' docker compose service containers and volumes"
|
|
@@ -1032,14 +1029,14 @@ Things to be removed:
|
|
|
1032
1029
|
- `)}
|
|
1033
1030
|
${i}
|
|
1034
1031
|
`;
|
|
1035
|
-
if (this.logger.warn(s), !
|
|
1032
|
+
if (this.logger.warn(s), !fr("Are you sure?")) {
|
|
1036
1033
|
this.logger.info("Reset action was canceled");
|
|
1037
1034
|
return;
|
|
1038
1035
|
}
|
|
1039
|
-
const c = new Set(
|
|
1040
|
-
(
|
|
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);
|
|
1041
1038
|
for (const A of c)
|
|
1042
|
-
this.logger.info(`Destroying docker compose '${A}'`), this.destroyDocker(A,
|
|
1039
|
+
this.logger.info(`Destroying docker compose '${A}'`), this.destroyDocker(A, ae());
|
|
1043
1040
|
for (const A of t)
|
|
1044
1041
|
this.logger.info(`Destroying '${A}'`), l.rmSync(A, { recursive: !0, force: !0 });
|
|
1045
1042
|
this.logger.info(`Destroying state dir '${o.path()}'`), l.rmSync(o.path(), { recursive: !0, force: !0 }), this.logger.info(
|
|
@@ -1073,10 +1070,10 @@ If you want to remove all downloaded platforma binaries, delete '${o.binaries()}
|
|
|
1073
1070
|
t = l.readFileSync(e, { encoding: r });
|
|
1074
1071
|
} catch {
|
|
1075
1072
|
}
|
|
1076
|
-
return t == "" && (t =
|
|
1073
|
+
return t == "" && (t = hr(64), l.writeFileSync(e, t, { encoding: r })), t;
|
|
1077
1074
|
}
|
|
1078
1075
|
destroyDocker(e, r) {
|
|
1079
|
-
const t = o.data("stub"), i =
|
|
1076
|
+
const t = o.data("stub"), i = J("docker", ["compose", "--file", e, "down", "--volumes", "--remove-orphans"], {
|
|
1080
1077
|
env: {
|
|
1081
1078
|
...process.env,
|
|
1082
1079
|
PL_IMAGE: "scratch",
|
|
@@ -1154,13 +1151,13 @@ You can obtain the license from "https://licensing.milaboratories.com".`), new E
|
|
|
1154
1151
|
}
|
|
1155
1152
|
readComposeFile(e) {
|
|
1156
1153
|
const r = l.readFileSync(e);
|
|
1157
|
-
return
|
|
1154
|
+
return Me.parse(r.toString());
|
|
1158
1155
|
}
|
|
1159
1156
|
writeComposeFile(e, r) {
|
|
1160
|
-
l.writeFileSync(e,
|
|
1157
|
+
l.writeFileSync(e, Me.stringify(r));
|
|
1161
1158
|
}
|
|
1162
1159
|
}
|
|
1163
|
-
function
|
|
1160
|
+
function H(a, e) {
|
|
1164
1161
|
if (a.error)
|
|
1165
1162
|
throw a.error;
|
|
1166
1163
|
const r = e ?? "failed to run command";
|
|
@@ -1176,7 +1173,7 @@ const x = class x extends $ {
|
|
|
1176
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", {
|
|
1177
1174
|
...T
|
|
1178
1175
|
});
|
|
1179
|
-
let
|
|
1176
|
+
let ce = x;
|
|
1180
1177
|
const M = class M extends $ {
|
|
1181
1178
|
async run() {
|
|
1182
1179
|
const { flags: e } = await this.parse(M), r = E(e["log-level"]);
|
|
@@ -1186,7 +1183,7 @@ const M = class M extends $ {
|
|
|
1186
1183
|
m(M, "description", "Start last run service configuraiton"), m(M, "examples", ["<%= config.bin %> <%= command.id %>"]), m(M, "flags", {
|
|
1187
1184
|
...T
|
|
1188
1185
|
});
|
|
1189
|
-
let
|
|
1186
|
+
let ne = M;
|
|
1190
1187
|
const C = class C extends $ {
|
|
1191
1188
|
async run() {
|
|
1192
1189
|
const { flags: e } = await this.parse(C), r = E(e["log-level"]);
|
|
@@ -1196,7 +1193,7 @@ const C = class C extends $ {
|
|
|
1196
1193
|
m(C, "description", "Stop platforma service"), m(C, "examples", ["<%= config.bin %> <%= command.id %>"]), m(C, "flags", {
|
|
1197
1194
|
...T
|
|
1198
1195
|
});
|
|
1199
|
-
let
|
|
1196
|
+
let le = C;
|
|
1200
1197
|
const B = class B extends $ {
|
|
1201
1198
|
async run() {
|
|
1202
1199
|
const { flags: e } = await this.parse(B), r = E(e["log-level"]), t = new D(r);
|
|
@@ -1225,17 +1222,17 @@ const B = class B extends $ {
|
|
|
1225
1222
|
};
|
|
1226
1223
|
m(B, "description", "Run platforma backend service with 'FS' primary storage type"), m(B, "examples", ["<%= config.bin %> <%= command.id %>"]), m(B, "flags", {
|
|
1227
1224
|
...T,
|
|
1225
|
+
...ee,
|
|
1226
|
+
...Ge,
|
|
1227
|
+
...X,
|
|
1228
|
+
...te,
|
|
1228
1229
|
...Z,
|
|
1229
|
-
...Ue,
|
|
1230
|
-
...Q,
|
|
1231
1230
|
...re,
|
|
1232
|
-
...X,
|
|
1233
|
-
...ee,
|
|
1234
|
-
...he,
|
|
1235
1231
|
...fe,
|
|
1236
|
-
...
|
|
1232
|
+
...ue,
|
|
1233
|
+
...he
|
|
1237
1234
|
});
|
|
1238
|
-
let
|
|
1235
|
+
let oe = B;
|
|
1239
1236
|
const G = class G extends $ {
|
|
1240
1237
|
async run() {
|
|
1241
1238
|
const { flags: e } = await this.parse(G), r = E(e["log-level"]), t = new D(r);
|
|
@@ -1269,30 +1266,30 @@ const G = class G extends $ {
|
|
|
1269
1266
|
}
|
|
1270
1267
|
}
|
|
1271
1268
|
};
|
|
1272
|
-
d.binaryPath ? t.startLocal(d) :
|
|
1269
|
+
d.binaryPath ? t.startLocal(d) : Ve(r, { version: e.version }).then(() => t.startLocal(d)).catch(function(b) {
|
|
1273
1270
|
r.error(b.message);
|
|
1274
1271
|
});
|
|
1275
1272
|
}
|
|
1276
1273
|
};
|
|
1277
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", {
|
|
1278
1275
|
...T,
|
|
1279
|
-
...Q,
|
|
1280
|
-
...Z,
|
|
1281
|
-
...Je,
|
|
1282
|
-
...He,
|
|
1283
|
-
...Ye,
|
|
1284
1276
|
...X,
|
|
1285
1277
|
...ee,
|
|
1286
|
-
...he,
|
|
1287
|
-
...fe,
|
|
1288
|
-
...me,
|
|
1289
1278
|
...je,
|
|
1279
|
+
...He,
|
|
1280
|
+
...Je,
|
|
1281
|
+
...Z,
|
|
1282
|
+
...re,
|
|
1283
|
+
...fe,
|
|
1284
|
+
...ue,
|
|
1285
|
+
...he,
|
|
1286
|
+
...Ue,
|
|
1290
1287
|
...We,
|
|
1291
|
-
...
|
|
1288
|
+
...te
|
|
1292
1289
|
});
|
|
1293
|
-
let
|
|
1290
|
+
let de = G;
|
|
1294
1291
|
var R;
|
|
1295
|
-
let
|
|
1292
|
+
let Br = (R = class extends $ {
|
|
1296
1293
|
async run() {
|
|
1297
1294
|
const { flags: e } = await this.parse(R), r = E(e["log-level"]), t = new D(r);
|
|
1298
1295
|
t.mergeLicenseEnvs(e);
|
|
@@ -1316,12 +1313,12 @@ let Gr = (R = class extends $ {
|
|
|
1316
1313
|
}
|
|
1317
1314
|
}, m(R, "description", "Run platforma backend service with 'S3' primary storage type"), m(R, "examples", ["<%= config.bin %> <%= command.id %>"]), m(R, "flags", {
|
|
1318
1315
|
...T,
|
|
1319
|
-
...Z,
|
|
1320
|
-
...Ue,
|
|
1321
|
-
...Q,
|
|
1322
1316
|
...ee,
|
|
1317
|
+
...Ge,
|
|
1323
1318
|
...X,
|
|
1324
|
-
...re
|
|
1319
|
+
...re,
|
|
1320
|
+
...Z,
|
|
1321
|
+
...te
|
|
1325
1322
|
}), R);
|
|
1326
1323
|
const U = class U extends $ {
|
|
1327
1324
|
async run() {
|
|
@@ -1360,38 +1357,38 @@ const U = class U extends $ {
|
|
|
1360
1357
|
}
|
|
1361
1358
|
}
|
|
1362
1359
|
};
|
|
1363
|
-
d.binaryPath ? t.startLocalS3(d) :
|
|
1360
|
+
d.binaryPath ? t.startLocalS3(d) : Ve(r, { version: e.version }).then(() => t.startLocalS3(d)).catch(function(b) {
|
|
1364
1361
|
r.error(b.message);
|
|
1365
1362
|
});
|
|
1366
1363
|
}
|
|
1367
1364
|
};
|
|
1368
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", {
|
|
1369
1366
|
...T,
|
|
1370
|
-
...Q,
|
|
1371
|
-
...Z,
|
|
1372
|
-
...dr,
|
|
1373
|
-
...Je,
|
|
1374
|
-
...He,
|
|
1375
|
-
...Ye,
|
|
1376
1367
|
...X,
|
|
1377
1368
|
...ee,
|
|
1378
|
-
...
|
|
1379
|
-
...fe,
|
|
1380
|
-
...me,
|
|
1369
|
+
...lr,
|
|
1381
1370
|
...je,
|
|
1371
|
+
...He,
|
|
1372
|
+
...Je,
|
|
1373
|
+
...Z,
|
|
1374
|
+
...re,
|
|
1375
|
+
...fe,
|
|
1376
|
+
...ue,
|
|
1377
|
+
...he,
|
|
1378
|
+
...Ue,
|
|
1382
1379
|
...We,
|
|
1383
|
-
...
|
|
1380
|
+
...te
|
|
1384
1381
|
});
|
|
1385
|
-
let
|
|
1382
|
+
let ge = U;
|
|
1386
1383
|
const rt = {
|
|
1387
|
-
"create-block":
|
|
1388
|
-
reset:
|
|
1389
|
-
start:
|
|
1390
|
-
stop:
|
|
1391
|
-
"start:docker":
|
|
1392
|
-
"start:local":
|
|
1393
|
-
"start:docker:s3":
|
|
1394
|
-
"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
|
|
1395
1392
|
};
|
|
1396
1393
|
export {
|
|
1397
1394
|
rt as COMMANDS
|