@milaboratories/pl-deployments 2.15.7 → 2.15.9

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.
Files changed (106) hide show
  1. package/README.md +18 -5
  2. package/dist/common/os_and_arch.cjs +19 -19
  3. package/dist/common/os_and_arch.cjs.map +1 -1
  4. package/dist/common/os_and_arch.js +19 -19
  5. package/dist/common/os_and_arch.js.map +1 -1
  6. package/dist/common/pl_binary.cjs +9 -9
  7. package/dist/common/pl_binary.cjs.map +1 -1
  8. package/dist/common/pl_binary.d.ts +6 -6
  9. package/dist/common/pl_binary.d.ts.map +1 -1
  10. package/dist/common/pl_binary.js +9 -9
  11. package/dist/common/pl_binary.js.map +1 -1
  12. package/dist/common/pl_binary_download.cjs +16 -16
  13. package/dist/common/pl_binary_download.cjs.map +1 -1
  14. package/dist/common/pl_binary_download.d.ts +6 -6
  15. package/dist/common/pl_binary_download.d.ts.map +1 -1
  16. package/dist/common/pl_binary_download.js +16 -16
  17. package/dist/common/pl_binary_download.js.map +1 -1
  18. package/dist/common/pl_version.cjs +1 -1
  19. package/dist/common/pl_version.cjs.map +1 -1
  20. package/dist/common/pl_version.js +1 -1
  21. package/dist/common/pl_version.js.map +1 -1
  22. package/dist/index.d.ts +5 -5
  23. package/dist/local/options.d.ts +4 -4
  24. package/dist/local/pid.cjs +1 -1
  25. package/dist/local/pid.cjs.map +1 -1
  26. package/dist/local/pid.js +1 -1
  27. package/dist/local/pid.js.map +1 -1
  28. package/dist/local/pl.cjs +26 -26
  29. package/dist/local/pl.cjs.map +1 -1
  30. package/dist/local/pl.d.ts +8 -8
  31. package/dist/local/pl.d.ts.map +1 -1
  32. package/dist/local/pl.js +26 -26
  33. package/dist/local/pl.js.map +1 -1
  34. package/dist/local/process.cjs +16 -16
  35. package/dist/local/process.cjs.map +1 -1
  36. package/dist/local/process.d.ts +2 -2
  37. package/dist/local/process.js +16 -16
  38. package/dist/local/process.js.map +1 -1
  39. package/dist/local/trace.cjs.map +1 -1
  40. package/dist/local/trace.d.ts +1 -1
  41. package/dist/local/trace.js.map +1 -1
  42. package/dist/package.json.cjs +2 -1
  43. package/dist/package.json.cjs.map +1 -1
  44. package/dist/package.json.js +2 -1
  45. package/dist/package.json.js.map +1 -1
  46. package/dist/ssh/__tests__/common-utils.d.ts +2 -2
  47. package/dist/ssh/__tests__/common-utils.d.ts.map +1 -1
  48. package/dist/ssh/connection_info.cjs +13 -7
  49. package/dist/ssh/connection_info.cjs.map +1 -1
  50. package/dist/ssh/connection_info.d.ts +1 -1
  51. package/dist/ssh/connection_info.d.ts.map +1 -1
  52. package/dist/ssh/connection_info.js +13 -7
  53. package/dist/ssh/connection_info.js.map +1 -1
  54. package/dist/ssh/pl.cjs +79 -76
  55. package/dist/ssh/pl.cjs.map +1 -1
  56. package/dist/ssh/pl.d.ts +18 -18
  57. package/dist/ssh/pl.d.ts.map +1 -1
  58. package/dist/ssh/pl.js +79 -76
  59. package/dist/ssh/pl.js.map +1 -1
  60. package/dist/ssh/pl_paths.cjs +13 -13
  61. package/dist/ssh/pl_paths.cjs.map +1 -1
  62. package/dist/ssh/pl_paths.d.ts.map +1 -1
  63. package/dist/ssh/pl_paths.js +13 -13
  64. package/dist/ssh/pl_paths.js.map +1 -1
  65. package/dist/ssh/ssh.cjs +43 -40
  66. package/dist/ssh/ssh.cjs.map +1 -1
  67. package/dist/ssh/ssh.d.ts +9 -9
  68. package/dist/ssh/ssh.d.ts.map +1 -1
  69. package/dist/ssh/ssh.js +43 -40
  70. package/dist/ssh/ssh.js.map +1 -1
  71. package/dist/ssh/ssh_errors.cjs +7 -5
  72. package/dist/ssh/ssh_errors.cjs.map +1 -1
  73. package/dist/ssh/ssh_errors.d.ts.map +1 -1
  74. package/dist/ssh/ssh_errors.js +7 -5
  75. package/dist/ssh/ssh_errors.js.map +1 -1
  76. package/dist/ssh/supervisord.cjs +15 -13
  77. package/dist/ssh/supervisord.cjs.map +1 -1
  78. package/dist/ssh/supervisord.d.ts +2 -2
  79. package/dist/ssh/supervisord.d.ts.map +1 -1
  80. package/dist/ssh/supervisord.js +15 -13
  81. package/dist/ssh/supervisord.js.map +1 -1
  82. package/package.json +38 -37
  83. package/src/common/os_and_arch.ts +19 -19
  84. package/src/common/pl_binary.ts +30 -27
  85. package/src/common/pl_binary_download.ts +80 -59
  86. package/src/common/pl_version.ts +2 -2
  87. package/src/index.ts +5 -5
  88. package/src/local/config.test.yaml +19 -19
  89. package/src/local/options.ts +4 -4
  90. package/src/local/pid.ts +4 -4
  91. package/src/local/pl.test.ts +245 -253
  92. package/src/local/pl.ts +45 -50
  93. package/src/local/process.ts +21 -21
  94. package/src/local/trace.ts +1 -1
  95. package/src/ssh/__tests__/common-utils.ts +21 -19
  96. package/src/ssh/__tests__/pl-docker.test.ts +68 -59
  97. package/src/ssh/__tests__/ssh-docker.test.ts +152 -90
  98. package/src/ssh/__tests__/ssh-upload.test.ts +42 -31
  99. package/src/ssh/connection_info.ts +33 -27
  100. package/src/ssh/pl.test.ts +15 -13
  101. package/src/ssh/pl.ts +228 -143
  102. package/src/ssh/pl_paths.ts +22 -18
  103. package/src/ssh/ssh.ts +151 -74
  104. package/src/ssh/ssh_errors.test.ts +39 -39
  105. package/src/ssh/ssh_errors.ts +8 -6
  106. package/src/ssh/supervisord.ts +28 -28
@@ -1,21 +1,21 @@
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';
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 = 'https://cdn-ga.pl-open.science/software';
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
- { logger, baseDir, softwareName, tgzName, arch, platform, dispatcher }: {
32
- logger: MiLogger;
33
- baseDir: string;
34
- softwareName: string;
35
- tgzName: string;
36
- arch: string;
37
- platform: string;
38
- dispatcher?: Dispatcher;
39
- },
40
- ): Promise<DownloadBinaryResult> {
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 (_e) {
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
- { logger, baseDir, softwareName, archiveName, arch, platform, dispatcher }: {
57
- logger: MiLogger;
58
- baseDir: string;
59
- softwareName: string;
60
- archiveName: string;
61
- arch: string;
62
- platform: string;
63
- dispatcher?: Dispatcher;
64
- },
65
- ): Promise<DownloadBinaryResult> {
66
- const opts = getPathsForDownload(softwareName, archiveName, baseDir, newArch(arch), newOs(platform));
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 (_e) {
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
- { logger, archiveUrl, archivePath, dispatcher }: {
124
- logger: MiLogger;
125
- archiveUrl: string;
126
- archivePath: string;
127
- dispatcher?: Dispatcher;
128
- },
129
- ): Promise<DownloadInfo> {
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 + '.tmp';
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 = '.ok';
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('extracting archive...');
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 'tgz':
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 'zip':
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, 'ok');
252
+ await fsp.writeFile(markerFilePath, "ok");
232
253
 
233
254
  logger.info(` ... unpack done.`);
234
255
  }
235
256
 
236
- export type ArchiveType = 'tgz' | 'zip';
257
+ export type ArchiveType = "tgz" | "zip";
237
258
 
238
259
  const osToArchiveType: Record<OSType, ArchiveType> = {
239
- linux: 'tgz',
240
- macos: 'tgz',
241
- windows: 'zip',
260
+ linux: "tgz",
261
+ macos: "tgz",
262
+ windows: "zip",
242
263
  };
@@ -1,6 +1,6 @@
1
- import packageJson from '../../package.json';
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['pl-version'];
5
+ return packageJson["pl-version"];
6
6
  }
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
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
+ 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: 'info'
6
+ level: "info"
7
7
  destinations:
8
- - path: 'platforma.log'
8
+ - path: "platforma.log"
9
9
 
10
10
  monitoring:
11
- listen: '127.0.0.1:11235'
11
+ listen: "127.0.0.1:11235"
12
12
 
13
13
  debug:
14
- listen: '127.0.0.1:11236'
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: '127.0.0.1:11234'
22
+ listen: "127.0.0.1:11234"
23
23
  tlsEnabled: false
24
24
 
25
25
  http:
26
- listen: '127.0.0.1:11233'
26
+ listen: "127.0.0.1:11233"
27
27
 
28
28
  authEnabled: false
29
29
  auth: []
30
30
  db:
31
- path: './db'
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
- - id: 'main'
47
- type: 'FS'
48
- indexCachePeriod: '1m'
49
- rootPath: './storages/main'
46
+ - id: "main"
47
+ type: "FS"
48
+ indexCachePeriod: "1m"
49
+ rootPath: "./storages/main"
50
50
 
51
- - id: 'work'
52
- type: 'FS'
53
- indexCachePeriod: '1m'
54
- rootPath: './storages/work'
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: './storages/work'
60
+ storageRoot: "./storages/work"
61
61
 
62
62
  packageLoader:
63
- packagesRoot: './packages'
63
+ packagesRoot: "./packages"
64
64
 
65
65
  workflows: {}
@@ -1,5 +1,5 @@
1
- import type { SpawnOptions } from 'node:child_process';
2
- import type { PlBinarySource } from '../common/pl_binary';
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: 'silent';
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: 'hook';
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 '@milaboratories/ts-helpers';
2
- import fs from 'node:fs/promises';
3
- import upath from 'upath';
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, 'pl_pid');
6
+ return upath.join(dir, "pl_pid");
7
7
  }
8
8
 
9
9
  export async function readPid(filePath: string): Promise<number | undefined> {