@milaboratories/pl-deployments 2.15.7 → 2.15.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/README.md +18 -5
- package/dist/common/os_and_arch.cjs +19 -19
- package/dist/common/os_and_arch.cjs.map +1 -1
- package/dist/common/os_and_arch.js +19 -19
- package/dist/common/os_and_arch.js.map +1 -1
- package/dist/common/pl_binary.cjs +9 -9
- package/dist/common/pl_binary.cjs.map +1 -1
- package/dist/common/pl_binary.d.ts +6 -6
- package/dist/common/pl_binary.d.ts.map +1 -1
- package/dist/common/pl_binary.js +9 -9
- package/dist/common/pl_binary.js.map +1 -1
- package/dist/common/pl_binary_download.cjs +16 -16
- package/dist/common/pl_binary_download.cjs.map +1 -1
- package/dist/common/pl_binary_download.d.ts +6 -6
- package/dist/common/pl_binary_download.d.ts.map +1 -1
- package/dist/common/pl_binary_download.js +16 -16
- package/dist/common/pl_binary_download.js.map +1 -1
- package/dist/common/pl_version.cjs +1 -1
- package/dist/common/pl_version.cjs.map +1 -1
- package/dist/common/pl_version.js +1 -1
- package/dist/common/pl_version.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/local/options.d.ts +4 -4
- package/dist/local/pid.cjs +1 -1
- package/dist/local/pid.cjs.map +1 -1
- package/dist/local/pid.js +1 -1
- package/dist/local/pid.js.map +1 -1
- package/dist/local/pl.cjs +26 -26
- package/dist/local/pl.cjs.map +1 -1
- package/dist/local/pl.d.ts +8 -8
- package/dist/local/pl.d.ts.map +1 -1
- package/dist/local/pl.js +26 -26
- package/dist/local/pl.js.map +1 -1
- package/dist/local/process.cjs +16 -16
- package/dist/local/process.cjs.map +1 -1
- package/dist/local/process.d.ts +2 -2
- package/dist/local/process.js +16 -16
- package/dist/local/process.js.map +1 -1
- package/dist/local/trace.cjs.map +1 -1
- package/dist/local/trace.d.ts +1 -1
- package/dist/local/trace.js.map +1 -1
- package/dist/package.json.cjs +2 -1
- package/dist/package.json.cjs.map +1 -1
- package/dist/package.json.js +2 -1
- package/dist/package.json.js.map +1 -1
- package/dist/ssh/__tests__/common-utils.d.ts +2 -2
- package/dist/ssh/__tests__/common-utils.d.ts.map +1 -1
- package/dist/ssh/connection_info.cjs +13 -7
- package/dist/ssh/connection_info.cjs.map +1 -1
- package/dist/ssh/connection_info.d.ts +1 -1
- package/dist/ssh/connection_info.d.ts.map +1 -1
- package/dist/ssh/connection_info.js +13 -7
- package/dist/ssh/connection_info.js.map +1 -1
- package/dist/ssh/pl.cjs +79 -76
- package/dist/ssh/pl.cjs.map +1 -1
- package/dist/ssh/pl.d.ts +18 -18
- package/dist/ssh/pl.d.ts.map +1 -1
- package/dist/ssh/pl.js +79 -76
- package/dist/ssh/pl.js.map +1 -1
- package/dist/ssh/pl_paths.cjs +13 -13
- package/dist/ssh/pl_paths.cjs.map +1 -1
- package/dist/ssh/pl_paths.d.ts.map +1 -1
- package/dist/ssh/pl_paths.js +13 -13
- package/dist/ssh/pl_paths.js.map +1 -1
- package/dist/ssh/ssh.cjs +43 -40
- package/dist/ssh/ssh.cjs.map +1 -1
- package/dist/ssh/ssh.d.ts +9 -9
- package/dist/ssh/ssh.d.ts.map +1 -1
- package/dist/ssh/ssh.js +43 -40
- package/dist/ssh/ssh.js.map +1 -1
- package/dist/ssh/ssh_errors.cjs +7 -5
- package/dist/ssh/ssh_errors.cjs.map +1 -1
- package/dist/ssh/ssh_errors.d.ts.map +1 -1
- package/dist/ssh/ssh_errors.js +7 -5
- package/dist/ssh/ssh_errors.js.map +1 -1
- package/dist/ssh/supervisord.cjs +15 -13
- package/dist/ssh/supervisord.cjs.map +1 -1
- package/dist/ssh/supervisord.d.ts +2 -2
- package/dist/ssh/supervisord.d.ts.map +1 -1
- package/dist/ssh/supervisord.js +15 -13
- package/dist/ssh/supervisord.js.map +1 -1
- package/package.json +37 -36
- package/src/common/os_and_arch.ts +19 -19
- package/src/common/pl_binary.ts +30 -27
- package/src/common/pl_binary_download.ts +80 -59
- package/src/common/pl_version.ts +2 -2
- package/src/index.ts +5 -5
- package/src/local/config.test.yaml +19 -19
- package/src/local/options.ts +4 -4
- package/src/local/pid.ts +4 -4
- package/src/local/pl.test.ts +245 -253
- package/src/local/pl.ts +45 -50
- package/src/local/process.ts +21 -21
- package/src/local/trace.ts +1 -1
- package/src/ssh/__tests__/common-utils.ts +21 -19
- package/src/ssh/__tests__/pl-docker.test.ts +68 -59
- package/src/ssh/__tests__/ssh-docker.test.ts +152 -90
- package/src/ssh/__tests__/ssh-upload.test.ts +42 -31
- package/src/ssh/connection_info.ts +33 -27
- package/src/ssh/pl.test.ts +15 -13
- package/src/ssh/pl.ts +228 -143
- package/src/ssh/pl_paths.ts +22 -18
- package/src/ssh/ssh.ts +151 -74
- package/src/ssh/ssh_errors.test.ts +39 -39
- package/src/ssh/ssh_errors.ts +8 -6
- package/src/ssh/supervisord.ts +28 -28
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import fs from
|
|
2
|
-
import fsp from
|
|
3
|
-
import upath from
|
|
4
|
-
import type { Dispatcher } from
|
|
5
|
-
import { request } from
|
|
6
|
-
import { Writable, Readable } from
|
|
7
|
-
import { text } from
|
|
8
|
-
import * as tar from
|
|
9
|
-
import type { MiLogger } from
|
|
10
|
-
import { assertNever, fileExists } from
|
|
11
|
-
import decompress from
|
|
12
|
-
import type { ArchType, OSType } from
|
|
13
|
-
import { newOs, newArch } from
|
|
14
|
-
|
|
15
|
-
const cdn =
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import fsp from "node:fs/promises";
|
|
3
|
+
import upath from "upath";
|
|
4
|
+
import type { Dispatcher } from "undici";
|
|
5
|
+
import { request } from "undici";
|
|
6
|
+
import { Writable, Readable } from "node:stream";
|
|
7
|
+
import { text } from "node:stream/consumers";
|
|
8
|
+
import * as tar from "tar";
|
|
9
|
+
import type { MiLogger } from "@milaboratories/ts-helpers";
|
|
10
|
+
import { assertNever, fileExists } from "@milaboratories/ts-helpers";
|
|
11
|
+
import decompress from "decompress";
|
|
12
|
+
import type { ArchType, OSType } from "./os_and_arch";
|
|
13
|
+
import { newOs, newArch } from "./os_and_arch";
|
|
14
|
+
|
|
15
|
+
const cdn = "https://cdn.platforma.bio/software";
|
|
16
16
|
// We'll download things from Global Access if downloading from CDN has failed
|
|
17
17
|
// (it might be that it's blocked from the company's network.)
|
|
18
|
-
const gaCdn =
|
|
18
|
+
const gaCdn = "https://cdn-ga.pl-open.science/software";
|
|
19
19
|
|
|
20
20
|
export type DownloadBinaryResult = {
|
|
21
21
|
archiveUrl: string;
|
|
@@ -27,24 +27,30 @@ export type DownloadBinaryResult = {
|
|
|
27
27
|
baseName: string;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
export async function downloadBinaryNoExtract(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
export async function downloadBinaryNoExtract({
|
|
31
|
+
logger,
|
|
32
|
+
baseDir,
|
|
33
|
+
softwareName,
|
|
34
|
+
tgzName,
|
|
35
|
+
arch,
|
|
36
|
+
platform,
|
|
37
|
+
dispatcher,
|
|
38
|
+
}: {
|
|
39
|
+
logger: MiLogger;
|
|
40
|
+
baseDir: string;
|
|
41
|
+
softwareName: string;
|
|
42
|
+
tgzName: string;
|
|
43
|
+
arch: string;
|
|
44
|
+
platform: string;
|
|
45
|
+
dispatcher?: Dispatcher;
|
|
46
|
+
}): Promise<DownloadBinaryResult> {
|
|
41
47
|
const opts = getPathsForDownload(softwareName, tgzName, baseDir, newArch(arch), newOs(platform));
|
|
42
48
|
const { archiveUrl, alternativeArchiveGAUrl, archivePath } = opts;
|
|
43
49
|
|
|
44
50
|
try {
|
|
45
51
|
await downloadArchive({ logger, archiveUrl, archivePath, dispatcher });
|
|
46
52
|
opts.wasDownloadedFrom = archiveUrl;
|
|
47
|
-
} catch
|
|
53
|
+
} catch {
|
|
48
54
|
await downloadArchive({ logger, archiveUrl: alternativeArchiveGAUrl, archivePath, dispatcher });
|
|
49
55
|
opts.wasDownloadedFrom = alternativeArchiveGAUrl;
|
|
50
56
|
}
|
|
@@ -52,24 +58,36 @@ export async function downloadBinaryNoExtract(
|
|
|
52
58
|
return opts;
|
|
53
59
|
}
|
|
54
60
|
|
|
55
|
-
export async function downloadBinary(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
export async function downloadBinary({
|
|
62
|
+
logger,
|
|
63
|
+
baseDir,
|
|
64
|
+
softwareName,
|
|
65
|
+
archiveName,
|
|
66
|
+
arch,
|
|
67
|
+
platform,
|
|
68
|
+
dispatcher,
|
|
69
|
+
}: {
|
|
70
|
+
logger: MiLogger;
|
|
71
|
+
baseDir: string;
|
|
72
|
+
softwareName: string;
|
|
73
|
+
archiveName: string;
|
|
74
|
+
arch: string;
|
|
75
|
+
platform: string;
|
|
76
|
+
dispatcher?: Dispatcher;
|
|
77
|
+
}): Promise<DownloadBinaryResult> {
|
|
78
|
+
const opts = getPathsForDownload(
|
|
79
|
+
softwareName,
|
|
80
|
+
archiveName,
|
|
81
|
+
baseDir,
|
|
82
|
+
newArch(arch),
|
|
83
|
+
newOs(platform),
|
|
84
|
+
);
|
|
67
85
|
const { archiveUrl, alternativeArchiveGAUrl, archivePath, archiveType, targetFolder } = opts;
|
|
68
86
|
|
|
69
87
|
try {
|
|
70
88
|
await downloadArchive({ logger, archiveUrl, archivePath, dispatcher });
|
|
71
89
|
opts.wasDownloadedFrom = archiveUrl;
|
|
72
|
-
} catch
|
|
90
|
+
} catch {
|
|
73
91
|
await downloadArchive({ logger, archiveUrl: alternativeArchiveGAUrl, archivePath, dispatcher });
|
|
74
92
|
opts.wasDownloadedFrom = alternativeArchiveGAUrl;
|
|
75
93
|
}
|
|
@@ -119,14 +137,17 @@ export type DownloadInfo = {
|
|
|
119
137
|
newExisted?: boolean;
|
|
120
138
|
};
|
|
121
139
|
|
|
122
|
-
export async function downloadArchive(
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
140
|
+
export async function downloadArchive({
|
|
141
|
+
logger,
|
|
142
|
+
archiveUrl,
|
|
143
|
+
archivePath,
|
|
144
|
+
dispatcher,
|
|
145
|
+
}: {
|
|
146
|
+
logger: MiLogger;
|
|
147
|
+
archiveUrl: string;
|
|
148
|
+
archivePath: string;
|
|
149
|
+
dispatcher?: Dispatcher;
|
|
150
|
+
}): Promise<DownloadInfo> {
|
|
130
151
|
const state: DownloadInfo = {};
|
|
131
152
|
state.archivePath = archivePath;
|
|
132
153
|
|
|
@@ -153,7 +174,7 @@ export async function downloadArchive(
|
|
|
153
174
|
}
|
|
154
175
|
|
|
155
176
|
// to prevent incomplete downloads we first write in a temp file
|
|
156
|
-
state.tmpPath = archivePath +
|
|
177
|
+
state.tmpPath = archivePath + ".tmp";
|
|
157
178
|
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
|
158
179
|
await Readable.toWeb(body).pipeTo(Writable.toWeb(fs.createWriteStream(state.tmpPath)));
|
|
159
180
|
state.wroteTmp = true;
|
|
@@ -173,7 +194,7 @@ export async function downloadArchive(
|
|
|
173
194
|
}
|
|
174
195
|
|
|
175
196
|
/** Used to prevent mid-way interrupted unarchived folders to be used */
|
|
176
|
-
const MarkerFileName =
|
|
197
|
+
const MarkerFileName = ".ok";
|
|
177
198
|
|
|
178
199
|
export async function extractArchive(
|
|
179
200
|
logger: MiLogger,
|
|
@@ -181,7 +202,7 @@ export async function extractArchive(
|
|
|
181
202
|
archiveType: ArchiveType,
|
|
182
203
|
dstFolder: string,
|
|
183
204
|
) {
|
|
184
|
-
logger.info(
|
|
205
|
+
logger.info("extracting archive...");
|
|
185
206
|
logger.info(` archive path: '${archivePath}'`);
|
|
186
207
|
logger.info(` target dir: '${dstFolder}'`);
|
|
187
208
|
|
|
@@ -211,7 +232,7 @@ export async function extractArchive(
|
|
|
211
232
|
);
|
|
212
233
|
|
|
213
234
|
switch (archiveType) {
|
|
214
|
-
case
|
|
235
|
+
case "tgz":
|
|
215
236
|
await tar.x({
|
|
216
237
|
file: archivePath,
|
|
217
238
|
cwd: dstFolder,
|
|
@@ -219,7 +240,7 @@ export async function extractArchive(
|
|
|
219
240
|
});
|
|
220
241
|
break;
|
|
221
242
|
|
|
222
|
-
case
|
|
243
|
+
case "zip":
|
|
223
244
|
await decompress(archivePath, dstFolder);
|
|
224
245
|
break;
|
|
225
246
|
|
|
@@ -228,15 +249,15 @@ export async function extractArchive(
|
|
|
228
249
|
}
|
|
229
250
|
|
|
230
251
|
// writing marker file, to be able in the future detect that we completely unarchived the tar file
|
|
231
|
-
await fsp.writeFile(markerFilePath,
|
|
252
|
+
await fsp.writeFile(markerFilePath, "ok");
|
|
232
253
|
|
|
233
254
|
logger.info(` ... unpack done.`);
|
|
234
255
|
}
|
|
235
256
|
|
|
236
|
-
export type ArchiveType =
|
|
257
|
+
export type ArchiveType = "tgz" | "zip";
|
|
237
258
|
|
|
238
259
|
const osToArchiveType: Record<OSType, ArchiveType> = {
|
|
239
|
-
linux:
|
|
240
|
-
macos:
|
|
241
|
-
windows:
|
|
260
|
+
linux: "tgz",
|
|
261
|
+
macos: "tgz",
|
|
262
|
+
windows: "zip",
|
|
242
263
|
};
|
package/src/common/pl_version.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import packageJson from
|
|
1
|
+
import packageJson from "../../package.json";
|
|
2
2
|
|
|
3
3
|
export function getDefaultPlVersion(): string {
|
|
4
4
|
// drop build error if pl-version is not defined
|
|
5
|
-
return packageJson[
|
|
5
|
+
return packageJson["pl-version"];
|
|
6
6
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
1
|
+
export * from "./local/pl";
|
|
2
|
+
export * from "./common/pl_version";
|
|
3
|
+
export * from "./ssh/ssh";
|
|
4
|
+
export * from "./ssh/pl";
|
|
5
|
+
export * from "./ssh/connection_info";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
license:
|
|
2
|
-
value:
|
|
3
|
-
file:
|
|
2
|
+
value: ""
|
|
3
|
+
file: ""
|
|
4
4
|
|
|
5
5
|
logging:
|
|
6
|
-
level:
|
|
6
|
+
level: "info"
|
|
7
7
|
destinations:
|
|
8
|
-
|
|
8
|
+
- path: "platforma.log"
|
|
9
9
|
|
|
10
10
|
monitoring:
|
|
11
|
-
listen:
|
|
11
|
+
listen: "127.0.0.1:11235"
|
|
12
12
|
|
|
13
13
|
debug:
|
|
14
|
-
listen:
|
|
14
|
+
listen: "127.0.0.1:11236"
|
|
15
15
|
|
|
16
16
|
core:
|
|
17
17
|
logging:
|
|
@@ -19,16 +19,16 @@ core:
|
|
|
19
19
|
dumpResourceData: true
|
|
20
20
|
|
|
21
21
|
grpc:
|
|
22
|
-
listen:
|
|
22
|
+
listen: "127.0.0.1:11234"
|
|
23
23
|
tlsEnabled: false
|
|
24
24
|
|
|
25
25
|
http:
|
|
26
|
-
listen:
|
|
26
|
+
listen: "127.0.0.1:11233"
|
|
27
27
|
|
|
28
28
|
authEnabled: false
|
|
29
29
|
auth: []
|
|
30
30
|
db:
|
|
31
|
-
path:
|
|
31
|
+
path: "./db"
|
|
32
32
|
|
|
33
33
|
controllers:
|
|
34
34
|
data:
|
|
@@ -43,23 +43,23 @@ controllers:
|
|
|
43
43
|
downloadable: false
|
|
44
44
|
|
|
45
45
|
storages:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
- id: "main"
|
|
47
|
+
type: "FS"
|
|
48
|
+
indexCachePeriod: "1m"
|
|
49
|
+
rootPath: "./storages/main"
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
- id: "work"
|
|
52
|
+
type: "FS"
|
|
53
|
+
indexCachePeriod: "1m"
|
|
54
|
+
rootPath: "./storages/work"
|
|
55
55
|
|
|
56
56
|
runner:
|
|
57
57
|
type: local
|
|
58
58
|
resources:
|
|
59
59
|
cpu: 5
|
|
60
|
-
storageRoot:
|
|
60
|
+
storageRoot: "./storages/work"
|
|
61
61
|
|
|
62
62
|
packageLoader:
|
|
63
|
-
packagesRoot:
|
|
63
|
+
packagesRoot: "./packages"
|
|
64
64
|
|
|
65
65
|
workflows: {}
|
package/src/local/options.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SpawnOptions } from
|
|
2
|
-
import type { PlBinarySource } from
|
|
1
|
+
import type { SpawnOptions } from "node:child_process";
|
|
2
|
+
import type { PlBinarySource } from "../common/pl_binary";
|
|
3
3
|
|
|
4
4
|
/** Options to start a local pl-core. */
|
|
5
5
|
export type LocalPlOptions = {
|
|
@@ -24,11 +24,11 @@ export type LocalPlRestart = LocalPlRestartSilent | LocalPlRestartHook;
|
|
|
24
24
|
|
|
25
25
|
/** Do nothing if the error happened or a process exited. */
|
|
26
26
|
export type LocalPlRestartSilent = {
|
|
27
|
-
type:
|
|
27
|
+
type: "silent";
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
/** Run a hook if the error happened or a process exited. */
|
|
31
31
|
export type LocalPlRestartHook = {
|
|
32
|
-
type:
|
|
32
|
+
type: "hook";
|
|
33
33
|
hook(pl: any): void;
|
|
34
34
|
};
|
package/src/local/pid.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { fileExists } from
|
|
2
|
-
import fs from
|
|
3
|
-
import upath from
|
|
1
|
+
import { fileExists } from "@milaboratories/ts-helpers";
|
|
2
|
+
import fs from "node:fs/promises";
|
|
3
|
+
import upath from "upath";
|
|
4
4
|
|
|
5
5
|
export function filePid(dir: string) {
|
|
6
|
-
return upath.join(dir,
|
|
6
|
+
return upath.join(dir, "pl_pid");
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export async function readPid(filePath: string): Promise<number | undefined> {
|