@platforma-sdk/bootstrap 3.4.3 → 3.4.5
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.map +1 -1
- package/dist/index.js +24 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +462 -436
- package/dist/index.mjs.map +1 -1
- package/dist/templates/pl-config.d.ts.map +1 -1
- package/dist/templates/types.d.ts +2 -0
- package/dist/templates/types.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var l = (a, e, t) =>
|
|
4
|
-
import { Flags as w, Command as L, Args as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
1
|
+
var Sr = Object.defineProperty;
|
|
2
|
+
var $r = (a, e, t) => e in a ? Sr(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
|
|
3
|
+
var l = (a, e, t) => $r(a, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { Flags as w, Command as L, Args as Q } from "@oclif/core";
|
|
5
|
+
import * as me from "node:os";
|
|
6
|
+
import N from "node:os";
|
|
7
|
+
import f, { createWriteStream as Lr } from "node:fs";
|
|
8
|
+
import m, { resolve as Ar } from "node:path";
|
|
9
|
+
import { execSync as Re, spawn as Ir, spawnSync as Or } from "node:child_process";
|
|
10
|
+
import fe from "winston";
|
|
11
|
+
import { randomBytes as Er } from "node:crypto";
|
|
12
|
+
import re from "readline-sync";
|
|
13
|
+
import * as M from "node:fs/promises";
|
|
14
|
+
import { Writable as Rr } from "node:stream";
|
|
15
|
+
import { z as C } from "zod";
|
|
16
|
+
import xr from "decompress";
|
|
17
|
+
import { getDefaultPlVersion as he } from "@milaboratories/pl-deployments";
|
|
18
|
+
import gr from "yaml";
|
|
18
19
|
import Tr from "node:https";
|
|
19
|
-
import * as
|
|
20
|
+
import * as Fr from "tar";
|
|
20
21
|
const A = {
|
|
21
22
|
"log-level": w.string({
|
|
22
23
|
description: "logging level",
|
|
@@ -29,19 +30,19 @@ w.string({
|
|
|
29
30
|
description: "name of instance",
|
|
30
31
|
required: !1
|
|
31
32
|
});
|
|
32
|
-
const
|
|
33
|
+
const ye = {
|
|
33
34
|
image: w.string({
|
|
34
35
|
description: "use custom docker image to run platforma"
|
|
35
36
|
})
|
|
36
|
-
},
|
|
37
|
+
}, j = {
|
|
37
38
|
version: w.string({
|
|
38
39
|
description: "use custom platforma release (official docker image or binary package)"
|
|
39
40
|
})
|
|
40
|
-
},
|
|
41
|
+
}, pe = {
|
|
41
42
|
arch: w.string({
|
|
42
43
|
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
44
|
})
|
|
44
|
-
},
|
|
45
|
+
}, B = {
|
|
45
46
|
license: w.string({
|
|
46
47
|
description: 'pass a license code. The license can be got from "https://licensing.milaboratories.com".'
|
|
47
48
|
}),
|
|
@@ -49,7 +50,7 @@ const fe = {
|
|
|
49
50
|
exists: !0,
|
|
50
51
|
description: "specify a path to the file with a license. The license can be got from 'https://licensing.milaboratories.com'."
|
|
51
52
|
})
|
|
52
|
-
},
|
|
53
|
+
}, U = {
|
|
53
54
|
"grpc-port": w.integer({
|
|
54
55
|
description: "port for Platforma Backend gRPC API. Default is 6345",
|
|
55
56
|
env: "PLATFORMA_GRPC_PORT"
|
|
@@ -74,7 +75,7 @@ const fe = {
|
|
|
74
75
|
description: "full listen addr for Platforma Backend debug API. Default is 127.0.0.1:9091",
|
|
75
76
|
env: "PLATFORMA_DEBUG_LISTEN"
|
|
76
77
|
})
|
|
77
|
-
},
|
|
78
|
+
}, hr = {
|
|
78
79
|
"s3-port": w.integer({
|
|
79
80
|
description: "port that S3 will listen, default is 9000",
|
|
80
81
|
default: 9e3,
|
|
@@ -85,36 +86,36 @@ const fe = {
|
|
|
85
86
|
default: 9001,
|
|
86
87
|
env: "PLATFORMA_S3_CONSOLE_PORT"
|
|
87
88
|
})
|
|
88
|
-
},
|
|
89
|
+
}, G = {
|
|
89
90
|
storage: w.string({
|
|
90
91
|
description: "specify path on host to be used as storage for all Platforma Backend data"
|
|
91
92
|
})
|
|
92
|
-
},
|
|
93
|
+
}, yr = {
|
|
93
94
|
"minio-presign-host": w.boolean({
|
|
94
95
|
description: "use 'minio' host instead of 'localhost' in presign URLs"
|
|
95
96
|
})
|
|
96
|
-
},
|
|
97
|
+
}, be = {
|
|
97
98
|
mount: w.string({
|
|
98
99
|
multiple: !0,
|
|
99
100
|
description: "things to be mounted into platforma docker container. Targets will appear inside the container under the same absolute paths"
|
|
100
101
|
})
|
|
101
|
-
},
|
|
102
|
+
}, we = {
|
|
102
103
|
"pl-log-file": w.file({
|
|
103
104
|
description: "specify path for Platforma Backend log file"
|
|
104
105
|
})
|
|
105
|
-
},
|
|
106
|
+
}, ve = {
|
|
106
107
|
"pl-workdir": w.file({
|
|
107
108
|
description: "specify working directory for Platforma Backend process"
|
|
108
109
|
})
|
|
109
|
-
},
|
|
110
|
+
}, Pe = {
|
|
110
111
|
"pl-binary": w.file({
|
|
111
112
|
description: "start given Platforma Backend binary instead of automatically downloaded version"
|
|
112
113
|
})
|
|
113
|
-
},
|
|
114
|
+
}, ke = {
|
|
114
115
|
"pl-sources": w.file({
|
|
115
116
|
description: "path to pl repository root: build Platforma Backend from sources and start the resulting binary"
|
|
116
117
|
})
|
|
117
|
-
},
|
|
118
|
+
}, Se = {
|
|
118
119
|
config: w.string({
|
|
119
120
|
description: "use custom Platforma Backend config"
|
|
120
121
|
})
|
|
@@ -122,7 +123,7 @@ const fe = {
|
|
|
122
123
|
w.file({
|
|
123
124
|
description: "specify path on host to be used as 'primary' storage"
|
|
124
125
|
});
|
|
125
|
-
const
|
|
126
|
+
const oe = {
|
|
126
127
|
"storage-work": w.file({
|
|
127
128
|
description: "specify path on host to be used as 'work' storage"
|
|
128
129
|
})
|
|
@@ -130,7 +131,7 @@ const ie = {
|
|
|
130
131
|
w.file({
|
|
131
132
|
description: "specify path on host to be used as 'library' storage"
|
|
132
133
|
});
|
|
133
|
-
const
|
|
134
|
+
const le = {
|
|
134
135
|
"storage-primary": w.string({
|
|
135
136
|
description: `specify 'primary' storage destination URL.
|
|
136
137
|
file:/path/to/dir for directory on local FS
|
|
@@ -138,7 +139,7 @@ const ce = {
|
|
|
138
139
|
s3e://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via http
|
|
139
140
|
s3es://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via https`
|
|
140
141
|
})
|
|
141
|
-
},
|
|
142
|
+
}, de = {
|
|
142
143
|
"storage-library": w.string({
|
|
143
144
|
description: `specify 'library' storage destination URL.
|
|
144
145
|
file:/path/to/dir for directory on local FS
|
|
@@ -146,38 +147,38 @@ const ce = {
|
|
|
146
147
|
s3e://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via http
|
|
147
148
|
s3es://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via https`
|
|
148
149
|
})
|
|
149
|
-
},
|
|
150
|
+
}, Dr = {
|
|
150
151
|
"auth-enabled": w.boolean({
|
|
151
152
|
description: "enable authorization"
|
|
152
153
|
})
|
|
153
|
-
},
|
|
154
|
+
}, Nr = {
|
|
154
155
|
"auth-htpasswd-file": w.file({
|
|
155
156
|
description: "path to .htpasswd file with Platforma users (static user DB auth source)"
|
|
156
157
|
})
|
|
157
|
-
},
|
|
158
|
+
}, _r = {
|
|
158
159
|
"auth-ldap-server": w.string({
|
|
159
160
|
description: "address of LDAP server to use for auth in Platforma (auth source)"
|
|
160
161
|
})
|
|
161
|
-
},
|
|
162
|
+
}, Cr = {
|
|
162
163
|
"auth-ldap-default-dn": w.string({
|
|
163
164
|
description: "DN to use when checking user with LDAP bind operation: e.g. cn=%u,ou=users,dc=example,dc=com"
|
|
164
165
|
})
|
|
165
|
-
},
|
|
166
|
-
...Fr,
|
|
166
|
+
}, J = {
|
|
167
167
|
...Dr,
|
|
168
168
|
...Nr,
|
|
169
|
-
..._r
|
|
169
|
+
..._r,
|
|
170
|
+
...Cr
|
|
170
171
|
};
|
|
171
|
-
function
|
|
172
|
-
return
|
|
172
|
+
function Mr(a) {
|
|
173
|
+
return re.question(`${a} [y/N] `).toLowerCase() === "y";
|
|
173
174
|
}
|
|
174
|
-
function
|
|
175
|
+
function H(a) {
|
|
175
176
|
throw new Error("this should never happen");
|
|
176
177
|
}
|
|
177
178
|
function I(a = "debug") {
|
|
178
|
-
return
|
|
179
|
+
return fe.createLogger({
|
|
179
180
|
level: a,
|
|
180
|
-
format:
|
|
181
|
+
format: fe.format.printf(({ level: e, message: t }) => {
|
|
181
182
|
const r = " ".repeat(e.length + 2);
|
|
182
183
|
if (typeof t != "string") {
|
|
183
184
|
const i = JSON.stringify(t);
|
|
@@ -186,64 +187,64 @@ function I(a = "debug") {
|
|
|
186
187
|
const n = t.split(`
|
|
187
188
|
`).map((i, c) => c === 0 ? i : r + i).join(`
|
|
188
189
|
`);
|
|
189
|
-
return `${((i) =>
|
|
190
|
+
return `${((i) => fe.format.colorize().colorize(i, i))(e)}: ${n}`;
|
|
190
191
|
}),
|
|
191
192
|
transports: [
|
|
192
|
-
new
|
|
193
|
+
new fe.transports.Console({
|
|
193
194
|
stderrLevels: ["error", "warn", "info", "debug"],
|
|
194
195
|
handleExceptions: !0
|
|
195
196
|
})
|
|
196
197
|
]
|
|
197
198
|
});
|
|
198
199
|
}
|
|
199
|
-
function Mr(a) {
|
|
200
|
-
return Or(Math.ceil(a / 2)).toString("hex").slice(0, a);
|
|
201
|
-
}
|
|
202
200
|
function jr(a) {
|
|
203
|
-
return a.
|
|
201
|
+
return Er(Math.ceil(a / 2)).toString("hex").slice(0, a);
|
|
204
202
|
}
|
|
205
|
-
function
|
|
203
|
+
function Br(a) {
|
|
204
|
+
return a.startsWith("~") ? m.join(N.homedir(), a.slice(1)) : a;
|
|
205
|
+
}
|
|
206
|
+
function Le(a, e) {
|
|
206
207
|
f.existsSync(a) || (f.mkdirSync(a, { recursive: !0 }), e != null && e.mode && f.chmodSync(a, e.mode));
|
|
207
208
|
}
|
|
208
|
-
function
|
|
209
|
+
function Ur(a) {
|
|
209
210
|
try {
|
|
210
|
-
if (
|
|
211
|
-
return
|
|
212
|
-
const e = `wmic process where processid=${a} get Caption`, t =
|
|
211
|
+
if (N.platform() !== "win32")
|
|
212
|
+
return Re(`ps -p ${a} -o comm=`, { encoding: "utf8" }).trim();
|
|
213
|
+
const e = `wmic process where processid=${a} get Caption`, t = Re(e, { encoding: "utf8" }).split(`
|
|
213
214
|
`);
|
|
214
215
|
return t.length <= 1 ? "" : t[1].trim();
|
|
215
216
|
} catch {
|
|
216
217
|
return "";
|
|
217
218
|
}
|
|
218
219
|
}
|
|
219
|
-
function
|
|
220
|
-
const e =
|
|
220
|
+
function Gr(a) {
|
|
221
|
+
const e = Re(`docker compose ls --filter name=${a} --format json`, { encoding: "utf8" }).trim(), t = JSON.parse(e);
|
|
221
222
|
for (const r of t)
|
|
222
223
|
if (r.Name === a)
|
|
223
224
|
return r;
|
|
224
225
|
}
|
|
225
|
-
const
|
|
226
|
-
npmOrgName:
|
|
227
|
-
orgName:
|
|
228
|
-
blockName:
|
|
229
|
-
softwarePlatforms:
|
|
226
|
+
const xe = ["Python"], pr = ["Tengo", "Python"], Jr = C.union([C.literal("Tengo"), C.literal("Python")]), Hr = C.object({
|
|
227
|
+
npmOrgName: C.string().min(1),
|
|
228
|
+
orgName: C.string().min(1, { message: "Organization name must be provided" }),
|
|
229
|
+
blockName: C.string().min(1, { message: "Block name must be provided" }),
|
|
230
|
+
softwarePlatforms: C.array(Jr).refine((a) => new Set(a).size === a.length, {
|
|
230
231
|
message: "Must be an array of unique software platforms"
|
|
231
232
|
})
|
|
232
233
|
});
|
|
233
|
-
async function
|
|
234
|
-
const { npmOrgName: e, orgName: t, blockName: r, softwarePlatforms: n } =
|
|
235
|
-
a.info("Downloading boilerplate code..."), await
|
|
234
|
+
async function Wr(a) {
|
|
235
|
+
const { npmOrgName: e, orgName: t, blockName: r, softwarePlatforms: n } = qr(), s = m.join(process.cwd(), r);
|
|
236
|
+
a.info("Downloading boilerplate code..."), await zr(
|
|
236
237
|
// 'https://github.com/milaboratory/platforma-block-boilerplate/archive/refs/heads/software_platforms.zip',
|
|
237
238
|
// 'platforma-block-boilerplate-software_platforms',
|
|
238
239
|
"https://github.com/milaboratory/platforma-block-boilerplate/archive/refs/heads/main.zip",
|
|
239
240
|
"platforma-block-boilerplate-main",
|
|
240
241
|
s
|
|
241
242
|
);
|
|
242
|
-
const i =
|
|
243
|
+
const i = pr.filter((o) => n.indexOf(o) < 0), c = xe.length == i.length;
|
|
243
244
|
a.info(`Keep platforms '${n}', remove: '${i}'. Will remove all platforms? ${c}`);
|
|
244
245
|
for (const o of i)
|
|
245
|
-
await
|
|
246
|
-
c && await
|
|
246
|
+
await Yr(s, o);
|
|
247
|
+
c && await Vr(s), a.info("Replace everything in the template with provided options..."), Kr(s, [
|
|
247
248
|
// '@' literal ensures only npm org name will be renamed,
|
|
248
249
|
// as public registry for software also is called platforma-open, but without '@'.
|
|
249
250
|
// Also, don't rename an organization for runenv-python-3 package.
|
|
@@ -252,55 +253,55 @@ async function Hr(a) {
|
|
|
252
253
|
{ from: /block-boilerplate/g, to: r }
|
|
253
254
|
]);
|
|
254
255
|
}
|
|
255
|
-
function
|
|
256
|
-
let a =
|
|
256
|
+
function qr() {
|
|
257
|
+
let a = re.question(
|
|
257
258
|
'Write an organization name for npm. Default is "platforma-open": '
|
|
258
259
|
);
|
|
259
260
|
a === "" && (a = "platforma-open");
|
|
260
261
|
let e = "";
|
|
261
262
|
for (; e.length < 1; )
|
|
262
|
-
e =
|
|
263
|
+
e = re.question('Write an organization name, e.g. "my-org": ');
|
|
263
264
|
let t = "";
|
|
264
265
|
for (; t.length < 1; )
|
|
265
|
-
t =
|
|
266
|
-
const r =
|
|
266
|
+
t = re.question('Write a name of the block, e.g. "hello-world": ');
|
|
267
|
+
const r = re.keyInYN("Create package for block's software?");
|
|
267
268
|
let n = ["Tengo"];
|
|
268
269
|
if (r)
|
|
269
|
-
for (; n.length <
|
|
270
|
-
const i =
|
|
270
|
+
for (; n.length < pr.length; ) {
|
|
271
|
+
const i = re.keyInSelect(xe, "Choose software platform:");
|
|
271
272
|
if (i < 0) break;
|
|
272
|
-
n.push(
|
|
273
|
+
n.push(xe[i]);
|
|
273
274
|
}
|
|
274
275
|
n = Array.from(new Set(n)).sort();
|
|
275
|
-
const s =
|
|
276
|
+
const s = Hr.safeParse({ npmOrgName: a, orgName: e, blockName: t, softwarePlatforms: n });
|
|
276
277
|
if (!s.success && s.error.issues.length)
|
|
277
278
|
throw new Error(s.error.issues.map((i) => i.message).join("; "));
|
|
278
279
|
return s.data;
|
|
279
280
|
}
|
|
280
|
-
async function
|
|
281
|
-
const n = await (await fetch(a)).blob(), s = await
|
|
281
|
+
async function zr(a, e, t) {
|
|
282
|
+
const n = await (await fetch(a)).blob(), s = await M.mkdtemp(m.join(N.tmpdir(), "create-repo")), i = m.join(s, "packed-repo.zip"), c = Rr.toWeb(Lr(i));
|
|
282
283
|
await n.stream().pipeTo(c);
|
|
283
284
|
const o = m.join(s, "unpacked-repo");
|
|
284
|
-
await
|
|
285
|
+
await M.mkdir(o), await xr(i, o), await M.cp(m.join(o, e), t, { recursive: !0 });
|
|
285
286
|
}
|
|
286
|
-
async function
|
|
287
|
+
async function Yr(a, e) {
|
|
287
288
|
const t = e.toLowerCase();
|
|
288
|
-
await
|
|
289
|
+
await te(
|
|
289
290
|
m.join(a, "ui", "src", "pages", "MainPage.vue"),
|
|
290
291
|
new RegExp(`.*${t}Message.*\\n`, "g")
|
|
291
|
-
), await
|
|
292
|
+
), await te(
|
|
292
293
|
m.join(a, "model", "src", "index.ts"),
|
|
293
294
|
new RegExp(`.*${t}Message.*\\n\\n`, "g")
|
|
294
|
-
), await
|
|
295
|
+
), await te(
|
|
295
296
|
m.join(a, "workflow", "src", "main.tpl.tengo"),
|
|
296
297
|
new RegExp(`.*${t}.*exec.builder.*[\\s\\S]*?\\n\\n`, "g")
|
|
297
|
-
), await
|
|
298
|
+
), await te(
|
|
298
299
|
m.join(a, "workflow", "src", "main.tpl.tengo"),
|
|
299
300
|
new RegExp(`.*${t}Message.*\\n`, "g")
|
|
300
|
-
), await
|
|
301
|
+
), await te(
|
|
301
302
|
m.join(a, "workflow", "src", "wf.test.ts"),
|
|
302
303
|
new RegExp(`.*${t}Message.*\\n.*expect.*\\n\\n`, "g")
|
|
303
|
-
), await
|
|
304
|
+
), await M.rm(m.join(a, "software", `src_${t}`), { recursive: !0 }), await He(
|
|
304
305
|
m.join(a, "software", "package.json"),
|
|
305
306
|
(r) => {
|
|
306
307
|
const n = JSON.parse(r);
|
|
@@ -308,75 +309,75 @@ async function zr(a, e) {
|
|
|
308
309
|
}
|
|
309
310
|
);
|
|
310
311
|
}
|
|
311
|
-
async function
|
|
312
|
-
await
|
|
312
|
+
async function Vr(a) {
|
|
313
|
+
await M.rm(m.join(a, "software"), { recursive: !0 }), await He(
|
|
313
314
|
m.join(a, "workflow", "package.json"),
|
|
314
315
|
(e) => {
|
|
315
316
|
const t = JSON.parse(e);
|
|
316
317
|
return delete t.dependencies["@platforma-open/my-org.block-boilerplate.software"], JSON.stringify(t, null, 2);
|
|
317
318
|
}
|
|
318
|
-
), await
|
|
319
|
+
), await te(
|
|
319
320
|
m.join(a, "pnpm-workspace.yaml"),
|
|
320
321
|
/.*- software$\n/gm
|
|
321
322
|
);
|
|
322
323
|
}
|
|
323
|
-
async function
|
|
324
|
-
const t = await
|
|
324
|
+
async function Kr(a, e) {
|
|
325
|
+
const t = await Xr(a);
|
|
325
326
|
for (const { from: r, to: n } of e)
|
|
326
327
|
for (const s of t)
|
|
327
|
-
await
|
|
328
|
+
await br(s, r, n);
|
|
328
329
|
}
|
|
329
|
-
async function
|
|
330
|
-
return (await
|
|
330
|
+
async function Xr(a) {
|
|
331
|
+
return (await M.readdir(a, {
|
|
331
332
|
withFileTypes: !0,
|
|
332
333
|
recursive: !0
|
|
333
334
|
})).filter((t) => t.isFile()).map((t) => m.join(t.parentPath, t.name));
|
|
334
335
|
}
|
|
335
|
-
async function
|
|
336
|
-
const t = await
|
|
337
|
-
await
|
|
336
|
+
async function He(a, e) {
|
|
337
|
+
const t = await M.readFile(a), r = e(t.toString());
|
|
338
|
+
await M.writeFile(a, r);
|
|
338
339
|
}
|
|
339
|
-
async function
|
|
340
|
-
return await
|
|
340
|
+
async function br(a, e, t) {
|
|
341
|
+
return await He(a, (r) => r.replaceAll(e, t));
|
|
341
342
|
}
|
|
342
|
-
async function
|
|
343
|
-
return await
|
|
343
|
+
async function te(a, e) {
|
|
344
|
+
return await br(a, e, "");
|
|
344
345
|
}
|
|
345
|
-
const
|
|
346
|
+
const ae = class ae extends L {
|
|
346
347
|
async run() {
|
|
347
|
-
const { flags: e } = await this.parse(
|
|
348
|
-
await
|
|
348
|
+
const { flags: e } = await this.parse(ae), t = I(e["log-level"]);
|
|
349
|
+
await Wr(t);
|
|
349
350
|
}
|
|
350
351
|
};
|
|
351
|
-
l(
|
|
352
|
+
l(ae, "description", "Helps to create a new block by downloading a block's template."), l(ae, "examples", ["<%= name %>"]), l(ae, "flags", {
|
|
352
353
|
...A
|
|
353
354
|
});
|
|
354
|
-
let
|
|
355
|
-
function
|
|
356
|
-
return
|
|
355
|
+
let Te = ae;
|
|
356
|
+
function wr(...a) {
|
|
357
|
+
return Ar(__dirname, "..", ...a);
|
|
357
358
|
}
|
|
358
|
-
function
|
|
359
|
-
return
|
|
359
|
+
function Z(...a) {
|
|
360
|
+
return wr("assets", ...a);
|
|
360
361
|
}
|
|
361
|
-
function
|
|
362
|
-
return f.readFileSync(
|
|
362
|
+
function Ae(...a) {
|
|
363
|
+
return f.readFileSync(wr(...a));
|
|
363
364
|
}
|
|
364
|
-
function
|
|
365
|
-
return a || (a =
|
|
365
|
+
function ur(a) {
|
|
366
|
+
return a || (a = he()), `quay.io/milaboratories/platforma:${a}`;
|
|
366
367
|
}
|
|
367
|
-
const
|
|
368
|
+
const W = class W {
|
|
368
369
|
constructor(e) {
|
|
369
370
|
l(this, "state", {
|
|
370
371
|
currentInstance: ""
|
|
371
372
|
});
|
|
372
373
|
l(this, "filePath");
|
|
373
374
|
l(this, "dirPath");
|
|
374
|
-
e = e ?? m.resolve(
|
|
375
|
+
e = e ?? m.resolve(N.homedir(), ".config", "pl-bootstrap");
|
|
375
376
|
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(
|
|
377
|
+
this.dirPath = e, this.filePath = t, f.existsSync(e) || f.mkdirSync(e, { recursive: !0 }), f.existsSync(t) && (this.state = JSON.parse(Ae(t).toString()));
|
|
377
378
|
}
|
|
378
379
|
static getStateInstance() {
|
|
379
|
-
return
|
|
380
|
+
return W.instance || (W.instance = new W()), W.instance;
|
|
380
381
|
}
|
|
381
382
|
path(...e) {
|
|
382
383
|
return m.join(this.dirPath, ...e);
|
|
@@ -400,7 +401,7 @@ const J = class J {
|
|
|
400
401
|
const t = this.instanceDir(e, "instance.json");
|
|
401
402
|
if (!f.existsSync(t))
|
|
402
403
|
throw new Error(`platforma backend instance '${e}' does not exist or is corrupted`);
|
|
403
|
-
const r = JSON.parse(
|
|
404
|
+
const r = JSON.parse(Ae(t).toString());
|
|
404
405
|
return {
|
|
405
406
|
name: e,
|
|
406
407
|
...r
|
|
@@ -410,18 +411,18 @@ const J = class J {
|
|
|
410
411
|
f.existsSync(this.instanceDir(e)) || f.mkdirSync(this.instanceDir(e), { recursive: !0 });
|
|
411
412
|
const r = this.instanceDir(e, "instance.json");
|
|
412
413
|
let n = {};
|
|
413
|
-
f.existsSync(r) && (n = JSON.parse(
|
|
414
|
+
f.existsSync(r) && (n = JSON.parse(Ae(r).toString())), f.writeFileSync(r, JSON.stringify({ ...n, ...t }));
|
|
414
415
|
}
|
|
415
416
|
isInstanceActive(e) {
|
|
416
417
|
switch (e.type) {
|
|
417
418
|
case "docker": {
|
|
418
|
-
const r =
|
|
419
|
+
const r = Gr(`pl-${e.name}`);
|
|
419
420
|
return r ? r.Status.trim().startsWith("running") : !1;
|
|
420
421
|
}
|
|
421
422
|
case "process":
|
|
422
|
-
return e.pid ?
|
|
423
|
+
return e.pid ? fr(e.pid) : !1;
|
|
423
424
|
default:
|
|
424
|
-
throw
|
|
425
|
+
throw H(), new Error("cli logic error: unknown service type, cannot check its state");
|
|
425
426
|
}
|
|
426
427
|
}
|
|
427
428
|
get isActive() {
|
|
@@ -433,7 +434,7 @@ const J = class J {
|
|
|
433
434
|
return !1;
|
|
434
435
|
}
|
|
435
436
|
isValidPID(e) {
|
|
436
|
-
return
|
|
437
|
+
return fr(e);
|
|
437
438
|
}
|
|
438
439
|
get currentInstance() {
|
|
439
440
|
const e = this.state.currentInstance;
|
|
@@ -452,14 +453,14 @@ const J = class J {
|
|
|
452
453
|
this.state.currentInstance = e, this.writeState();
|
|
453
454
|
}
|
|
454
455
|
};
|
|
455
|
-
l(
|
|
456
|
-
let
|
|
457
|
-
function
|
|
458
|
-
const e =
|
|
456
|
+
l(W, "instance");
|
|
457
|
+
let Fe = W;
|
|
458
|
+
function fr(a) {
|
|
459
|
+
const e = Ur(a);
|
|
459
460
|
return e === "platforma" || e.endsWith("/platforma") || e.endsWith("\\platforma");
|
|
460
461
|
}
|
|
461
|
-
const u =
|
|
462
|
-
function
|
|
462
|
+
const u = Fe.getStateInstance();
|
|
463
|
+
function Ie(a, e, t) {
|
|
463
464
|
const r = [], n = [];
|
|
464
465
|
for (const s of e) {
|
|
465
466
|
const i = {
|
|
@@ -475,7 +476,7 @@ function $e(a, e, t) {
|
|
|
475
476
|
const c = Qr(a, s.cmd, s.args, i);
|
|
476
477
|
n.push(c);
|
|
477
478
|
} else {
|
|
478
|
-
const c =
|
|
479
|
+
const c = Zr(a, s.cmd, s.args, i);
|
|
479
480
|
if (r.push(c), c.error || c.status !== 0)
|
|
480
481
|
break;
|
|
481
482
|
}
|
|
@@ -492,7 +493,7 @@ function Qr(a, e, t, r) {
|
|
|
492
493
|
cmd: ${JSON.stringify([e, ...t])}
|
|
493
494
|
wd: ${(c = r.cwd) == null ? void 0 : c.toString()}`
|
|
494
495
|
), r.env = { ...process.env, ...r.env }, a.debug(" spawning child process");
|
|
495
|
-
const n =
|
|
496
|
+
const n = Ir(e, t, r);
|
|
496
497
|
let s = !1;
|
|
497
498
|
const i = () => {
|
|
498
499
|
n.kill("SIGINT"), s = !0;
|
|
@@ -501,15 +502,15 @@ function Qr(a, e, t, r) {
|
|
|
501
502
|
process.removeListener("SIGINT", i), s && process.exit(o);
|
|
502
503
|
}), n;
|
|
503
504
|
}
|
|
504
|
-
function
|
|
505
|
+
function Zr(a, e, t, r) {
|
|
505
506
|
return a.debug(
|
|
506
507
|
`Running:
|
|
507
508
|
cmd: ${JSON.stringify([e, ...t])}
|
|
508
509
|
opts: ${JSON.stringify(r)}`
|
|
509
|
-
), r.env = { ...process.env, ...r.env },
|
|
510
|
+
), r.env = { ...process.env, ...r.env }, Or(e, t, r);
|
|
510
511
|
}
|
|
511
|
-
function
|
|
512
|
-
const s = f.readFileSync(a, { encoding: "utf-8" }), i =
|
|
512
|
+
function Oe(a, e, t, r, n) {
|
|
513
|
+
const s = f.readFileSync(a, { encoding: "utf-8" }), i = gr.parse(s.toString());
|
|
513
514
|
if (!i.services)
|
|
514
515
|
throw new Error(`file '${a}' seems to be not a docker-compose file or has unsupported version`);
|
|
515
516
|
if (r)
|
|
@@ -539,9 +540,9 @@ function Le(a, e, t, r, n) {
|
|
|
539
540
|
g.volumes.push(`${d.hostPath}:${d.containerPath}`);
|
|
540
541
|
}
|
|
541
542
|
}
|
|
542
|
-
n != null && n.dropVolumes && delete i.volumes, f.writeFileSync(e,
|
|
543
|
+
n != null && n.dropVolumes && delete i.volumes, f.writeFileSync(e, gr.stringify(i));
|
|
543
544
|
}
|
|
544
|
-
function
|
|
545
|
+
function et(a) {
|
|
545
546
|
return {
|
|
546
547
|
id: a,
|
|
547
548
|
type: "S3",
|
|
@@ -558,7 +559,7 @@ function Zr(a) {
|
|
|
558
559
|
uploadKeyPrefix: ""
|
|
559
560
|
};
|
|
560
561
|
}
|
|
561
|
-
function
|
|
562
|
+
function vr(a) {
|
|
562
563
|
return {
|
|
563
564
|
id: a,
|
|
564
565
|
type: "FS",
|
|
@@ -566,8 +567,8 @@ function wr(a) {
|
|
|
566
567
|
rootPath: ""
|
|
567
568
|
};
|
|
568
569
|
}
|
|
569
|
-
function
|
|
570
|
-
a =
|
|
570
|
+
function ee(a, e, t) {
|
|
571
|
+
a = Br(a);
|
|
571
572
|
const r = new URL(a, `file:${e}`);
|
|
572
573
|
switch (r.protocol) {
|
|
573
574
|
case "s3:": {
|
|
@@ -615,24 +616,24 @@ function X(a, e, t) {
|
|
|
615
616
|
throw new Error(`storage protocol '${r.protocol}' is not supported`);
|
|
616
617
|
}
|
|
617
618
|
}
|
|
618
|
-
function
|
|
619
|
-
var b, y, P, $,
|
|
619
|
+
function rt(a, e) {
|
|
620
|
+
var b, y, P, $, k, v, S, _, ge, E, We, qe, ze, Ye, Ve, Ke, Xe, Qe, Ze, er, rr, tr, ar, nr, sr, ir, cr, or, lr, dr;
|
|
620
621
|
const t = (e == null ? void 0 : e.localRoot) ?? u.instanceDir("default"), r = {
|
|
621
622
|
level: ((b = e == null ? void 0 : e.log) == null ? void 0 : b.level) ?? "info",
|
|
622
623
|
path: ((y = e == null ? void 0 : e.log) == null ? void 0 : y.path) ?? `${t}/logs/platforma.log`
|
|
623
624
|
}, n = {
|
|
624
625
|
listen: ((P = e == null ? void 0 : e.grpc) == null ? void 0 : P.listen) ?? "localhost:6345",
|
|
625
626
|
tls: {
|
|
626
|
-
enable:
|
|
627
|
-
clientAuthMode: ((
|
|
628
|
-
certFile: ((
|
|
629
|
-
keyFile: ((
|
|
630
|
-
...(
|
|
627
|
+
enable: ue((k = ($ = e == null ? void 0 : e.grpc) == null ? void 0 : $.tls) == null ? void 0 : k.enable, !1),
|
|
628
|
+
clientAuthMode: ((S = (v = e == null ? void 0 : e.grpc) == null ? void 0 : v.tls) == null ? void 0 : S.clientAuthMode) ?? "NoAuth",
|
|
629
|
+
certFile: ((ge = (_ = e == null ? void 0 : e.grpc) == null ? void 0 : _.tls) == null ? void 0 : ge.certFile) ?? `${t}/certs/tls.cert`,
|
|
630
|
+
keyFile: ((We = (E = e == null ? void 0 : e.grpc) == null ? void 0 : E.tls) == null ? void 0 : We.keyFile) ?? `${t}/certs/tls.key`,
|
|
631
|
+
...(qe = e == null ? void 0 : e.grpc) == null ? void 0 : qe.tls
|
|
631
632
|
}
|
|
632
633
|
}, s = {
|
|
633
634
|
auth: {
|
|
634
|
-
enabled: ((
|
|
635
|
-
drivers: ((
|
|
635
|
+
enabled: ((Ye = (ze = e == null ? void 0 : e.core) == null ? void 0 : ze.auth) == null ? void 0 : Ye.enabled) ?? !1,
|
|
636
|
+
drivers: ((Ke = (Ve = e == null ? void 0 : e.core) == null ? void 0 : Ve.auth) == null ? void 0 : Ke.drivers) ?? [
|
|
636
637
|
{ driver: "jwt", key: a },
|
|
637
638
|
{ driver: "htpasswd", path: `${t}/users.htpasswd` }
|
|
638
639
|
]
|
|
@@ -640,35 +641,35 @@ function et(a, e) {
|
|
|
640
641
|
db: {
|
|
641
642
|
path: `${t}/db`
|
|
642
643
|
}
|
|
643
|
-
}, i =
|
|
644
|
+
}, i = mr(
|
|
644
645
|
"main",
|
|
645
646
|
`${t}/storages/main`,
|
|
646
647
|
"main-bucket",
|
|
647
|
-
(
|
|
648
|
+
(Xe = e == null ? void 0 : e.storages) == null ? void 0 : Xe.primary
|
|
648
649
|
);
|
|
649
650
|
let c;
|
|
650
|
-
switch ((
|
|
651
|
+
switch ((Ze = (Qe = e == null ? void 0 : e.storages) == null ? void 0 : Qe.work) == null ? void 0 : Ze.type) {
|
|
651
652
|
case void 0:
|
|
652
653
|
case "FS":
|
|
653
|
-
c =
|
|
654
|
+
c = vr("work"), c.rootPath = ((rr = (er = e == null ? void 0 : e.storages) == null ? void 0 : er.work) == null ? void 0 : rr.rootPath) ?? `${t}/storages/work`, c.indexCachePeriod = ((ar = (tr = e == null ? void 0 : e.storages) == null ? void 0 : tr.work) == null ? void 0 : ar.indexCachePeriod) ?? "1m";
|
|
654
655
|
break;
|
|
655
656
|
default:
|
|
656
657
|
throw new Error("work storage MUST have 'FS' type as it is used for working directories management");
|
|
657
658
|
}
|
|
658
|
-
const g =
|
|
659
|
+
const g = mr(
|
|
659
660
|
"library",
|
|
660
661
|
`${t}/storages/library`,
|
|
661
662
|
"library-bucket",
|
|
662
|
-
(
|
|
663
|
+
(nr = e == null ? void 0 : e.storages) == null ? void 0 : nr.library
|
|
663
664
|
), d = {
|
|
664
|
-
enabled:
|
|
665
|
-
listen: ((
|
|
665
|
+
enabled: ue((sr = e == null ? void 0 : e.monitoring) == null ? void 0 : sr.enabled, !0),
|
|
666
|
+
listen: ((ir = e == null ? void 0 : e.monitoring) == null ? void 0 : ir.listen) ?? "127.0.0.1:9090"
|
|
666
667
|
}, h = {
|
|
667
|
-
enabled:
|
|
668
|
-
listen: ((
|
|
668
|
+
enabled: ue((cr = e == null ? void 0 : e.debug) == null ? void 0 : cr.enabled, !0),
|
|
669
|
+
listen: ((or = e == null ? void 0 : e.debug) == null ? void 0 : or.listen) ?? "127.0.0.1:9091"
|
|
669
670
|
}, p = {
|
|
670
|
-
value: ((
|
|
671
|
-
file: ((
|
|
671
|
+
value: ((lr = e == null ? void 0 : e.license) == null ? void 0 : lr.value) ?? "",
|
|
672
|
+
file: ((dr = e == null ? void 0 : e.license) == null ? void 0 : dr.file) ?? ""
|
|
672
673
|
};
|
|
673
674
|
return {
|
|
674
675
|
localRoot: t,
|
|
@@ -678,29 +679,35 @@ function et(a, e) {
|
|
|
678
679
|
core: s,
|
|
679
680
|
monitoring: d,
|
|
680
681
|
debug: h,
|
|
682
|
+
numCpu: e == null ? void 0 : e.numCpu,
|
|
681
683
|
storages: { primary: i, work: c, library: g },
|
|
682
684
|
hacks: { libraryDownloadable: !0 }
|
|
683
685
|
};
|
|
684
686
|
}
|
|
685
|
-
function
|
|
687
|
+
function mr(a, e, t, r) {
|
|
686
688
|
let n;
|
|
687
689
|
switch (r == null ? void 0 : r.type) {
|
|
688
690
|
case void 0:
|
|
689
691
|
case "FS":
|
|
690
|
-
n =
|
|
692
|
+
n = vr(a), n.rootPath = (r == null ? void 0 : r.rootPath) ?? e;
|
|
691
693
|
break;
|
|
692
694
|
case "S3":
|
|
693
|
-
n =
|
|
695
|
+
n = et(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 = ue(r == null ? void 0 : r.createBucket, !0), n.forcePathStyle = ue(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) ?? "";
|
|
694
696
|
break;
|
|
695
697
|
default:
|
|
696
|
-
throw
|
|
698
|
+
throw H(), new Error("unknown storage type");
|
|
697
699
|
}
|
|
698
700
|
return n;
|
|
699
701
|
}
|
|
700
|
-
function
|
|
702
|
+
function tt(a) {
|
|
701
703
|
const e = a.monitoring.enabled ? "" : " disabled", t = a.debug.enabled ? "" : " disabled", r = a.hacks.libraryDownloadable ? "true" : "false";
|
|
702
704
|
let n = a.license.value;
|
|
703
|
-
|
|
705
|
+
a.license.file != "" && (n = f.readFileSync(a.license.file).toString().trimEnd());
|
|
706
|
+
let s = "";
|
|
707
|
+
return a.numCpu && (s = `
|
|
708
|
+
resources:
|
|
709
|
+
cpu: ${a.numCpu}
|
|
710
|
+
`), `
|
|
704
711
|
license:
|
|
705
712
|
value: '${a.license.value}'
|
|
706
713
|
file: '${a.license.file}'
|
|
@@ -767,6 +774,7 @@ controllers:
|
|
|
767
774
|
storageRoot: '${a.storages.work.rootPath}'
|
|
768
775
|
workdirCacheOnSuccess: 20m
|
|
769
776
|
workdirCacheOnFailure: 1h
|
|
777
|
+
${s}
|
|
770
778
|
secrets:
|
|
771
779
|
- map:
|
|
772
780
|
MI_LICENSE: ${JSON.stringify(n)}
|
|
@@ -782,12 +790,12 @@ controllers:
|
|
|
782
790
|
computeLimits: false
|
|
783
791
|
`;
|
|
784
792
|
}
|
|
785
|
-
function
|
|
793
|
+
function ue(a, e) {
|
|
786
794
|
return a === void 0 ? e : a;
|
|
787
795
|
}
|
|
788
|
-
const
|
|
789
|
-
function
|
|
790
|
-
const e =
|
|
796
|
+
const at = ["linux", "macos", "windows"];
|
|
797
|
+
function nt(a) {
|
|
798
|
+
const e = N.platform();
|
|
791
799
|
switch (e) {
|
|
792
800
|
case "darwin":
|
|
793
801
|
return "macos";
|
|
@@ -797,13 +805,13 @@ function at(a) {
|
|
|
797
805
|
return "windows";
|
|
798
806
|
default:
|
|
799
807
|
throw new Error(
|
|
800
|
-
`operating system '${e}' is not currently supported by Platforma ecosystem. The list of OSes supported: ` + JSON.stringify(
|
|
808
|
+
`operating system '${e}' is not currently supported by Platforma ecosystem. The list of OSes supported: ` + JSON.stringify(at)
|
|
801
809
|
);
|
|
802
810
|
}
|
|
803
811
|
}
|
|
804
|
-
const
|
|
805
|
-
function
|
|
806
|
-
const e =
|
|
812
|
+
const st = ["amd64", "arm64"];
|
|
813
|
+
function Pr(a) {
|
|
814
|
+
const e = N.arch();
|
|
807
815
|
switch (e) {
|
|
808
816
|
case "arm64":
|
|
809
817
|
return "arm64";
|
|
@@ -811,12 +819,12 @@ function vr(a) {
|
|
|
811
819
|
return "amd64";
|
|
812
820
|
default:
|
|
813
821
|
throw new Error(
|
|
814
|
-
`processor architecture '${e}' is not currently supported by Platforma ecosystem. The list of architectures supported: ` + JSON.stringify(
|
|
822
|
+
`processor architecture '${e}' is not currently supported by Platforma ecosystem. The list of architectures supported: ` + JSON.stringify(st)
|
|
815
823
|
);
|
|
816
824
|
}
|
|
817
825
|
}
|
|
818
|
-
function
|
|
819
|
-
const t = (e == null ? void 0 : e.version) ??
|
|
826
|
+
function it(a, e) {
|
|
827
|
+
const t = (e == null ? void 0 : e.version) ?? he(), r = (e == null ? void 0 : e.showProgress) ?? process.stdout.isTTY, n = `pl-${t}-${Pr()}.tgz`, s = (e == null ? void 0 : e.downloadURL) ?? `https://cdn.platforma.bio/software/pl/${nt()}/${n}`, i = (e == null ? void 0 : e.saveTo) ?? u.binaries(n);
|
|
820
828
|
if (f.existsSync(i))
|
|
821
829
|
return a.info(`Platforma Backend archive download skipped: '${i}' already exists`), Promise.resolve(i);
|
|
822
830
|
f.mkdirSync(m.dirname(i), { recursive: !0 }), a.info(`Downloading Platforma Backend archive:
|
|
@@ -850,13 +858,13 @@ function st(a, e) {
|
|
|
850
858
|
});
|
|
851
859
|
});
|
|
852
860
|
}
|
|
853
|
-
function
|
|
861
|
+
function ct(a, e) {
|
|
854
862
|
a.debug("extracting archive...");
|
|
855
|
-
const t = (e == null ? void 0 : e.version) ??
|
|
863
|
+
const t = (e == null ? void 0 : e.version) ?? he();
|
|
856
864
|
a.debug(` version: '${t}'`);
|
|
857
|
-
const r = `${
|
|
865
|
+
const r = `${kr({ version: t })}.tgz`, n = (e == null ? void 0 : e.archivePath) ?? u.binaries(r);
|
|
858
866
|
a.debug(` archive path: '${n}'`);
|
|
859
|
-
const s = (e == null ? void 0 : e.extractTo) ??
|
|
867
|
+
const s = (e == null ? void 0 : e.extractTo) ?? lt(n);
|
|
860
868
|
if (a.debug(` target dir: '${s}'`), f.existsSync(s))
|
|
861
869
|
return a.info(`Platforma Backend binaries unpack skipped: '${s}' exists`), s;
|
|
862
870
|
if (!f.existsSync(n)) {
|
|
@@ -865,23 +873,23 @@ function it(a, e) {
|
|
|
865
873
|
}
|
|
866
874
|
return f.existsSync(s) || (a.debug(` creating target dir '${s}'`), f.mkdirSync(s, { recursive: !0 })), a.info(`Unpacking Platforma Backend archive:
|
|
867
875
|
Archive: ${n}
|
|
868
|
-
Target dir: ${s}`),
|
|
876
|
+
Target dir: ${s}`), Fr.x({
|
|
869
877
|
file: n,
|
|
870
878
|
cwd: s,
|
|
871
879
|
gzip: !0,
|
|
872
880
|
sync: !0
|
|
873
881
|
}), a.info(" ... unpack done."), s;
|
|
874
882
|
}
|
|
875
|
-
function
|
|
876
|
-
return
|
|
883
|
+
function $e(a, e) {
|
|
884
|
+
return it(a, e).then((t) => ct(a, { archivePath: t }));
|
|
877
885
|
}
|
|
878
|
-
function
|
|
879
|
-
return `pl-${(a == null ? void 0 : a.version) ??
|
|
886
|
+
function kr(a) {
|
|
887
|
+
return `pl-${(a == null ? void 0 : a.version) ?? he()}-${Pr()}`;
|
|
880
888
|
}
|
|
881
|
-
function
|
|
882
|
-
return u.binaries(
|
|
889
|
+
function ot(a, ...e) {
|
|
890
|
+
return u.binaries(kr({ version: a }), ...e);
|
|
883
891
|
}
|
|
884
|
-
function
|
|
892
|
+
function lt(a) {
|
|
885
893
|
const e = a.lastIndexOf(".");
|
|
886
894
|
return e === -1 ? a : a.slice(0, e);
|
|
887
895
|
}
|
|
@@ -901,16 +909,16 @@ class O {
|
|
|
901
909
|
this.logger.info(`Starting platforma backend instance '${e.name}':
|
|
902
910
|
${r}`);
|
|
903
911
|
}
|
|
904
|
-
const t =
|
|
912
|
+
const t = Ie(
|
|
905
913
|
this.logger,
|
|
906
914
|
e.upCommands
|
|
907
915
|
);
|
|
908
|
-
return
|
|
916
|
+
return Ee(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;
|
|
909
917
|
}
|
|
910
918
|
stopInstance(e) {
|
|
911
919
|
this.logger.info(`stopping platforma backend instance '${e.name}'...`);
|
|
912
|
-
const t =
|
|
913
|
-
switch (
|
|
920
|
+
const t = Ie(this.logger, e.downCommands);
|
|
921
|
+
switch (Ee(t.executed), e.type) {
|
|
914
922
|
case "docker":
|
|
915
923
|
return;
|
|
916
924
|
case "process": {
|
|
@@ -918,7 +926,7 @@ ${r}`);
|
|
|
918
926
|
return;
|
|
919
927
|
}
|
|
920
928
|
default:
|
|
921
|
-
|
|
929
|
+
H();
|
|
922
930
|
}
|
|
923
931
|
}
|
|
924
932
|
switchInstance(e) {
|
|
@@ -930,52 +938,58 @@ ${r}`);
|
|
|
930
938
|
return this.startInstance(e);
|
|
931
939
|
}
|
|
932
940
|
createLocal(e, t) {
|
|
933
|
-
var
|
|
934
|
-
let r =
|
|
935
|
-
t != null && t.sourcesPath && (r = m.join(
|
|
941
|
+
var d, h, p, b, y, P, $, k, v, S, _, ge;
|
|
942
|
+
let r = ot(t == null ? void 0 : t.version, "binaries", "platforma");
|
|
943
|
+
t != null && t.sourcesPath && (r = m.join(N.tmpdir(), "platforma-custom-build")), t != null && t.binaryPath && (r = t.binaryPath);
|
|
936
944
|
let n = t == null ? void 0 : t.configPath;
|
|
937
945
|
const s = (t == null ? void 0 : t.workdir) ?? (n ? process.cwd() : u.instanceDir(e));
|
|
938
946
|
t != null && t.primaryURL && (t.configOptions = {
|
|
939
947
|
...t.configOptions,
|
|
940
948
|
storages: {
|
|
941
|
-
...(
|
|
942
|
-
primary:
|
|
949
|
+
...(d = t.configOptions) == null ? void 0 : d.storages,
|
|
950
|
+
primary: ee(t.primaryURL, s, (p = (h = t.configOptions) == null ? void 0 : h.storages) == null ? void 0 : p.primary)
|
|
943
951
|
}
|
|
944
952
|
}), t != null && t.libraryURL && (t.configOptions = {
|
|
945
953
|
...t.configOptions,
|
|
946
954
|
storages: {
|
|
947
|
-
...(
|
|
948
|
-
library:
|
|
955
|
+
...(b = t.configOptions) == null ? void 0 : b.storages,
|
|
956
|
+
library: ee(t.libraryURL, s, (P = (y = t.configOptions) == null ? void 0 : y.storages) == null ? void 0 : P.library)
|
|
949
957
|
}
|
|
950
958
|
});
|
|
951
|
-
const i =
|
|
952
|
-
this.logger.debug(" checking license..."), this.checkLicense((
|
|
959
|
+
const i = rt(this.getLastJwt(), t == null ? void 0 : t.configOptions);
|
|
960
|
+
this.logger.debug(" checking license..."), this.checkLicense((k = ($ = t == null ? void 0 : t.configOptions) == null ? void 0 : $.license) == null ? void 0 : k.value, (S = (v = t == null ? void 0 : t.configOptions) == null ? void 0 : v.license) == null ? void 0 : S.file);
|
|
953
961
|
const c = [
|
|
954
962
|
`${i.localRoot}/packages`,
|
|
955
963
|
`${i.localRoot}/packages-local`,
|
|
956
964
|
`${i.localRoot}/blocks-local`
|
|
957
965
|
];
|
|
958
966
|
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...");
|
|
959
|
-
for (const
|
|
960
|
-
f.existsSync(
|
|
961
|
-
for (const
|
|
962
|
-
|
|
963
|
-
n || (n = m.join(i.localRoot, "config.yaml"), this.logger.debug(` rendering configuration '${n}'...`), f.writeFileSync(n,
|
|
967
|
+
for (const E of c)
|
|
968
|
+
f.existsSync(E) || (this.logger.debug(` '${E}'`), f.mkdirSync(E, { recursive: !0 }));
|
|
969
|
+
for (const E of i.core.auth.drivers)
|
|
970
|
+
E.driver === "htpasswd" && (f.existsSync(E.path) || (this.logger.debug(` installing default 'users.htpasswd' to ${E.path}...`), f.copyFileSync(Z("users.htpasswd"), E.path)));
|
|
971
|
+
n || (n = m.join(i.localRoot, "config.yaml"), this.logger.debug(` rendering configuration '${n}'...`), f.writeFileSync(n, tt(i)));
|
|
964
972
|
const o = [];
|
|
965
|
-
|
|
973
|
+
t != null && t.sourcesPath && o.push({
|
|
966
974
|
cmd: "go",
|
|
967
975
|
args: ["build", "-o", r, "."],
|
|
968
976
|
workdir: m.resolve(t.sourcesPath, "cmd", "platforma"),
|
|
969
977
|
runOpts: {
|
|
970
978
|
stdio: "inherit"
|
|
971
979
|
}
|
|
972
|
-
})
|
|
980
|
+
});
|
|
981
|
+
const g = {
|
|
973
982
|
async: !0,
|
|
974
983
|
cmd: r,
|
|
975
984
|
args: ["--quiet", "--config", n],
|
|
976
985
|
workdir: s,
|
|
977
|
-
runOpts: {
|
|
978
|
-
|
|
986
|
+
runOpts: {
|
|
987
|
+
stdio: "inherit"
|
|
988
|
+
}
|
|
989
|
+
};
|
|
990
|
+
return (_ = t == null ? void 0 : t.configOptions) != null && _.numCpu && (g.runOpts.env = {
|
|
991
|
+
GOMAXPROCS: String((ge = t == null ? void 0 : t.configOptions) == null ? void 0 : ge.numCpu)
|
|
992
|
+
}), o.push(g), u.setInstanceInfo(e, {
|
|
979
993
|
type: "process",
|
|
980
994
|
upCommands: o,
|
|
981
995
|
downCommands: [],
|
|
@@ -1016,8 +1030,8 @@ ${r}`);
|
|
|
1016
1030
|
}
|
|
1017
1031
|
createMinio(e, t) {
|
|
1018
1032
|
this.logger.debug(" creating docker compose for minio service...");
|
|
1019
|
-
const r =
|
|
1020
|
-
|
|
1033
|
+
const r = Z("compose-backend.yaml"), n = u.instanceDir(e, "compose-minio.yaml");
|
|
1034
|
+
Oe(
|
|
1021
1035
|
r,
|
|
1022
1036
|
n,
|
|
1023
1037
|
`pl-${e}-minio`,
|
|
@@ -1031,7 +1045,7 @@ ${r}`);
|
|
|
1031
1045
|
const i = (t == null ? void 0 : t.image) ?? `quay.io/minio/minio${s}`;
|
|
1032
1046
|
this.logger.debug(` minio image: ${i}`);
|
|
1033
1047
|
const c = (t == null ? void 0 : t.storage) ?? u.instanceDir(e, "minio");
|
|
1034
|
-
|
|
1048
|
+
Le(c, { mode: "0775" });
|
|
1035
1049
|
const o = (t == null ? void 0 : t.minioPort) ?? 9e3, g = (t == null ? void 0 : t.minioConsolePort) ?? 9001, d = {
|
|
1036
1050
|
MINIO_IMAGE: i,
|
|
1037
1051
|
MINIO_STORAGE: m.resolve(c),
|
|
@@ -1064,23 +1078,23 @@ ${r}`);
|
|
|
1064
1078
|
}
|
|
1065
1079
|
createDockerS3(e, t, r) {
|
|
1066
1080
|
this.logger.debug("creating platforma instance in 'docker s3' mode...");
|
|
1067
|
-
const n =
|
|
1081
|
+
const n = Z("compose-backend.yaml"), s = (r == null ? void 0 : r.image) ?? ur(r == null ? void 0 : r.version);
|
|
1068
1082
|
this.checkLicense(r == null ? void 0 : r.license, r == null ? void 0 : r.licenseFile);
|
|
1069
1083
|
const i = (...v) => m.join(t, ...v), c = (v) => {
|
|
1070
|
-
const
|
|
1071
|
-
return
|
|
1084
|
+
const S = i(v);
|
|
1085
|
+
return Le(S, { mode: "0775" }), S;
|
|
1072
1086
|
}, o = i("logs", "platforma.log");
|
|
1073
1087
|
f.existsSync(o) || (f.mkdirSync(m.dirname(o), { recursive: !0 }), f.writeFileSync(o, ""));
|
|
1074
|
-
const g = (r == null ? void 0 : r.presignHost) ?? "localhost", d =
|
|
1088
|
+
const g = (r == null ? void 0 : r.presignHost) ?? "localhost", d = ee("s3e://testuser:testpassword@minio:9000/main-bucket");
|
|
1075
1089
|
if (d.type !== "S3")
|
|
1076
1090
|
throw new Error("primary storage must have 'S3' type in 'docker s3' configuration");
|
|
1077
1091
|
d.presignEndpoint = `http://${g}:9000`;
|
|
1078
|
-
const h =
|
|
1092
|
+
const h = ee("s3e://testuser:testpassword@minio:9000/library-bucket");
|
|
1079
1093
|
if (h.type !== "S3")
|
|
1080
1094
|
throw new Error(`${h.type} storage type is not supported for library storage`);
|
|
1081
1095
|
h.presignEndpoint = `http://${g}:9000`;
|
|
1082
1096
|
const p = c("db"), b = c("work"), y = i("users.htpasswd");
|
|
1083
|
-
f.existsSync(y) || f.copyFileSync(
|
|
1097
|
+
f.existsSync(y) || f.copyFileSync(Z("users.htpasswd"), y);
|
|
1084
1098
|
const P = i("compose.yaml");
|
|
1085
1099
|
f.existsSync(P) && this.logger.info(`replacing docker compose file ${P}`);
|
|
1086
1100
|
const $ = [];
|
|
@@ -1089,14 +1103,14 @@ ${r}`);
|
|
|
1089
1103
|
hostPath: v.hostPath,
|
|
1090
1104
|
containerPath: v.containerPath ?? v.hostPath
|
|
1091
1105
|
});
|
|
1092
|
-
|
|
1106
|
+
Oe(n, P, `pl-${e}`, /* @__PURE__ */ new Map([
|
|
1093
1107
|
["minio", {}],
|
|
1094
1108
|
["backend", {
|
|
1095
1109
|
platform: r == null ? void 0 : r.platformOverride,
|
|
1096
1110
|
mounts: $
|
|
1097
1111
|
}]
|
|
1098
1112
|
]));
|
|
1099
|
-
const
|
|
1113
|
+
const k = {
|
|
1100
1114
|
MINIO_IMAGE: "quay.io/minio/minio",
|
|
1101
1115
|
MINIO_STORAGE: c("minio"),
|
|
1102
1116
|
PL_IMAGE: s,
|
|
@@ -1116,29 +1130,29 @@ ${r}`);
|
|
|
1116
1130
|
...this.configureDockerStorage("primary", d),
|
|
1117
1131
|
...this.configureDockerStorage("library", h)
|
|
1118
1132
|
};
|
|
1119
|
-
if (r != null && r.grpcAddr && (
|
|
1133
|
+
if (r != null && r.grpcAddr && (k.PL_GRPC_ADDR = r.grpcAddr), r != null && r.grpcPort && (k.PL_GRPC_PORT = r.grpcPort.toString()), r != null && r.monitoringAddr && (k.PL_MONITORING_ADDR = r.monitoringAddr), r != null && r.monitoringPort && (k.PL_MONITORING_PORT = r.monitoringPort.toString()), r != null && r.debugAddr && (k.PL_DEBUG_ADDR = r.debugAddr), r != null && r.debugPort && (k.PL_DEBUG_PORT = r.debugPort.toString()), r != null && r.auth && (r.auth.enabled && (k.PL_AUTH_ENABLED = "true"), r.auth.drivers)) {
|
|
1120
1134
|
for (const v of r.auth.drivers)
|
|
1121
|
-
v.driver === "htpasswd" && (
|
|
1122
|
-
|
|
1135
|
+
v.driver === "htpasswd" && (k.PL_AUTH_HTPASSWD_PATH = m.resolve(v.path), v.path = "/etc/platforma/users.htpasswd");
|
|
1136
|
+
k.PL_AUTH_DRIVERS = JSON.stringify(r.auth.drivers);
|
|
1123
1137
|
}
|
|
1124
1138
|
return u.setInstanceInfo(e, {
|
|
1125
1139
|
type: "docker",
|
|
1126
1140
|
upCommands: [{
|
|
1127
1141
|
cmd: "docker",
|
|
1128
1142
|
args: ["compose", `--file=${P}`, "up", "--detach", "--remove-orphans", "--pull=missing"],
|
|
1129
|
-
envs:
|
|
1143
|
+
envs: k,
|
|
1130
1144
|
runOpts: { stdio: "inherit" }
|
|
1131
1145
|
}],
|
|
1132
1146
|
downCommands: [{
|
|
1133
1147
|
cmd: "docker",
|
|
1134
1148
|
args: ["compose", `--file=${P}`, "down"],
|
|
1135
|
-
envs:
|
|
1149
|
+
envs: k,
|
|
1136
1150
|
runOpts: { stdio: "inherit" }
|
|
1137
1151
|
}],
|
|
1138
1152
|
cleanupCommands: [{
|
|
1139
1153
|
cmd: "docker",
|
|
1140
1154
|
args: ["compose", `--file=${P}`, "down", "--volumes", "--remove-orphans"],
|
|
1141
|
-
envs:
|
|
1155
|
+
envs: k,
|
|
1142
1156
|
runOpts: { stdio: "inherit" }
|
|
1143
1157
|
}],
|
|
1144
1158
|
runInfo: {
|
|
@@ -1154,30 +1168,30 @@ ${r}`);
|
|
|
1154
1168
|
}
|
|
1155
1169
|
createDocker(e, t, r) {
|
|
1156
1170
|
this.logger.debug("creating platforma instance in 'docker' mode...");
|
|
1157
|
-
const n =
|
|
1171
|
+
const n = Z("compose-backend.yaml"), s = (r == null ? void 0 : r.image) ?? ur(r == null ? void 0 : r.version);
|
|
1158
1172
|
this.checkLicense(r == null ? void 0 : r.license, r == null ? void 0 : r.licenseFile);
|
|
1159
|
-
const i = (...
|
|
1160
|
-
const
|
|
1161
|
-
return
|
|
1173
|
+
const i = (...S) => m.join(t, ...S), c = (S) => {
|
|
1174
|
+
const _ = i(S);
|
|
1175
|
+
return Le(_, { mode: "0775" }), _;
|
|
1162
1176
|
}, o = i("logs", "platforma.log");
|
|
1163
1177
|
f.existsSync(o) || (f.mkdirSync(m.dirname(o), { recursive: !0 }), f.writeFileSync(o, ""));
|
|
1164
1178
|
const g = c("db"), d = c("primary"), h = c("library"), p = c("work"), b = i("users.htpasswd");
|
|
1165
|
-
f.existsSync(b) || f.copyFileSync(
|
|
1179
|
+
f.existsSync(b) || f.copyFileSync(Z("users.htpasswd"), b);
|
|
1166
1180
|
const y = i("compose.yaml");
|
|
1167
1181
|
f.existsSync(y) && this.logger.info(`replacing docker compose file ${y}`);
|
|
1168
1182
|
const P = [];
|
|
1169
|
-
for (const
|
|
1183
|
+
for (const S of (r == null ? void 0 : r.customMounts) ?? [])
|
|
1170
1184
|
P.push({
|
|
1171
|
-
hostPath:
|
|
1172
|
-
containerPath:
|
|
1185
|
+
hostPath: S.hostPath,
|
|
1186
|
+
containerPath: S.containerPath ?? S.hostPath
|
|
1173
1187
|
});
|
|
1174
|
-
this.logger.debug(`Rendering docker compose file '${y}' using '${n}' as base template`),
|
|
1188
|
+
this.logger.debug(`Rendering docker compose file '${y}' using '${n}' as base template`), Oe(n, y, `pl-${e}`, /* @__PURE__ */ new Map([
|
|
1175
1189
|
["backend", {
|
|
1176
1190
|
platform: r == null ? void 0 : r.platformOverride,
|
|
1177
1191
|
mounts: P
|
|
1178
1192
|
}]
|
|
1179
1193
|
]));
|
|
1180
|
-
const $ =
|
|
1194
|
+
const $ = ee((r == null ? void 0 : r.primaryStorageURL) ?? `file:${d}`, "."), k = ee((r == null ? void 0 : r.libraryStorageURL) ?? `file:${h}`, "."), v = {
|
|
1181
1195
|
PL_IMAGE: s,
|
|
1182
1196
|
PL_AUTH_HTPASSWD_PATH: b,
|
|
1183
1197
|
PL_LICENSE: r == null ? void 0 : r.license,
|
|
@@ -1192,11 +1206,11 @@ ${r}`);
|
|
|
1192
1206
|
PL_DATA_WORKDIR_ROOT: p,
|
|
1193
1207
|
PL_DATA_PACKAGE_ROOT: c("packages"),
|
|
1194
1208
|
...this.configureDockerStorage("primary", $),
|
|
1195
|
-
...this.configureDockerStorage("library",
|
|
1209
|
+
...this.configureDockerStorage("library", k)
|
|
1196
1210
|
};
|
|
1197
1211
|
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)) {
|
|
1198
|
-
for (const
|
|
1199
|
-
|
|
1212
|
+
for (const S of r.auth.drivers)
|
|
1213
|
+
S.driver === "htpasswd" && (v.PL_AUTH_HTPASSWD_PATH = m.resolve(S.path), S.path = "/etc/platforma/users.htpasswd");
|
|
1200
1214
|
v.PL_AUTH_DRIVERS = JSON.stringify(r.auth.drivers);
|
|
1201
1215
|
}
|
|
1202
1216
|
return u.setInstanceInfo(e, {
|
|
@@ -1225,7 +1239,7 @@ ${r}`);
|
|
|
1225
1239
|
logPath: o,
|
|
1226
1240
|
primary: $,
|
|
1227
1241
|
work: { type: "FS", rootPath: p },
|
|
1228
|
-
library:
|
|
1242
|
+
library: k,
|
|
1229
1243
|
dbPath: g
|
|
1230
1244
|
}
|
|
1231
1245
|
}), u.getInstanceInfo(e);
|
|
@@ -1245,7 +1259,7 @@ ${r}`);
|
|
|
1245
1259
|
break;
|
|
1246
1260
|
}
|
|
1247
1261
|
default:
|
|
1248
|
-
|
|
1262
|
+
H();
|
|
1249
1263
|
}
|
|
1250
1264
|
e === u.currentInstanceName && t.push(
|
|
1251
1265
|
"last command run cache ('pl-dev start' shorthand will stop working until next full start command call)"
|
|
@@ -1266,15 +1280,15 @@ You are going to reset the state of all platforma services configured with pl-bo
|
|
|
1266
1280
|
- `)}
|
|
1267
1281
|
`;
|
|
1268
1282
|
}
|
|
1269
|
-
if (this.logger.warn(n), !
|
|
1283
|
+
if (this.logger.warn(n), !Mr("Are you sure?")) {
|
|
1270
1284
|
this.logger.info("Reset action was canceled");
|
|
1271
1285
|
return;
|
|
1272
1286
|
}
|
|
1273
1287
|
for (const [s, i] of r.entries()) {
|
|
1274
1288
|
if (i.cleanupCommands.length) {
|
|
1275
1289
|
this.logger.info(`Wiping instance ${s} services`);
|
|
1276
|
-
const c =
|
|
1277
|
-
|
|
1290
|
+
const c = Ie(this.logger, i.cleanupCommands);
|
|
1291
|
+
Ee(c.executed, `failed to wipe instance ${s} services`);
|
|
1278
1292
|
}
|
|
1279
1293
|
this.logger.info(`Destroying instance '${s}' data directory`), f.rmSync(u.instanceDir(s), { recursive: !0, force: !0 });
|
|
1280
1294
|
}
|
|
@@ -1285,7 +1299,7 @@ If you want to remove all downloaded platforma binaries, delete '${u.binaries()}
|
|
|
1285
1299
|
);
|
|
1286
1300
|
}
|
|
1287
1301
|
mergeLicenseEnvs(e) {
|
|
1288
|
-
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(
|
|
1302
|
+
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(N.homedir(), ".pl.license")) && (e["license-file"] = m.resolve(N.homedir(), ".pl.license")));
|
|
1289
1303
|
}
|
|
1290
1304
|
initAuthDriversList(e, t) {
|
|
1291
1305
|
const r = [];
|
|
@@ -1305,7 +1319,7 @@ If you want to remove all downloaded platforma binaries, delete '${u.binaries()}
|
|
|
1305
1319
|
getLastJwt() {
|
|
1306
1320
|
const e = u.path("auth.jwt"), t = "utf-8";
|
|
1307
1321
|
let r = "";
|
|
1308
|
-
return f.existsSync(e) && (r = f.readFileSync(e, { encoding: t })), r == "" && (r =
|
|
1322
|
+
return f.existsSync(e) && (r = f.readFileSync(e, { encoding: t })), r == "" && (r = jr(64), f.writeFileSync(e, r, { encoding: t })), r;
|
|
1309
1323
|
}
|
|
1310
1324
|
checkLicense(e, t) {
|
|
1311
1325
|
if (!(e !== void 0 && e != "") && !(t !== void 0 && t != ""))
|
|
@@ -1329,7 +1343,7 @@ You can obtain the license from "https://licensing.milaboratories.com".`), new E
|
|
|
1329
1343
|
case "FS":
|
|
1330
1344
|
return r[`PL_DATA_${e}_TYPE`] = "FS", r;
|
|
1331
1345
|
default:
|
|
1332
|
-
|
|
1346
|
+
H();
|
|
1333
1347
|
}
|
|
1334
1348
|
return {};
|
|
1335
1349
|
}
|
|
@@ -1348,7 +1362,7 @@ You can obtain the license from "https://licensing.milaboratories.com".`), new E
|
|
|
1348
1362
|
);
|
|
1349
1363
|
break;
|
|
1350
1364
|
default:
|
|
1351
|
-
|
|
1365
|
+
H();
|
|
1352
1366
|
}
|
|
1353
1367
|
switch ((o = e.library) == null ? void 0 : o.type) {
|
|
1354
1368
|
case void 0:
|
|
@@ -1362,13 +1376,13 @@ You can obtain the license from "https://licensing.milaboratories.com".`), new E
|
|
|
1362
1376
|
);
|
|
1363
1377
|
break;
|
|
1364
1378
|
default:
|
|
1365
|
-
|
|
1379
|
+
H();
|
|
1366
1380
|
}
|
|
1367
1381
|
return e.work && r.push(`${n("workdirs")}: ${e.work.rootPath}`), e.dbPath && r.push(`${n("db")}: ${e.dbPath}`), r.join(`
|
|
1368
1382
|
`);
|
|
1369
1383
|
}
|
|
1370
1384
|
}
|
|
1371
|
-
function
|
|
1385
|
+
function Ee(a, e) {
|
|
1372
1386
|
for (const t of a) {
|
|
1373
1387
|
if (t.error)
|
|
1374
1388
|
throw t.error;
|
|
@@ -1377,40 +1391,40 @@ function Ae(a, e) {
|
|
|
1377
1391
|
throw new Error(`${r}, process exited with code '${t.status}'`);
|
|
1378
1392
|
}
|
|
1379
1393
|
}
|
|
1380
|
-
const
|
|
1394
|
+
const ne = class ne extends L {
|
|
1381
1395
|
async run() {
|
|
1382
|
-
const { flags: e } = await this.parse(
|
|
1396
|
+
const { flags: e } = await this.parse(ne), t = I(e["log-level"]);
|
|
1383
1397
|
new O(t).cleanupInstance();
|
|
1384
1398
|
}
|
|
1385
1399
|
};
|
|
1386
|
-
l(
|
|
1400
|
+
l(ne, "description", "Clear service state (forget last run command, destroy docker services, volumes and so on)"), l(ne, "examples", ["<%= config.bin %> <%= command.id %>"]), l(ne, "flags", {
|
|
1387
1401
|
...A
|
|
1388
1402
|
});
|
|
1389
|
-
let
|
|
1390
|
-
const
|
|
1403
|
+
let De = ne;
|
|
1404
|
+
const se = class se extends L {
|
|
1391
1405
|
async run() {
|
|
1392
|
-
const { flags: e } = await this.parse(
|
|
1406
|
+
const { flags: e } = await this.parse(se), t = I(e["log-level"]);
|
|
1393
1407
|
new O(t).startLast();
|
|
1394
1408
|
}
|
|
1395
1409
|
};
|
|
1396
|
-
l(
|
|
1410
|
+
l(se, "description", "Start last run service configuraiton"), l(se, "examples", ["<%= config.bin %> <%= command.id %>"]), l(se, "flags", {
|
|
1397
1411
|
...A
|
|
1398
1412
|
});
|
|
1399
|
-
let
|
|
1400
|
-
const
|
|
1413
|
+
let Ne = se;
|
|
1414
|
+
const ie = class ie extends L {
|
|
1401
1415
|
async run() {
|
|
1402
|
-
const { flags: e } = await this.parse(
|
|
1416
|
+
const { flags: e } = await this.parse(ie), t = I(e["log-level"]), r = new O(t);
|
|
1403
1417
|
u.currentInstance ? r.stopInstance(u.currentInstance) : t.warn("up/start command was not called for any instance, nothing to stop");
|
|
1404
1418
|
}
|
|
1405
1419
|
};
|
|
1406
|
-
l(
|
|
1420
|
+
l(ie, "description", "Stop platforma service"), l(ie, "examples", ["<%= config.bin %> <%= command.id %>"]), l(ie, "flags", {
|
|
1407
1421
|
...A
|
|
1408
1422
|
});
|
|
1409
|
-
let
|
|
1410
|
-
var
|
|
1411
|
-
let
|
|
1423
|
+
let _e = ie;
|
|
1424
|
+
var x;
|
|
1425
|
+
let dt = (x = class extends L {
|
|
1412
1426
|
async run() {
|
|
1413
|
-
const { flags: e } = await this.parse(
|
|
1427
|
+
const { flags: e } = await this.parse(x), t = I(e["log-level"]), r = new O(t);
|
|
1414
1428
|
r.mergeLicenseEnvs(e);
|
|
1415
1429
|
const n = "docker", s = e["auth-enabled"], i = s ? {
|
|
1416
1430
|
enabled: s,
|
|
@@ -1438,22 +1452,22 @@ let lt = (R = class extends L {
|
|
|
1438
1452
|
});
|
|
1439
1453
|
r.switchInstance(d);
|
|
1440
1454
|
}
|
|
1441
|
-
}, l(
|
|
1455
|
+
}, l(x, "description", "Run platforma backend service with 'FS' primary storage type"), l(x, "examples", ["<%= config.bin %> <%= command.id %>"]), l(x, "flags", {
|
|
1442
1456
|
...A,
|
|
1443
|
-
...j,
|
|
1444
|
-
...fe,
|
|
1445
|
-
...C,
|
|
1446
|
-
...me,
|
|
1447
1457
|
...U,
|
|
1448
|
-
...
|
|
1449
|
-
...
|
|
1458
|
+
...ye,
|
|
1459
|
+
...j,
|
|
1460
|
+
...pe,
|
|
1461
|
+
...J,
|
|
1450
1462
|
...B,
|
|
1451
|
-
...
|
|
1452
|
-
...
|
|
1453
|
-
...
|
|
1454
|
-
|
|
1463
|
+
...be,
|
|
1464
|
+
...G,
|
|
1465
|
+
...le,
|
|
1466
|
+
...oe,
|
|
1467
|
+
...de
|
|
1468
|
+
}), x);
|
|
1455
1469
|
var T;
|
|
1456
|
-
let
|
|
1470
|
+
let gt = (T = class extends L {
|
|
1457
1471
|
async run() {
|
|
1458
1472
|
const { flags: e } = await this.parse(T), t = I(e["log-level"]), r = new O(t);
|
|
1459
1473
|
r.mergeLicenseEnvs(e);
|
|
@@ -1482,10 +1496,13 @@ let dt = (T = class extends L {
|
|
|
1482
1496
|
core: { auth: { enabled: g, drivers: o } },
|
|
1483
1497
|
storages: {
|
|
1484
1498
|
work: { type: "FS", rootPath: e["storage-work"] }
|
|
1485
|
-
}
|
|
1499
|
+
},
|
|
1500
|
+
// Backend could consume a lot of CPU power,
|
|
1501
|
+
// we want to keep at least a couple for UI and other apps to work.
|
|
1502
|
+
numCpu: Math.max(me.cpus().length - 2, 1)
|
|
1486
1503
|
}
|
|
1487
1504
|
}, y = r.createLocal(n, b);
|
|
1488
|
-
b.binaryPath || b.sourcesPath ? r.switchInstance(y) :
|
|
1505
|
+
b.binaryPath || b.sourcesPath ? r.switchInstance(y) : $e(t, { version: e.version }).then(() => {
|
|
1489
1506
|
const P = r.switchInstance(y);
|
|
1490
1507
|
setTimeout(() => {
|
|
1491
1508
|
for (const $ of P)
|
|
@@ -1497,51 +1514,51 @@ let dt = (T = class extends L {
|
|
|
1497
1514
|
}
|
|
1498
1515
|
}, 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", {
|
|
1499
1516
|
...A,
|
|
1500
|
-
...C,
|
|
1501
1517
|
...j,
|
|
1502
|
-
...
|
|
1503
|
-
...
|
|
1504
|
-
...
|
|
1505
|
-
...
|
|
1518
|
+
...U,
|
|
1519
|
+
...Pe,
|
|
1520
|
+
...ke,
|
|
1521
|
+
...Se,
|
|
1506
1522
|
...B,
|
|
1507
|
-
...
|
|
1508
|
-
...
|
|
1523
|
+
...G,
|
|
1524
|
+
...le,
|
|
1509
1525
|
...oe,
|
|
1510
|
-
...
|
|
1511
|
-
...
|
|
1512
|
-
...
|
|
1526
|
+
...de,
|
|
1527
|
+
...we,
|
|
1528
|
+
...ve,
|
|
1529
|
+
...J
|
|
1513
1530
|
}), T);
|
|
1514
|
-
const
|
|
1531
|
+
const q = class q extends L {
|
|
1515
1532
|
async run() {
|
|
1516
|
-
const { flags: e, args: t } = await this.parse(
|
|
1533
|
+
const { flags: e, args: t } = await this.parse(q), r = I(e["log-level"]), n = new O(r), s = t.name;
|
|
1517
1534
|
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
1535
|
}
|
|
1519
1536
|
};
|
|
1520
|
-
l(
|
|
1537
|
+
l(q, "description", "List available instances"), l(q, "examples", ["<%= config.bin %> <%= command.id %>"]), l(q, "flags", {
|
|
1521
1538
|
...A,
|
|
1522
1539
|
all: w.boolean({
|
|
1523
1540
|
description: "remove all known instances",
|
|
1524
1541
|
required: !1
|
|
1525
1542
|
})
|
|
1526
|
-
}), l(
|
|
1527
|
-
name:
|
|
1543
|
+
}), l(q, "args", {
|
|
1544
|
+
name: Q.string({ required: !1 })
|
|
1528
1545
|
});
|
|
1529
|
-
let
|
|
1530
|
-
const
|
|
1546
|
+
let Ce = q;
|
|
1547
|
+
const z = class z extends L {
|
|
1531
1548
|
async run() {
|
|
1532
|
-
const { flags: e, args: t } = await this.parse(
|
|
1549
|
+
const { flags: e, args: t } = await this.parse(z), r = I(e["log-level"]), n = new O(r), s = t.name ?? u.currentInstanceName;
|
|
1533
1550
|
s || (r.info("no pl service instance selected. No service was stopped"), process.exit(0)), n.stopInstance(u.getInstanceInfo(s));
|
|
1534
1551
|
}
|
|
1535
1552
|
};
|
|
1536
|
-
l(
|
|
1553
|
+
l(z, "description", "List available instances"), l(z, "examples", ["<%= config.bin %> <%= command.id %>"]), l(z, "flags", {
|
|
1537
1554
|
...A
|
|
1538
|
-
}), l(
|
|
1539
|
-
name:
|
|
1555
|
+
}), l(z, "args", {
|
|
1556
|
+
name: Q.string({ required: !1 })
|
|
1540
1557
|
});
|
|
1541
|
-
let
|
|
1542
|
-
const
|
|
1558
|
+
let Me = z;
|
|
1559
|
+
const ce = class ce extends L {
|
|
1543
1560
|
async run() {
|
|
1544
|
-
await this.parse(
|
|
1561
|
+
await this.parse(ce);
|
|
1545
1562
|
const e = u.instanceList, t = u.currentInstanceName;
|
|
1546
1563
|
for (const r of e) {
|
|
1547
1564
|
const n = [], s = u.getInstanceInfo(r);
|
|
@@ -1549,11 +1566,11 @@ const se = class se extends L {
|
|
|
1549
1566
|
}
|
|
1550
1567
|
}
|
|
1551
1568
|
};
|
|
1552
|
-
l(
|
|
1553
|
-
let
|
|
1554
|
-
const
|
|
1569
|
+
l(ce, "description", "List available instances"), l(ce, "examples", ["<%= config.bin %> <%= command.id %>"]), l(ce, "flags", {});
|
|
1570
|
+
let je = ce;
|
|
1571
|
+
const Y = class Y extends L {
|
|
1555
1572
|
async run() {
|
|
1556
|
-
const { flags: e, args: t } = await this.parse(
|
|
1573
|
+
const { flags: e, args: t } = await this.parse(Y), r = I(e["log-level"]), n = new O(r), s = t.name ?? u.currentInstanceName;
|
|
1557
1574
|
s || (r.error("no pl service instance is selected. Select instance with 'select' command or provide name to 'up'"), process.exit(1));
|
|
1558
1575
|
const i = n.switchInstance(u.getInstanceInfo(s)), c = [];
|
|
1559
1576
|
for (const o of i)
|
|
@@ -1563,16 +1580,16 @@ const q = class q extends L {
|
|
|
1563
1580
|
await Promise.all(c);
|
|
1564
1581
|
}
|
|
1565
1582
|
};
|
|
1566
|
-
l(
|
|
1583
|
+
l(Y, "description", "List available instances"), l(Y, "examples", ["<%= config.bin %> <%= command.id %>"]), l(Y, "flags", {
|
|
1567
1584
|
...A
|
|
1568
|
-
}), l(
|
|
1569
|
-
name:
|
|
1585
|
+
}), l(Y, "args", {
|
|
1586
|
+
name: Q.string({ required: !1 })
|
|
1570
1587
|
});
|
|
1571
|
-
let
|
|
1572
|
-
var
|
|
1573
|
-
let
|
|
1588
|
+
let Be = Y;
|
|
1589
|
+
var F;
|
|
1590
|
+
let ut = (F = class extends L {
|
|
1574
1591
|
async run() {
|
|
1575
|
-
const { flags: e } = await this.parse(
|
|
1592
|
+
const { flags: e } = await this.parse(F), t = I(e["log-level"]), r = new O(t);
|
|
1576
1593
|
r.mergeLicenseEnvs(e);
|
|
1577
1594
|
const n = "docker-s3", s = e["auth-enabled"], i = s ? {
|
|
1578
1595
|
enabled: s,
|
|
@@ -1598,22 +1615,22 @@ let gt = (x = class extends L {
|
|
|
1598
1615
|
});
|
|
1599
1616
|
r.switchInstance(h);
|
|
1600
1617
|
}
|
|
1601
|
-
}, l(
|
|
1618
|
+
}, l(F, "description", "Run platforma backend service with 'S3' primary storage type"), l(F, "examples", ["<%= config.bin %> <%= command.id %>"]), l(F, "flags", {
|
|
1602
1619
|
...A,
|
|
1603
|
-
...j,
|
|
1604
|
-
...fe,
|
|
1605
|
-
...C,
|
|
1606
|
-
...me,
|
|
1607
1620
|
...U,
|
|
1608
|
-
...
|
|
1609
|
-
...
|
|
1621
|
+
...ye,
|
|
1622
|
+
...j,
|
|
1623
|
+
...pe,
|
|
1624
|
+
...J,
|
|
1610
1625
|
...B,
|
|
1611
|
-
...
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1626
|
+
...be,
|
|
1627
|
+
...G,
|
|
1628
|
+
...yr
|
|
1629
|
+
}), F);
|
|
1630
|
+
var D;
|
|
1631
|
+
let ft = (D = class extends L {
|
|
1615
1632
|
async run() {
|
|
1616
|
-
const { flags: e } = await this.parse(
|
|
1633
|
+
const { flags: e } = await this.parse(D), t = I(e["log-level"]), r = new O(t);
|
|
1617
1634
|
r.mergeLicenseEnvs(e);
|
|
1618
1635
|
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;
|
|
1619
1636
|
let d = "127.0.0.1:6345";
|
|
@@ -1642,42 +1659,45 @@ let ut = (F = class extends L {
|
|
|
1642
1659
|
core: {
|
|
1643
1660
|
auth: { enabled: g, drivers: o }
|
|
1644
1661
|
},
|
|
1662
|
+
// Backend could consume a lot of CPU power,
|
|
1663
|
+
// we want to keep at least a couple for UI and other apps to work.
|
|
1664
|
+
numCpu: Math.max(me.cpus().length - 2, 1),
|
|
1645
1665
|
storages: {
|
|
1646
1666
|
work: { type: "FS", rootPath: e["storage-work"] }
|
|
1647
1667
|
}
|
|
1648
1668
|
}
|
|
1649
1669
|
}, y = r.createLocalS3(n, b);
|
|
1650
|
-
b.binaryPath || b.sourcesPath ? r.switchInstance(y) : await
|
|
1670
|
+
b.binaryPath || b.sourcesPath ? r.switchInstance(y) : await $e(t, { version: e.version }).then(() => {
|
|
1651
1671
|
const P = r.switchInstance(y), $ = [];
|
|
1652
|
-
for (const
|
|
1653
|
-
$.push(new Promise((v,
|
|
1654
|
-
|
|
1672
|
+
for (const k of P)
|
|
1673
|
+
$.push(new Promise((v, S) => {
|
|
1674
|
+
k.on("close", v), k.on("error", S);
|
|
1655
1675
|
}));
|
|
1656
1676
|
return Promise.all($);
|
|
1657
1677
|
}).catch(function(P) {
|
|
1658
1678
|
t.error(P.message);
|
|
1659
1679
|
});
|
|
1660
1680
|
}
|
|
1661
|
-
}, l(
|
|
1681
|
+
}, l(D, "description", "Run Platforma Backend service as local process on current host (no docker container)"), l(D, "examples", ["<%= config.bin %> <%= command.id %>"]), l(D, "flags", {
|
|
1662
1682
|
...A,
|
|
1663
|
-
...C,
|
|
1664
1683
|
...j,
|
|
1665
|
-
...
|
|
1666
|
-
...
|
|
1667
|
-
...
|
|
1668
|
-
...
|
|
1669
|
-
...
|
|
1684
|
+
...U,
|
|
1685
|
+
...hr,
|
|
1686
|
+
...Pe,
|
|
1687
|
+
...ke,
|
|
1688
|
+
...Se,
|
|
1670
1689
|
...B,
|
|
1671
|
-
...
|
|
1672
|
-
...
|
|
1690
|
+
...G,
|
|
1691
|
+
...le,
|
|
1673
1692
|
...oe,
|
|
1674
|
-
...
|
|
1675
|
-
...
|
|
1676
|
-
...
|
|
1677
|
-
|
|
1678
|
-
|
|
1693
|
+
...de,
|
|
1694
|
+
...we,
|
|
1695
|
+
...ve,
|
|
1696
|
+
...J
|
|
1697
|
+
}), D);
|
|
1698
|
+
const V = class V extends L {
|
|
1679
1699
|
async run() {
|
|
1680
|
-
const { flags: e, args: t } = await this.parse(
|
|
1700
|
+
const { flags: e, args: t } = await this.parse(V), r = I(e["log-level"]), n = new O(r);
|
|
1681
1701
|
n.mergeLicenseEnvs(e);
|
|
1682
1702
|
const s = t.name, i = e["auth-enabled"], c = i ? {
|
|
1683
1703
|
enabled: i,
|
|
@@ -1706,27 +1726,27 @@ const z = class z extends L {
|
|
|
1706
1726
|
}), r.info(`Instance '${s}' was created. To start it run 'up' command`);
|
|
1707
1727
|
}
|
|
1708
1728
|
};
|
|
1709
|
-
l(
|
|
1729
|
+
l(V, "description", "Run Platforma Backend service as docker container on current host"), l(V, "examples", ["<%= config.bin %> <%= command.id %>"]), l(V, "flags", {
|
|
1710
1730
|
...A,
|
|
1711
|
-
...j,
|
|
1712
|
-
...fe,
|
|
1713
|
-
...C,
|
|
1714
|
-
...me,
|
|
1715
1731
|
...U,
|
|
1716
|
-
...
|
|
1717
|
-
...
|
|
1732
|
+
...ye,
|
|
1733
|
+
...j,
|
|
1734
|
+
...pe,
|
|
1735
|
+
...J,
|
|
1718
1736
|
...B,
|
|
1719
|
-
...
|
|
1720
|
-
...
|
|
1721
|
-
...
|
|
1722
|
-
|
|
1723
|
-
|
|
1737
|
+
...be,
|
|
1738
|
+
...G,
|
|
1739
|
+
...le,
|
|
1740
|
+
...oe,
|
|
1741
|
+
...de
|
|
1742
|
+
}), l(V, "args", {
|
|
1743
|
+
name: Q.string({ required: !0 })
|
|
1724
1744
|
});
|
|
1725
|
-
let
|
|
1726
|
-
var
|
|
1727
|
-
let
|
|
1745
|
+
let Ue = V;
|
|
1746
|
+
var R;
|
|
1747
|
+
let mt = (R = class extends L {
|
|
1728
1748
|
async run() {
|
|
1729
|
-
const { flags: e, args: t } = await this.parse(
|
|
1749
|
+
const { flags: e, args: t } = await this.parse(R), r = I(e["log-level"]), n = new O(r);
|
|
1730
1750
|
n.mergeLicenseEnvs(e);
|
|
1731
1751
|
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;
|
|
1732
1752
|
let h = "127.0.0.1:6345";
|
|
@@ -1753,38 +1773,41 @@ let ft = (E = class extends L {
|
|
|
1753
1773
|
core: { auth: { enabled: d, drivers: g } },
|
|
1754
1774
|
storages: {
|
|
1755
1775
|
work: { type: "FS", rootPath: e["storage-work"] }
|
|
1756
|
-
}
|
|
1776
|
+
},
|
|
1777
|
+
// Backend could consume a lot of CPU power,
|
|
1778
|
+
// we want to keep at least a couple for UI and other apps to work.
|
|
1779
|
+
numCpu: Math.max(me.cpus().length - 2, 1)
|
|
1757
1780
|
}
|
|
1758
1781
|
};
|
|
1759
1782
|
if (n.createLocal(s, y), y.binaryPath || y.sourcesPath) {
|
|
1760
1783
|
r.info(`Instance '${s}' was created. To start it run 'up' command`);
|
|
1761
1784
|
return;
|
|
1762
1785
|
}
|
|
1763
|
-
|
|
1786
|
+
$e(r, { version: e.version }).then(() => r.info(`Instance '${s}' was created. To start it run 'svc up' command`)).catch(function(P) {
|
|
1764
1787
|
r.error(P.message);
|
|
1765
1788
|
});
|
|
1766
1789
|
}
|
|
1767
|
-
}, l(
|
|
1790
|
+
}, l(R, "description", "Run Platforma Backend service as local process on current host (no docker container)"), l(R, "examples", ["<%= config.bin %> <%= command.id %>"]), l(R, "flags", {
|
|
1768
1791
|
...A,
|
|
1769
|
-
...C,
|
|
1770
1792
|
...j,
|
|
1771
|
-
...
|
|
1772
|
-
...
|
|
1773
|
-
...
|
|
1774
|
-
...
|
|
1793
|
+
...U,
|
|
1794
|
+
...Pe,
|
|
1795
|
+
...ke,
|
|
1796
|
+
...Se,
|
|
1775
1797
|
...B,
|
|
1776
|
-
...
|
|
1777
|
-
...
|
|
1798
|
+
...G,
|
|
1799
|
+
...le,
|
|
1778
1800
|
...oe,
|
|
1779
|
-
...
|
|
1780
|
-
...
|
|
1781
|
-
...
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
})
|
|
1785
|
-
|
|
1801
|
+
...de,
|
|
1802
|
+
...we,
|
|
1803
|
+
...ve,
|
|
1804
|
+
...J
|
|
1805
|
+
}), l(R, "args", {
|
|
1806
|
+
name: Q.string({ required: !0 })
|
|
1807
|
+
}), R);
|
|
1808
|
+
const K = class K extends L {
|
|
1786
1809
|
async run() {
|
|
1787
|
-
const { flags: e, args: t } = await this.parse(
|
|
1810
|
+
const { flags: e, args: t } = await this.parse(K), r = I(e["log-level"]), n = new O(r);
|
|
1788
1811
|
n.mergeLicenseEnvs(e);
|
|
1789
1812
|
const s = t.name, i = e["auth-enabled"], c = i ? {
|
|
1790
1813
|
enabled: i,
|
|
@@ -1811,24 +1834,24 @@ const Y = class Y extends L {
|
|
|
1811
1834
|
}), r.info(`Instance '${s}' was created. To start it run 'up' command`), e["minio-presign-host"] && r.info(" NOTE: make sure you have 'minio' host in your hosts file as 127.0.0.1 address");
|
|
1812
1835
|
}
|
|
1813
1836
|
};
|
|
1814
|
-
l(
|
|
1837
|
+
l(K, "description", "Run Platforma Backend service as docker container on current host with MinIO as local S3 storage"), l(K, "examples", ["<%= config.bin %> <%= command.id %>"]), l(K, "flags", {
|
|
1815
1838
|
...A,
|
|
1816
|
-
...j,
|
|
1817
|
-
...fe,
|
|
1818
|
-
...C,
|
|
1819
|
-
...me,
|
|
1820
1839
|
...U,
|
|
1821
|
-
...
|
|
1822
|
-
...
|
|
1840
|
+
...ye,
|
|
1841
|
+
...j,
|
|
1842
|
+
...pe,
|
|
1843
|
+
...J,
|
|
1823
1844
|
...B,
|
|
1824
|
-
...
|
|
1825
|
-
|
|
1826
|
-
|
|
1845
|
+
...be,
|
|
1846
|
+
...G,
|
|
1847
|
+
...yr
|
|
1848
|
+
}), l(K, "args", {
|
|
1849
|
+
name: Q.string({ required: !0 })
|
|
1827
1850
|
});
|
|
1828
|
-
let
|
|
1829
|
-
const
|
|
1851
|
+
let Ge = K;
|
|
1852
|
+
const X = class X extends L {
|
|
1830
1853
|
async run() {
|
|
1831
|
-
const { flags: e, args: t } = await this.parse(
|
|
1854
|
+
const { flags: e, args: t } = await this.parse(X), r = I(e["log-level"]), n = new O(r);
|
|
1832
1855
|
n.mergeLicenseEnvs(e);
|
|
1833
1856
|
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;
|
|
1834
1857
|
let h = "127.0.0.1:6345";
|
|
@@ -1857,57 +1880,60 @@ const V = class V extends L {
|
|
|
1857
1880
|
core: { auth: { enabled: d, drivers: g } },
|
|
1858
1881
|
storages: {
|
|
1859
1882
|
work: { type: "FS", rootPath: e["storage-work"] }
|
|
1860
|
-
}
|
|
1883
|
+
},
|
|
1884
|
+
// Backend could consume a lot of CPU power,
|
|
1885
|
+
// we want to keep at least a couple for UI and other apps to work.
|
|
1886
|
+
numCpu: Math.max(me.cpus().length - 2, 1)
|
|
1861
1887
|
}
|
|
1862
1888
|
};
|
|
1863
1889
|
if (r.info("Creating instance configuration, data directory and other stuff..."), n.createLocalS3(s, y), y.binaryPath || y.sourcesPath) {
|
|
1864
1890
|
r.info(`Instance '${s}' was created. To start it run 'up' command`);
|
|
1865
1891
|
return;
|
|
1866
1892
|
}
|
|
1867
|
-
|
|
1893
|
+
$e(r, { version: e.version }).then(() => r.info(`Instance '${s}' was created. To start it run 'svc up' command`)).catch(function(P) {
|
|
1868
1894
|
r.error(P.message);
|
|
1869
1895
|
});
|
|
1870
1896
|
}
|
|
1871
1897
|
};
|
|
1872
|
-
l(
|
|
1898
|
+
l(X, "description", "Run Platforma Backend service as local process on current host (no docker container)"), l(X, "examples", ["<%= config.bin %> <%= command.id %>"]), l(X, "flags", {
|
|
1873
1899
|
...A,
|
|
1874
|
-
...C,
|
|
1875
|
-
...mr,
|
|
1876
1900
|
...j,
|
|
1877
|
-
...
|
|
1878
|
-
...
|
|
1879
|
-
...
|
|
1880
|
-
...
|
|
1901
|
+
...hr,
|
|
1902
|
+
...U,
|
|
1903
|
+
...Pe,
|
|
1904
|
+
...ke,
|
|
1905
|
+
...Se,
|
|
1881
1906
|
...B,
|
|
1882
|
-
...
|
|
1883
|
-
...
|
|
1907
|
+
...G,
|
|
1908
|
+
...le,
|
|
1884
1909
|
...oe,
|
|
1885
|
-
...
|
|
1886
|
-
...
|
|
1887
|
-
...
|
|
1888
|
-
|
|
1889
|
-
|
|
1910
|
+
...de,
|
|
1911
|
+
...we,
|
|
1912
|
+
...ve,
|
|
1913
|
+
...J
|
|
1914
|
+
}), l(X, "args", {
|
|
1915
|
+
name: Q.string({ required: !0 })
|
|
1890
1916
|
});
|
|
1891
|
-
let
|
|
1892
|
-
const
|
|
1893
|
-
"create-block":
|
|
1894
|
-
reset:
|
|
1895
|
-
start:
|
|
1896
|
-
stop:
|
|
1897
|
-
"start:docker":
|
|
1898
|
-
"start:local":
|
|
1899
|
-
"svc:delete":
|
|
1900
|
-
"svc:down":
|
|
1901
|
-
"svc:list":
|
|
1902
|
-
"svc:up":
|
|
1903
|
-
"start:docker:s3":
|
|
1904
|
-
"start:local:s3":
|
|
1905
|
-
"svc:create:docker":
|
|
1906
|
-
"svc:create:local":
|
|
1907
|
-
"svc:create:docker:s3":
|
|
1908
|
-
"svc:create:local:s3":
|
|
1917
|
+
let Je = X;
|
|
1918
|
+
const Rt = {
|
|
1919
|
+
"create-block": Te,
|
|
1920
|
+
reset: De,
|
|
1921
|
+
start: Ne,
|
|
1922
|
+
stop: _e,
|
|
1923
|
+
"start:docker": dt,
|
|
1924
|
+
"start:local": gt,
|
|
1925
|
+
"svc:delete": Ce,
|
|
1926
|
+
"svc:down": Me,
|
|
1927
|
+
"svc:list": je,
|
|
1928
|
+
"svc:up": Be,
|
|
1929
|
+
"start:docker:s3": ut,
|
|
1930
|
+
"start:local:s3": ft,
|
|
1931
|
+
"svc:create:docker": Ue,
|
|
1932
|
+
"svc:create:local": mt,
|
|
1933
|
+
"svc:create:docker:s3": Ge,
|
|
1934
|
+
"svc:create:local:s3": Je
|
|
1909
1935
|
};
|
|
1910
1936
|
export {
|
|
1911
|
-
|
|
1937
|
+
Rt as COMMANDS
|
|
1912
1938
|
};
|
|
1913
1939
|
//# sourceMappingURL=index.mjs.map
|