@platforma-sdk/bootstrap 3.1.3 → 3.1.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/README.md +23 -0
- package/dist/commands/svc/create/local/s3.d.ts +38 -0
- package/dist/commands/svc/create/local/s3.d.ts.map +1 -0
- package/dist/commands/svc/create/local.d.ts +0 -3
- package/dist/commands/svc/create/local.d.ts.map +1 -1
- package/dist/commands/svc/up.d.ts.map +1 -1
- package/dist/core.d.ts +5 -7
- package/dist/core.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +641 -597
- package/dist/index.mjs.map +1 -1
- package/dist/templates/pl-config.d.ts.map +1 -1
- package/dist/templates/types.d.ts +3 -3
- package/dist/templates/types.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,183 +1,183 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var l = (a, e, t) =>
|
|
4
|
-
import { Flags as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import m, { resolve as
|
|
8
|
-
import { execSync as
|
|
9
|
-
import
|
|
10
|
-
import { randomBytes as
|
|
11
|
-
import
|
|
12
|
-
import * as
|
|
13
|
-
import { Writable as
|
|
14
|
-
import { z as
|
|
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 v, Command as L, Args as K } from "@oclif/core";
|
|
5
|
+
import F from "node:os";
|
|
6
|
+
import f, { createWriteStream as Lr } from "node:fs";
|
|
7
|
+
import m, { resolve as Ir } from "node:path";
|
|
8
|
+
import { execSync as Ae, spawn as Ar, spawnSync as mr } from "node:child_process";
|
|
9
|
+
import ge from "winston";
|
|
10
|
+
import { randomBytes as Or } from "node:crypto";
|
|
11
|
+
import Z from "readline-sync";
|
|
12
|
+
import * as _ from "node:fs/promises";
|
|
13
|
+
import { Writable as Rr } from "node:stream";
|
|
14
|
+
import { z as N } from "zod";
|
|
15
15
|
import Er from "decompress";
|
|
16
|
-
import ue from "yaml";
|
|
17
16
|
import { getDefaultPlVersion as fe } from "@milaboratories/pl-deployments";
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
import dr from "yaml";
|
|
18
|
+
import Tr from "node:https";
|
|
19
|
+
import * as xr from "tar";
|
|
20
|
+
const I = {
|
|
21
|
+
"log-level": v.string({
|
|
22
22
|
description: "logging level",
|
|
23
23
|
default: "info",
|
|
24
24
|
options: ["error", "warn", "info", "debug"],
|
|
25
25
|
required: !1
|
|
26
26
|
})
|
|
27
27
|
};
|
|
28
|
-
|
|
28
|
+
v.string({
|
|
29
29
|
description: "name of instance",
|
|
30
30
|
required: !1
|
|
31
31
|
});
|
|
32
32
|
const me = {
|
|
33
|
-
image:
|
|
33
|
+
image: v.string({
|
|
34
34
|
description: "use custom docker image to run platforma"
|
|
35
35
|
})
|
|
36
|
-
},
|
|
37
|
-
version:
|
|
36
|
+
}, C = {
|
|
37
|
+
version: v.string({
|
|
38
38
|
description: "use custom platforma release (official docker image or binary package)"
|
|
39
39
|
})
|
|
40
40
|
}, he = {
|
|
41
|
-
arch:
|
|
41
|
+
arch: v.string({
|
|
42
42
|
description: "override architecture. You can start amd64 linux image on arm-based host (say, Apple M family processor). I.e. arm64, amd64, amd64/v2"
|
|
43
43
|
})
|
|
44
|
-
},
|
|
45
|
-
license:
|
|
44
|
+
}, M = {
|
|
45
|
+
license: v.string({
|
|
46
46
|
description: 'pass a license code. The license can be got from "https://licensing.milaboratories.com".'
|
|
47
47
|
}),
|
|
48
|
-
"license-file":
|
|
48
|
+
"license-file": v.file({
|
|
49
49
|
exists: !0,
|
|
50
50
|
description: "specify a path to the file with a license. The license can be got from 'https://licensing.milaboratories.com'."
|
|
51
51
|
})
|
|
52
|
-
},
|
|
53
|
-
"grpc-port":
|
|
52
|
+
}, j = {
|
|
53
|
+
"grpc-port": v.integer({
|
|
54
54
|
description: "port for Platforma Backend gRPC API. Default is 6345",
|
|
55
55
|
env: "PLATFORMA_GRPC_PORT"
|
|
56
56
|
}),
|
|
57
|
-
"grpc-listen":
|
|
57
|
+
"grpc-listen": v.string({
|
|
58
58
|
description: "full listen addr for Platforma Backend gRPC API. Default is 127.0.0.1:6345",
|
|
59
59
|
env: "PLATFORMA_GRPC_LISTEN"
|
|
60
60
|
}),
|
|
61
|
-
"monitoring-port":
|
|
61
|
+
"monitoring-port": v.integer({
|
|
62
62
|
description: "port for Platforma Backend monitoring API. Default is 9090",
|
|
63
63
|
env: "PLATFORMA_MONITORING_PORT"
|
|
64
64
|
}),
|
|
65
|
-
"monitoring-listen":
|
|
65
|
+
"monitoring-listen": v.string({
|
|
66
66
|
description: "full listen addr for Platforma Backend monitoring API. Default is 127.0.0.1:9090",
|
|
67
67
|
env: "PLATFORMA_MONITORING_LISTEN"
|
|
68
68
|
}),
|
|
69
|
-
"debug-port":
|
|
69
|
+
"debug-port": v.integer({
|
|
70
70
|
description: "port for Platforma Backend debug API. Default is 9091",
|
|
71
71
|
env: "PLATFORMA_DEBUG_PORT"
|
|
72
72
|
}),
|
|
73
|
-
"debug-listen":
|
|
73
|
+
"debug-listen": v.string({
|
|
74
74
|
description: "full listen addr for Platforma Backend debug API. Default is 127.0.0.1:9091",
|
|
75
75
|
env: "PLATFORMA_DEBUG_LISTEN"
|
|
76
76
|
})
|
|
77
|
-
},
|
|
78
|
-
"s3-port":
|
|
77
|
+
}, hr = {
|
|
78
|
+
"s3-port": v.integer({
|
|
79
79
|
description: "port that S3 will listen, default is 9000",
|
|
80
80
|
default: 9e3,
|
|
81
81
|
env: "PLATFORMA_S3_PORT"
|
|
82
82
|
}),
|
|
83
|
-
"s3-console-port":
|
|
83
|
+
"s3-console-port": v.integer({
|
|
84
84
|
description: "port that a console of S3 will listen, default is 9001",
|
|
85
85
|
default: 9001,
|
|
86
86
|
env: "PLATFORMA_S3_CONSOLE_PORT"
|
|
87
87
|
})
|
|
88
|
-
},
|
|
89
|
-
storage:
|
|
88
|
+
}, B = {
|
|
89
|
+
storage: v.string({
|
|
90
90
|
description: "specify path on host to be used as storage for all Platforma Backend data"
|
|
91
91
|
})
|
|
92
|
-
},
|
|
93
|
-
"minio-presign-host":
|
|
92
|
+
}, yr = {
|
|
93
|
+
"minio-presign-host": v.boolean({
|
|
94
94
|
description: "use 'minio' host instead of 'localhost' in presign URLs"
|
|
95
95
|
})
|
|
96
96
|
}, ye = {
|
|
97
|
-
mount:
|
|
97
|
+
mount: v.string({
|
|
98
98
|
multiple: !0,
|
|
99
99
|
description: "things to be mounted into platforma docker container. Targets will appear inside the container under the same absolute paths"
|
|
100
100
|
})
|
|
101
|
-
},
|
|
102
|
-
"pl-log-file":
|
|
101
|
+
}, pe = {
|
|
102
|
+
"pl-log-file": v.file({
|
|
103
103
|
description: "specify path for Platforma Backend log file"
|
|
104
104
|
})
|
|
105
|
-
},
|
|
106
|
-
"pl-workdir":
|
|
105
|
+
}, be = {
|
|
106
|
+
"pl-workdir": v.file({
|
|
107
107
|
description: "specify working directory for Platforma Backend process"
|
|
108
108
|
})
|
|
109
|
-
},
|
|
110
|
-
"pl-binary":
|
|
109
|
+
}, we = {
|
|
110
|
+
"pl-binary": v.file({
|
|
111
111
|
description: "start given Platforma Backend binary instead of automatically downloaded version"
|
|
112
112
|
})
|
|
113
|
-
},
|
|
114
|
-
"pl-sources":
|
|
113
|
+
}, ve = {
|
|
114
|
+
"pl-sources": v.file({
|
|
115
115
|
description: "path to pl repository root: build Platforma Backend from sources and start the resulting binary"
|
|
116
116
|
})
|
|
117
|
-
},
|
|
118
|
-
config:
|
|
117
|
+
}, Pe = {
|
|
118
|
+
config: v.string({
|
|
119
119
|
description: "use custom Platforma Backend config"
|
|
120
120
|
})
|
|
121
121
|
};
|
|
122
|
-
|
|
122
|
+
v.file({
|
|
123
123
|
description: "specify path on host to be used as 'primary' storage"
|
|
124
124
|
});
|
|
125
|
-
const
|
|
126
|
-
"storage-work":
|
|
125
|
+
const ie = {
|
|
126
|
+
"storage-work": v.file({
|
|
127
127
|
description: "specify path on host to be used as 'work' storage"
|
|
128
128
|
})
|
|
129
129
|
};
|
|
130
|
-
|
|
130
|
+
v.file({
|
|
131
131
|
description: "specify path on host to be used as 'library' storage"
|
|
132
132
|
});
|
|
133
|
-
const
|
|
134
|
-
"storage-primary":
|
|
133
|
+
const ce = {
|
|
134
|
+
"storage-primary": v.string({
|
|
135
135
|
description: `specify 'primary' storage destination URL.
|
|
136
136
|
file:/path/to/dir for directory on local FS
|
|
137
137
|
s3://<bucket>/?region=<name> for real AWS bucket
|
|
138
138
|
s3e://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via http
|
|
139
139
|
s3es://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via https`
|
|
140
140
|
})
|
|
141
|
-
},
|
|
142
|
-
"storage-library":
|
|
141
|
+
}, oe = {
|
|
142
|
+
"storage-library": v.string({
|
|
143
143
|
description: `specify 'library' storage destination URL.
|
|
144
144
|
file:/path/to/dir for directory on local FS
|
|
145
145
|
s3://<bucket>/?region=<name> for real AWS bucket
|
|
146
146
|
s3e://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via http
|
|
147
147
|
s3es://<endpoint>/<bucket>/?region=<name> for bucket behind custom endpoint via https`
|
|
148
148
|
})
|
|
149
|
-
},
|
|
150
|
-
"auth-enabled":
|
|
149
|
+
}, Dr = {
|
|
150
|
+
"auth-enabled": v.boolean({
|
|
151
151
|
description: "enable authorization"
|
|
152
152
|
})
|
|
153
|
-
},
|
|
154
|
-
"auth-htpasswd-file":
|
|
153
|
+
}, Fr = {
|
|
154
|
+
"auth-htpasswd-file": v.file({
|
|
155
155
|
description: "path to .htpasswd file with Platforma users (static user DB auth source)"
|
|
156
156
|
})
|
|
157
|
-
},
|
|
158
|
-
"auth-ldap-server":
|
|
157
|
+
}, Nr = {
|
|
158
|
+
"auth-ldap-server": v.string({
|
|
159
159
|
description: "address of LDAP server to use for auth in Platforma (auth source)"
|
|
160
160
|
})
|
|
161
|
-
},
|
|
162
|
-
"auth-ldap-default-dn":
|
|
161
|
+
}, _r = {
|
|
162
|
+
"auth-ldap-default-dn": v.string({
|
|
163
163
|
description: "DN to use when checking user with LDAP bind operation: e.g. cn=%u,ou=users,dc=example,dc=com"
|
|
164
164
|
})
|
|
165
|
-
},
|
|
166
|
-
...Fr,
|
|
167
|
-
...xr,
|
|
165
|
+
}, U = {
|
|
168
166
|
...Dr,
|
|
169
|
-
...
|
|
167
|
+
...Fr,
|
|
168
|
+
...Nr,
|
|
169
|
+
..._r
|
|
170
170
|
};
|
|
171
|
-
function
|
|
172
|
-
return
|
|
171
|
+
function Cr(a) {
|
|
172
|
+
return Z.question(`${a} [y/N] `).toLowerCase() === "y";
|
|
173
173
|
}
|
|
174
|
-
function
|
|
174
|
+
function G(a) {
|
|
175
175
|
throw new Error("this should never happen");
|
|
176
176
|
}
|
|
177
|
-
function
|
|
178
|
-
return
|
|
177
|
+
function A(a = "debug") {
|
|
178
|
+
return ge.createLogger({
|
|
179
179
|
level: a,
|
|
180
|
-
format:
|
|
180
|
+
format: ge.format.printf(({ level: e, message: t }) => {
|
|
181
181
|
const r = " ".repeat(e.length + 2);
|
|
182
182
|
if (typeof t != "string") {
|
|
183
183
|
const i = JSON.stringify(t);
|
|
@@ -186,64 +186,64 @@ function I(a = "debug") {
|
|
|
186
186
|
const n = t.split(`
|
|
187
187
|
`).map((i, c) => c === 0 ? i : r + i).join(`
|
|
188
188
|
`);
|
|
189
|
-
return `${((i) =>
|
|
189
|
+
return `${((i) => ge.format.colorize().colorize(i, i))(e)}: ${n}`;
|
|
190
190
|
}),
|
|
191
191
|
transports: [
|
|
192
|
-
new
|
|
192
|
+
new ge.transports.Console({
|
|
193
193
|
stderrLevels: ["error", "warn", "info", "debug"],
|
|
194
194
|
handleExceptions: !0
|
|
195
195
|
})
|
|
196
196
|
]
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
|
-
function Cr(a) {
|
|
200
|
-
return Ir(Math.ceil(a / 2)).toString("hex").slice(0, a);
|
|
201
|
-
}
|
|
202
199
|
function Mr(a) {
|
|
203
|
-
return a.
|
|
204
|
-
}
|
|
205
|
-
function pe(a, e) {
|
|
206
|
-
u.existsSync(a) || (u.mkdirSync(a, { recursive: !0 }), e != null && e.mode && u.chmodSync(a, e.mode));
|
|
200
|
+
return Or(Math.ceil(a / 2)).toString("hex").slice(0, a);
|
|
207
201
|
}
|
|
208
202
|
function jr(a) {
|
|
203
|
+
return a.startsWith("~") ? m.join(F.homedir(), a.slice(1)) : a;
|
|
204
|
+
}
|
|
205
|
+
function Se(a, e) {
|
|
206
|
+
f.existsSync(a) || (f.mkdirSync(a, { recursive: !0 }), e != null && e.mode && f.chmodSync(a, e.mode));
|
|
207
|
+
}
|
|
208
|
+
function Br(a) {
|
|
209
209
|
try {
|
|
210
|
-
if (
|
|
211
|
-
return
|
|
212
|
-
const e = `wmic process where processid=${a} get Caption`, t =
|
|
210
|
+
if (F.platform() !== "win32")
|
|
211
|
+
return Ae(`ps -p ${a} -o comm=`, { encoding: "utf8" }).trim();
|
|
212
|
+
const e = `wmic process where processid=${a} get Caption`, t = Ae(e, { encoding: "utf8" }).split(`
|
|
213
213
|
`);
|
|
214
214
|
return t.length <= 1 ? "" : t[1].trim();
|
|
215
215
|
} catch {
|
|
216
216
|
return "";
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
|
-
function
|
|
220
|
-
const e =
|
|
219
|
+
function Ur(a) {
|
|
220
|
+
const e = Ae(`docker compose ls --filter name=${a} --format json`, { encoding: "utf8" }).trim(), t = JSON.parse(e);
|
|
221
221
|
for (const r of t)
|
|
222
222
|
if (r.Name === a)
|
|
223
223
|
return r;
|
|
224
224
|
}
|
|
225
|
-
const
|
|
226
|
-
npmOrgName:
|
|
227
|
-
orgName:
|
|
228
|
-
blockName:
|
|
229
|
-
softwarePlatforms:
|
|
225
|
+
const Oe = ["Python"], pr = ["Tengo", "Python"], Gr = N.union([N.literal("Tengo"), N.literal("Python")]), Jr = N.object({
|
|
226
|
+
npmOrgName: N.string().min(1),
|
|
227
|
+
orgName: N.string().min(1),
|
|
228
|
+
blockName: N.string().min(1),
|
|
229
|
+
softwarePlatforms: N.array(Gr).refine((a) => new Set(a).size === a.length, {
|
|
230
230
|
message: "Must be an array of unique software platforms"
|
|
231
231
|
})
|
|
232
232
|
});
|
|
233
|
-
async function
|
|
234
|
-
const { npmOrgName: e, orgName: t, blockName: r, softwarePlatforms: n } =
|
|
235
|
-
a.info("Downloading boilerplate code..."), await
|
|
233
|
+
async function Hr(a) {
|
|
234
|
+
const { npmOrgName: e, orgName: t, blockName: r, softwarePlatforms: n } = Wr(), s = m.join(process.cwd(), r);
|
|
235
|
+
a.info("Downloading boilerplate code..."), await qr(
|
|
236
236
|
// 'https://github.com/milaboratory/platforma-block-boilerplate/archive/refs/heads/software_platforms.zip',
|
|
237
237
|
// 'platforma-block-boilerplate-software_platforms',
|
|
238
238
|
"https://github.com/milaboratory/platforma-block-boilerplate/archive/refs/heads/main.zip",
|
|
239
239
|
"platforma-block-boilerplate-main",
|
|
240
240
|
s
|
|
241
241
|
);
|
|
242
|
-
const i =
|
|
242
|
+
const i = pr.filter((o) => n.indexOf(o) < 0), c = Oe.length == i.length;
|
|
243
243
|
a.info(`Keep platforms '${n}', remove: '${i}'. Will remove all platforms? ${c}`);
|
|
244
244
|
for (const o of i)
|
|
245
|
-
await
|
|
246
|
-
c && await
|
|
245
|
+
await zr(s, o);
|
|
246
|
+
c && await Yr(s), a.info("Replace everything in the template with provided options..."), Vr(s, [
|
|
247
247
|
// '@' literal ensures only npm org name will be renamed,
|
|
248
248
|
// as public registry for software also is called platforma-open, but without '@'.
|
|
249
249
|
// Also, don't rename an organization for runenv-python-3 package.
|
|
@@ -252,45 +252,45 @@ async function Jr(a) {
|
|
|
252
252
|
{ from: /block-boilerplate/g, to: r }
|
|
253
253
|
]);
|
|
254
254
|
}
|
|
255
|
-
function
|
|
256
|
-
let a =
|
|
255
|
+
function Wr() {
|
|
256
|
+
let a = Z.question(
|
|
257
257
|
'Write an organization name for npm. Default is "platforma-open": '
|
|
258
258
|
);
|
|
259
259
|
a === "" && (a = "platforma-open");
|
|
260
|
-
const e =
|
|
260
|
+
const e = Z.question('Write an organization name, e.g. "my-org": '), t = Z.question('Write a name of the block, e.g. "hello-world": '), r = Z.keyInYN("Create package for block's software?");
|
|
261
261
|
let n = ["Tengo"];
|
|
262
262
|
if (r)
|
|
263
|
-
for (; n.length <
|
|
264
|
-
const s =
|
|
263
|
+
for (; n.length < pr.length; ) {
|
|
264
|
+
const s = Z.keyInSelect(Oe, "Choose software platform:");
|
|
265
265
|
if (s < 0) break;
|
|
266
|
-
n.push(
|
|
266
|
+
n.push(Oe[s]);
|
|
267
267
|
}
|
|
268
|
-
return n = Array.from(new Set(n)).sort(),
|
|
268
|
+
return n = Array.from(new Set(n)).sort(), Jr.parse({ npmOrgName: a, orgName: e, blockName: t, softwarePlatforms: n });
|
|
269
269
|
}
|
|
270
|
-
async function
|
|
271
|
-
const n = await (await fetch(a)).blob(), s = await
|
|
270
|
+
async function qr(a, e, t) {
|
|
271
|
+
const n = await (await fetch(a)).blob(), s = await _.mkdtemp(m.join(F.tmpdir(), "create-repo")), i = m.join(s, "packed-repo.zip"), c = Rr.toWeb(Lr(i));
|
|
272
272
|
await n.stream().pipeTo(c);
|
|
273
273
|
const o = m.join(s, "unpacked-repo");
|
|
274
|
-
await
|
|
274
|
+
await _.mkdir(o), await Er(i, o), await _.cp(m.join(o, e), t, { recursive: !0 });
|
|
275
275
|
}
|
|
276
|
-
async function
|
|
276
|
+
async function zr(a, e) {
|
|
277
277
|
const t = e.toLowerCase();
|
|
278
|
-
await
|
|
278
|
+
await ee(
|
|
279
279
|
m.join(a, "ui", "src", "pages", "MainPage.vue"),
|
|
280
280
|
new RegExp(`.*${t}Message.*\\n\\n`, "g")
|
|
281
|
-
), await
|
|
281
|
+
), await ee(
|
|
282
282
|
m.join(a, "model", "src", "index.ts"),
|
|
283
283
|
new RegExp(`.*${t}Message.*\\n\\n`, "g")
|
|
284
|
-
), await
|
|
284
|
+
), await ee(
|
|
285
285
|
m.join(a, "workflow", "src", "main.tpl.tengo"),
|
|
286
286
|
new RegExp(`.*${t}.*exec.builder.*[\\s\\S]*?\\n\\n`, "g")
|
|
287
|
-
), await
|
|
287
|
+
), await ee(
|
|
288
288
|
m.join(a, "workflow", "src", "main.tpl.tengo"),
|
|
289
289
|
new RegExp(`.*${t}Message.*\\n`, "g")
|
|
290
|
-
), await
|
|
290
|
+
), await ee(
|
|
291
291
|
m.join(a, "workflow", "src", "wf.test.ts"),
|
|
292
292
|
new RegExp(`.*${t}Message.*\\n.*expect.*\\n\\n`, "g")
|
|
293
|
-
), await
|
|
293
|
+
), await _.rm(m.join(a, "software", `src_${t}`), { recursive: !0 }), await Ue(
|
|
294
294
|
m.join(a, "software", "package.json"),
|
|
295
295
|
(r) => {
|
|
296
296
|
const n = JSON.parse(r);
|
|
@@ -298,75 +298,75 @@ async function qr(a, e) {
|
|
|
298
298
|
}
|
|
299
299
|
);
|
|
300
300
|
}
|
|
301
|
-
async function
|
|
302
|
-
await
|
|
301
|
+
async function Yr(a) {
|
|
302
|
+
await _.rm(m.join(a, "software"), { recursive: !0 }), await Ue(
|
|
303
303
|
m.join(a, "workflow", "package.json"),
|
|
304
304
|
(e) => {
|
|
305
305
|
const t = JSON.parse(e);
|
|
306
306
|
return delete t.dependencies["@platforma-open/my-org.block-boilerplate.software"], JSON.stringify(t, null, 2);
|
|
307
307
|
}
|
|
308
|
-
), await
|
|
308
|
+
), await ee(
|
|
309
309
|
m.join(a, "pnpm-workspace.yaml"),
|
|
310
310
|
/.*- software$\n/gm
|
|
311
311
|
);
|
|
312
312
|
}
|
|
313
|
-
async function
|
|
314
|
-
const t = await
|
|
313
|
+
async function Vr(a, e) {
|
|
314
|
+
const t = await Kr(a);
|
|
315
315
|
for (const { from: r, to: n } of e)
|
|
316
316
|
for (const s of t)
|
|
317
|
-
await
|
|
317
|
+
await br(s, r, n);
|
|
318
318
|
}
|
|
319
|
-
async function
|
|
320
|
-
return (await
|
|
319
|
+
async function Kr(a) {
|
|
320
|
+
return (await _.readdir(a, {
|
|
321
321
|
withFileTypes: !0,
|
|
322
322
|
recursive: !0
|
|
323
323
|
})).filter((t) => t.isFile()).map((t) => m.join(t.parentPath, t.name));
|
|
324
324
|
}
|
|
325
|
-
async function
|
|
326
|
-
const t = await
|
|
327
|
-
await
|
|
325
|
+
async function Ue(a, e) {
|
|
326
|
+
const t = await _.readFile(a), r = e(t.toString());
|
|
327
|
+
await _.writeFile(a, r);
|
|
328
328
|
}
|
|
329
|
-
async function
|
|
330
|
-
return await
|
|
329
|
+
async function br(a, e, t) {
|
|
330
|
+
return await Ue(a, (r) => r.replaceAll(e, t));
|
|
331
331
|
}
|
|
332
|
-
async function
|
|
333
|
-
return await
|
|
332
|
+
async function ee(a, e) {
|
|
333
|
+
return await br(a, e, "");
|
|
334
334
|
}
|
|
335
|
-
const
|
|
335
|
+
const re = class re extends L {
|
|
336
336
|
async run() {
|
|
337
|
-
const { flags: e } = await this.parse(
|
|
338
|
-
await
|
|
337
|
+
const { flags: e } = await this.parse(re), t = A(e["log-level"]);
|
|
338
|
+
await Hr(t);
|
|
339
339
|
}
|
|
340
340
|
};
|
|
341
|
-
l(
|
|
342
|
-
...
|
|
341
|
+
l(re, "description", "Helps to create a new block by downloading a block's template."), l(re, "examples", ["<%= name %>"]), l(re, "flags", {
|
|
342
|
+
...I
|
|
343
343
|
});
|
|
344
|
-
let
|
|
345
|
-
function
|
|
346
|
-
return
|
|
344
|
+
let Re = re;
|
|
345
|
+
function wr(...a) {
|
|
346
|
+
return Ir(__dirname, "..", ...a);
|
|
347
347
|
}
|
|
348
|
-
function
|
|
349
|
-
return
|
|
348
|
+
function Q(...a) {
|
|
349
|
+
return wr("assets", ...a);
|
|
350
350
|
}
|
|
351
|
-
function
|
|
352
|
-
return
|
|
351
|
+
function $e(...a) {
|
|
352
|
+
return f.readFileSync(wr(...a));
|
|
353
353
|
}
|
|
354
|
-
function
|
|
354
|
+
function gr(a) {
|
|
355
355
|
return a || (a = fe()), `quay.io/milaboratories/platforma:${a}`;
|
|
356
356
|
}
|
|
357
|
-
const
|
|
357
|
+
const J = class J {
|
|
358
358
|
constructor(e) {
|
|
359
359
|
l(this, "state", {
|
|
360
360
|
currentInstance: ""
|
|
361
361
|
});
|
|
362
362
|
l(this, "filePath");
|
|
363
363
|
l(this, "dirPath");
|
|
364
|
-
e = e ?? m.resolve(
|
|
364
|
+
e = e ?? m.resolve(F.homedir(), ".config", "pl-bootstrap");
|
|
365
365
|
const t = m.join(e, "state.json");
|
|
366
|
-
this.dirPath = e, this.filePath = t,
|
|
366
|
+
this.dirPath = e, this.filePath = t, f.existsSync(e) || f.mkdirSync(e, { recursive: !0 }), f.existsSync(t) && (this.state = JSON.parse($e(t).toString()));
|
|
367
367
|
}
|
|
368
368
|
static getStateInstance() {
|
|
369
|
-
return
|
|
369
|
+
return J.instance || (J.instance = new J()), J.instance;
|
|
370
370
|
}
|
|
371
371
|
path(...e) {
|
|
372
372
|
return m.join(this.dirPath, ...e);
|
|
@@ -378,40 +378,40 @@ const C = class C {
|
|
|
378
378
|
return this.path("binaries", ...e);
|
|
379
379
|
}
|
|
380
380
|
writeState() {
|
|
381
|
-
|
|
381
|
+
f.writeFileSync(this.filePath, JSON.stringify(this.state));
|
|
382
382
|
}
|
|
383
383
|
get instanceList() {
|
|
384
|
-
return
|
|
384
|
+
return f.existsSync(this.instanceDir()) ? f.readdirSync(this.instanceDir()).filter((t) => this.instanceExists(t)) : [];
|
|
385
385
|
}
|
|
386
386
|
instanceExists(e) {
|
|
387
|
-
return
|
|
387
|
+
return f.existsSync(this.instanceDir(e, "instance.json"));
|
|
388
388
|
}
|
|
389
389
|
getInstanceInfo(e) {
|
|
390
390
|
const t = this.instanceDir(e, "instance.json");
|
|
391
|
-
if (!
|
|
391
|
+
if (!f.existsSync(t))
|
|
392
392
|
throw new Error(`platforma backend instance '${e}' does not exist or is corrupted`);
|
|
393
|
-
const r = JSON.parse(
|
|
393
|
+
const r = JSON.parse($e(t).toString());
|
|
394
394
|
return {
|
|
395
395
|
name: e,
|
|
396
396
|
...r
|
|
397
397
|
};
|
|
398
398
|
}
|
|
399
399
|
setInstanceInfo(e, t) {
|
|
400
|
-
|
|
400
|
+
f.existsSync(this.instanceDir(e)) || f.mkdirSync(this.instanceDir(e), { recursive: !0 });
|
|
401
401
|
const r = this.instanceDir(e, "instance.json");
|
|
402
402
|
let n = {};
|
|
403
|
-
|
|
403
|
+
f.existsSync(r) && (n = JSON.parse($e(r).toString())), f.writeFileSync(r, JSON.stringify({ ...n, ...t }));
|
|
404
404
|
}
|
|
405
405
|
isInstanceActive(e) {
|
|
406
406
|
switch (e.type) {
|
|
407
407
|
case "docker": {
|
|
408
|
-
const r =
|
|
408
|
+
const r = Ur(`pl-${e.name}`);
|
|
409
409
|
return r ? r.Status.trim().startsWith("running") : !1;
|
|
410
410
|
}
|
|
411
411
|
case "process":
|
|
412
|
-
return e.pid ?
|
|
412
|
+
return e.pid ? ur(e.pid) : !1;
|
|
413
413
|
default:
|
|
414
|
-
throw
|
|
414
|
+
throw G(), new Error("cli logic error: unknown service type, cannot check its state");
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
417
|
get isActive() {
|
|
@@ -423,7 +423,7 @@ const C = class C {
|
|
|
423
423
|
return !1;
|
|
424
424
|
}
|
|
425
425
|
isValidPID(e) {
|
|
426
|
-
return
|
|
426
|
+
return ur(e);
|
|
427
427
|
}
|
|
428
428
|
get currentInstance() {
|
|
429
429
|
const e = this.state.currentInstance;
|
|
@@ -442,14 +442,14 @@ const C = class C {
|
|
|
442
442
|
this.state.currentInstance = e, this.writeState();
|
|
443
443
|
}
|
|
444
444
|
};
|
|
445
|
-
l(
|
|
446
|
-
let
|
|
447
|
-
function
|
|
448
|
-
const e =
|
|
445
|
+
l(J, "instance");
|
|
446
|
+
let Ee = J;
|
|
447
|
+
function ur(a) {
|
|
448
|
+
const e = Br(a);
|
|
449
449
|
return e === "platforma" || e.endsWith("/platforma") || e.endsWith("\\platforma");
|
|
450
450
|
}
|
|
451
|
-
const
|
|
452
|
-
function
|
|
451
|
+
const u = Ee.getStateInstance();
|
|
452
|
+
function Le(a, e, t) {
|
|
453
453
|
const r = [], n = [];
|
|
454
454
|
for (const s of e)
|
|
455
455
|
if (t = {
|
|
@@ -461,10 +461,10 @@ function we(a, e, t) {
|
|
|
461
461
|
...s.runOpts,
|
|
462
462
|
...t
|
|
463
463
|
}, s.async) {
|
|
464
|
-
const i =
|
|
464
|
+
const i = Qr(a, s.cmd, s.args, t);
|
|
465
465
|
n.push(i);
|
|
466
466
|
} else {
|
|
467
|
-
const i =
|
|
467
|
+
const i = Xr(a, s.cmd, s.args, t);
|
|
468
468
|
if (r.push(i), i.error || i.status !== 0)
|
|
469
469
|
break;
|
|
470
470
|
}
|
|
@@ -473,7 +473,7 @@ function we(a, e, t) {
|
|
|
473
473
|
spawned: n
|
|
474
474
|
};
|
|
475
475
|
}
|
|
476
|
-
function
|
|
476
|
+
function Qr(a, e, t, r) {
|
|
477
477
|
var c;
|
|
478
478
|
a.debug(
|
|
479
479
|
`Running:
|
|
@@ -490,15 +490,15 @@ function Kr(a, e, t, r) {
|
|
|
490
490
|
process.removeListener("SIGINT", i), s && process.exit(o);
|
|
491
491
|
}), n;
|
|
492
492
|
}
|
|
493
|
-
function
|
|
493
|
+
function Xr(a, e, t, r) {
|
|
494
494
|
return a.debug(
|
|
495
495
|
`Running:
|
|
496
496
|
cmd: ${JSON.stringify([e, ...t])}
|
|
497
497
|
opts: ${JSON.stringify(r)}`
|
|
498
|
-
), r.env = { ...process.env, ...r.env },
|
|
498
|
+
), r.env = { ...process.env, ...r.env }, mr(e, t, r);
|
|
499
499
|
}
|
|
500
|
-
function
|
|
501
|
-
const s =
|
|
500
|
+
function Ie(a, e, t, r, n) {
|
|
501
|
+
const s = f.readFileSync(a, { encoding: "utf-8" }), i = dr.parse(s.toString());
|
|
502
502
|
if (!i.services)
|
|
503
503
|
throw new Error(`file '${a}' seems to be not a docker-compose file or has unsupported version`);
|
|
504
504
|
if (r)
|
|
@@ -506,38 +506,37 @@ function ve(a, e, t, r, n) {
|
|
|
506
506
|
r.has(c) || delete i.services[c];
|
|
507
507
|
i.name = t;
|
|
508
508
|
for (const [c, o] of (r == null ? void 0 : r.entries()) ?? []) {
|
|
509
|
-
const
|
|
510
|
-
if (!
|
|
509
|
+
const d = i.services[c];
|
|
510
|
+
if (!d)
|
|
511
511
|
throw new Error(`docker compose '${a}' has no declaration of service '${c}'`);
|
|
512
|
-
if (o.platform && (
|
|
513
|
-
|
|
514
|
-
for (let g = 0; g < ((
|
|
515
|
-
const
|
|
516
|
-
if (o.envs[
|
|
517
|
-
const
|
|
518
|
-
|
|
512
|
+
if (o.platform && (d.platform = o.platform), o.envs) {
|
|
513
|
+
d.environment || (d.environment = []);
|
|
514
|
+
for (let g = 0; g < ((d == null ? void 0 : d.environment.length) ?? 0); ) {
|
|
515
|
+
const b = d.environment[g].split("=")[0];
|
|
516
|
+
if (o.envs[b]) {
|
|
517
|
+
const w = d.environment.pop();
|
|
518
|
+
w && d.environment.length !== g && (d.environment[g] = w);
|
|
519
519
|
} else
|
|
520
520
|
g++;
|
|
521
521
|
}
|
|
522
522
|
for (const [g, h] of Object.entries(o.envs))
|
|
523
|
-
|
|
523
|
+
d.environment.push(`${g}=${h}`);
|
|
524
524
|
}
|
|
525
525
|
if (o.mounts) {
|
|
526
|
-
|
|
526
|
+
d.volumes || (d.volumes = []);
|
|
527
527
|
for (const g of o.mounts)
|
|
528
|
-
|
|
528
|
+
d.volumes.push(`${g.hostPath}:${g.containerPath}`);
|
|
529
529
|
}
|
|
530
530
|
}
|
|
531
|
-
n != null && n.dropVolumes && delete i.volumes,
|
|
531
|
+
n != null && n.dropVolumes && delete i.volumes, f.writeFileSync(e, dr.stringify(i));
|
|
532
532
|
}
|
|
533
|
-
function
|
|
533
|
+
function Zr(a) {
|
|
534
534
|
return {
|
|
535
535
|
id: a,
|
|
536
536
|
type: "S3",
|
|
537
537
|
indexCachePeriod: "0s",
|
|
538
538
|
endpoint: "",
|
|
539
539
|
region: "",
|
|
540
|
-
presignEndpoint: "",
|
|
541
540
|
bucketName: "",
|
|
542
541
|
createBucket: !1,
|
|
543
542
|
forcePathStyle: !1,
|
|
@@ -548,7 +547,7 @@ function Xr(a) {
|
|
|
548
547
|
uploadKeyPrefix: ""
|
|
549
548
|
};
|
|
550
549
|
}
|
|
551
|
-
function
|
|
550
|
+
function vr(a) {
|
|
552
551
|
return {
|
|
553
552
|
id: a,
|
|
554
553
|
type: "FS",
|
|
@@ -556,42 +555,46 @@ function wr(a) {
|
|
|
556
555
|
rootPath: ""
|
|
557
556
|
};
|
|
558
557
|
}
|
|
559
|
-
function
|
|
560
|
-
a =
|
|
558
|
+
function X(a, e, t) {
|
|
559
|
+
a = jr(a);
|
|
561
560
|
const r = new URL(a, `file:${e}`);
|
|
562
561
|
switch (r.protocol) {
|
|
563
|
-
case "s3:":
|
|
564
|
-
|
|
562
|
+
case "s3:": {
|
|
563
|
+
const n = r.hostname, s = r.searchParams.get("region"), i = r.pathname.slice(1);
|
|
565
564
|
return {
|
|
566
565
|
...t,
|
|
567
566
|
type: "S3",
|
|
568
|
-
bucketName:
|
|
569
|
-
region:
|
|
567
|
+
bucketName: n,
|
|
568
|
+
region: s,
|
|
569
|
+
keyPrefix: i
|
|
570
570
|
};
|
|
571
|
-
|
|
572
|
-
|
|
571
|
+
}
|
|
572
|
+
case "s3e:": {
|
|
573
|
+
const n = r.pathname.split("/").slice(1), s = n[0], i = n.length > 1 ? n.slice(1).join("/") : "";
|
|
573
574
|
return {
|
|
574
575
|
...t,
|
|
575
576
|
type: "S3",
|
|
576
577
|
endpoint: `http://${r.host}/`,
|
|
577
|
-
bucketName:
|
|
578
|
-
keyPrefix:
|
|
578
|
+
bucketName: s,
|
|
579
|
+
keyPrefix: i,
|
|
579
580
|
region: r.searchParams.get("region"),
|
|
580
581
|
key: r.username ? `static:${r.username}` : "",
|
|
581
582
|
secret: r.password ? `static:${r.password}` : ""
|
|
582
583
|
};
|
|
583
|
-
|
|
584
|
-
|
|
584
|
+
}
|
|
585
|
+
case "s3es:": {
|
|
586
|
+
const n = r.pathname.split("/").slice(1), s = n[0], i = n.length > 1 ? n.slice(1).join("/") : "";
|
|
585
587
|
return {
|
|
586
588
|
...t,
|
|
587
589
|
type: "S3",
|
|
588
590
|
endpoint: `https://${r.host}/`,
|
|
589
|
-
bucketName:
|
|
590
|
-
keyPrefix:
|
|
591
|
+
bucketName: s,
|
|
592
|
+
keyPrefix: i,
|
|
591
593
|
region: r.searchParams.get("region"),
|
|
592
594
|
key: r.username ? `static:${r.username}` : "",
|
|
593
595
|
secret: r.password ? `static:${r.password}` : ""
|
|
594
596
|
};
|
|
597
|
+
}
|
|
595
598
|
case "file:":
|
|
596
599
|
return {
|
|
597
600
|
type: "FS",
|
|
@@ -601,17 +604,17 @@ function Q(a, e, t) {
|
|
|
601
604
|
throw new Error(`storage protocol '${r.protocol}' is not supported`);
|
|
602
605
|
}
|
|
603
606
|
}
|
|
604
|
-
function
|
|
605
|
-
var
|
|
606
|
-
const t = (e == null ? void 0 : e.localRoot) ??
|
|
607
|
-
level: ((
|
|
607
|
+
function et(a, e) {
|
|
608
|
+
var w, y, P, S, k, p, $, le, Ge, Je, He, We, qe, ze, Ye, Ve, Ke, Qe, Xe, Ze, er, rr, tr, ar, nr, sr, ir, cr, or, lr;
|
|
609
|
+
const t = (e == null ? void 0 : e.localRoot) ?? u.instanceDir("default"), r = {
|
|
610
|
+
level: ((w = e == null ? void 0 : e.log) == null ? void 0 : w.level) ?? "info",
|
|
608
611
|
path: ((y = e == null ? void 0 : e.log) == null ? void 0 : y.path) ?? `${t}/logs/platforma.log`
|
|
609
612
|
}, n = {
|
|
610
613
|
listen: ((P = e == null ? void 0 : e.grpc) == null ? void 0 : P.listen) ?? "localhost:6345",
|
|
611
614
|
tls: {
|
|
612
|
-
enable:
|
|
615
|
+
enable: de((k = (S = e == null ? void 0 : e.grpc) == null ? void 0 : S.tls) == null ? void 0 : k.enable, !1),
|
|
613
616
|
clientAuthMode: (($ = (p = e == null ? void 0 : e.grpc) == null ? void 0 : p.tls) == null ? void 0 : $.clientAuthMode) ?? "NoAuth",
|
|
614
|
-
certFile: ((
|
|
617
|
+
certFile: ((Ge = (le = e == null ? void 0 : e.grpc) == null ? void 0 : le.tls) == null ? void 0 : Ge.certFile) ?? `${t}/certs/tls.cert`,
|
|
615
618
|
keyFile: ((He = (Je = e == null ? void 0 : e.grpc) == null ? void 0 : Je.tls) == null ? void 0 : He.keyFile) ?? `${t}/certs/tls.key`,
|
|
616
619
|
...(We = e == null ? void 0 : e.grpc) == null ? void 0 : We.tls
|
|
617
620
|
}
|
|
@@ -626,7 +629,7 @@ function Zr(a, e) {
|
|
|
626
629
|
db: {
|
|
627
630
|
path: `${t}/db`
|
|
628
631
|
}
|
|
629
|
-
}, i =
|
|
632
|
+
}, i = fr(
|
|
630
633
|
"main",
|
|
631
634
|
`${t}/storages/main`,
|
|
632
635
|
"main-bucket",
|
|
@@ -636,57 +639,57 @@ function Zr(a, e) {
|
|
|
636
639
|
switch ((Xe = (Qe = e == null ? void 0 : e.storages) == null ? void 0 : Qe.work) == null ? void 0 : Xe.type) {
|
|
637
640
|
case void 0:
|
|
638
641
|
case "FS":
|
|
639
|
-
c =
|
|
642
|
+
c = vr("work"), c.rootPath = ((er = (Ze = e == null ? void 0 : e.storages) == null ? void 0 : Ze.work) == null ? void 0 : er.rootPath) ?? `${t}/storages/work`, c.indexCachePeriod = ((tr = (rr = e == null ? void 0 : e.storages) == null ? void 0 : rr.work) == null ? void 0 : tr.indexCachePeriod) ?? "1m";
|
|
640
643
|
break;
|
|
641
644
|
default:
|
|
642
645
|
throw new Error("work storage MUST have 'FS' type as it is used for working directories management");
|
|
643
646
|
}
|
|
644
|
-
const
|
|
647
|
+
const d = fr(
|
|
645
648
|
"library",
|
|
646
649
|
`${t}/storages/library`,
|
|
647
650
|
"library-bucket",
|
|
648
651
|
(ar = e == null ? void 0 : e.storages) == null ? void 0 : ar.library
|
|
649
652
|
), g = {
|
|
650
|
-
enabled:
|
|
653
|
+
enabled: de((nr = e == null ? void 0 : e.monitoring) == null ? void 0 : nr.enabled, !0),
|
|
651
654
|
listen: ((sr = e == null ? void 0 : e.monitoring) == null ? void 0 : sr.listen) ?? "127.0.0.1:9090"
|
|
652
655
|
}, h = {
|
|
653
|
-
enabled:
|
|
656
|
+
enabled: de((ir = e == null ? void 0 : e.debug) == null ? void 0 : ir.enabled, !0),
|
|
654
657
|
listen: ((cr = e == null ? void 0 : e.debug) == null ? void 0 : cr.listen) ?? "127.0.0.1:9091"
|
|
655
|
-
},
|
|
658
|
+
}, b = {
|
|
656
659
|
value: ((or = e == null ? void 0 : e.license) == null ? void 0 : or.value) ?? "",
|
|
657
660
|
file: ((lr = e == null ? void 0 : e.license) == null ? void 0 : lr.file) ?? ""
|
|
658
661
|
};
|
|
659
662
|
return {
|
|
660
663
|
localRoot: t,
|
|
661
|
-
license:
|
|
664
|
+
license: b,
|
|
662
665
|
log: r,
|
|
663
666
|
grpc: n,
|
|
664
667
|
core: s,
|
|
665
668
|
monitoring: g,
|
|
666
669
|
debug: h,
|
|
667
|
-
storages: { primary: i, work: c, library:
|
|
670
|
+
storages: { primary: i, work: c, library: d },
|
|
668
671
|
hacks: { libraryDownloadable: !0 }
|
|
669
672
|
};
|
|
670
673
|
}
|
|
671
|
-
function
|
|
674
|
+
function fr(a, e, t, r) {
|
|
672
675
|
let n;
|
|
673
676
|
switch (r == null ? void 0 : r.type) {
|
|
674
677
|
case void 0:
|
|
675
678
|
case "FS":
|
|
676
|
-
n =
|
|
679
|
+
n = vr(a), n.rootPath = (r == null ? void 0 : r.rootPath) ?? e;
|
|
677
680
|
break;
|
|
678
681
|
case "S3":
|
|
679
|
-
n =
|
|
682
|
+
n = Zr(a), n.endpoint = r == null ? void 0 : r.endpoint, n.region = r == null ? void 0 : r.region, n.presignEndpoint = (r == null ? void 0 : r.presignEndpoint) ?? (r == null ? void 0 : r.endpoint), n.bucketName = (r == null ? void 0 : r.bucketName) ?? t, n.createBucket = de(r == null ? void 0 : r.createBucket, !0), n.forcePathStyle = de(r == null ? void 0 : r.forcePathStyle, !0), n.key = (r == null ? void 0 : r.key) ?? "", n.secret = (r == null ? void 0 : r.secret) ?? "", n.keyPrefix = (r == null ? void 0 : r.keyPrefix) ?? "", n.accessPrefixes = (r == null ? void 0 : r.accessPrefixes) ?? [""], n.uploadKeyPrefix = (r == null ? void 0 : r.uploadKeyPrefix) ?? "";
|
|
680
683
|
break;
|
|
681
684
|
default:
|
|
682
|
-
throw
|
|
685
|
+
throw G(), new Error("unknown storage type");
|
|
683
686
|
}
|
|
684
687
|
return n;
|
|
685
688
|
}
|
|
686
|
-
function
|
|
689
|
+
function rt(a) {
|
|
687
690
|
const e = a.monitoring.enabled ? "" : " disabled", t = a.debug.enabled ? "" : " disabled", r = a.hacks.libraryDownloadable ? "true" : "false";
|
|
688
691
|
let n = a.license.value;
|
|
689
|
-
return a.license.file != "" && (n =
|
|
692
|
+
return a.license.file != "" && (n = f.readFileSync(a.license.file).toString().trimEnd()), `
|
|
690
693
|
license:
|
|
691
694
|
value: '${a.license.value}'
|
|
692
695
|
file: '${a.license.file}'
|
|
@@ -762,12 +765,12 @@ controllers:
|
|
|
762
765
|
workflows: {}
|
|
763
766
|
`;
|
|
764
767
|
}
|
|
765
|
-
function
|
|
768
|
+
function de(a, e) {
|
|
766
769
|
return a === void 0 ? e : a;
|
|
767
770
|
}
|
|
768
|
-
const
|
|
769
|
-
function
|
|
770
|
-
const e =
|
|
771
|
+
const tt = ["linux", "macos", "windows"];
|
|
772
|
+
function at(a) {
|
|
773
|
+
const e = F.platform();
|
|
771
774
|
switch (e) {
|
|
772
775
|
case "darwin":
|
|
773
776
|
return "macos";
|
|
@@ -777,13 +780,13 @@ function tt(a) {
|
|
|
777
780
|
return "windows";
|
|
778
781
|
default:
|
|
779
782
|
throw new Error(
|
|
780
|
-
`operating system '${e}' is not currently supported by Platforma ecosystem. The list of OSes supported: ` + JSON.stringify(
|
|
783
|
+
`operating system '${e}' is not currently supported by Platforma ecosystem. The list of OSes supported: ` + JSON.stringify(tt)
|
|
781
784
|
);
|
|
782
785
|
}
|
|
783
786
|
}
|
|
784
|
-
const
|
|
785
|
-
function
|
|
786
|
-
const e =
|
|
787
|
+
const nt = ["amd64", "arm64"];
|
|
788
|
+
function Pr(a) {
|
|
789
|
+
const e = F.arch();
|
|
787
790
|
switch (e) {
|
|
788
791
|
case "arm64":
|
|
789
792
|
return "arm64";
|
|
@@ -791,77 +794,77 @@ function vr(a) {
|
|
|
791
794
|
return "amd64";
|
|
792
795
|
default:
|
|
793
796
|
throw new Error(
|
|
794
|
-
`processor architecture '${e}' is not currently supported by Platforma ecosystem. The list of architectures supported: ` + JSON.stringify(
|
|
797
|
+
`processor architecture '${e}' is not currently supported by Platforma ecosystem. The list of architectures supported: ` + JSON.stringify(nt)
|
|
795
798
|
);
|
|
796
799
|
}
|
|
797
800
|
}
|
|
798
|
-
function
|
|
799
|
-
const t = (e == null ? void 0 : e.version) ?? fe(), r = (e == null ? void 0 : e.showProgress) ?? process.stdout.isTTY, n = `pl-${t}-${
|
|
800
|
-
if (
|
|
801
|
+
function st(a, e) {
|
|
802
|
+
const t = (e == null ? void 0 : e.version) ?? fe(), r = (e == null ? void 0 : e.showProgress) ?? process.stdout.isTTY, n = `pl-${t}-${Pr()}.tgz`, s = (e == null ? void 0 : e.downloadURL) ?? `https://cdn.platforma.bio/software/pl/${at()}/${n}`, i = (e == null ? void 0 : e.saveTo) ?? u.binaries(n);
|
|
803
|
+
if (f.existsSync(i))
|
|
801
804
|
return a.info(`Platforma Backend archive download skipped: '${i}' already exists`), Promise.resolve(i);
|
|
802
|
-
|
|
805
|
+
f.mkdirSync(m.dirname(i), { recursive: !0 }), a.info(`Downloading Platforma Backend archive:
|
|
803
806
|
URL: ${s}
|
|
804
807
|
Save to: ${i}`);
|
|
805
|
-
const c =
|
|
806
|
-
return new Promise((o,
|
|
808
|
+
const c = Tr.get(s);
|
|
809
|
+
return new Promise((o, d) => {
|
|
807
810
|
c.on("response", (g) => {
|
|
808
811
|
if (!g.statusCode) {
|
|
809
812
|
const y = new Error("failed to download archive: no HTTP status code in response from server");
|
|
810
|
-
c.destroy(),
|
|
813
|
+
c.destroy(), d(y);
|
|
811
814
|
return;
|
|
812
815
|
}
|
|
813
816
|
if (g.statusCode !== 200) {
|
|
814
817
|
const y = new Error(`failed to download archive: ${g.statusCode} ${g.statusMessage}`);
|
|
815
|
-
c.destroy(),
|
|
818
|
+
c.destroy(), d(y);
|
|
816
819
|
return;
|
|
817
820
|
}
|
|
818
821
|
const h = parseInt(g.headers["content-length"] || "0", 10);
|
|
819
|
-
let
|
|
820
|
-
const
|
|
821
|
-
g.pipe(
|
|
822
|
-
|
|
823
|
-
const P =
|
|
822
|
+
let b = 0;
|
|
823
|
+
const w = f.createWriteStream(i);
|
|
824
|
+
g.pipe(w), g.on("data", (y) => {
|
|
825
|
+
b += y.length;
|
|
826
|
+
const P = b / h * 100;
|
|
824
827
|
r && process.stdout.write(` downloading: ${P.toFixed(2)}%\r`);
|
|
825
828
|
}), g.on("error", (y) => {
|
|
826
|
-
|
|
827
|
-
}),
|
|
828
|
-
|
|
829
|
+
f.unlinkSync(i), a.error(`Failed to download Platforma Binary: ${y.message}`), c.destroy(), d(y);
|
|
830
|
+
}), w.on("finish", () => {
|
|
831
|
+
w.close(), a.info(" ... download done."), c.destroy(), o(i);
|
|
829
832
|
});
|
|
830
833
|
});
|
|
831
834
|
});
|
|
832
835
|
}
|
|
833
|
-
function
|
|
836
|
+
function it(a, e) {
|
|
834
837
|
a.debug("extracting archive...");
|
|
835
838
|
const t = (e == null ? void 0 : e.version) ?? fe();
|
|
836
839
|
a.debug(` version: '${t}'`);
|
|
837
|
-
const r = `${
|
|
840
|
+
const r = `${kr({ version: t })}.tgz`, n = (e == null ? void 0 : e.archivePath) ?? u.binaries(r);
|
|
838
841
|
a.debug(` archive path: '${n}'`);
|
|
839
|
-
const s = (e == null ? void 0 : e.extractTo) ??
|
|
840
|
-
if (a.debug(` target dir: '${s}'`),
|
|
842
|
+
const s = (e == null ? void 0 : e.extractTo) ?? ot(n);
|
|
843
|
+
if (a.debug(` target dir: '${s}'`), f.existsSync(s))
|
|
841
844
|
return a.info(`Platforma Backend binaries unpack skipped: '${s}' exists`), s;
|
|
842
|
-
if (!
|
|
845
|
+
if (!f.existsSync(n)) {
|
|
843
846
|
const i = `Platforma Backend binary archive not found at '${n}'`;
|
|
844
847
|
throw a.error(i), new Error(i);
|
|
845
848
|
}
|
|
846
|
-
return
|
|
849
|
+
return f.existsSync(s) || (a.debug(` creating target dir '${s}'`), f.mkdirSync(s, { recursive: !0 })), a.info(`Unpacking Platforma Backend archive:
|
|
847
850
|
Archive: ${n}
|
|
848
|
-
Target dir: ${s}`),
|
|
851
|
+
Target dir: ${s}`), xr.x({
|
|
849
852
|
file: n,
|
|
850
853
|
cwd: s,
|
|
851
854
|
gzip: !0,
|
|
852
855
|
sync: !0
|
|
853
856
|
}), a.info(" ... unpack done."), s;
|
|
854
857
|
}
|
|
855
|
-
function
|
|
856
|
-
return
|
|
858
|
+
function ke(a, e) {
|
|
859
|
+
return st(a, e).then((t) => it(a, { archivePath: t }));
|
|
857
860
|
}
|
|
858
|
-
function
|
|
859
|
-
return `pl-${(a == null ? void 0 : a.version) ?? fe()}-${
|
|
861
|
+
function kr(a) {
|
|
862
|
+
return `pl-${(a == null ? void 0 : a.version) ?? fe()}-${Pr()}`;
|
|
860
863
|
}
|
|
861
|
-
function
|
|
862
|
-
return
|
|
864
|
+
function ct(a, ...e) {
|
|
865
|
+
return u.binaries(kr({ version: a }), ...e);
|
|
863
866
|
}
|
|
864
|
-
function
|
|
867
|
+
function ot(a) {
|
|
865
868
|
const e = a.lastIndexOf(".");
|
|
866
869
|
return e === -1 ? a : a.slice(0, e);
|
|
867
870
|
}
|
|
@@ -870,7 +873,7 @@ class O {
|
|
|
870
873
|
this.logger = e;
|
|
871
874
|
}
|
|
872
875
|
startLast() {
|
|
873
|
-
const e =
|
|
876
|
+
const e = u.currentInstance;
|
|
874
877
|
if (!e)
|
|
875
878
|
throw this.logger.error("failed to bring back Platforma Backend in the last started configuration: no last configuration found"), new Error("no previous run info found");
|
|
876
879
|
return this.startInstance(e);
|
|
@@ -881,57 +884,57 @@ class O {
|
|
|
881
884
|
this.logger.info(`Starting platforma backend instance '${e.name}':
|
|
882
885
|
${r}`);
|
|
883
886
|
}
|
|
884
|
-
const t =
|
|
887
|
+
const t = Le(
|
|
885
888
|
this.logger,
|
|
886
889
|
e.upCommands
|
|
887
890
|
);
|
|
888
|
-
return
|
|
891
|
+
return ue(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;
|
|
889
892
|
}
|
|
890
893
|
stopInstance(e) {
|
|
891
|
-
if (!
|
|
894
|
+
if (!u.isInstanceActive(e)) {
|
|
892
895
|
this.logger.info(`instance '${e.name}' is not running`);
|
|
893
896
|
return;
|
|
894
897
|
}
|
|
895
898
|
this.logger.info(`stopping platforma backend instance '${e.name}'...`);
|
|
896
|
-
const t =
|
|
897
|
-
switch (
|
|
899
|
+
const t = Le(this.logger, e.downCommands);
|
|
900
|
+
switch (ue(t.executed), e.type) {
|
|
898
901
|
case "docker":
|
|
899
902
|
return;
|
|
900
903
|
case "process": {
|
|
901
|
-
e.pid &&
|
|
904
|
+
e.pid && u.isValidPID(e.pid) && process.kill(e.pid);
|
|
902
905
|
return;
|
|
903
906
|
}
|
|
904
907
|
default:
|
|
905
|
-
|
|
908
|
+
G();
|
|
906
909
|
}
|
|
907
910
|
}
|
|
908
911
|
switchInstance(e) {
|
|
909
|
-
for (const t of
|
|
912
|
+
for (const t of u.instanceList)
|
|
910
913
|
if (t !== e.name) {
|
|
911
|
-
const r =
|
|
912
|
-
|
|
914
|
+
const r = u.getInstanceInfo(t);
|
|
915
|
+
u.isInstanceActive(r) && this.stopInstance(r);
|
|
913
916
|
}
|
|
914
917
|
return this.startInstance(e);
|
|
915
918
|
}
|
|
916
919
|
createLocal(e, t) {
|
|
917
|
-
var o,
|
|
918
|
-
const r = (t == null ? void 0 : t.binaryPath) ??
|
|
920
|
+
var o, d, g, h, b, w, y, P, S, k;
|
|
921
|
+
const r = (t == null ? void 0 : t.binaryPath) ?? ct(t == null ? void 0 : t.version, "binaries", "platforma");
|
|
919
922
|
let n = t == null ? void 0 : t.configPath;
|
|
920
|
-
const s = (t == null ? void 0 : t.workdir) ?? (n ? process.cwd() :
|
|
923
|
+
const s = (t == null ? void 0 : t.workdir) ?? (n ? process.cwd() : u.instanceDir(e));
|
|
921
924
|
t != null && t.primaryURL && (t.configOptions = {
|
|
922
925
|
...t.configOptions,
|
|
923
926
|
storages: {
|
|
924
927
|
...(o = t.configOptions) == null ? void 0 : o.storages,
|
|
925
|
-
primary:
|
|
928
|
+
primary: X(t.primaryURL, s, (g = (d = t.configOptions) == null ? void 0 : d.storages) == null ? void 0 : g.primary)
|
|
926
929
|
}
|
|
927
930
|
}), t != null && t.libraryURL && (t.configOptions = {
|
|
928
931
|
...t.configOptions,
|
|
929
932
|
storages: {
|
|
930
933
|
...(h = t.configOptions) == null ? void 0 : h.storages,
|
|
931
|
-
library:
|
|
934
|
+
library: X(t.libraryURL, s, (w = (b = t.configOptions) == null ? void 0 : b.storages) == null ? void 0 : w.library)
|
|
932
935
|
}
|
|
933
936
|
});
|
|
934
|
-
const i =
|
|
937
|
+
const i = et(this.getLastJwt(), t == null ? void 0 : t.configOptions);
|
|
935
938
|
this.logger.debug(" checking license..."), this.checkLicense((P = (y = t == null ? void 0 : t.configOptions) == null ? void 0 : y.license) == null ? void 0 : P.value, (k = (S = t == null ? void 0 : t.configOptions) == null ? void 0 : S.license) == null ? void 0 : k.file);
|
|
936
939
|
const c = [
|
|
937
940
|
`${i.localRoot}/packages`,
|
|
@@ -940,10 +943,10 @@ ${r}`);
|
|
|
940
943
|
];
|
|
941
944
|
i.storages.primary.type === "FS" && c.push(i.storages.primary.rootPath), i.storages.library.type === "FS" && (c.push(i.storages.library.rootPath), i.hacks.libraryDownloadable = !1), i.storages.work.type === "FS" && c.push(i.storages.work.rootPath), this.logger.debug(" creating pl state directories...");
|
|
942
945
|
for (const p of c)
|
|
943
|
-
|
|
946
|
+
f.existsSync(p) || (this.logger.debug(` '${p}'`), f.mkdirSync(p, { recursive: !0 }));
|
|
944
947
|
for (const p of i.core.auth.drivers)
|
|
945
|
-
p.driver === "htpasswd" && (
|
|
946
|
-
return n || (n = m.join(i.localRoot, "config.yaml"), this.logger.debug(` rendering configuration '${n}'...`),
|
|
948
|
+
p.driver === "htpasswd" && (f.existsSync(p.path) || (this.logger.debug(` installing default 'users.htpasswd' to ${p.path}...`), f.copyFileSync(Q("users.htpasswd"), p.path)));
|
|
949
|
+
return n || (n = m.join(i.localRoot, "config.yaml"), this.logger.debug(` rendering configuration '${n}'...`), f.writeFileSync(n, rt(i))), u.setInstanceInfo(e, {
|
|
947
950
|
type: "process",
|
|
948
951
|
upCommands: [
|
|
949
952
|
{
|
|
@@ -965,7 +968,7 @@ ${r}`);
|
|
|
965
968
|
work: i.storages.work,
|
|
966
969
|
library: i.storages.library
|
|
967
970
|
}
|
|
968
|
-
}),
|
|
971
|
+
}), u.getInstanceInfo(e);
|
|
969
972
|
}
|
|
970
973
|
createLocalS3(e, t) {
|
|
971
974
|
var c;
|
|
@@ -988,12 +991,12 @@ ${r}`);
|
|
|
988
991
|
], n.cleanupCommands = [
|
|
989
992
|
i.cleanup,
|
|
990
993
|
...n.cleanupCommands
|
|
991
|
-
],
|
|
994
|
+
], u.setInstanceInfo(e, n), n;
|
|
992
995
|
}
|
|
993
996
|
createMinio(e, t) {
|
|
994
997
|
this.logger.debug(" creating docker compose for minio service...");
|
|
995
|
-
const r =
|
|
996
|
-
|
|
998
|
+
const r = Q("compose-backend.yaml"), n = u.instanceDir(e, "compose-minio.yaml");
|
|
999
|
+
Ie(
|
|
997
1000
|
r,
|
|
998
1001
|
n,
|
|
999
1002
|
`pl-${e}-minio`,
|
|
@@ -1006,75 +1009,75 @@ ${r}`);
|
|
|
1006
1009
|
this.logger.debug(` minio version: ${s}`);
|
|
1007
1010
|
const i = (t == null ? void 0 : t.image) ?? `quay.io/minio/minio${s}`;
|
|
1008
1011
|
this.logger.debug(` minio image: ${i}`);
|
|
1009
|
-
const c = (t == null ? void 0 : t.storage) ??
|
|
1010
|
-
|
|
1011
|
-
const o = (t == null ? void 0 : t.minioPort) ?? 9e3,
|
|
1012
|
+
const c = (t == null ? void 0 : t.storage) ?? u.instanceDir(e, "minio");
|
|
1013
|
+
Se(c, { mode: "0775" });
|
|
1014
|
+
const o = (t == null ? void 0 : t.minioPort) ?? 9e3, d = (t == null ? void 0 : t.minioConsolePort) ?? 9001, g = {
|
|
1012
1015
|
MINIO_IMAGE: i,
|
|
1013
1016
|
MINIO_STORAGE: m.resolve(c),
|
|
1014
1017
|
MINIO_PORT: o.toString(),
|
|
1015
|
-
MINIO_CONSOLE_PORT:
|
|
1018
|
+
MINIO_CONSOLE_PORT: d.toString()
|
|
1016
1019
|
};
|
|
1017
1020
|
return {
|
|
1018
1021
|
start: {
|
|
1019
1022
|
cmd: "docker",
|
|
1020
1023
|
args: ["compose", `--file=${n}`, "up", "--detach", "--remove-orphans", "--pull=missing"],
|
|
1021
1024
|
envs: g,
|
|
1022
|
-
workdir:
|
|
1025
|
+
workdir: u.instanceDir(e),
|
|
1023
1026
|
runOpts: { stdio: "inherit" }
|
|
1024
1027
|
},
|
|
1025
1028
|
stop: {
|
|
1026
1029
|
cmd: "docker",
|
|
1027
1030
|
args: ["compose", `--file=${n}`, "down"],
|
|
1028
1031
|
envs: g,
|
|
1029
|
-
workdir:
|
|
1032
|
+
workdir: u.instanceDir(e),
|
|
1030
1033
|
runOpts: { stdio: "inherit" }
|
|
1031
1034
|
},
|
|
1032
1035
|
cleanup: {
|
|
1033
1036
|
cmd: "docker",
|
|
1034
1037
|
args: ["compose", `--file=${n}`, "down", "--volumes", "--remove-orphans"],
|
|
1035
1038
|
envs: g,
|
|
1036
|
-
workdir:
|
|
1039
|
+
workdir: u.instanceDir(e),
|
|
1037
1040
|
runOpts: { stdio: "inherit" }
|
|
1038
1041
|
}
|
|
1039
1042
|
};
|
|
1040
1043
|
}
|
|
1041
1044
|
buildPlatforma(e) {
|
|
1042
|
-
const t = m.resolve(e.repoRoot, "cmd", "platforma"), r = e.binPath ?? m.join(
|
|
1045
|
+
const t = m.resolve(e.repoRoot, "cmd", "platforma"), r = e.binPath ?? m.join(F.tmpdir(), "platforma-local-build");
|
|
1043
1046
|
this.logger.info("Building Platforma Backend binary from sources"), this.logger.info(` sources path: ${e.repoRoot}`), this.logger.info(` binary path: ${r}`);
|
|
1044
|
-
const n =
|
|
1047
|
+
const n = mr("go", ["build", "-o", r, "."], {
|
|
1045
1048
|
cwd: t,
|
|
1046
1049
|
stdio: "inherit"
|
|
1047
1050
|
});
|
|
1048
|
-
return
|
|
1051
|
+
return ue([n], "failed to build platforma binary from sources using 'go build' command"), r;
|
|
1049
1052
|
}
|
|
1050
1053
|
createDockerS3(e, t, r) {
|
|
1051
1054
|
this.logger.debug("creating platforma instance in 'docker s3' mode...");
|
|
1052
|
-
const n =
|
|
1055
|
+
const n = Q("compose-backend.yaml"), s = (r == null ? void 0 : r.image) ?? gr(r == null ? void 0 : r.version);
|
|
1053
1056
|
this.checkLicense(r == null ? void 0 : r.license, r == null ? void 0 : r.licenseFile);
|
|
1054
1057
|
const i = (...p) => m.join(t, ...p), c = (p) => {
|
|
1055
1058
|
const $ = i(p);
|
|
1056
|
-
return
|
|
1059
|
+
return Se($, { mode: "0775" }), $;
|
|
1057
1060
|
}, o = i("logs", "platforma.log");
|
|
1058
|
-
|
|
1059
|
-
const
|
|
1061
|
+
f.existsSync(o) || (f.mkdirSync(m.dirname(o), { recursive: !0 }), f.writeFileSync(o, ""));
|
|
1062
|
+
const d = (r == null ? void 0 : r.presignHost) ?? "localhost", g = X("s3e://testuser:testpassword@minio:9000/main-bucket");
|
|
1060
1063
|
if (g.type !== "S3")
|
|
1061
1064
|
throw new Error("primary storage must have 'S3' type in 'docker s3' configuration");
|
|
1062
|
-
g.presignEndpoint = `http://${
|
|
1063
|
-
const h =
|
|
1065
|
+
g.presignEndpoint = `http://${d}:9000`;
|
|
1066
|
+
const h = X("s3e://testuser:testpassword@minio:9000/library-bucket");
|
|
1064
1067
|
if (h.type !== "S3")
|
|
1065
1068
|
throw new Error(`${h.type} storage type is not supported for library storage`);
|
|
1066
|
-
h.presignEndpoint = `http://${
|
|
1067
|
-
const
|
|
1068
|
-
|
|
1069
|
+
h.presignEndpoint = `http://${d}:9000`;
|
|
1070
|
+
const b = c("db"), w = c("work"), y = i("users.htpasswd");
|
|
1071
|
+
f.existsSync(y) || f.copyFileSync(Q("users.htpasswd"), y);
|
|
1069
1072
|
const P = i("compose.yaml");
|
|
1070
|
-
|
|
1073
|
+
f.existsSync(P) && this.logger.info(`replacing docker compose file ${P}`);
|
|
1071
1074
|
const S = [];
|
|
1072
1075
|
for (const p of (r == null ? void 0 : r.customMounts) ?? [])
|
|
1073
1076
|
S.push({
|
|
1074
1077
|
hostPath: p.hostPath,
|
|
1075
1078
|
containerPath: p.containerPath ?? p.hostPath
|
|
1076
1079
|
});
|
|
1077
|
-
|
|
1080
|
+
Ie(n, P, `pl-${e}`, /* @__PURE__ */ new Map([
|
|
1078
1081
|
["minio", {}],
|
|
1079
1082
|
["backend", {
|
|
1080
1083
|
platform: r == null ? void 0 : r.platformOverride,
|
|
@@ -1091,10 +1094,10 @@ ${r}`);
|
|
|
1091
1094
|
PL_LOG_LEVEL: (r == null ? void 0 : r.logLevel) ?? "info",
|
|
1092
1095
|
PL_LOG_DIR: m.dirname(o),
|
|
1093
1096
|
PL_LOG_ROTATION_ENABLED: "true",
|
|
1094
|
-
PL_DATA_DB_ROOT:
|
|
1097
|
+
PL_DATA_DB_ROOT: b,
|
|
1095
1098
|
PL_DATA_PRIMARY_ROOT: c("primary"),
|
|
1096
1099
|
PL_DATA_LIBRARY_ROOT: c("library"),
|
|
1097
|
-
PL_DATA_WORKDIR_ROOT:
|
|
1100
|
+
PL_DATA_WORKDIR_ROOT: w,
|
|
1098
1101
|
// Mount packages storage as volume, because APFS is case-insensitive on Mac OS X and this breaks some pl software installation.
|
|
1099
1102
|
// PL_DATA_PACKAGE_ROOT: storageDir('packages'),
|
|
1100
1103
|
...this.configureDockerStorage("primary", g),
|
|
@@ -1105,7 +1108,7 @@ ${r}`);
|
|
|
1105
1108
|
p.driver === "htpasswd" && (k.PL_AUTH_HTPASSWD_PATH = m.resolve(p.path), p.path = "/etc/platforma/users.htpasswd");
|
|
1106
1109
|
k.PL_AUTH_DRIVERS = JSON.stringify(r.auth.drivers);
|
|
1107
1110
|
}
|
|
1108
|
-
return
|
|
1111
|
+
return u.setInstanceInfo(e, {
|
|
1109
1112
|
type: "docker",
|
|
1110
1113
|
upCommands: [{
|
|
1111
1114
|
cmd: "docker",
|
|
@@ -1130,51 +1133,51 @@ ${r}`);
|
|
|
1130
1133
|
apiAddr: r == null ? void 0 : r.grpcAddr,
|
|
1131
1134
|
logPath: o,
|
|
1132
1135
|
primary: g,
|
|
1133
|
-
work: { type: "FS", rootPath:
|
|
1136
|
+
work: { type: "FS", rootPath: w },
|
|
1134
1137
|
library: h,
|
|
1135
|
-
dbPath:
|
|
1138
|
+
dbPath: b
|
|
1136
1139
|
}
|
|
1137
|
-
}),
|
|
1140
|
+
}), u.getInstanceInfo(e);
|
|
1138
1141
|
}
|
|
1139
1142
|
createDocker(e, t, r) {
|
|
1140
1143
|
this.logger.debug("creating platforma instance in 'docker' mode...");
|
|
1141
|
-
const n =
|
|
1144
|
+
const n = Q("compose-backend.yaml"), s = (r == null ? void 0 : r.image) ?? gr(r == null ? void 0 : r.version);
|
|
1142
1145
|
this.checkLicense(r == null ? void 0 : r.license, r == null ? void 0 : r.licenseFile);
|
|
1143
1146
|
const i = (...$) => m.join(t, ...$), c = ($) => {
|
|
1144
|
-
const
|
|
1145
|
-
return
|
|
1147
|
+
const le = i($);
|
|
1148
|
+
return Se(le, { mode: "0775" }), le;
|
|
1146
1149
|
}, o = i("logs", "platforma.log");
|
|
1147
|
-
|
|
1148
|
-
const
|
|
1149
|
-
|
|
1150
|
+
f.existsSync(o) || (f.mkdirSync(m.dirname(o), { recursive: !0 }), f.writeFileSync(o, ""));
|
|
1151
|
+
const d = c("db"), g = c("primary"), h = c("library"), b = c("work"), w = i("users.htpasswd");
|
|
1152
|
+
f.existsSync(w) || f.copyFileSync(Q("users.htpasswd"), w);
|
|
1150
1153
|
const y = i("compose.yaml");
|
|
1151
|
-
|
|
1154
|
+
f.existsSync(y) && this.logger.info(`replacing docker compose file ${y}`);
|
|
1152
1155
|
const P = [];
|
|
1153
1156
|
for (const $ of (r == null ? void 0 : r.customMounts) ?? [])
|
|
1154
1157
|
P.push({
|
|
1155
1158
|
hostPath: $.hostPath,
|
|
1156
1159
|
containerPath: $.containerPath ?? $.hostPath
|
|
1157
1160
|
});
|
|
1158
|
-
this.logger.debug(`Rendering docker compose file '${y}' using '${n}' as base template`),
|
|
1161
|
+
this.logger.debug(`Rendering docker compose file '${y}' using '${n}' as base template`), Ie(n, y, `pl-${e}`, /* @__PURE__ */ new Map([
|
|
1159
1162
|
["backend", {
|
|
1160
1163
|
platform: r == null ? void 0 : r.platformOverride,
|
|
1161
1164
|
mounts: P
|
|
1162
1165
|
}]
|
|
1163
1166
|
]));
|
|
1164
|
-
const S =
|
|
1167
|
+
const S = X((r == null ? void 0 : r.primaryStorageURL) ?? `file:${g}`, "."), k = X((r == null ? void 0 : r.libraryStorageURL) ?? `file:${h}`, "."), p = {
|
|
1165
1168
|
MINIO_IMAGE: "quay.io/minio/minio",
|
|
1166
1169
|
MINIO_STORAGE: c("minio"),
|
|
1167
1170
|
PL_IMAGE: s,
|
|
1168
|
-
PL_AUTH_HTPASSWD_PATH:
|
|
1171
|
+
PL_AUTH_HTPASSWD_PATH: w,
|
|
1169
1172
|
PL_LICENSE: r == null ? void 0 : r.license,
|
|
1170
1173
|
PL_LICENSE_FILE: r == null ? void 0 : r.licenseFile,
|
|
1171
1174
|
PL_LOG_LEVEL: "info",
|
|
1172
1175
|
PL_LOG_DIR: m.dirname(o),
|
|
1173
1176
|
PL_LOG_ROTATION_ENABLED: "true",
|
|
1174
|
-
PL_DATA_DB_ROOT:
|
|
1177
|
+
PL_DATA_DB_ROOT: d,
|
|
1175
1178
|
PL_DATA_PRIMARY_ROOT: g,
|
|
1176
1179
|
PL_DATA_LIBRARY_ROOT: h,
|
|
1177
|
-
PL_DATA_WORKDIR_ROOT:
|
|
1180
|
+
PL_DATA_WORKDIR_ROOT: b,
|
|
1178
1181
|
PL_DATA_PACKAGE_ROOT: c("packages"),
|
|
1179
1182
|
...this.configureDockerStorage("primary", S),
|
|
1180
1183
|
...this.configureDockerStorage("library", k)
|
|
@@ -1184,7 +1187,7 @@ ${r}`);
|
|
|
1184
1187
|
$.driver === "htpasswd" && (p.PL_AUTH_HTPASSWD_PATH = m.resolve($.path), $.path = "/etc/platforma/users.htpasswd");
|
|
1185
1188
|
p.PL_AUTH_DRIVERS = JSON.stringify(r.auth.drivers);
|
|
1186
1189
|
}
|
|
1187
|
-
return
|
|
1190
|
+
return u.setInstanceInfo(e, {
|
|
1188
1191
|
type: "docker",
|
|
1189
1192
|
upCommands: [{
|
|
1190
1193
|
cmd: "docker",
|
|
@@ -1209,30 +1212,30 @@ ${r}`);
|
|
|
1209
1212
|
apiAddr: r == null ? void 0 : r.grpcAddr,
|
|
1210
1213
|
logPath: o,
|
|
1211
1214
|
primary: S,
|
|
1212
|
-
work: { type: "FS", rootPath:
|
|
1215
|
+
work: { type: "FS", rootPath: b },
|
|
1213
1216
|
library: k,
|
|
1214
|
-
dbPath:
|
|
1217
|
+
dbPath: d
|
|
1215
1218
|
}
|
|
1216
|
-
}),
|
|
1219
|
+
}), u.getInstanceInfo(e);
|
|
1217
1220
|
}
|
|
1218
1221
|
cleanupInstance(e) {
|
|
1219
1222
|
const t = [], r = /* @__PURE__ */ new Map();
|
|
1220
1223
|
let n = "";
|
|
1221
1224
|
if (e) {
|
|
1222
|
-
const s =
|
|
1225
|
+
const s = u.getInstanceInfo(e);
|
|
1223
1226
|
switch (r.set(e, s), s.type) {
|
|
1224
1227
|
case "docker": {
|
|
1225
|
-
t.push(`docker service 'pl-${e}', including all its volumes and data in '${
|
|
1228
|
+
t.push(`docker service 'pl-${e}', including all its volumes and data in '${u.instanceDir(e)}' will be destroyed`);
|
|
1226
1229
|
break;
|
|
1227
1230
|
}
|
|
1228
1231
|
case "process": {
|
|
1229
|
-
t.push(`directory '${
|
|
1232
|
+
t.push(`directory '${u.instanceDir(e)}' would be deleted`), s.downCommands && t.push("associated docker service, including all volumes and data will be destroyed");
|
|
1230
1233
|
break;
|
|
1231
1234
|
}
|
|
1232
1235
|
default:
|
|
1233
|
-
|
|
1236
|
+
G();
|
|
1234
1237
|
}
|
|
1235
|
-
e ===
|
|
1238
|
+
e === u.currentInstanceName && t.push(
|
|
1236
1239
|
"last command run cache ('pl-dev start' shorthand will stop working until next full start command call)"
|
|
1237
1240
|
), n = `
|
|
1238
1241
|
You are going to reset the state of platforma service '${e}':
|
|
@@ -1240,37 +1243,37 @@ You are going to reset the state of platforma service '${e}':
|
|
|
1240
1243
|
- `)}
|
|
1241
1244
|
`;
|
|
1242
1245
|
} else {
|
|
1243
|
-
for (const s of
|
|
1244
|
-
r.set(s,
|
|
1246
|
+
for (const s of u.instanceList)
|
|
1247
|
+
r.set(s, u.getInstanceInfo(s));
|
|
1245
1248
|
t.push(
|
|
1246
1249
|
"last command run cache ('pl-dev start' shorthand will stop working until next full start command call)",
|
|
1247
|
-
`all service configurations stored in: ${
|
|
1250
|
+
`all service configurations stored in: ${u.instanceDir()} (including all associated docker containers and volumes)`
|
|
1248
1251
|
), n = `
|
|
1249
1252
|
You are going to reset the state of all platforma services configured with pl-bootstrap package.
|
|
1250
1253
|
- ${t.join(`
|
|
1251
1254
|
- `)}
|
|
1252
1255
|
`;
|
|
1253
1256
|
}
|
|
1254
|
-
if (this.logger.warn(n), !
|
|
1257
|
+
if (this.logger.warn(n), !Cr("Are you sure?")) {
|
|
1255
1258
|
this.logger.info("Reset action was canceled");
|
|
1256
1259
|
return;
|
|
1257
1260
|
}
|
|
1258
1261
|
for (const [s, i] of r.entries()) {
|
|
1259
1262
|
if (i.cleanupCommands.length) {
|
|
1260
1263
|
this.logger.info(`Wiping instance ${s} services`);
|
|
1261
|
-
const c =
|
|
1262
|
-
|
|
1264
|
+
const c = Le(this.logger, i.cleanupCommands);
|
|
1265
|
+
ue(c.executed, `failed to wipe instance ${s} services`);
|
|
1263
1266
|
}
|
|
1264
|
-
this.logger.info(`Destroying instance '${s}' data directory`),
|
|
1267
|
+
this.logger.info(`Destroying instance '${s}' data directory`), f.rmSync(u.instanceDir(s), { recursive: !0, force: !0 });
|
|
1265
1268
|
}
|
|
1266
|
-
e || (this.logger.info(`Destroying state dir '${
|
|
1269
|
+
e || (this.logger.info(`Destroying state dir '${u.path()}'`), f.rmSync(u.path(), { recursive: !0, force: !0 })), this.logger.info(
|
|
1267
1270
|
`
|
|
1268
|
-
If you want to remove all downloaded platforma binaries, delete '${
|
|
1271
|
+
If you want to remove all downloaded platforma binaries, delete '${u.binaries()}' dir manually
|
|
1269
1272
|
`
|
|
1270
1273
|
);
|
|
1271
1274
|
}
|
|
1272
1275
|
mergeLicenseEnvs(e) {
|
|
1273
|
-
e.license === void 0 && ((process.env.MI_LICENSE ?? "") != "" ? e.license = process.env.MI_LICENSE : (process.env.PL_LICENSE ?? "") != "" && (e.license = process.env.PL_LICENSE)), e["license-file"] === void 0 && e.license === void 0 && ((process.env.MI_LICENSE_FILE ?? "") != "" ? e["license-file"] = process.env.MI_LICENSE_FILE : (process.env.PL_LICENSE_FILE ?? "") != "" ? e["license-file"] = process.env.PL_LICENSE_FILE :
|
|
1276
|
+
e.license === void 0 && ((process.env.MI_LICENSE ?? "") != "" ? e.license = process.env.MI_LICENSE : (process.env.PL_LICENSE ?? "") != "" && (e.license = process.env.PL_LICENSE)), e["license-file"] === void 0 && e.license === void 0 && ((process.env.MI_LICENSE_FILE ?? "") != "" ? e["license-file"] = process.env.MI_LICENSE_FILE : (process.env.PL_LICENSE_FILE ?? "") != "" ? e["license-file"] = process.env.PL_LICENSE_FILE : f.existsSync(m.resolve(F.homedir(), ".pl.license")) && (e["license-file"] = m.resolve(F.homedir(), ".pl.license")));
|
|
1274
1277
|
}
|
|
1275
1278
|
initAuthDriversList(e, t) {
|
|
1276
1279
|
const r = [];
|
|
@@ -1288,9 +1291,9 @@ If you want to remove all downloaded platforma binaries, delete '${d.binaries()}
|
|
|
1288
1291
|
}
|
|
1289
1292
|
/** Gets the last stored JWT secret key or generates it and stores in a file. */
|
|
1290
1293
|
getLastJwt() {
|
|
1291
|
-
const e =
|
|
1294
|
+
const e = u.path("auth.jwt"), t = "utf-8";
|
|
1292
1295
|
let r = "";
|
|
1293
|
-
return
|
|
1296
|
+
return f.existsSync(e) && (r = f.readFileSync(e, { encoding: t })), r == "" && (r = Mr(64), f.writeFileSync(e, r, { encoding: t })), r;
|
|
1294
1297
|
}
|
|
1295
1298
|
checkLicense(e, t) {
|
|
1296
1299
|
if (!(e !== void 0 && e != "") && !(t !== void 0 && t != ""))
|
|
@@ -1314,13 +1317,13 @@ You can obtain the license from "https://licensing.milaboratories.com".`), new E
|
|
|
1314
1317
|
case "FS":
|
|
1315
1318
|
return r[`PL_DATA_${e}_TYPE`] = "FS", r;
|
|
1316
1319
|
default:
|
|
1317
|
-
|
|
1320
|
+
G();
|
|
1318
1321
|
}
|
|
1319
1322
|
return {};
|
|
1320
1323
|
}
|
|
1321
1324
|
renderRunInfo(e, t = 10) {
|
|
1322
1325
|
var c, o;
|
|
1323
|
-
const r = [], n = (
|
|
1326
|
+
const r = [], n = (d) => d.padStart(t, " ");
|
|
1324
1327
|
switch (e.configPath && r.push(`${n("config")}: ${e.configPath}`), e.apiAddr ? r.push(`${n("API")}: ${e.apiAddr}`) : e.apiPort ? r.push(`${n("API")}: 127.0.0.1:${e.apiPort.toString()}`) : r.push(`${n("API")}: 127.0.0.1:6345`), e.logPath && r.push(`${n("log")}: ${e.logPath}`), (c = e.primary) == null ? void 0 : c.type) {
|
|
1325
1328
|
case void 0:
|
|
1326
1329
|
break;
|
|
@@ -1333,7 +1336,7 @@ You can obtain the license from "https://licensing.milaboratories.com".`), new E
|
|
|
1333
1336
|
);
|
|
1334
1337
|
break;
|
|
1335
1338
|
default:
|
|
1336
|
-
|
|
1339
|
+
G();
|
|
1337
1340
|
}
|
|
1338
1341
|
switch ((o = e.library) == null ? void 0 : o.type) {
|
|
1339
1342
|
case void 0:
|
|
@@ -1347,21 +1350,13 @@ You can obtain the license from "https://licensing.milaboratories.com".`), new E
|
|
|
1347
1350
|
);
|
|
1348
1351
|
break;
|
|
1349
1352
|
default:
|
|
1350
|
-
|
|
1353
|
+
G();
|
|
1351
1354
|
}
|
|
1352
1355
|
return e.work && r.push(`${n("workdirs")}: ${e.work.rootPath}`), e.dbPath && r.push(`${n("db")}: ${e.dbPath}`), r.join(`
|
|
1353
1356
|
`);
|
|
1354
1357
|
}
|
|
1355
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1356
|
-
readComposeFile(e) {
|
|
1357
|
-
const t = u.readFileSync(e);
|
|
1358
|
-
return ue.parse(t.toString());
|
|
1359
|
-
}
|
|
1360
|
-
writeComposeFile(e, t) {
|
|
1361
|
-
u.writeFileSync(e, ue.stringify(t));
|
|
1362
|
-
}
|
|
1363
1358
|
}
|
|
1364
|
-
function
|
|
1359
|
+
function ue(a, e) {
|
|
1365
1360
|
for (const t of a) {
|
|
1366
1361
|
if (t.error)
|
|
1367
1362
|
throw t.error;
|
|
@@ -1370,54 +1365,54 @@ function ge(a, e) {
|
|
|
1370
1365
|
throw new Error(`${r}, process exited with code '${t.status}'`);
|
|
1371
1366
|
}
|
|
1372
1367
|
}
|
|
1373
|
-
const
|
|
1368
|
+
const te = class te extends L {
|
|
1374
1369
|
async run() {
|
|
1375
|
-
const { flags: e } = await this.parse(
|
|
1370
|
+
const { flags: e } = await this.parse(te), t = A(e["log-level"]);
|
|
1376
1371
|
new O(t).cleanupInstance();
|
|
1377
1372
|
}
|
|
1378
1373
|
};
|
|
1379
|
-
l(
|
|
1380
|
-
...
|
|
1374
|
+
l(te, "description", "Clear service state (forget last run command, destroy docker services, volumes and so on)"), l(te, "examples", ["<%= config.bin %> <%= command.id %>"]), l(te, "flags", {
|
|
1375
|
+
...I
|
|
1381
1376
|
});
|
|
1382
|
-
let
|
|
1383
|
-
const
|
|
1377
|
+
let Te = te;
|
|
1378
|
+
const ae = class ae extends L {
|
|
1384
1379
|
async run() {
|
|
1385
|
-
const { flags: e } = await this.parse(
|
|
1380
|
+
const { flags: e } = await this.parse(ae), t = A(e["log-level"]);
|
|
1386
1381
|
new O(t).startLast();
|
|
1387
1382
|
}
|
|
1388
1383
|
};
|
|
1389
|
-
l(
|
|
1390
|
-
...
|
|
1384
|
+
l(ae, "description", "Start last run service configuraiton"), l(ae, "examples", ["<%= config.bin %> <%= command.id %>"]), l(ae, "flags", {
|
|
1385
|
+
...I
|
|
1391
1386
|
});
|
|
1392
|
-
let
|
|
1393
|
-
const
|
|
1387
|
+
let xe = ae;
|
|
1388
|
+
const ne = class ne extends L {
|
|
1394
1389
|
async run() {
|
|
1395
|
-
const { flags: e } = await this.parse(
|
|
1396
|
-
|
|
1390
|
+
const { flags: e } = await this.parse(ne), t = A(e["log-level"]), r = new O(t);
|
|
1391
|
+
u.currentInstance ? r.stopInstance(u.currentInstance) : t.warn("up/start command was not called for any instance, nothing to stop");
|
|
1397
1392
|
}
|
|
1398
1393
|
};
|
|
1399
|
-
l(
|
|
1400
|
-
...
|
|
1394
|
+
l(ne, "description", "Stop platforma service"), l(ne, "examples", ["<%= config.bin %> <%= command.id %>"]), l(ne, "flags", {
|
|
1395
|
+
...I
|
|
1401
1396
|
});
|
|
1402
|
-
let
|
|
1397
|
+
let De = ne;
|
|
1403
1398
|
var E;
|
|
1404
|
-
let
|
|
1399
|
+
let lt = (E = class extends L {
|
|
1405
1400
|
async run() {
|
|
1406
|
-
const { flags: e } = await this.parse(E), t =
|
|
1401
|
+
const { flags: e } = await this.parse(E), t = A(e["log-level"]), r = new O(t);
|
|
1407
1402
|
r.mergeLicenseEnvs(e);
|
|
1408
1403
|
const n = "docker", s = e["auth-enabled"], i = s ? {
|
|
1409
1404
|
enabled: s,
|
|
1410
1405
|
drivers: r.initAuthDriversList(e, ".")
|
|
1411
|
-
} : void 0, c = e.storage ? m.join(".", e.storage) :
|
|
1406
|
+
} : void 0, c = e.storage ? m.join(".", e.storage) : u.instanceDir(n), o = [];
|
|
1412
1407
|
for (const h of e.mount ?? [])
|
|
1413
1408
|
o.push({ hostPath: h });
|
|
1414
|
-
const
|
|
1409
|
+
const d = e.arch ? `linux/${e.arch}` : void 0, g = r.createDocker(n, c, {
|
|
1415
1410
|
primaryStorageURL: e["storage-primary"],
|
|
1416
1411
|
workStoragePath: e["storage-work"],
|
|
1417
1412
|
libraryStorageURL: e["storage-library"],
|
|
1418
1413
|
image: e.image,
|
|
1419
1414
|
version: e.version,
|
|
1420
|
-
platformOverride:
|
|
1415
|
+
platformOverride: d,
|
|
1421
1416
|
customMounts: o,
|
|
1422
1417
|
license: e.license,
|
|
1423
1418
|
licenseFile: e["license-file"],
|
|
@@ -1432,33 +1427,33 @@ let ot = (E = class extends L {
|
|
|
1432
1427
|
r.switchInstance(g);
|
|
1433
1428
|
}
|
|
1434
1429
|
}, l(E, "description", "Run platforma backend service with 'FS' primary storage type"), l(E, "examples", ["<%= config.bin %> <%= command.id %>"]), l(E, "flags", {
|
|
1435
|
-
...
|
|
1436
|
-
...
|
|
1430
|
+
...I,
|
|
1431
|
+
...j,
|
|
1437
1432
|
...me,
|
|
1438
|
-
...
|
|
1433
|
+
...C,
|
|
1439
1434
|
...he,
|
|
1440
|
-
...
|
|
1441
|
-
...
|
|
1435
|
+
...U,
|
|
1436
|
+
...M,
|
|
1442
1437
|
...ye,
|
|
1443
|
-
...
|
|
1444
|
-
...oe,
|
|
1438
|
+
...B,
|
|
1445
1439
|
...ce,
|
|
1446
|
-
...
|
|
1440
|
+
...ie,
|
|
1441
|
+
...oe
|
|
1447
1442
|
}), E);
|
|
1448
|
-
var
|
|
1449
|
-
let
|
|
1443
|
+
var T;
|
|
1444
|
+
let dt = (T = class extends L {
|
|
1450
1445
|
async run() {
|
|
1451
|
-
const { flags: e } = await this.parse(
|
|
1446
|
+
const { flags: e } = await this.parse(T), t = A(e["log-level"]), r = new O(t);
|
|
1452
1447
|
r.mergeLicenseEnvs(e);
|
|
1453
|
-
const n = "local", s = e["pl-workdir"] ?? ".", i = e.storage ? m.join(s, e.storage) :
|
|
1448
|
+
const n = "local", s = e["pl-workdir"] ?? ".", i = e.storage ? m.join(s, e.storage) : u.instanceDir(n), c = e["pl-log-file"] ? m.join(s, e["pl-log-file"]) : void 0, o = r.initAuthDriversList(e, s), d = e["auth-enabled"] ?? o !== void 0;
|
|
1454
1449
|
let g = e["pl-binary"];
|
|
1455
1450
|
e["pl-sources"] && (g = r.buildPlatforma({ repoRoot: e["pl-sources"] }));
|
|
1456
1451
|
let h = "127.0.0.1:6345";
|
|
1457
1452
|
e["grpc-listen"] ? h = e["grpc-listen"] : e["grpc-port"] && (h = `127.0.0.1:${e["grpc-port"]}`);
|
|
1458
|
-
let
|
|
1459
|
-
e["monitoring-listen"] ?
|
|
1460
|
-
let
|
|
1461
|
-
e["debug-listen"] ?
|
|
1453
|
+
let b = "127.0.0.1:9090";
|
|
1454
|
+
e["monitoring-listen"] ? b = e["monitoring-listen"] : e["monitoring-port"] && (b = `127.0.0.1:${e["monitoring-port"]}`);
|
|
1455
|
+
let w = "127.0.0.1:9091";
|
|
1456
|
+
e["debug-listen"] ? w = e["debug-listen"] : e["debug-port"] && (w = `127.0.0.1:${e["debug-port"]}`);
|
|
1462
1457
|
const y = {
|
|
1463
1458
|
binaryPath: g,
|
|
1464
1459
|
version: e.version,
|
|
@@ -1468,18 +1463,18 @@ let lt = (R = class extends L {
|
|
|
1468
1463
|
libraryURL: e["storage-library"],
|
|
1469
1464
|
configOptions: {
|
|
1470
1465
|
grpc: { listen: h },
|
|
1471
|
-
monitoring: { listen:
|
|
1472
|
-
debug: { listen:
|
|
1466
|
+
monitoring: { listen: b },
|
|
1467
|
+
debug: { listen: w },
|
|
1473
1468
|
license: { value: e.license, file: e["license-file"] },
|
|
1474
1469
|
log: { path: c },
|
|
1475
1470
|
localRoot: i,
|
|
1476
|
-
core: { auth: { enabled:
|
|
1471
|
+
core: { auth: { enabled: d, drivers: o } },
|
|
1477
1472
|
storages: {
|
|
1478
1473
|
work: { type: "FS", rootPath: e["storage-work"] }
|
|
1479
1474
|
}
|
|
1480
1475
|
}
|
|
1481
1476
|
}, P = r.createLocal(n, y);
|
|
1482
|
-
y.binaryPath ? r.switchInstance(P) :
|
|
1477
|
+
y.binaryPath ? r.switchInstance(P) : ke(t, { version: e.version }).then(() => {
|
|
1483
1478
|
const S = r.switchInstance(P);
|
|
1484
1479
|
setTimeout(() => {
|
|
1485
1480
|
for (const k of S)
|
|
@@ -1489,96 +1484,97 @@ let lt = (R = class extends L {
|
|
|
1489
1484
|
t.error(S.message);
|
|
1490
1485
|
});
|
|
1491
1486
|
}
|
|
1492
|
-
}, l(
|
|
1493
|
-
...
|
|
1494
|
-
...
|
|
1495
|
-
...
|
|
1496
|
-
...
|
|
1497
|
-
...
|
|
1498
|
-
...
|
|
1499
|
-
...
|
|
1500
|
-
...
|
|
1501
|
-
...oe,
|
|
1487
|
+
}, l(T, "description", "Run Platforma Backend service as local process on current host (no docker container)"), l(T, "examples", ["<%= config.bin %> <%= command.id %>"]), l(T, "flags", {
|
|
1488
|
+
...I,
|
|
1489
|
+
...C,
|
|
1490
|
+
...j,
|
|
1491
|
+
...we,
|
|
1492
|
+
...ve,
|
|
1493
|
+
...Pe,
|
|
1494
|
+
...M,
|
|
1495
|
+
...B,
|
|
1502
1496
|
...ce,
|
|
1503
|
-
...
|
|
1504
|
-
...
|
|
1505
|
-
...
|
|
1506
|
-
...
|
|
1507
|
-
|
|
1508
|
-
|
|
1497
|
+
...ie,
|
|
1498
|
+
...oe,
|
|
1499
|
+
...pe,
|
|
1500
|
+
...be,
|
|
1501
|
+
...U
|
|
1502
|
+
}), T);
|
|
1503
|
+
const H = class H extends L {
|
|
1509
1504
|
async run() {
|
|
1510
|
-
const { flags: e, args: t } = await this.parse(
|
|
1505
|
+
const { flags: e, args: t } = await this.parse(H), r = A(e["log-level"]), n = new O(r), s = t.name;
|
|
1511
1506
|
e.all && (n.cleanupInstance(), process.exit(0)), s || (r.error("Please, specify name of instance to be removed or set '--all' flag instead"), process.exit(1)), n.cleanupInstance(s);
|
|
1512
1507
|
}
|
|
1513
1508
|
};
|
|
1514
|
-
l(
|
|
1515
|
-
...
|
|
1516
|
-
all:
|
|
1509
|
+
l(H, "description", "List available instances"), l(H, "examples", ["<%= config.bin %> <%= command.id %>"]), l(H, "flags", {
|
|
1510
|
+
...I,
|
|
1511
|
+
all: v.boolean({
|
|
1517
1512
|
description: "remove all known instances",
|
|
1518
1513
|
required: !1
|
|
1519
1514
|
})
|
|
1520
|
-
}), l(
|
|
1521
|
-
name:
|
|
1515
|
+
}), l(H, "args", {
|
|
1516
|
+
name: K.string({ required: !1 })
|
|
1522
1517
|
});
|
|
1523
|
-
let
|
|
1524
|
-
const
|
|
1518
|
+
let Fe = H;
|
|
1519
|
+
const W = class W extends L {
|
|
1525
1520
|
async run() {
|
|
1526
|
-
const { flags: e, args: t } = await this.parse(
|
|
1527
|
-
s || (r.info("no pl service instance selected. No service was stopped"), process.exit(0)), n.stopInstance(
|
|
1521
|
+
const { flags: e, args: t } = await this.parse(W), r = A(e["log-level"]), n = new O(r), s = t.name ?? u.currentInstanceName;
|
|
1522
|
+
s || (r.info("no pl service instance selected. No service was stopped"), process.exit(0)), n.stopInstance(u.getInstanceInfo(s));
|
|
1528
1523
|
}
|
|
1529
1524
|
};
|
|
1530
|
-
l(
|
|
1531
|
-
...
|
|
1532
|
-
}), l(
|
|
1533
|
-
name:
|
|
1525
|
+
l(W, "description", "List available instances"), l(W, "examples", ["<%= config.bin %> <%= command.id %>"]), l(W, "flags", {
|
|
1526
|
+
...I
|
|
1527
|
+
}), l(W, "args", {
|
|
1528
|
+
name: K.string({ required: !1 })
|
|
1534
1529
|
});
|
|
1535
|
-
let
|
|
1536
|
-
const
|
|
1530
|
+
let Ne = W;
|
|
1531
|
+
const se = class se extends L {
|
|
1537
1532
|
async run() {
|
|
1538
|
-
await this.parse(
|
|
1539
|
-
const e =
|
|
1533
|
+
await this.parse(se);
|
|
1534
|
+
const e = u.instanceList, t = u.currentInstanceName;
|
|
1540
1535
|
for (const r of e) {
|
|
1541
|
-
const n = [], s =
|
|
1542
|
-
|
|
1536
|
+
const n = [], s = u.getInstanceInfo(r);
|
|
1537
|
+
u.isInstanceActive(s) && n.push("status:up"), n.push(`type:${s.type}`), console.log(r === t ? ` * ${r} (${n.join(", ")})` : ` ${r} (${n.join(", ")})`);
|
|
1543
1538
|
}
|
|
1544
1539
|
}
|
|
1545
1540
|
};
|
|
1546
|
-
l(
|
|
1547
|
-
let
|
|
1548
|
-
const
|
|
1541
|
+
l(se, "description", "List available instances"), l(se, "examples", ["<%= config.bin %> <%= command.id %>"]), l(se, "flags", {});
|
|
1542
|
+
let _e = se;
|
|
1543
|
+
const q = class q extends L {
|
|
1549
1544
|
async run() {
|
|
1550
|
-
const { flags: e, args: t } = await this.parse(
|
|
1545
|
+
const { flags: e, args: t } = await this.parse(q), r = A(e["log-level"]), n = new O(r), s = t.name ?? u.currentInstanceName;
|
|
1551
1546
|
s || (r.error("no pl service instance is selected. Select instance with 'select' command or provide name to 'up'"), process.exit(1));
|
|
1552
|
-
const i = n.switchInstance(
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1547
|
+
const i = n.switchInstance(u.getInstanceInfo(s)), c = [];
|
|
1548
|
+
for (const o of i)
|
|
1549
|
+
c.push(new Promise((d, g) => {
|
|
1550
|
+
o.on("close", d), o.on("error", g);
|
|
1551
|
+
}));
|
|
1552
|
+
await Promise.all(c);
|
|
1557
1553
|
}
|
|
1558
1554
|
};
|
|
1559
|
-
l(
|
|
1560
|
-
...
|
|
1561
|
-
}), l(
|
|
1562
|
-
name:
|
|
1555
|
+
l(q, "description", "List available instances"), l(q, "examples", ["<%= config.bin %> <%= command.id %>"]), l(q, "flags", {
|
|
1556
|
+
...I
|
|
1557
|
+
}), l(q, "args", {
|
|
1558
|
+
name: K.string({ required: !1 })
|
|
1563
1559
|
});
|
|
1564
|
-
let
|
|
1565
|
-
var
|
|
1566
|
-
let
|
|
1560
|
+
let Ce = q;
|
|
1561
|
+
var x;
|
|
1562
|
+
let gt = (x = class extends L {
|
|
1567
1563
|
async run() {
|
|
1568
|
-
const { flags: e } = await this.parse(
|
|
1564
|
+
const { flags: e } = await this.parse(x), t = A(e["log-level"]), r = new O(t);
|
|
1569
1565
|
r.mergeLicenseEnvs(e);
|
|
1570
1566
|
const n = "docker-s3", s = e["auth-enabled"], i = s ? {
|
|
1571
1567
|
enabled: s,
|
|
1572
1568
|
drivers: r.initAuthDriversList(e, ".")
|
|
1573
|
-
} : void 0, c = e.storage ? m.join(".", e.storage) :
|
|
1574
|
-
for (const
|
|
1575
|
-
o.push({ hostPath:
|
|
1576
|
-
const
|
|
1569
|
+
} : void 0, c = e.storage ? m.join(".", e.storage) : u.instanceDir(n), o = [];
|
|
1570
|
+
for (const b of e.mount ?? [])
|
|
1571
|
+
o.push({ hostPath: b });
|
|
1572
|
+
const d = e.arch ? `linux/${e.arch}` : void 0, g = e["minio-presign-host"] ? "minio" : "localhost", h = r.createDockerS3(n, c, {
|
|
1577
1573
|
image: e.image,
|
|
1578
1574
|
version: e.version,
|
|
1579
1575
|
license: e.license,
|
|
1580
1576
|
licenseFile: e["license-file"],
|
|
1581
|
-
platformOverride:
|
|
1577
|
+
platformOverride: d,
|
|
1582
1578
|
customMounts: o,
|
|
1583
1579
|
auth: i,
|
|
1584
1580
|
grpcAddr: e["grpc-listen"],
|
|
@@ -1591,32 +1587,32 @@ let dt = (T = class extends L {
|
|
|
1591
1587
|
});
|
|
1592
1588
|
r.switchInstance(h);
|
|
1593
1589
|
}
|
|
1594
|
-
}, l(
|
|
1595
|
-
...
|
|
1596
|
-
...
|
|
1590
|
+
}, l(x, "description", "Run platforma backend service with 'S3' primary storage type"), l(x, "examples", ["<%= config.bin %> <%= command.id %>"]), l(x, "flags", {
|
|
1591
|
+
...I,
|
|
1592
|
+
...j,
|
|
1597
1593
|
...me,
|
|
1598
|
-
...
|
|
1594
|
+
...C,
|
|
1599
1595
|
...he,
|
|
1600
|
-
...
|
|
1601
|
-
...
|
|
1596
|
+
...U,
|
|
1597
|
+
...M,
|
|
1602
1598
|
...ye,
|
|
1603
|
-
...
|
|
1604
|
-
...
|
|
1605
|
-
}),
|
|
1606
|
-
var
|
|
1607
|
-
let
|
|
1599
|
+
...B,
|
|
1600
|
+
...yr
|
|
1601
|
+
}), x);
|
|
1602
|
+
var D;
|
|
1603
|
+
let ut = (D = class extends L {
|
|
1608
1604
|
async run() {
|
|
1609
|
-
const { flags: e } = await this.parse(
|
|
1605
|
+
const { flags: e } = await this.parse(D), t = A(e["log-level"]), r = new O(t);
|
|
1610
1606
|
r.mergeLicenseEnvs(e);
|
|
1611
|
-
const n = "local-s3", s = e["pl-workdir"] ?? ".", i = e.storage ? m.join(s, e.storage) :
|
|
1607
|
+
const n = "local-s3", s = e["pl-workdir"] ?? ".", i = e.storage ? m.join(s, e.storage) : u.instanceDir(n), c = e["pl-log-file"] ? m.join(s, e["pl-log-file"]) : void 0, o = r.initAuthDriversList(e, s), d = e["auth-enabled"] ?? o !== void 0;
|
|
1612
1608
|
let g = e["pl-binary"];
|
|
1613
1609
|
e["pl-sources"] && (g = r.buildPlatforma({ repoRoot: e["pl-sources"] }));
|
|
1614
1610
|
let h = "127.0.0.1:6345";
|
|
1615
1611
|
e["grpc-listen"] ? h = e["grpc-listen"] : e["grpc-port"] && (h = `127.0.0.1:${e["grpc-port"]}`);
|
|
1616
|
-
let
|
|
1617
|
-
e["monitoring-listen"] ?
|
|
1618
|
-
let
|
|
1619
|
-
e["debug-listen"] ?
|
|
1612
|
+
let b = "127.0.0.1:9090";
|
|
1613
|
+
e["monitoring-listen"] ? b = e["monitoring-listen"] : e["monitoring-port"] && (b = `127.0.0.1:${e["monitoring-port"]}`);
|
|
1614
|
+
let w = "127.0.0.1:9091";
|
|
1615
|
+
e["debug-listen"] ? w = e["debug-listen"] : e["debug-port"] && (w = `127.0.0.1:${e["debug-port"]}`);
|
|
1620
1616
|
const y = {
|
|
1621
1617
|
binaryPath: g,
|
|
1622
1618
|
version: e.version,
|
|
@@ -1628,20 +1624,20 @@ let gt = (F = class extends L {
|
|
|
1628
1624
|
minioConsolePort: e["s3-console-port"],
|
|
1629
1625
|
configOptions: {
|
|
1630
1626
|
grpc: { listen: h },
|
|
1631
|
-
monitoring: { listen:
|
|
1632
|
-
debug: { listen:
|
|
1627
|
+
monitoring: { listen: b },
|
|
1628
|
+
debug: { listen: w },
|
|
1633
1629
|
license: { value: e.license, file: e["license-file"] },
|
|
1634
1630
|
log: { path: c },
|
|
1635
1631
|
localRoot: i,
|
|
1636
1632
|
core: {
|
|
1637
|
-
auth: { enabled:
|
|
1633
|
+
auth: { enabled: d, drivers: o }
|
|
1638
1634
|
},
|
|
1639
1635
|
storages: {
|
|
1640
1636
|
work: { type: "FS", rootPath: e["storage-work"] }
|
|
1641
1637
|
}
|
|
1642
1638
|
}
|
|
1643
1639
|
}, P = r.createLocalS3(n, y);
|
|
1644
|
-
y.binaryPath ? r.switchInstance(P) :
|
|
1640
|
+
y.binaryPath ? r.switchInstance(P) : ke(t, { version: e.version }).then(() => {
|
|
1645
1641
|
const S = r.switchInstance(P);
|
|
1646
1642
|
setTimeout(() => {
|
|
1647
1643
|
for (const k of S)
|
|
@@ -1651,33 +1647,33 @@ let gt = (F = class extends L {
|
|
|
1651
1647
|
t.error(S.message);
|
|
1652
1648
|
});
|
|
1653
1649
|
}
|
|
1654
|
-
}, l(
|
|
1655
|
-
...
|
|
1656
|
-
...
|
|
1657
|
-
...
|
|
1658
|
-
...
|
|
1659
|
-
...
|
|
1660
|
-
...
|
|
1661
|
-
...
|
|
1662
|
-
...
|
|
1663
|
-
...
|
|
1664
|
-
...oe,
|
|
1650
|
+
}, l(D, "description", "Run Platforma Backend service as local process on current host (no docker container)"), l(D, "examples", ["<%= config.bin %> <%= command.id %>"]), l(D, "flags", {
|
|
1651
|
+
...I,
|
|
1652
|
+
...C,
|
|
1653
|
+
...j,
|
|
1654
|
+
...hr,
|
|
1655
|
+
...we,
|
|
1656
|
+
...ve,
|
|
1657
|
+
...Pe,
|
|
1658
|
+
...M,
|
|
1659
|
+
...B,
|
|
1665
1660
|
...ce,
|
|
1666
|
-
...
|
|
1667
|
-
...
|
|
1668
|
-
...
|
|
1669
|
-
...
|
|
1670
|
-
|
|
1671
|
-
|
|
1661
|
+
...ie,
|
|
1662
|
+
...oe,
|
|
1663
|
+
...pe,
|
|
1664
|
+
...be,
|
|
1665
|
+
...U
|
|
1666
|
+
}), D);
|
|
1667
|
+
const z = class z extends L {
|
|
1672
1668
|
async run() {
|
|
1673
|
-
const { flags: e, args: t } = await this.parse(
|
|
1669
|
+
const { flags: e, args: t } = await this.parse(z), r = A(e["log-level"]), n = new O(r);
|
|
1674
1670
|
n.mergeLicenseEnvs(e);
|
|
1675
1671
|
const s = t.name, i = e["auth-enabled"], c = i ? {
|
|
1676
1672
|
enabled: i,
|
|
1677
1673
|
drivers: n.initAuthDriversList(e, ".")
|
|
1678
|
-
} : void 0, o = e.storage ? m.join(".", e.storage) :
|
|
1674
|
+
} : void 0, o = e.storage ? m.join(".", e.storage) : u.instanceDir(s), d = [];
|
|
1679
1675
|
for (const h of e.mount ?? [])
|
|
1680
|
-
|
|
1676
|
+
d.push({ hostPath: h });
|
|
1681
1677
|
const g = e.arch ? `linux/${e.arch}` : void 0;
|
|
1682
1678
|
n.createDocker(s, o, {
|
|
1683
1679
|
primaryStorageURL: e["storage-primary"],
|
|
@@ -1686,7 +1682,7 @@ const G = class G extends L {
|
|
|
1686
1682
|
image: e.image,
|
|
1687
1683
|
version: e.version,
|
|
1688
1684
|
platformOverride: g,
|
|
1689
|
-
customMounts:
|
|
1685
|
+
customMounts: d,
|
|
1690
1686
|
license: e.license,
|
|
1691
1687
|
licenseFile: e["license-file"],
|
|
1692
1688
|
auth: c,
|
|
@@ -1699,34 +1695,35 @@ const G = class G extends L {
|
|
|
1699
1695
|
}), r.info(`Instance '${s}' was created. To start it run 'up' command`);
|
|
1700
1696
|
}
|
|
1701
1697
|
};
|
|
1702
|
-
l(
|
|
1703
|
-
...
|
|
1704
|
-
...
|
|
1698
|
+
l(z, "description", "Run Platforma Backend service as docker container on current host"), l(z, "examples", ["<%= config.bin %> <%= command.id %>"]), l(z, "flags", {
|
|
1699
|
+
...I,
|
|
1700
|
+
...j,
|
|
1705
1701
|
...me,
|
|
1706
|
-
...
|
|
1702
|
+
...C,
|
|
1707
1703
|
...he,
|
|
1708
|
-
...
|
|
1709
|
-
...
|
|
1704
|
+
...U,
|
|
1705
|
+
...M,
|
|
1710
1706
|
...ye,
|
|
1711
|
-
...
|
|
1712
|
-
...oe,
|
|
1707
|
+
...B,
|
|
1713
1708
|
...ce,
|
|
1714
|
-
...
|
|
1715
|
-
|
|
1716
|
-
|
|
1709
|
+
...ie,
|
|
1710
|
+
...oe
|
|
1711
|
+
}), l(z, "args", {
|
|
1712
|
+
name: K.string({ required: !0 })
|
|
1717
1713
|
});
|
|
1718
|
-
let
|
|
1719
|
-
|
|
1714
|
+
let Me = z;
|
|
1715
|
+
var R;
|
|
1716
|
+
let ft = (R = class extends L {
|
|
1720
1717
|
async run() {
|
|
1721
|
-
const { flags: e, args: t } = await this.parse(
|
|
1718
|
+
const { flags: e, args: t } = await this.parse(R), r = A(e["log-level"]), n = new O(r);
|
|
1722
1719
|
n.mergeLicenseEnvs(e);
|
|
1723
|
-
const s = t.name, i = e["pl-workdir"] ?? ".", c = e.storage ? m.join(i, e.storage) :
|
|
1720
|
+
const s = t.name, i = e["pl-workdir"] ?? ".", c = e.storage ? m.join(i, e.storage) : u.instanceDir(s), o = e["pl-log-file"] ? m.join(i, e["pl-log-file"]) : void 0, d = n.initAuthDriversList(e, i), g = e["auth-enabled"] ?? d !== void 0;
|
|
1724
1721
|
let h = e["pl-binary"];
|
|
1725
1722
|
e["pl-sources"] && (h = n.buildPlatforma({ repoRoot: e["pl-sources"] }));
|
|
1726
|
-
let
|
|
1727
|
-
e["grpc-listen"] ?
|
|
1728
|
-
let
|
|
1729
|
-
e["monitoring-listen"] ?
|
|
1723
|
+
let b = "127.0.0.1:6345";
|
|
1724
|
+
e["grpc-listen"] ? b = e["grpc-listen"] : e["grpc-port"] && (b = `127.0.0.1:${e["grpc-port"]}`);
|
|
1725
|
+
let w = "127.0.0.1:9090";
|
|
1726
|
+
e["monitoring-listen"] ? w = e["monitoring-listen"] : e["monitoring-port"] && (w = `127.0.0.1:${e["monitoring-port"]}`);
|
|
1730
1727
|
let y = "127.0.0.1:9091";
|
|
1731
1728
|
e["debug-listen"] ? y = e["debug-listen"] : e["debug-port"] && (y = `127.0.0.1:${e["debug-port"]}`);
|
|
1732
1729
|
const P = {
|
|
@@ -1737,72 +1734,54 @@ const U = class U extends L {
|
|
|
1737
1734
|
primaryURL: e["storage-primary"],
|
|
1738
1735
|
libraryURL: e["storage-library"],
|
|
1739
1736
|
configOptions: {
|
|
1740
|
-
grpc: { listen:
|
|
1741
|
-
monitoring: { listen:
|
|
1737
|
+
grpc: { listen: b },
|
|
1738
|
+
monitoring: { listen: w },
|
|
1742
1739
|
debug: { listen: y },
|
|
1743
1740
|
license: { value: e.license, file: e["license-file"] },
|
|
1744
1741
|
log: { path: o },
|
|
1745
1742
|
localRoot: c,
|
|
1746
|
-
core: { auth: { enabled: g, drivers:
|
|
1743
|
+
core: { auth: { enabled: g, drivers: d } },
|
|
1747
1744
|
storages: {
|
|
1748
1745
|
work: { type: "FS", rootPath: e["storage-work"] }
|
|
1749
1746
|
}
|
|
1750
1747
|
}
|
|
1751
1748
|
};
|
|
1752
|
-
|
|
1753
|
-
case "s3": {
|
|
1754
|
-
r.info("Creating instance configuration, data directory and other stuff..."), n.createLocalS3(s, {
|
|
1755
|
-
...P,
|
|
1756
|
-
minioPort: e["s3-port"],
|
|
1757
|
-
minioConsolePort: e["s3-console-port"]
|
|
1758
|
-
});
|
|
1759
|
-
break;
|
|
1760
|
-
}
|
|
1761
|
-
case void 0: {
|
|
1762
|
-
e["s3-port"] && r.warn("flag 's3-port' is only for 's3' mode"), e["s3-console-port"] && r.warn("flag 's3-console-port' is only for 's3' mode"), n.createLocal(s, P);
|
|
1763
|
-
break;
|
|
1764
|
-
}
|
|
1765
|
-
}
|
|
1766
|
-
if (P.binaryPath) {
|
|
1749
|
+
if (n.createLocal(s, P), P.binaryPath) {
|
|
1767
1750
|
r.info(`Instance '${s}' was created. To start it run 'up' command`);
|
|
1768
1751
|
return;
|
|
1769
1752
|
}
|
|
1770
|
-
|
|
1771
|
-
r.error(
|
|
1753
|
+
ke(r, { version: e.version }).then(() => r.info(`Instance '${s}' was created. To start it run 'pl up' command`)).catch(function(S) {
|
|
1754
|
+
r.error(S.message);
|
|
1772
1755
|
});
|
|
1773
1756
|
}
|
|
1774
|
-
}
|
|
1775
|
-
|
|
1776
|
-
...
|
|
1777
|
-
...
|
|
1778
|
-
...
|
|
1779
|
-
...
|
|
1780
|
-
...
|
|
1781
|
-
...
|
|
1782
|
-
...
|
|
1783
|
-
...q,
|
|
1784
|
-
...Y,
|
|
1785
|
-
...oe,
|
|
1757
|
+
}, l(R, "description", "Run Platforma Backend service as local process on current host (no docker container)"), l(R, "examples", ["<%= config.bin %> <%= command.id %>"]), l(R, "flags", {
|
|
1758
|
+
...I,
|
|
1759
|
+
...C,
|
|
1760
|
+
...j,
|
|
1761
|
+
...we,
|
|
1762
|
+
...ve,
|
|
1763
|
+
...Pe,
|
|
1764
|
+
...M,
|
|
1765
|
+
...B,
|
|
1786
1766
|
...ce,
|
|
1787
|
-
...
|
|
1788
|
-
...
|
|
1789
|
-
...
|
|
1790
|
-
...
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
});
|
|
1795
|
-
|
|
1796
|
-
const J = class J extends L {
|
|
1767
|
+
...ie,
|
|
1768
|
+
...oe,
|
|
1769
|
+
...pe,
|
|
1770
|
+
...be,
|
|
1771
|
+
...U
|
|
1772
|
+
}), l(R, "args", {
|
|
1773
|
+
name: K.string({ required: !0 })
|
|
1774
|
+
}), R);
|
|
1775
|
+
const Y = class Y extends L {
|
|
1797
1776
|
async run() {
|
|
1798
|
-
const { flags: e, args: t } = await this.parse(
|
|
1777
|
+
const { flags: e, args: t } = await this.parse(Y), r = A(e["log-level"]), n = new O(r);
|
|
1799
1778
|
n.mergeLicenseEnvs(e);
|
|
1800
1779
|
const s = t.name, i = e["auth-enabled"], c = i ? {
|
|
1801
1780
|
enabled: i,
|
|
1802
1781
|
drivers: n.initAuthDriversList(e, ".")
|
|
1803
|
-
} : void 0, o = e.storage ? m.join(".", e.storage) :
|
|
1804
|
-
for (const
|
|
1805
|
-
|
|
1782
|
+
} : void 0, o = e.storage ? m.join(".", e.storage) : u.instanceDir(s), d = [];
|
|
1783
|
+
for (const b of e.mount ?? [])
|
|
1784
|
+
d.push({ hostPath: b });
|
|
1806
1785
|
const g = e.arch ? `linux/${e.arch}` : void 0, h = e["minio-presign-host"] ? "minio" : "localhost";
|
|
1807
1786
|
n.createDockerS3(s, o, {
|
|
1808
1787
|
image: e.image,
|
|
@@ -1810,7 +1789,7 @@ const J = class J extends L {
|
|
|
1810
1789
|
license: e.license,
|
|
1811
1790
|
licenseFile: e["license-file"],
|
|
1812
1791
|
platformOverride: g,
|
|
1813
|
-
customMounts:
|
|
1792
|
+
customMounts: d,
|
|
1814
1793
|
auth: c,
|
|
1815
1794
|
grpcAddr: e["grpc-listen"],
|
|
1816
1795
|
grpcPort: e["grpc-port"],
|
|
@@ -1822,39 +1801,104 @@ const J = class J extends L {
|
|
|
1822
1801
|
}), 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");
|
|
1823
1802
|
}
|
|
1824
1803
|
};
|
|
1825
|
-
l(
|
|
1826
|
-
...
|
|
1827
|
-
...
|
|
1804
|
+
l(Y, "description", "Run Platforma Backend service as docker container on current host with MinIO as local S3 storage"), l(Y, "examples", ["<%= config.bin %> <%= command.id %>"]), l(Y, "flags", {
|
|
1805
|
+
...I,
|
|
1806
|
+
...j,
|
|
1828
1807
|
...me,
|
|
1829
|
-
...
|
|
1808
|
+
...C,
|
|
1830
1809
|
...he,
|
|
1831
|
-
...
|
|
1832
|
-
...
|
|
1810
|
+
...U,
|
|
1811
|
+
...M,
|
|
1833
1812
|
...ye,
|
|
1834
|
-
...
|
|
1835
|
-
...
|
|
1836
|
-
}), l(
|
|
1837
|
-
name:
|
|
1813
|
+
...B,
|
|
1814
|
+
...yr
|
|
1815
|
+
}), l(Y, "args", {
|
|
1816
|
+
name: K.string({ required: !0 })
|
|
1817
|
+
});
|
|
1818
|
+
let je = Y;
|
|
1819
|
+
const V = class V extends L {
|
|
1820
|
+
async run() {
|
|
1821
|
+
const { flags: e, args: t } = await this.parse(V), r = A(e["log-level"]), n = new O(r);
|
|
1822
|
+
n.mergeLicenseEnvs(e);
|
|
1823
|
+
const s = t.name, i = e["pl-workdir"] ?? ".", c = e.storage ? m.join(i, e.storage) : u.instanceDir(s), o = e["pl-log-file"] ? m.join(i, e["pl-log-file"]) : void 0, d = n.initAuthDriversList(e, i), g = e["auth-enabled"] ?? d !== void 0;
|
|
1824
|
+
let h = e["pl-binary"];
|
|
1825
|
+
e["pl-sources"] && (h = n.buildPlatforma({ repoRoot: e["pl-sources"] }));
|
|
1826
|
+
let b = "127.0.0.1:6345";
|
|
1827
|
+
e["grpc-listen"] ? b = e["grpc-listen"] : e["grpc-port"] && (b = `127.0.0.1:${e["grpc-port"]}`);
|
|
1828
|
+
let w = "127.0.0.1:9090";
|
|
1829
|
+
e["monitoring-listen"] ? w = e["monitoring-listen"] : e["monitoring-port"] && (w = `127.0.0.1:${e["monitoring-port"]}`);
|
|
1830
|
+
let y = "127.0.0.1:9091";
|
|
1831
|
+
e["debug-listen"] ? y = e["debug-listen"] : e["debug-port"] && (y = `127.0.0.1:${e["debug-port"]}`);
|
|
1832
|
+
const P = {
|
|
1833
|
+
binaryPath: h,
|
|
1834
|
+
version: e.version,
|
|
1835
|
+
configPath: e.config,
|
|
1836
|
+
workdir: e["pl-workdir"],
|
|
1837
|
+
primaryURL: e["storage-primary"],
|
|
1838
|
+
libraryURL: e["storage-library"],
|
|
1839
|
+
minioPort: e["s3-port"],
|
|
1840
|
+
minioConsolePort: e["s3-console-port"],
|
|
1841
|
+
configOptions: {
|
|
1842
|
+
grpc: { listen: b },
|
|
1843
|
+
monitoring: { listen: w },
|
|
1844
|
+
debug: { listen: y },
|
|
1845
|
+
license: { value: e.license, file: e["license-file"] },
|
|
1846
|
+
log: { path: o },
|
|
1847
|
+
localRoot: c,
|
|
1848
|
+
core: { auth: { enabled: g, drivers: d } },
|
|
1849
|
+
storages: {
|
|
1850
|
+
work: { type: "FS", rootPath: e["storage-work"] }
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
};
|
|
1854
|
+
if (r.info("Creating instance configuration, data directory and other stuff..."), n.createLocalS3(s, P), P.binaryPath) {
|
|
1855
|
+
r.info(`Instance '${s}' was created. To start it run 'up' command`);
|
|
1856
|
+
return;
|
|
1857
|
+
}
|
|
1858
|
+
ke(r, { version: e.version }).then(() => r.info(`Instance '${s}' was created. To start it run 'pl up' command`)).catch(function(S) {
|
|
1859
|
+
r.error(S.message);
|
|
1860
|
+
});
|
|
1861
|
+
}
|
|
1862
|
+
};
|
|
1863
|
+
l(V, "description", "Run Platforma Backend service as local process on current host (no docker container)"), l(V, "examples", ["<%= config.bin %> <%= command.id %>"]), l(V, "flags", {
|
|
1864
|
+
...I,
|
|
1865
|
+
...C,
|
|
1866
|
+
...hr,
|
|
1867
|
+
...j,
|
|
1868
|
+
...we,
|
|
1869
|
+
...ve,
|
|
1870
|
+
...Pe,
|
|
1871
|
+
...M,
|
|
1872
|
+
...B,
|
|
1873
|
+
...ce,
|
|
1874
|
+
...ie,
|
|
1875
|
+
...oe,
|
|
1876
|
+
...pe,
|
|
1877
|
+
...be,
|
|
1878
|
+
...U
|
|
1879
|
+
}), l(V, "args", {
|
|
1880
|
+
name: K.string({ required: !0 })
|
|
1838
1881
|
});
|
|
1839
|
-
let
|
|
1840
|
-
const
|
|
1841
|
-
"create-block":
|
|
1842
|
-
reset:
|
|
1843
|
-
start:
|
|
1844
|
-
stop:
|
|
1845
|
-
"start:docker":
|
|
1846
|
-
"start:local":
|
|
1847
|
-
"svc:delete":
|
|
1848
|
-
"svc:down":
|
|
1849
|
-
"svc:list":
|
|
1850
|
-
"svc:up":
|
|
1851
|
-
"start:docker:s3":
|
|
1852
|
-
"start:local:s3":
|
|
1853
|
-
"svc:create:docker":
|
|
1854
|
-
"svc:create:local":
|
|
1855
|
-
"svc:create:docker:s3":
|
|
1882
|
+
let Be = V;
|
|
1883
|
+
const Rt = {
|
|
1884
|
+
"create-block": Re,
|
|
1885
|
+
reset: Te,
|
|
1886
|
+
start: xe,
|
|
1887
|
+
stop: De,
|
|
1888
|
+
"start:docker": lt,
|
|
1889
|
+
"start:local": dt,
|
|
1890
|
+
"svc:delete": Fe,
|
|
1891
|
+
"svc:down": Ne,
|
|
1892
|
+
"svc:list": _e,
|
|
1893
|
+
"svc:up": Ce,
|
|
1894
|
+
"start:docker:s3": gt,
|
|
1895
|
+
"start:local:s3": ut,
|
|
1896
|
+
"svc:create:docker": Me,
|
|
1897
|
+
"svc:create:local": ft,
|
|
1898
|
+
"svc:create:docker:s3": je,
|
|
1899
|
+
"svc:create:local:s3": Be
|
|
1856
1900
|
};
|
|
1857
1901
|
export {
|
|
1858
|
-
|
|
1902
|
+
Rt as COMMANDS
|
|
1859
1903
|
};
|
|
1860
1904
|
//# sourceMappingURL=index.mjs.map
|