@milaboratories/pl-deployments 1.1.7 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -34
- package/dist/index.mjs.map +1 -1
- package/dist/ssh/pl.d.ts +6 -2
- package/dist/ssh/pl.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ssh/__tests__/pl-docker.test.ts +13 -4
- package/src/ssh/pl.ts +9 -4
package/dist/index.mjs
CHANGED
|
@@ -22,7 +22,7 @@ function cr(s, t) {
|
|
|
22
22
|
cmd: ${JSON.stringify([t.cmd, ...t.args])}
|
|
23
23
|
wd: ${t.opts.cwd}`), s.info(" spawning child process"), V(t.cmd, t.args, t.opts);
|
|
24
24
|
}
|
|
25
|
-
async function
|
|
25
|
+
async function k(s) {
|
|
26
26
|
try {
|
|
27
27
|
return process.kill(s, 0), !0;
|
|
28
28
|
} catch {
|
|
@@ -34,12 +34,12 @@ function j(s) {
|
|
|
34
34
|
}
|
|
35
35
|
async function H(s, t) {
|
|
36
36
|
let e = 0;
|
|
37
|
-
for (; await
|
|
37
|
+
for (; await k(s); )
|
|
38
38
|
if (await F(100), e += 100, e > t)
|
|
39
39
|
throw new Error(`The process did not stopped after ${t} ms.`);
|
|
40
40
|
}
|
|
41
41
|
const lr = ["linux", "macos", "windows"];
|
|
42
|
-
function
|
|
42
|
+
function b(s) {
|
|
43
43
|
switch (s.toLowerCase()) {
|
|
44
44
|
case "darwin":
|
|
45
45
|
return "macos";
|
|
@@ -71,7 +71,7 @@ function P(s) {
|
|
|
71
71
|
}
|
|
72
72
|
const dr = "https://cdn.platforma.bio/software", ur = "https://cdn-ga.pl-open.science/software";
|
|
73
73
|
async function wr(s, t, r, e, i, o) {
|
|
74
|
-
const n = M(r, e, t, P(i),
|
|
74
|
+
const n = M(r, e, t, P(i), b(o)), { archiveUrl: c, alternativeArchiveGAUrl: a, archivePath: l } = n;
|
|
75
75
|
try {
|
|
76
76
|
await v(s, c, l), n.wasDownloadedFrom = c;
|
|
77
77
|
} catch {
|
|
@@ -80,7 +80,7 @@ async function wr(s, t, r, e, i, o) {
|
|
|
80
80
|
return n;
|
|
81
81
|
}
|
|
82
82
|
async function fr(s, t, r, e, i, o) {
|
|
83
|
-
const n = M(r, e, t, P(i),
|
|
83
|
+
const n = M(r, e, t, P(i), b(o)), { archiveUrl: c, alternativeArchiveGAUrl: a, archivePath: l, archiveType: h, targetFolder: u, baseName: g } = n;
|
|
84
84
|
try {
|
|
85
85
|
await v(s, c, l), n.wasDownloadedFrom = c;
|
|
86
86
|
} catch {
|
|
@@ -155,17 +155,17 @@ const gr = {
|
|
|
155
155
|
macos: "tgz",
|
|
156
156
|
windows: "zip"
|
|
157
157
|
};
|
|
158
|
-
function
|
|
158
|
+
function x() {
|
|
159
159
|
return "1.18.3";
|
|
160
160
|
}
|
|
161
161
|
function yr() {
|
|
162
|
-
return { type: "Download", version:
|
|
162
|
+
return { type: "Download", version: x() };
|
|
163
163
|
}
|
|
164
164
|
async function $r(s, t, r) {
|
|
165
165
|
switch (r.type) {
|
|
166
166
|
case "Download":
|
|
167
167
|
const e = await fr(s, t, "pl", `pl-${r.version}`, C.arch(), C.platform());
|
|
168
|
-
return d.join(e.baseName, "binaries", Pr[
|
|
168
|
+
return d.join(e.baseName, "binaries", Pr[b(C.platform())]);
|
|
169
169
|
case "Local":
|
|
170
170
|
return r.path;
|
|
171
171
|
default:
|
|
@@ -195,7 +195,7 @@ function Cr() {
|
|
|
195
195
|
function Er(s, t, r) {
|
|
196
196
|
return s[t] = r, r;
|
|
197
197
|
}
|
|
198
|
-
async function
|
|
198
|
+
async function O(s, t) {
|
|
199
199
|
const r = Cr();
|
|
200
200
|
try {
|
|
201
201
|
return await t((i, o) => Er(r, i, o), r);
|
|
@@ -214,7 +214,7 @@ class Ar {
|
|
|
214
214
|
this.logger = t, this.workingDir = r, this.startOptions = e, this.initialStartHistory = i, this.onClose = o, this.onError = n, this.onCloseAndError = c, this.onCloseAndErrorNoStop = a;
|
|
215
215
|
}
|
|
216
216
|
async start() {
|
|
217
|
-
await
|
|
217
|
+
await O(this.logger, async (t, r) => {
|
|
218
218
|
this.wasStopped = !1;
|
|
219
219
|
const e = cr(this.logger, this.startOptions);
|
|
220
220
|
e.on("error", (o) => {
|
|
@@ -238,7 +238,7 @@ class Ar {
|
|
|
238
238
|
return this.wasStopped;
|
|
239
239
|
}
|
|
240
240
|
async isAlive() {
|
|
241
|
-
return await
|
|
241
|
+
return await k(p(this.pid));
|
|
242
242
|
}
|
|
243
243
|
debugInfo() {
|
|
244
244
|
return {
|
|
@@ -258,7 +258,7 @@ async function st(s, t) {
|
|
|
258
258
|
closeOld: !0,
|
|
259
259
|
...t
|
|
260
260
|
};
|
|
261
|
-
return await
|
|
261
|
+
return await O(s, async (e, i) => {
|
|
262
262
|
e("startOptions", { ...r, config: "too wordy" });
|
|
263
263
|
const o = d.resolve(r.workingDir);
|
|
264
264
|
r.closeOld && e("closeOld", await Dr(s, o));
|
|
@@ -295,12 +295,12 @@ async function st(s, t) {
|
|
|
295
295
|
});
|
|
296
296
|
}
|
|
297
297
|
async function Dr(s, t) {
|
|
298
|
-
return await
|
|
299
|
-
const i = r("pidFilePath", J(t)), o = r("pid", await vr(i)), n = r("wasAlive", await
|
|
298
|
+
return await O(s, async (r, e) => {
|
|
299
|
+
const i = r("pidFilePath", J(t)), o = r("pid", await vr(i)), n = r("wasAlive", await k(o));
|
|
300
300
|
return o !== void 0 && n && (r("stopped", j(o)), r("waitStopped", await H(o, 1e4))), e;
|
|
301
301
|
});
|
|
302
302
|
}
|
|
303
|
-
const
|
|
303
|
+
const kr = {
|
|
304
304
|
keepaliveInterval: 6e4,
|
|
305
305
|
keepaliveCountMax: 10
|
|
306
306
|
};
|
|
@@ -318,7 +318,7 @@ class R {
|
|
|
318
318
|
*/
|
|
319
319
|
static async init(t, r) {
|
|
320
320
|
const e = {
|
|
321
|
-
...
|
|
321
|
+
...kr,
|
|
322
322
|
...r
|
|
323
323
|
}, i = new R(t, new E());
|
|
324
324
|
return await i.connect(e), i;
|
|
@@ -340,7 +340,7 @@ class R {
|
|
|
340
340
|
* @returns A promise that resolves when the connection is established or rejects on error.
|
|
341
341
|
*/
|
|
342
342
|
async connect(t) {
|
|
343
|
-
return this.config = t, await
|
|
343
|
+
return this.config = t, await br(this.client, t);
|
|
344
344
|
}
|
|
345
345
|
/**
|
|
346
346
|
* Executes a command on the SSH server.
|
|
@@ -431,7 +431,7 @@ class R {
|
|
|
431
431
|
}
|
|
432
432
|
let u;
|
|
433
433
|
try {
|
|
434
|
-
u = await
|
|
434
|
+
u = await xr(this.logger, h, "127.0.0.1", 0, "127.0.0.1", t.remotePort);
|
|
435
435
|
} catch (g) {
|
|
436
436
|
this.logger.error(`${l}.forwardOut.err: ${g}`), a.end();
|
|
437
437
|
return;
|
|
@@ -743,7 +743,7 @@ class R {
|
|
|
743
743
|
this.closeForwardedPorts(), this.client.end();
|
|
744
744
|
}
|
|
745
745
|
}
|
|
746
|
-
async function
|
|
746
|
+
async function br(s, t, r, e) {
|
|
747
747
|
return new Promise((i, o) => {
|
|
748
748
|
s.on("ready", () => {
|
|
749
749
|
i(s);
|
|
@@ -753,12 +753,12 @@ async function xr(s, t, r, e) {
|
|
|
753
753
|
}), s.connect(t);
|
|
754
754
|
});
|
|
755
755
|
}
|
|
756
|
-
async function
|
|
756
|
+
async function xr(s, t, r, e, i, o) {
|
|
757
757
|
return new Promise((n, c) => {
|
|
758
758
|
t.forwardOut(r, e, i, o, (a, l) => a ? (s.error(`forwardOut.error: ${a}`), c(a)) : n(l));
|
|
759
759
|
});
|
|
760
760
|
}
|
|
761
|
-
const
|
|
761
|
+
const Or = "minio-2024-12-18T13-15-44Z", Rr = "supervisord-0.7.3", Ur = "supervisord_0.7.3_Linux_64-bit";
|
|
762
762
|
function $(s) {
|
|
763
763
|
return d.join(s, "platforma_ssh");
|
|
764
764
|
}
|
|
@@ -766,7 +766,7 @@ function S(s) {
|
|
|
766
766
|
return d.join(s, "platforma_ssh", "binaries");
|
|
767
767
|
}
|
|
768
768
|
function Nr(s, t) {
|
|
769
|
-
return d.join(S(s), `pl-${
|
|
769
|
+
return d.join(S(s), `pl-${x()}-${P(t)}`);
|
|
770
770
|
}
|
|
771
771
|
function L(s, t) {
|
|
772
772
|
return d.join(Nr(s, t), "binaries");
|
|
@@ -777,19 +777,19 @@ function N(s, t) {
|
|
|
777
777
|
function Br(s, t) {
|
|
778
778
|
return d.join(L(s, t), "free-port");
|
|
779
779
|
}
|
|
780
|
-
function
|
|
780
|
+
function W(s, t) {
|
|
781
781
|
return d.join(S(s), `minio-2024-12-18T13-15-44Z-${P(t)}`);
|
|
782
782
|
}
|
|
783
783
|
function Tr(s, t) {
|
|
784
|
-
return d.join(
|
|
784
|
+
return d.join(W(s, t), "minio");
|
|
785
785
|
}
|
|
786
786
|
function _r(s, t) {
|
|
787
787
|
return d.join(S(s), `supervisord-0.7.3-${P(t)}`, Ur);
|
|
788
788
|
}
|
|
789
|
-
function
|
|
789
|
+
function z(s, t) {
|
|
790
790
|
return d.join(_r(s, t), "supervisord");
|
|
791
791
|
}
|
|
792
|
-
function
|
|
792
|
+
function G(s) {
|
|
793
793
|
return d.join($(s), "supervisor.conf");
|
|
794
794
|
}
|
|
795
795
|
function B(s) {
|
|
@@ -849,7 +849,7 @@ autorestart=true
|
|
|
849
849
|
`;
|
|
850
850
|
}
|
|
851
851
|
async function U(s, t, r, e) {
|
|
852
|
-
const i =
|
|
852
|
+
const i = z(t, r), o = G(t), n = `${i} --configuration ${o} ${e}`;
|
|
853
853
|
return await s.exec(n);
|
|
854
854
|
}
|
|
855
855
|
function T(s, t) {
|
|
@@ -912,7 +912,7 @@ class K {
|
|
|
912
912
|
return this.logger.info("pl.reset: Stop Platforma on the server"), await this.stop(), this.logger.info(`pl.reset: Deleting Platforma workDir ${t} on the server`), await this.sshClient.deleteFolder($(t)), this.cleanUp(), !0;
|
|
913
913
|
}
|
|
914
914
|
async platformaInit(t) {
|
|
915
|
-
const r = { localWorkdir: t };
|
|
915
|
+
const r = { localWorkdir: t.localWorkdir };
|
|
916
916
|
try {
|
|
917
917
|
if (r.arch = await this.getArch(), r.remoteHome = await this.getUserHomeDirectory(), r.isAlive = await this.isAlive(), r.isAlive) {
|
|
918
918
|
if (r.userCredentials = await this.getUserCredentials(r.remoteHome), !r.userCredentials)
|
|
@@ -920,7 +920,7 @@ class K {
|
|
|
920
920
|
return r.userCredentials;
|
|
921
921
|
}
|
|
922
922
|
const e = await this.downloadBinariesAndUploadToTheServer(
|
|
923
|
-
t,
|
|
923
|
+
t.localWorkdir,
|
|
924
924
|
r.remoteHome,
|
|
925
925
|
r.arch
|
|
926
926
|
);
|
|
@@ -959,7 +959,7 @@ class K {
|
|
|
959
959
|
r.binPaths.minioRelPath,
|
|
960
960
|
r.binPaths.downloadedPl
|
|
961
961
|
);
|
|
962
|
-
if (!await this.sshClient.writeFileOnTheServer(
|
|
962
|
+
if (!await this.sshClient.writeFileOnTheServer(G(r.remoteHome), o))
|
|
963
963
|
throw new Error(`Can not write supervisord config on the server ${$(r.remoteHome)}`);
|
|
964
964
|
return r.connectionInfo = {
|
|
965
965
|
plUser: i.plUser,
|
|
@@ -986,7 +986,7 @@ class K {
|
|
|
986
986
|
r,
|
|
987
987
|
e,
|
|
988
988
|
"pl",
|
|
989
|
-
`pl-${
|
|
989
|
+
`pl-${x()}`
|
|
990
990
|
);
|
|
991
991
|
i.push(o);
|
|
992
992
|
const n = await this.downloadAndUntar(
|
|
@@ -1002,7 +1002,7 @@ class K {
|
|
|
1002
1002
|
r,
|
|
1003
1003
|
e,
|
|
1004
1004
|
"minio",
|
|
1005
|
-
|
|
1005
|
+
Or
|
|
1006
1006
|
);
|
|
1007
1007
|
return i.push(a), await this.sshClient.chmod(c, 488), {
|
|
1008
1008
|
history: i,
|
|
@@ -1047,7 +1047,7 @@ class K {
|
|
|
1047
1047
|
return n.plUntarDone = !0, n;
|
|
1048
1048
|
}
|
|
1049
1049
|
async needDownload(t, r) {
|
|
1050
|
-
const e =
|
|
1050
|
+
const e = z(t, r.arch), i = W(t, r.arch), o = N(t, r.arch);
|
|
1051
1051
|
return !await this.sshClient.checkFileExists(o) || !await this.sshClient.checkFileExists(i) || !await this.sshClient.checkFileExists(e);
|
|
1052
1052
|
}
|
|
1053
1053
|
async checkIsAliveWithInterval(t = 1e3, r = 15, e = !0) {
|
|
@@ -1127,7 +1127,7 @@ export {
|
|
|
1127
1127
|
Ar as LocalPl,
|
|
1128
1128
|
R as SshClient,
|
|
1129
1129
|
K as SshPl,
|
|
1130
|
-
|
|
1130
|
+
x as getDefaultPlVersion,
|
|
1131
1131
|
st as localPlatformaInit
|
|
1132
1132
|
};
|
|
1133
1133
|
//# sourceMappingURL=index.mjs.map
|