@milaboratories/pl-deployments 2.12.5 → 2.12.7
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/ssh/pl.cjs +146 -6
- package/dist/ssh/pl.cjs.map +1 -1
- package/dist/ssh/pl.d.ts +15 -3
- package/dist/ssh/pl.d.ts.map +1 -1
- package/dist/ssh/pl.js +147 -7
- package/dist/ssh/pl.js.map +1 -1
- package/dist/ssh/pl_paths.cjs +4 -0
- package/dist/ssh/pl_paths.cjs.map +1 -1
- package/dist/ssh/pl_paths.d.ts +1 -0
- package/dist/ssh/pl_paths.d.ts.map +1 -1
- package/dist/ssh/pl_paths.js +4 -1
- package/dist/ssh/pl_paths.js.map +1 -1
- package/package.json +4 -4
- package/src/ssh/__tests__/pl-docker.test.ts +30 -1
- package/src/ssh/pl.ts +174 -0
- package/src/ssh/pl_paths.ts +4 -0
package/dist/ssh/pl.js
CHANGED
|
@@ -2,8 +2,9 @@ import { SshClient } from './ssh.js';
|
|
|
2
2
|
import { notEmpty, sleep } from '@milaboratories/ts-helpers';
|
|
3
3
|
import { downloadBinaryNoExtract } from '../common/pl_binary_download.js';
|
|
4
4
|
import upath from 'upath';
|
|
5
|
-
import { platformaCliLogs, workDir, connectionInfo, supervisorConf, supervisordDirName, minioBin, minioDirName, platformaBin, binariesDir, supervisorBin, minioDir, platformaFreePortBin } from './pl_paths.js';
|
|
5
|
+
import { platformaCliLogs, workDir, connectionInfo, platformaDbLock, supervisorConf, supervisordDirName, minioBin, minioDirName, platformaBin, binariesDir, supervisorBin, minioDir, platformaFreePortBin } from './pl_paths.js';
|
|
6
6
|
import { getDefaultPlVersion } from '../common/pl_version.js';
|
|
7
|
+
import { defaultHttpDispatcher } from '@milaboratories/pl-http';
|
|
7
8
|
import net from 'node:net';
|
|
8
9
|
import { generateSshPlConfigs, getFreePort } from '@milaboratories/pl-config';
|
|
9
10
|
import { supervisorStatus, isAllAlive, supervisorCtlStart, isSupervisordRunning, supervisorStop, generateSupervisordConfigWithMinio, generateSupervisordConfig } from './supervisord.js';
|
|
@@ -126,6 +127,7 @@ class SshPl {
|
|
|
126
127
|
return state.existedSettings;
|
|
127
128
|
}
|
|
128
129
|
await this.doStepStopExistedPlatforma(state, onProgress);
|
|
130
|
+
await this.doStepCheckDbLock(state, onProgress);
|
|
129
131
|
await onProgress?.('Installation platforma...');
|
|
130
132
|
await this.doStepDownloadBinaries(state, onProgress, ops);
|
|
131
133
|
await this.doStepFetchPorts(state);
|
|
@@ -171,6 +173,50 @@ class SshPl {
|
|
|
171
173
|
await this.sshClient.writeFileOnTheServer(connectionInfo(state.remoteHome), stringifyConnectionInfo(state.connectionInfo));
|
|
172
174
|
await onProgress?.('Connection information saved.');
|
|
173
175
|
}
|
|
176
|
+
async doStepCheckDbLock(state, onProgress) {
|
|
177
|
+
const removeLockFile = async (lockFilePath) => {
|
|
178
|
+
try {
|
|
179
|
+
await this.sshClient.exec(`rm -f ${lockFilePath}`);
|
|
180
|
+
this.logger.info(`Removed stale lock file ${lockFilePath}`);
|
|
181
|
+
}
|
|
182
|
+
catch (e) {
|
|
183
|
+
const msg = `Failed to remove stale lock file ${lockFilePath}: ${e}`;
|
|
184
|
+
this.logger.error(msg);
|
|
185
|
+
throw new Error(msg);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
state.step = 'checkDbLock';
|
|
189
|
+
await onProgress?.('Checking for DB lock...');
|
|
190
|
+
const lockFilePath = platformaDbLock(state.remoteHome);
|
|
191
|
+
const lockFileExists = await this.sshClient.checkFileExists(lockFilePath);
|
|
192
|
+
if (!lockFileExists) {
|
|
193
|
+
await onProgress?.('No DB lock found. Proceeding...');
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
this.logger.info(`DB lock file found at ${lockFilePath}. Checking which process holds it...`);
|
|
197
|
+
const lockProcessInfo = await this.findLockHolder(lockFilePath);
|
|
198
|
+
if (!lockProcessInfo) {
|
|
199
|
+
this.logger.warn('Lock file exists but no process is holding it. Removing stale lock file...');
|
|
200
|
+
await removeLockFile(lockFilePath);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
this.logger.info(`Found process ${lockProcessInfo.pid} (user: ${lockProcessInfo.user}) holding DB lock`);
|
|
204
|
+
if (lockProcessInfo.user !== this.username) {
|
|
205
|
+
const msg = `DB lock is held by process ${lockProcessInfo.pid} `
|
|
206
|
+
+ `owned by user '${lockProcessInfo.user}', but current user is '${this.username}'. `
|
|
207
|
+
+ 'Cannot kill process owned by different user.';
|
|
208
|
+
this.logger.error(msg);
|
|
209
|
+
throw new Error(msg);
|
|
210
|
+
}
|
|
211
|
+
this.logger.info(`Process ${lockProcessInfo.pid} belongs to current user ${this.username}. Killing it...`);
|
|
212
|
+
await this.killRemoteProcess(lockProcessInfo.pid);
|
|
213
|
+
this.logger.info('Process holding DB lock has been terminated.');
|
|
214
|
+
// Verify lock file is gone or can be removed
|
|
215
|
+
const lockStillExists = await this.sshClient.checkFileExists(lockFilePath);
|
|
216
|
+
if (lockStillExists) {
|
|
217
|
+
await removeLockFile(lockFilePath);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
174
220
|
async doStepConfigureSupervisord(state, onProgress) {
|
|
175
221
|
await onProgress?.('Writing supervisord configuration...');
|
|
176
222
|
state.step = 'configureSupervisord';
|
|
@@ -248,7 +294,7 @@ class SshPl {
|
|
|
248
294
|
const glibcVersion = await getGlibcVersion(this.logger, this.sshClient);
|
|
249
295
|
if (glibcVersion < minRequiredGlibcVersion)
|
|
250
296
|
throw new Error(`glibc version ${glibcVersion} is too old. Version ${minRequiredGlibcVersion} or higher is required for Platforma.`);
|
|
251
|
-
const downloadRes = await this.downloadBinariesAndUploadToTheServer(ops.localWorkdir, ops.plBinary, state.remoteHome, state.arch, state.shouldUseMinio ?? false);
|
|
297
|
+
const downloadRes = await this.downloadBinariesAndUploadToTheServer(ops.localWorkdir, ops.plBinary, state.remoteHome, state.arch, state.shouldUseMinio ?? false, ops.proxy);
|
|
252
298
|
await onProgress?.('All required binaries have been downloaded and uploaded.');
|
|
253
299
|
state.binPaths = { ...downloadRes, history: undefined };
|
|
254
300
|
state.downloadedBinaries = downloadRes.history;
|
|
@@ -296,16 +342,17 @@ class SshPl {
|
|
|
296
342
|
await this.stop();
|
|
297
343
|
return true;
|
|
298
344
|
}
|
|
299
|
-
async downloadBinariesAndUploadToTheServer(localWorkdir, plBinary, remoteHome, arch, shouldUseMinio) {
|
|
345
|
+
async downloadBinariesAndUploadToTheServer(localWorkdir, plBinary, remoteHome, arch, shouldUseMinio, proxy) {
|
|
300
346
|
const state = [];
|
|
347
|
+
const dispatcher = defaultHttpDispatcher(proxy);
|
|
301
348
|
try {
|
|
302
|
-
const pl = await this.downloadAndUntar(localWorkdir, remoteHome, arch, 'pl', `pl-${plBinary.version}
|
|
349
|
+
const pl = await this.downloadAndUntar(localWorkdir, remoteHome, arch, 'pl', `pl-${plBinary.version}`, dispatcher);
|
|
303
350
|
state.push(pl);
|
|
304
|
-
const supervisor = await this.downloadAndUntar(localWorkdir, remoteHome, arch, 'supervisord', supervisordDirName);
|
|
351
|
+
const supervisor = await this.downloadAndUntar(localWorkdir, remoteHome, arch, 'supervisord', supervisordDirName, dispatcher);
|
|
305
352
|
state.push(supervisor);
|
|
306
353
|
const minioPath = minioBin(remoteHome, arch.arch);
|
|
307
354
|
if (shouldUseMinio) {
|
|
308
|
-
const minio = await this.downloadAndUntar(localWorkdir, remoteHome, arch, 'minio', minioDirName);
|
|
355
|
+
const minio = await this.downloadAndUntar(localWorkdir, remoteHome, arch, 'minio', minioDirName, dispatcher);
|
|
309
356
|
state.push(minio);
|
|
310
357
|
await this.sshClient.chmod(minioPath, 0o750);
|
|
311
358
|
}
|
|
@@ -320,6 +367,98 @@ class SshPl {
|
|
|
320
367
|
this.logger.error(msg);
|
|
321
368
|
throw e;
|
|
322
369
|
}
|
|
370
|
+
finally {
|
|
371
|
+
await dispatcher.close();
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
async findLockHolderWithLsof(lockFilePath) {
|
|
375
|
+
try {
|
|
376
|
+
const { stdout } = await this.sshClient.exec(`lsof ${lockFilePath} 2>/dev/null || true`);
|
|
377
|
+
const output = stdout.trim();
|
|
378
|
+
if (!output) {
|
|
379
|
+
return null;
|
|
380
|
+
}
|
|
381
|
+
// Example:
|
|
382
|
+
// COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
|
|
383
|
+
// platforma 11628 rfiskov 10u REG 1,16 0 66670038 ./LOCK
|
|
384
|
+
const lines = output.split('\n');
|
|
385
|
+
if (lines.length <= 1) {
|
|
386
|
+
return null;
|
|
387
|
+
}
|
|
388
|
+
const parts = lines[1].trim().split(/\s+/);
|
|
389
|
+
if (parts.length < 3) {
|
|
390
|
+
return null;
|
|
391
|
+
}
|
|
392
|
+
const pid = Number.parseInt(parts[1], 10);
|
|
393
|
+
const user = parts[2];
|
|
394
|
+
return Number.isNaN(pid) || !user ? null : { pid, user };
|
|
395
|
+
}
|
|
396
|
+
catch (e) {
|
|
397
|
+
this.logger.warn(`Failed to use lsof to check lock: ${e}`);
|
|
398
|
+
return null;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
async findLockHolderWithFuser(lockFilePath) {
|
|
402
|
+
try {
|
|
403
|
+
const { stdout } = await this.sshClient.exec(`fuser ${lockFilePath} 2>/dev/null || true`);
|
|
404
|
+
const output = stdout.trim();
|
|
405
|
+
if (!output) {
|
|
406
|
+
return null;
|
|
407
|
+
}
|
|
408
|
+
// Example: ./LOCK: 11628
|
|
409
|
+
const match = output.match(/: (\d+)/);
|
|
410
|
+
if (!match) {
|
|
411
|
+
return null;
|
|
412
|
+
}
|
|
413
|
+
const pid = Number.parseInt(match[1], 10);
|
|
414
|
+
if (Number.isNaN(pid)) {
|
|
415
|
+
return null;
|
|
416
|
+
}
|
|
417
|
+
try {
|
|
418
|
+
const psResult = await this.sshClient.exec(`ps -o user= -p ${pid} 2>/dev/null || true`);
|
|
419
|
+
const user = psResult.stdout.trim();
|
|
420
|
+
return user ? { pid, user } : null;
|
|
421
|
+
}
|
|
422
|
+
catch (e) {
|
|
423
|
+
this.logger.warn(`Failed to get user for PID ${pid}: ${e}`);
|
|
424
|
+
return null;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
catch (e) {
|
|
428
|
+
this.logger.warn(`Failed to use fuser to check lock: ${e}`);
|
|
429
|
+
return null;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
async findLockHolder(lockFilePath) {
|
|
433
|
+
const viaLsof = await this.findLockHolderWithLsof(lockFilePath);
|
|
434
|
+
if (viaLsof) {
|
|
435
|
+
return viaLsof;
|
|
436
|
+
}
|
|
437
|
+
return this.findLockHolderWithFuser(lockFilePath);
|
|
438
|
+
}
|
|
439
|
+
async killRemoteProcess(pid) {
|
|
440
|
+
this.logger.info(`Killing process ${pid}...`);
|
|
441
|
+
try {
|
|
442
|
+
// Try graceful termination first
|
|
443
|
+
await this.sshClient.exec(`kill ${pid} 2>/dev/null || true`);
|
|
444
|
+
await sleep(1000);
|
|
445
|
+
// Check if process still exists
|
|
446
|
+
try {
|
|
447
|
+
await this.sshClient.exec(`kill -0 ${pid} 2>/dev/null`);
|
|
448
|
+
// Process still exists, force kill
|
|
449
|
+
this.logger.warn(`Process ${pid} still alive after SIGTERM, forcing kill...`);
|
|
450
|
+
await this.sshClient.exec(`kill -9 ${pid} 2>/dev/null || true`);
|
|
451
|
+
await sleep(500);
|
|
452
|
+
}
|
|
453
|
+
catch {
|
|
454
|
+
// Process is dead, nothing to do
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
catch (e) {
|
|
458
|
+
const msg = `Failed to kill process ${pid}: ${e}`;
|
|
459
|
+
this.logger.error(msg);
|
|
460
|
+
throw new Error(msg);
|
|
461
|
+
}
|
|
323
462
|
}
|
|
324
463
|
/** We have to extract pl in the remote server,
|
|
325
464
|
* because Windows doesn't support symlinks
|
|
@@ -327,7 +466,7 @@ class SshPl {
|
|
|
327
466
|
* For this reason, we extract all to the remote server.
|
|
328
467
|
* It requires `tar` to be installed on the server
|
|
329
468
|
* (it's not installed for Rocky Linux for example). */
|
|
330
|
-
async downloadAndUntar(localWorkdir, remoteHome, arch, softwareName, tgzName) {
|
|
469
|
+
async downloadAndUntar(localWorkdir, remoteHome, arch, softwareName, tgzName, dispatcher) {
|
|
331
470
|
const state = {};
|
|
332
471
|
state.binBasePath = binariesDir(remoteHome);
|
|
333
472
|
await this.sshClient.ensureRemoteDirCreated(state.binBasePath);
|
|
@@ -343,6 +482,7 @@ class SshPl {
|
|
|
343
482
|
tgzName,
|
|
344
483
|
arch: arch.arch,
|
|
345
484
|
platform: arch.platform,
|
|
485
|
+
dispatcher,
|
|
346
486
|
});
|
|
347
487
|
break;
|
|
348
488
|
}
|
package/dist/ssh/pl.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pl.js","sources":["../../src/ssh/pl.ts"],"sourcesContent":["import type * as ssh from 'ssh2';\nimport { SshClient } from './ssh';\nimport type { MiLogger } from '@milaboratories/ts-helpers';\nimport { sleep, notEmpty } from '@milaboratories/ts-helpers';\nimport type { DownloadBinaryResult } from '../common/pl_binary_download';\nimport { downloadBinaryNoExtract } from '../common/pl_binary_download';\nimport upath from 'upath';\nimport * as plpath from './pl_paths';\nimport { getDefaultPlVersion } from '../common/pl_version';\n\nimport net from 'node:net';\nimport type { PlConfig, PlLicenseMode, SshPlConfigGenerationResult } from '@milaboratories/pl-config';\nimport { getFreePort, generateSshPlConfigs } from '@milaboratories/pl-config';\nimport type { SupervisorStatus } from './supervisord';\nimport { supervisorStatus, supervisorStop as supervisorCtlShutdown, generateSupervisordConfigWithMinio, supervisorCtlStart, isSupervisordRunning, generateSupervisordConfig, isAllAlive } from './supervisord';\nimport type { ConnectionInfo, SshPlPorts } from './connection_info';\nimport { newConnectionInfo, parseConnectionInfo, stringifyConnectionInfo } from './connection_info';\nimport type { PlBinarySourceDownload } from '../common/pl_binary';\n\nconst minRequiredGlibcVersion = 2.28;\n\nexport class SshPl {\n private initState: PlatformaInitState = { step: 'init' };\n constructor(\n public readonly logger: MiLogger,\n public readonly sshClient: SshClient,\n private readonly username: string,\n ) { }\n\n public info() {\n return {\n username: this.username,\n initState: this.initState,\n };\n }\n\n public static async init(logger: MiLogger, config: ssh.ConnectConfig): Promise<SshPl> {\n try {\n const sshClient = await SshClient.init(logger, config);\n return new SshPl(logger, sshClient, notEmpty(config.username));\n } catch (e: unknown) {\n logger.error(`Connection error in SshClient.init: ${e}`);\n throw e;\n }\n }\n\n public cleanUp() {\n this.sshClient.close();\n }\n\n /** Provides an info if the platforma and minio are running along with the debug info. */\n public async isAlive(): Promise<SupervisorStatus> {\n const arch = await this.getArch();\n const remoteHome = await this.getUserHomeDirectory();\n return await supervisorStatus(this.logger, this.sshClient, remoteHome, arch.arch);\n }\n\n /** Starts all the services on the server.\n * Idempotent semantic: we could call it several times. */\n public async start(shouldUseMinio: boolean) {\n const arch = await this.getArch();\n const remoteHome = await this.getUserHomeDirectory();\n\n try {\n if (!isAllAlive(await this.isAlive(), shouldUseMinio)) {\n await supervisorCtlStart(this.sshClient, remoteHome, arch.arch);\n\n // We are waiting for Platforma to run to ensure that it has started.\n return await this.checkIsAliveWithInterval(shouldUseMinio);\n }\n } catch (e: unknown) {\n let msg = `SshPl.start: ${e}`;\n\n let logs = '';\n try {\n logs = await this.sshClient.readFile(plpath.platformaCliLogs(remoteHome));\n msg += `, platforma cli logs: ${logs}`;\n } catch (e: unknown) {\n msg += `, Can not read platforma cli logs: ${e}`;\n }\n\n this.logger.error(msg);\n throw new Error(msg);\n }\n }\n\n /** Stops all the services on the server.\n * Idempotent semantic: we could call it several times. */\n public async stop() {\n const arch = await this.getArch();\n const remoteHome = await this.getUserHomeDirectory();\n\n try {\n const alive = await this.isAlive();\n if (isSupervisordRunning(alive)) {\n await supervisorCtlShutdown(this.sshClient, remoteHome, arch.arch);\n // Check if Minio is running by looking at the alive status\n const shouldUseMinio = alive.minio === true;\n return await this.checkIsAliveWithInterval(shouldUseMinio, 1000, 15, false);\n }\n } catch (e: unknown) {\n const msg = `PlSsh.stop: ${e}`;\n this.logger.error(msg);\n throw new Error(msg);\n }\n }\n\n /** Stops the services, deletes a directory with the state and closes SSH connection. */\n public async reset(): Promise<boolean> {\n await this.stopAndClean();\n this.cleanUp();\n return true;\n }\n\n /** Stops platforma and deletes its state. */\n public async stopAndClean(): Promise<void> {\n const remoteHome = await this.getUserHomeDirectory();\n\n this.logger.info(`pl.reset: Stop Platforma on the server`);\n await this.stop();\n\n this.logger.info(`pl.reset: Deleting Platforma workDir ${plpath.workDir(remoteHome)} on the server`);\n await this.sshClient.deleteFolder(plpath.workDir(remoteHome));\n }\n\n /** Downloads binaries and untar them on the server,\n * generates all the configs, creates necessary dirs,\n * and finally starts all the services. */\n public async platformaInit(options: SshPlConfig): Promise<ConnectionInfo> {\n const state: PlatformaInitState = { localWorkdir: options.localWorkdir, step: 'init' };\n\n const { onProgress } = options;\n\n // merge options with default ops.\n const ops: SshPlConfig = {\n ...defaultSshPlConfig,\n ...options,\n };\n state.plBinaryOps = ops.plBinary;\n\n try {\n await this.doStepDetectArch(state, onProgress);\n await this.doStepDetectHome(state, onProgress);\n\n const needRestartPlatforma = await this.doStepReadExistedConfig(state, ops, onProgress);\n if (!needRestartPlatforma) {\n await onProgress?.('Platforma is already running. Skipping initialization.');\n return state.existedSettings!;\n }\n await this.doStepStopExistedPlatforma(state, onProgress);\n\n await onProgress?.('Installation platforma...');\n\n await this.doStepDownloadBinaries(state, onProgress, ops);\n await this.doStepFetchPorts(state);\n await this.doStepGenerateNewConfig(state, onProgress, ops);\n await this.doStepCreateFoldersAndSaveFiles(state, onProgress);\n await this.doStepConfigureSupervisord(state, onProgress);\n await this.doStepSaveNewConnectionInfo(state, onProgress, ops);\n await this.doStepStartPlatforma(state, onProgress);\n\n return state.connectionInfo!;\n } catch (e: unknown) {\n const msg = `SshPl.platformaInit: ${e}, state: ${JSON.stringify(this.removeSensitiveData(state))}`;\n this.logger.error(msg);\n\n throw new Error(msg);\n }\n }\n\n private async doStepStopExistedPlatforma(state: PlatformaInitState, onProgress: ((...args: any) => Promise<any>) | undefined) {\n state.step = 'stopExistedPlatforma';\n if (!isAllAlive(state.alive!, state.shouldUseMinio ?? false)) {\n return;\n }\n\n await onProgress?.('Stopping services...');\n await this.stop();\n }\n\n private removeSensitiveData(state: PlatformaInitState): PlatformaInitState {\n const stateCopy = { ...state };\n stateCopy.generatedConfig = { ...stateCopy.generatedConfig, filesToCreate: { skipped: 'sanitized' } } as SshPlConfigGenerationResult;\n return stateCopy;\n }\n\n private async doStepStartPlatforma(state: PlatformaInitState, onProgress: ((...args: any) => Promise<any>) | undefined) {\n state.step = 'startPlatforma';\n await onProgress?.('Starting Platforma on the server...');\n await this.start(state.shouldUseMinio ?? false);\n state.started = true;\n this.initState = state;\n\n await onProgress?.('Platforma has been started successfully.');\n }\n\n private async doStepSaveNewConnectionInfo(state: PlatformaInitState, onProgress: ((...args: any) => Promise<any>) | undefined, ops: SshPlConfig) {\n state.step = 'saveNewConnectionInfo';\n const config = state.generatedConfig!;\n await onProgress?.('Saving connection information...');\n state.connectionInfo = newConnectionInfo(\n config.plUser,\n config.plPassword,\n state.ports!,\n notEmpty(ops.useGlobalAccess),\n ops.plBinary!.version,\n state.shouldUseMinio ?? false,\n );\n await this.sshClient.writeFileOnTheServer(\n plpath.connectionInfo(state.remoteHome!),\n stringifyConnectionInfo(state.connectionInfo),\n );\n await onProgress?.('Connection information saved.');\n }\n\n private async doStepConfigureSupervisord(state: PlatformaInitState, onProgress: ((...args: any) => Promise<any>) | undefined) {\n await onProgress?.('Writing supervisord configuration...');\n state.step = 'configureSupervisord';\n\n const config = state.generatedConfig!;\n\n let supervisorConfig: string;\n if (state.shouldUseMinio) {\n supervisorConfig = generateSupervisordConfigWithMinio(\n config.minioConfig.storageDir,\n config.minioConfig.envs,\n await this.getFreePortForPlatformaOnServer(state.remoteHome!, state.arch!),\n config.workingDir,\n config.plConfig.configPath,\n state.binPaths!.minioRelPath!,\n state.binPaths!.downloadedPl,\n );\n } else {\n supervisorConfig = generateSupervisordConfig(\n await this.getFreePortForPlatformaOnServer(state.remoteHome!, state.arch!),\n config.workingDir,\n config.plConfig.configPath,\n state.binPaths!.downloadedPl,\n );\n }\n\n const writeResult = await this.sshClient.writeFileOnTheServer(plpath.supervisorConf(state.remoteHome!), supervisorConfig);\n if (!writeResult) {\n throw new Error(`Can not write supervisord config on the server ${plpath.workDir(state.remoteHome!)}`);\n }\n await onProgress?.('Supervisord configuration written.');\n }\n\n private async doStepCreateFoldersAndSaveFiles(state: PlatformaInitState, onProgress: ((...args: any) => Promise<any>) | undefined) {\n state.step = 'createFoldersAndSaveFiles';\n const config = state.generatedConfig!;\n await onProgress?.('Generating folder structure...');\n for (const [filePath, content] of Object.entries(config.filesToCreate)) {\n await this.sshClient.writeFileOnTheServer(filePath, content);\n this.logger.info(`Created file ${filePath}`);\n }\n\n for (const dir of config.dirsToCreate) {\n await this.sshClient.ensureRemoteDirCreated(dir);\n this.logger.info(`Created directory ${dir}`);\n }\n await onProgress?.('Folder structure created.');\n }\n\n private async doStepGenerateNewConfig(state: PlatformaInitState, onProgress: ((...args: any) => Promise<any>) | undefined, ops: SshPlConfig) {\n state.step = 'generateNewConfig';\n\n await onProgress?.('Generating new config...');\n const config = await generateSshPlConfigs({\n logger: this.logger,\n workingDir: plpath.workDir(state.remoteHome!),\n portsMode: {\n type: 'customWithMinio',\n ports: {\n debug: state.ports!.debug.remote,\n grpc: state.ports!.grpc.remote,\n http: state.ports!.http!.remote,\n minio: state.ports!.minioPort.remote,\n minioConsole: state.ports!.minioConsolePort.remote,\n monitoring: state.ports!.monitoring.remote,\n\n httpLocal: state.ports!.http!.local,\n grpcLocal: state.ports!.grpc.local,\n minioLocal: state.ports!.minioPort.local,\n },\n },\n licenseMode: ops.license,\n useGlobalAccess: notEmpty(ops.useGlobalAccess),\n plConfigPostprocessing: ops.plConfigPostprocessing,\n useMinio: state.shouldUseMinio ?? false,\n });\n state.generatedConfig = { ...config };\n await onProgress?.('New config generated');\n }\n\n private async doStepFetchPorts(state: PlatformaInitState) {\n state.step = 'fetchPorts';\n state.ports = await this.fetchPorts(state.remoteHome!, state.arch!);\n\n if (!state.ports.debug.remote\n || !state.ports.grpc.remote\n || !state.ports.minioPort.remote\n || !state.ports.minioConsolePort.remote\n || !state.ports.monitoring.remote\n || !state.ports.http?.remote) {\n throw new Error(`SshPl.platformaInit: remote ports are not defined`);\n }\n }\n\n private async doStepDownloadBinaries(state: PlatformaInitState, onProgress: ((...args: any) => Promise<any>) | undefined, ops: SshPlConfig) {\n state.step = 'downloadBinaries';\n await onProgress?.('Downloading and uploading required binaries...');\n\n const glibcVersion = await getGlibcVersion(this.logger, this.sshClient);\n if (glibcVersion < minRequiredGlibcVersion)\n throw new Error(`glibc version ${glibcVersion} is too old. Version ${minRequiredGlibcVersion} or higher is required for Platforma.`);\n\n const downloadRes = await this.downloadBinariesAndUploadToTheServer(\n ops.localWorkdir, ops.plBinary!, state.remoteHome!, state.arch!, state.shouldUseMinio ?? false,\n );\n await onProgress?.('All required binaries have been downloaded and uploaded.');\n\n state.binPaths = { ...downloadRes, history: undefined };\n state.downloadedBinaries = downloadRes.history;\n }\n\n private async doStepDetectArch(state: PlatformaInitState, onProgress: ((...args: any) => Promise<any>) | undefined) {\n state.step = 'detectArch';\n await onProgress?.('Detecting server architecture...');\n state.arch = await this.getArch();\n await onProgress?.('Server architecture detected.');\n }\n\n private async doStepDetectHome(state: PlatformaInitState, onProgress: ((...args: any) => Promise<any>) | undefined) {\n state.step = 'detectHome';\n await onProgress?.('Fetching user home directory...');\n state.remoteHome = await this.getUserHomeDirectory();\n await onProgress?.('User home directory retrieved.');\n }\n\n private async doStepReadExistedConfig(\n state: PlatformaInitState,\n ops: SshPlConfig,\n onProgress: ((...args: any) => Promise<any>) | undefined,\n ): Promise<boolean> {\n state.step = 'checkAlive';\n await onProgress?.('Checking platform status...');\n state.alive = await this.isAlive();\n\n if (!state.alive?.platforma) {\n return true;\n }\n\n await onProgress?.('All required services are running.');\n\n state.existedSettings = await this.readExistedConfig(state.remoteHome!);\n if (!state.existedSettings) {\n throw new Error(`SshPl.platformaInit: platforma is alive but existed settings are not found`);\n }\n\n const sameGA = state.existedSettings.useGlobalAccess == ops.useGlobalAccess;\n const samePlVersion = state.existedSettings.plVersion == ops.plBinary!.version;\n state.needRestart = !(sameGA && samePlVersion);\n this.logger.info(`SshPl.platformaInit: need restart? ${state.needRestart}`);\n\n state.shouldUseMinio = state.existedSettings.minioIsUsed;\n if (state.shouldUseMinio) {\n this.logger.info(`SshPl.platformaInit: minio is used`);\n } else {\n this.logger.info(`SshPl.platformaInit: minio is not used`);\n }\n\n if (!state.needRestart) {\n await onProgress?.('Server setup completed.');\n return false;\n }\n\n await onProgress?.('Stopping services...');\n await this.stop();\n\n return true;\n }\n\n public async downloadBinariesAndUploadToTheServer(\n localWorkdir: string,\n plBinary: PlBinarySourceDownload,\n remoteHome: string,\n arch: Arch,\n shouldUseMinio: boolean,\n ) {\n const state: DownloadAndUntarState[] = [];\n try {\n const pl = await this.downloadAndUntar(\n localWorkdir, remoteHome, arch,\n 'pl', `pl-${plBinary.version}`,\n );\n state.push(pl);\n\n const supervisor = await this.downloadAndUntar(\n localWorkdir, remoteHome, arch,\n 'supervisord', plpath.supervisordDirName,\n );\n state.push(supervisor);\n\n const minioPath = plpath.minioBin(remoteHome, arch.arch);\n if (shouldUseMinio) {\n const minio = await this.downloadAndUntar(\n localWorkdir, remoteHome, arch,\n 'minio', plpath.minioDirName,\n );\n state.push(minio);\n await this.sshClient.chmod(minioPath, 0o750);\n }\n\n return {\n history: state,\n minioRelPath: shouldUseMinio ? minioPath : undefined,\n downloadedPl: plpath.platformaBin(remoteHome, arch.arch),\n };\n } catch (e: unknown) {\n const msg = `SshPl.downloadBinariesAndUploadToServer: ${e}, state: ${JSON.stringify(state)}`;\n this.logger.error(msg);\n throw e;\n }\n }\n\n /** We have to extract pl in the remote server,\n * because Windows doesn't support symlinks\n * that are found in Linux pl binaries tgz archive.\n * For this reason, we extract all to the remote server.\n * It requires `tar` to be installed on the server\n * (it's not installed for Rocky Linux for example). */\n public async downloadAndUntar(\n localWorkdir: string,\n remoteHome: string,\n arch: Arch,\n softwareName: string,\n tgzName: string,\n ): Promise<DownloadAndUntarState> {\n const state: DownloadAndUntarState = {};\n state.binBasePath = plpath.binariesDir(remoteHome);\n await this.sshClient.ensureRemoteDirCreated(state.binBasePath);\n state.binBasePathCreated = true;\n\n let downloadBinaryResult: DownloadBinaryResult | null = null;\n const attempts = 5;\n for (let i = 1; i <= attempts; i++) {\n try {\n downloadBinaryResult = await downloadBinaryNoExtract({\n logger: this.logger,\n baseDir: localWorkdir,\n softwareName,\n tgzName,\n arch: arch.arch,\n platform: arch.platform,\n });\n break;\n } catch (e: unknown) {\n await sleep(300);\n if (i == attempts) {\n throw new Error(`downloadAndUntar: ${attempts} attempts, last error: ${e}`);\n }\n }\n }\n state.downloadResult = notEmpty(downloadBinaryResult);\n\n state.localArchivePath = upath.resolve(state.downloadResult.archivePath);\n state.remoteDir = upath.join(state.binBasePath, state.downloadResult.baseName);\n state.remoteArchivePath = state.remoteDir + '.tgz';\n\n await this.sshClient.ensureRemoteDirCreated(state.remoteDir);\n await this.sshClient.uploadFile(state.localArchivePath, state.remoteArchivePath);\n state.uploadDone = true;\n\n try {\n await this.sshClient.exec('hash tar');\n } catch (_) {\n throw new Error(`tar is not installed on the server. Please install it before running Platforma.`);\n }\n\n // TODO: Create a proper archive to avoid xattr warnings\n const untarResult = await this.sshClient.exec(\n `tar --warning=no-all -xvf ${state.remoteArchivePath} --directory=${state.remoteDir}`,\n );\n\n if (untarResult.stderr)\n throw new Error(`downloadAndUntar: untar: stderr occurred: ${untarResult.stderr}, stdout: ${untarResult.stdout}`);\n\n state.untarDone = true;\n\n return state;\n }\n\n public async needDownload(remoteHome: string, arch: Arch) {\n const checkPathSupervisor = plpath.supervisorBin(remoteHome, arch.arch);\n const checkPathMinio = plpath.minioDir(remoteHome, arch.arch);\n const checkPathPlatforma = plpath.platformaBin(remoteHome, arch.arch);\n\n if (!await this.sshClient.checkFileExists(checkPathPlatforma)\n || !await this.sshClient.checkFileExists(checkPathMinio)\n || !await this.sshClient.checkFileExists(checkPathSupervisor)) {\n return true;\n }\n\n return false;\n }\n\n public async checkIsAliveWithInterval(shouldUseMinio: boolean, interval: number = 1000, count = 15, shouldStart = true): Promise<void> {\n const maxMs = count * interval;\n\n let total = 0;\n let alive = await this.isAlive();\n while (shouldStart ? !isAllAlive(alive, shouldUseMinio) : isAllAlive(alive, shouldUseMinio)) {\n await sleep(interval);\n total += interval;\n if (total > maxMs) {\n throw new Error(`isAliveWithInterval: The process did not ${shouldStart ? 'started' : 'stopped'} after ${maxMs} ms. Live status: ${JSON.stringify(alive)}`);\n }\n alive = await this.isAlive();\n }\n }\n\n public async readExistedConfig(remoteHome: string): Promise<ConnectionInfo> {\n const connectionInfo = await this.sshClient.readFile(plpath.connectionInfo(remoteHome));\n return parseConnectionInfo(connectionInfo);\n }\n\n public async fetchPorts(remoteHome: string, arch: Arch): Promise<SshPlPorts> {\n const ports: SshPlPorts = {\n grpc: {\n local: await getFreePort(),\n remote: await this.getFreePortForPlatformaOnServer(remoteHome, arch),\n },\n monitoring: {\n local: await getFreePort(),\n remote: await this.getFreePortForPlatformaOnServer(remoteHome, arch),\n },\n debug: {\n local: await getFreePort(),\n remote: await this.getFreePortForPlatformaOnServer(remoteHome, arch),\n },\n http: {\n local: await getFreePort(),\n remote: await this.getFreePortForPlatformaOnServer(remoteHome, arch),\n },\n minioPort: {\n local: await getFreePort(),\n remote: await this.getFreePortForPlatformaOnServer(remoteHome, arch),\n },\n minioConsolePort: {\n local: await getFreePort(),\n remote: await this.getFreePortForPlatformaOnServer(remoteHome, arch),\n },\n };\n\n return ports;\n }\n\n public async getLocalFreePort(): Promise<number> {\n return new Promise((res) => {\n const srv = net.createServer();\n srv.listen(0, () => {\n const port = (srv.address() as net.AddressInfo).port;\n srv.close((_) => res(port));\n });\n });\n }\n\n public async getFreePortForPlatformaOnServer(remoteHome: string, arch: Arch): Promise<number> {\n const freePortBin = plpath.platformaFreePortBin(remoteHome, arch.arch);\n\n const { stdout, stderr } = await this.sshClient.exec(`${freePortBin}`);\n if (stderr) {\n throw new Error(`getFreePortForPlatformaOnServer: stderr is not empty: ${stderr}, stdout: ${stdout}`);\n }\n\n return +stdout;\n }\n\n public async getArch(): Promise<Arch> {\n const { stdout, stderr } = await this.sshClient.exec('uname -s && uname -m');\n if (stderr)\n throw new Error(`getArch: stderr is not empty: ${stderr}, stdout: ${stdout}`);\n\n const arr = stdout.split('\\n');\n\n return {\n platform: arr[0],\n arch: arr[1],\n };\n }\n\n public async getUserHomeDirectory() {\n const { stdout, stderr } = await this.sshClient.exec('echo $HOME');\n\n if (stderr) {\n const home = `/home/${this.username}`;\n console.warn(`getUserHomeDirectory: stderr is not empty: ${stderr}, stdout: ${stdout}, will get a default home: ${home}`);\n\n return home;\n }\n\n return stdout.trim();\n }\n}\n\ntype Arch = { platform: string; arch: string };\n\nexport type SshPlConfig = {\n localWorkdir: string;\n license: PlLicenseMode;\n useGlobalAccess?: boolean;\n plBinary?: PlBinarySourceDownload;\n\n onProgress?: (...args: any) => Promise<any>;\n plConfigPostprocessing?: (config: PlConfig) => PlConfig;\n};\n\nconst defaultSshPlConfig: Pick<\n SshPlConfig,\n | 'useGlobalAccess'\n | 'plBinary'\n> = {\n useGlobalAccess: false,\n plBinary: {\n type: 'Download',\n version: getDefaultPlVersion(),\n },\n};\n\ntype BinPaths = {\n history?: DownloadAndUntarState[];\n minioRelPath?: string;\n downloadedPl: string;\n};\n\ntype DownloadAndUntarState = {\n binBasePath?: string;\n binBasePathCreated?: boolean;\n downloadResult?: DownloadBinaryResult;\n attempts?: number;\n\n localArchivePath?: string;\n remoteDir?: string;\n remoteArchivePath?: string;\n uploadDone?: boolean;\n untarDone?: boolean;\n};\n\ntype PlatformaInitStep =\n 'init'\n | 'detectArch'\n | 'detectHome'\n | 'checkAlive'\n | 'stopExistedPlatforma'\n | 'downloadBinaries'\n | 'fetchPorts'\n | 'generateNewConfig'\n | 'createFoldersAndSaveFiles'\n | 'configureSupervisord'\n | 'saveNewConnectionInfo'\n | 'startPlatforma';\n\ntype PlatformaInitState = {\n step: PlatformaInitStep;\n localWorkdir?: string;\n plBinaryOps?: PlBinarySourceDownload;\n arch?: Arch;\n remoteHome?: string;\n alive?: SupervisorStatus;\n existedSettings?: ConnectionInfo;\n needRestart?: boolean;\n shouldUseMinio?: boolean;\n downloadedBinaries?: DownloadAndUntarState[];\n binPaths?: BinPaths;\n ports?: SshPlPorts;\n generatedConfig?: SshPlConfigGenerationResult;\n connectionInfo?: ConnectionInfo;\n started?: boolean;\n};\n\n/**\n * Gets the glibc version on the remote system\n * @returns The glibc version as a number\n * @throws Error if version cannot be determined\n */\nasync function getGlibcVersion(logger: MiLogger, sshClient: SshClient): Promise <number> {\n try {\n const { stdout, stderr } = await sshClient.exec('ldd --version | head -n 1');\n if (stderr) {\n throw new Error(`Failed to check glibc version: ${stderr}`);\n }\n return parseGlibcVersion(stdout);\n } catch (e: unknown) {\n logger.error(`glibc version check failed: ${e}`);\n throw e;\n }\n}\n\nexport function parseGlibcVersion(output: string): number {\n const versionMatch = output.match(/\\d+\\.\\d+/);\n if (!versionMatch) {\n throw new Error(`Could not parse glibc version from: ${output}`);\n }\n\n return parseFloat(versionMatch[0]);\n}\n"],"names":["plpath.platformaCliLogs","supervisorCtlShutdown","plpath.workDir","plpath.connectionInfo","plpath.supervisorConf","plpath.supervisordDirName","plpath.minioBin","plpath.minioDirName","plpath.platformaBin","plpath.binariesDir","plpath.supervisorBin","plpath.minioDir","connectionInfo","plpath.platformaFreePortBin"],"mappings":";;;;;;;;;;;AAmBA,MAAM,uBAAuB,GAAG,IAAI;MAEvB,KAAK,CAAA;AAGE,IAAA,MAAA;AACA,IAAA,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U;QAChB,OAAO,EAAE,mBAAmB,EAAE;AAC/B,KAAA;CACF;AAqDD;;;;AAIG;AACH,eAAe,eAAe,CAAC,MAAgB,EAAE,SAAoB,EAAA;AACnE,IAAA,IAAI;AACF,QAAA,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,2BAA2B,CAAC;QAC5E,IAAI,MAAM,EAAE;AACV,YAAA,MAAM,IAAI,KAAK,CAAC,kCAAkC,MAAM,CAAA,CAAE,CAAC;QAC7D;AACA,QAAA,OAAO,iBAAiB,CAAC,MAAM,CAAC;IAClC;IAAE,OAAO,CAAU,EAAE;AACnB,QAAA,MAAM,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAA,CAAE,CAAC;AAChD,QAAA,MAAM,CAAC;IACT;AACF;AAEM,SAAU,iBAAiB,CAAC,MAAc,EAAA;IAC9C,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC;IAC7C,IAAI,CAAC,YAAY,EAAE;AACjB,QAAA,MAAM,IAAI,KAAK,CAAC,uCAAuC,MAAM,CAAA,CAAE,CAAC;IAClE;AAEA,IAAA,OAAO,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;AACpC;;;;"}
|
|
1
|
+
{"version":3,"file":"pl.js","sources":["../../src/ssh/pl.ts"],"sourcesContent":["import type * as ssh from 'ssh2';\nimport { SshClient } from './ssh';\nimport type { MiLogger } from '@milaboratories/ts-helpers';\nimport { sleep, notEmpty } from '@milaboratories/ts-helpers';\nimport type { DownloadBinaryResult } from '../common/pl_binary_download';\nimport { downloadBinaryNoExtract } from '../common/pl_binary_download';\nimport upath from 'upath';\nimport * as plpath from './pl_paths';\nimport { getDefaultPlVersion } from '../common/pl_version';\nimport type { ProxySettings } from '@milaboratories/pl-http';\nimport { defaultHttpDispatcher } from '@milaboratories/pl-http';\nimport type { Dispatcher } from 'undici';\n\nimport net from 'node:net';\nimport type { PlConfig, PlLicenseMode, SshPlConfigGenerationResult } from '@milaboratories/pl-config';\nimport { getFreePort, generateSshPlConfigs } from '@milaboratories/pl-config';\nimport type { SupervisorStatus } from './supervisord';\nimport { supervisorStatus, supervisorStop as supervisorCtlShutdown, generateSupervisordConfigWithMinio, supervisorCtlStart, isSupervisordRunning, generateSupervisordConfig, isAllAlive } from './supervisord';\nimport type { ConnectionInfo, SshPlPorts } from './connection_info';\nimport { newConnectionInfo, parseConnectionInfo, stringifyConnectionInfo } from './connection_info';\nimport type { PlBinarySourceDownload } from '../common/pl_binary';\n\nconst minRequiredGlibcVersion = 2.28;\n\nexport class SshPl {\n private initState: PlatformaInitState = { step: 'init' };\n constructor(\n public readonly logger: MiLogger,\n public readonly sshClient: SshClient,\n private readonly username: string,\n ) { }\n\n public info() {\n return {\n username: this.username,\n initState: this.initState,\n };\n }\n\n public static async init(logger: MiLogger, config: ssh.ConnectConfig): Promise<SshPl> {\n try {\n const sshClient = await SshClient.init(logger, config);\n return new SshPl(logger, sshClient, notEmpty(config.username));\n } catch (e: unknown) {\n logger.error(`Connection error in SshClient.init: ${e}`);\n throw e;\n }\n }\n\n public cleanUp() {\n this.sshClient.close();\n }\n\n /** Provides an info if the platforma and minio are running along with the debug info. */\n public async isAlive(): Promise<SupervisorStatus> {\n const arch = await this.getArch();\n const remoteHome = await this.getUserHomeDirectory();\n return await supervisorStatus(this.logger, this.sshClient, remoteHome, arch.arch);\n }\n\n /** Starts all the services on the server.\n * Idempotent semantic: we could call it several times. */\n public async start(shouldUseMinio: boolean) {\n const arch = await this.getArch();\n const remoteHome = await this.getUserHomeDirectory();\n\n try {\n if (!isAllAlive(await this.isAlive(), shouldUseMinio)) {\n await supervisorCtlStart(this.sshClient, remoteHome, arch.arch);\n\n // We are waiting for Platforma to run to ensure that it has started.\n return await this.checkIsAliveWithInterval(shouldUseMinio);\n }\n } catch (e: unknown) {\n let msg = `SshPl.start: ${e}`;\n\n let logs = '';\n try {\n logs = await this.sshClient.readFile(plpath.platformaCliLogs(remoteHome));\n msg += `, platforma cli logs: ${logs}`;\n } catch (e: unknown) {\n msg += `, Can not read platforma cli logs: ${e}`;\n }\n\n this.logger.error(msg);\n throw new Error(msg);\n }\n }\n\n /** Stops all the services on the server.\n * Idempotent semantic: we could call it several times. */\n public async stop() {\n const arch = await this.getArch();\n const remoteHome = await this.getUserHomeDirectory();\n\n try {\n const alive = await this.isAlive();\n if (isSupervisordRunning(alive)) {\n await supervisorCtlShutdown(this.sshClient, remoteHome, arch.arch);\n // Check if Minio is running by looking at the alive status\n const shouldUseMinio = alive.minio === true;\n return await this.checkIsAliveWithInterval(shouldUseMinio, 1000, 15, false);\n }\n } catch (e: unknown) {\n const msg = `PlSsh.stop: ${e}`;\n this.logger.error(msg);\n throw new Error(msg);\n }\n }\n\n /** Stops the services, deletes a directory with the state and closes SSH connection. */\n public async reset(): Promise<boolean> {\n await this.stopAndClean();\n this.cleanUp();\n return true;\n }\n\n /** Stops platforma and deletes its state. */\n public async stopAndClean(): Promise<void> {\n const remoteHome = await this.getUserHomeDirectory();\n\n this.logger.info(`pl.reset: Stop Platforma on the server`);\n await this.stop();\n\n this.logger.info(`pl.reset: Deleting Platforma workDir ${plpath.workDir(remoteHome)} on the server`);\n await this.sshClient.deleteFolder(plpath.workDir(remoteHome));\n }\n\n /** Downloads binaries and untar them on the server,\n * generates all the configs, creates necessary dirs,\n * and finally starts all the services. */\n public async platformaInit(options: SshPlConfig): Promise<ConnectionInfo> {\n const state: PlatformaInitState = { localWorkdir: options.localWorkdir, step: 'init' };\n\n const { onProgress } = options;\n\n // merge options with default ops.\n const ops: SshPlConfig = {\n ...defaultSshPlConfig,\n ...options,\n };\n state.plBinaryOps = ops.plBinary;\n\n try {\n await this.doStepDetectArch(state, onProgress);\n await this.doStepDetectHome(state, onProgress);\n\n const needRestartPlatforma = await this.doStepReadExistedConfig(state, ops, onProgress);\n if (!needRestartPlatforma) {\n await onProgress?.('Platforma is already running. Skipping initialization.');\n return state.existedSettings!;\n }\n await this.doStepStopExistedPlatforma(state, onProgress);\n await this.doStepCheckDbLock(state, onProgress);\n\n await onProgress?.('Installation platforma...');\n\n await this.doStepDownloadBinaries(state, onProgress, ops);\n await this.doStepFetchPorts(state);\n await this.doStepGenerateNewConfig(state, onProgress, ops);\n await this.doStepCreateFoldersAndSaveFiles(state, onProgress);\n await this.doStepConfigureSupervisord(state, onProgress);\n await this.doStepSaveNewConnectionInfo(state, onProgress, ops);\n await this.doStepStartPlatforma(state, onProgress);\n\n return state.connectionInfo!;\n } catch (e: unknown) {\n const msg = `SshPl.platformaInit: ${e}, state: ${JSON.stringify(this.removeSensitiveData(state))}`;\n this.logger.error(msg);\n\n throw new Error(msg);\n }\n }\n\n private async doStepStopExistedPlatforma(state: PlatformaInitState, onProgress: ((...args: any) => Promise<any>) | undefined) {\n state.step = 'stopExistedPlatforma';\n if (!isAllAlive(state.alive!, state.shouldUseMinio ?? false)) {\n return;\n }\n\n await onProgress?.('Stopping services...');\n await this.stop();\n }\n\n private removeSensitiveData(state: PlatformaInitState): PlatformaInitState {\n const stateCopy = { ...state };\n stateCopy.generatedConfig = { ...stateCopy.generatedConfig, filesToCreate: { skipped: 'sanitized' } } as SshPlConfigGenerationResult;\n return stateCopy;\n }\n\n private async doStepStartPlatforma(state: PlatformaInitState, onProgress: ((...args: any) => Promise<any>) | undefined) {\n state.step = 'startPlatforma';\n await onProgress?.('Starting Platforma on the server...');\n await this.start(state.shouldUseMinio ?? false);\n state.started = true;\n this.initState = state;\n\n await onProgress?.('Platforma has been started successfully.');\n }\n\n private async doStepSaveNewConnectionInfo(state: PlatformaInitState, onProgress: ((...args: any) => Promise<any>) | undefined, ops: SshPlConfig) {\n state.step = 'saveNewConnectionInfo';\n const config = state.generatedConfig!;\n await onProgress?.('Saving connection information...');\n state.connectionInfo = newConnectionInfo(\n config.plUser,\n config.plPassword,\n state.ports!,\n notEmpty(ops.useGlobalAccess),\n ops.plBinary!.version,\n state.shouldUseMinio ?? false,\n );\n await this.sshClient.writeFileOnTheServer(\n plpath.connectionInfo(state.remoteHome!),\n stringifyConnectionInfo(state.connectionInfo),\n );\n await onProgress?.('Connection information saved.');\n }\n\n private async doStepCheckDbLock(\n state: PlatformaInitState,\n onProgress?: (...args: any[]) => Promise<any>,\n ) {\n const removeLockFile = async (lockFilePath: string) => {\n try {\n await this.sshClient.exec(`rm -f ${lockFilePath}`);\n this.logger.info(`Removed stale lock file ${lockFilePath}`);\n } catch (e: unknown) {\n const msg = `Failed to remove stale lock file ${lockFilePath}: ${e}`;\n this.logger.error(msg);\n throw new Error(msg);\n }\n };\n\n state.step = 'checkDbLock';\n await onProgress?.('Checking for DB lock...');\n\n const lockFilePath = plpath.platformaDbLock(state.remoteHome!);\n const lockFileExists = await this.sshClient.checkFileExists(lockFilePath);\n\n if (!lockFileExists) {\n await onProgress?.('No DB lock found. Proceeding...');\n return;\n }\n\n this.logger.info(`DB lock file found at ${lockFilePath}. Checking which process holds it...`);\n const lockProcessInfo = await this.findLockHolder(lockFilePath);\n\n if (!lockProcessInfo) {\n this.logger.warn('Lock file exists but no process is holding it. Removing stale lock file...');\n await removeLockFile(lockFilePath);\n return;\n }\n\n this.logger.info(\n `Found process ${lockProcessInfo.pid} (user: ${lockProcessInfo.user}) holding DB lock`,\n );\n\n if (lockProcessInfo.user !== this.username) {\n const msg\n = `DB lock is held by process ${lockProcessInfo.pid} `\n + `owned by user '${lockProcessInfo.user}', but current user is '${this.username}'. `\n + 'Cannot kill process owned by different user.';\n this.logger.error(msg);\n throw new Error(msg);\n }\n\n this.logger.info(`Process ${lockProcessInfo.pid} belongs to current user ${this.username}. Killing it...`);\n await this.killRemoteProcess(lockProcessInfo.pid);\n this.logger.info('Process holding DB lock has been terminated.');\n\n // Verify lock file is gone or can be removed\n const lockStillExists = await this.sshClient.checkFileExists(lockFilePath);\n if (lockStillExists) {\n await removeLockFile(lockFilePath);\n }\n }\n\n private async doStepConfigureSupervisord(state: PlatformaInitState, onProgress: ((...args: any) => Promise<any>) | undefined) {\n await onProgress?.('Writing supervisord configuration...');\n state.step = 'configureSupervisord';\n\n const config = state.generatedConfig!;\n\n let supervisorConfig: string;\n if (state.shouldUseMinio) {\n supervisorConfig = generateSupervisordConfigWithMinio(\n config.minioConfig.storageDir,\n config.minioConfig.envs,\n await this.getFreePortForPlatformaOnServer(state.remoteHome!, state.arch!),\n config.workingDir,\n config.plConfig.configPath,\n state.binPaths!.minioRelPath!,\n state.binPaths!.downloadedPl,\n );\n } else {\n supervisorConfig = generateSupervisordConfig(\n await this.getFreePortForPlatformaOnServer(state.remoteHome!, state.arch!),\n config.workingDir,\n config.plConfig.configPath,\n state.binPaths!.downloadedPl,\n );\n }\n\n const writeResult = await this.sshClient.writeFileOnTheServer(plpath.supervisorConf(state.remoteHome!), supervisorConfig);\n if (!writeResult) {\n throw new Error(`Can not write supervisord config on the server ${plpath.workDir(state.remoteHome!)}`);\n }\n await onProgress?.('Supervisord configuration written.');\n }\n\n private async doStepCreateFoldersAndSaveFiles(state: PlatformaInitState, onProgress: ((...args: any) => Promise<any>) | undefined) {\n state.step = 'createFoldersAndSaveFiles';\n const config = state.generatedConfig!;\n await onProgress?.('Generating folder structure...');\n for (const [filePath, content] of Object.entries(config.filesToCreate)) {\n await this.sshClient.writeFileOnTheServer(filePath, content);\n this.logger.info(`Created file ${filePath}`);\n }\n\n for (const dir of config.dirsToCreate) {\n await this.sshClient.ensureRemoteDirCreated(dir);\n this.logger.info(`Created directory ${dir}`);\n }\n await onProgress?.('Folder structure created.');\n }\n\n private async doStepGenerateNewConfig(state: PlatformaInitState, onProgress: ((...args: any) => Promise<any>) | undefined, ops: SshPlConfig) {\n state.step = 'generateNewConfig';\n\n await onProgress?.('Generating new config...');\n const config = await generateSshPlConfigs({\n logger: this.logger,\n workingDir: plpath.workDir(state.remoteHome!),\n portsMode: {\n type: 'customWithMinio',\n ports: {\n debug: state.ports!.debug.remote,\n grpc: state.ports!.grpc.remote,\n http: state.ports!.http!.remote,\n minio: state.ports!.minioPort.remote,\n minioConsole: state.ports!.minioConsolePort.remote,\n monitoring: state.ports!.monitoring.remote,\n\n httpLocal: state.ports!.http!.local,\n grpcLocal: state.ports!.grpc.local,\n minioLocal: state.ports!.minioPort.local,\n },\n },\n licenseMode: ops.license,\n useGlobalAccess: notEmpty(ops.useGlobalAccess),\n plConfigPostprocessing: ops.plConfigPostprocessing,\n useMinio: state.shouldUseMinio ?? false,\n });\n state.generatedConfig = { ...config };\n await onProgress?.('New config generated');\n }\n\n private async doStepFetchPorts(state: PlatformaInitState) {\n state.step = 'fetchPorts';\n state.ports = await this.fetchPorts(state.remoteHome!, state.arch!);\n\n if (!state.ports.debug.remote\n || !state.ports.grpc.remote\n || !state.ports.minioPort.remote\n || !state.ports.minioConsolePort.remote\n || !state.ports.monitoring.remote\n || !state.ports.http?.remote) {\n throw new Error(`SshPl.platformaInit: remote ports are not defined`);\n }\n }\n\n private async doStepDownloadBinaries(state: PlatformaInitState, onProgress: ((...args: any) => Promise<any>) | undefined, ops: SshPlConfig) {\n state.step = 'downloadBinaries';\n await onProgress?.('Downloading and uploading required binaries...');\n\n const glibcVersion = await getGlibcVersion(this.logger, this.sshClient);\n if (glibcVersion < minRequiredGlibcVersion)\n throw new Error(`glibc version ${glibcVersion} is too old. Version ${minRequiredGlibcVersion} or higher is required for Platforma.`);\n\n const downloadRes = await this.downloadBinariesAndUploadToTheServer(\n ops.localWorkdir, ops.plBinary!, state.remoteHome!, state.arch!, state.shouldUseMinio ?? false,\n ops.proxy,\n );\n await onProgress?.('All required binaries have been downloaded and uploaded.');\n\n state.binPaths = { ...downloadRes, history: undefined };\n state.downloadedBinaries = downloadRes.history;\n }\n\n private async doStepDetectArch(state: PlatformaInitState, onProgress: ((...args: any) => Promise<any>) | undefined) {\n state.step = 'detectArch';\n await onProgress?.('Detecting server architecture...');\n state.arch = await this.getArch();\n await onProgress?.('Server architecture detected.');\n }\n\n private async doStepDetectHome(state: PlatformaInitState, onProgress: ((...args: any) => Promise<any>) | undefined) {\n state.step = 'detectHome';\n await onProgress?.('Fetching user home directory...');\n state.remoteHome = await this.getUserHomeDirectory();\n await onProgress?.('User home directory retrieved.');\n }\n\n private async doStepReadExistedConfig(\n state: PlatformaInitState,\n ops: SshPlConfig,\n onProgress: ((...args: any) => Promise<any>) | undefined,\n ): Promise<boolean> {\n state.step = 'checkAlive';\n await onProgress?.('Checking platform status...');\n state.alive = await this.isAlive();\n\n if (!state.alive?.platforma) {\n return true;\n }\n\n await onProgress?.('All required services are running.');\n\n state.existedSettings = await this.readExistedConfig(state.remoteHome!);\n if (!state.existedSettings) {\n throw new Error(`SshPl.platformaInit: platforma is alive but existed settings are not found`);\n }\n\n const sameGA = state.existedSettings.useGlobalAccess == ops.useGlobalAccess;\n const samePlVersion = state.existedSettings.plVersion == ops.plBinary!.version;\n state.needRestart = !(sameGA && samePlVersion);\n this.logger.info(`SshPl.platformaInit: need restart? ${state.needRestart}`);\n\n state.shouldUseMinio = state.existedSettings.minioIsUsed;\n if (state.shouldUseMinio) {\n this.logger.info(`SshPl.platformaInit: minio is used`);\n } else {\n this.logger.info(`SshPl.platformaInit: minio is not used`);\n }\n\n if (!state.needRestart) {\n await onProgress?.('Server setup completed.');\n return false;\n }\n\n await onProgress?.('Stopping services...');\n await this.stop();\n\n return true;\n }\n\n public async downloadBinariesAndUploadToTheServer(\n localWorkdir: string,\n plBinary: PlBinarySourceDownload,\n remoteHome: string,\n arch: Arch,\n shouldUseMinio: boolean,\n proxy?: ProxySettings,\n ) {\n const state: DownloadAndUntarState[] = [];\n const dispatcher = defaultHttpDispatcher(proxy);\n try {\n const pl = await this.downloadAndUntar(\n localWorkdir, remoteHome, arch,\n 'pl', `pl-${plBinary.version}`,\n dispatcher,\n );\n state.push(pl);\n\n const supervisor = await this.downloadAndUntar(\n localWorkdir, remoteHome, arch,\n 'supervisord', plpath.supervisordDirName,\n dispatcher,\n );\n state.push(supervisor);\n\n const minioPath = plpath.minioBin(remoteHome, arch.arch);\n if (shouldUseMinio) {\n const minio = await this.downloadAndUntar(\n localWorkdir, remoteHome, arch,\n 'minio', plpath.minioDirName,\n dispatcher,\n );\n state.push(minio);\n await this.sshClient.chmod(minioPath, 0o750);\n }\n\n return {\n history: state,\n minioRelPath: shouldUseMinio ? minioPath : undefined,\n downloadedPl: plpath.platformaBin(remoteHome, arch.arch),\n };\n } catch (e: unknown) {\n const msg = `SshPl.downloadBinariesAndUploadToServer: ${e}, state: ${JSON.stringify(state)}`;\n this.logger.error(msg);\n throw e;\n } finally {\n await dispatcher.close();\n }\n }\n\n private async findLockHolderWithLsof(lockFilePath: string): Promise<LockProcessInfo | null> {\n try {\n const { stdout } = await this.sshClient.exec(`lsof ${lockFilePath} 2>/dev/null || true`);\n const output = stdout.trim();\n if (!output) {\n return null;\n }\n\n // Example:\n // COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME\n // platforma 11628 rfiskov 10u REG 1,16 0 66670038 ./LOCK\n const lines = output.split('\\n');\n if (lines.length <= 1) {\n return null;\n }\n\n const parts = lines[1].trim().split(/\\s+/);\n if (parts.length < 3) {\n return null;\n }\n\n const pid = Number.parseInt(parts[1], 10);\n const user = parts[2];\n\n return Number.isNaN(pid) || !user ? null : { pid, user };\n } catch (e: unknown) {\n this.logger.warn(`Failed to use lsof to check lock: ${e}`);\n return null;\n }\n }\n\n private async findLockHolderWithFuser(lockFilePath: string): Promise<LockProcessInfo | null> {\n try {\n const { stdout } = await this.sshClient.exec(`fuser ${lockFilePath} 2>/dev/null || true`);\n const output = stdout.trim();\n if (!output) {\n return null;\n }\n\n // Example: ./LOCK: 11628\n const match = output.match(/: (\\d+)/);\n if (!match) {\n return null;\n }\n\n const pid = Number.parseInt(match[1], 10);\n if (Number.isNaN(pid)) {\n return null;\n }\n\n try {\n const psResult = await this.sshClient.exec(`ps -o user= -p ${pid} 2>/dev/null || true`);\n const user = psResult.stdout.trim();\n return user ? { pid, user } : null;\n } catch (e: unknown) {\n this.logger.warn(`Failed to get user for PID ${pid}: ${e}`);\n return null;\n }\n } catch (e: unknown) {\n this.logger.warn(`Failed to use fuser to check lock: ${e}`);\n return null;\n }\n }\n\n private async findLockHolder(lockFilePath: string): Promise<LockProcessInfo | null> {\n const viaLsof = await this.findLockHolderWithLsof(lockFilePath);\n if (viaLsof) {\n return viaLsof;\n }\n return this.findLockHolderWithFuser(lockFilePath);\n }\n\n private async killRemoteProcess(pid: number): Promise<void> {\n this.logger.info(`Killing process ${pid}...`);\n\n try {\n // Try graceful termination first\n await this.sshClient.exec(`kill ${pid} 2>/dev/null || true`);\n await sleep(1000);\n\n // Check if process still exists\n try {\n await this.sshClient.exec(`kill -0 ${pid} 2>/dev/null`);\n // Process still exists, force kill\n this.logger.warn(`Process ${pid} still alive after SIGTERM, forcing kill...`);\n await this.sshClient.exec(`kill -9 ${pid} 2>/dev/null || true`);\n await sleep(500);\n } catch {\n // Process is dead, nothing to do\n }\n } catch (e: unknown) {\n const msg = `Failed to kill process ${pid}: ${e}`;\n this.logger.error(msg);\n throw new Error(msg);\n }\n }\n\n /** We have to extract pl in the remote server,\n * because Windows doesn't support symlinks\n * that are found in Linux pl binaries tgz archive.\n * For this reason, we extract all to the remote server.\n * It requires `tar` to be installed on the server\n * (it's not installed for Rocky Linux for example). */\n public async downloadAndUntar(\n localWorkdir: string,\n remoteHome: string,\n arch: Arch,\n softwareName: string,\n tgzName: string,\n dispatcher?: Dispatcher,\n ): Promise<DownloadAndUntarState> {\n const state: DownloadAndUntarState = {};\n state.binBasePath = plpath.binariesDir(remoteHome);\n await this.sshClient.ensureRemoteDirCreated(state.binBasePath);\n state.binBasePathCreated = true;\n\n let downloadBinaryResult: DownloadBinaryResult | null = null;\n const attempts = 5;\n for (let i = 1; i <= attempts; i++) {\n try {\n downloadBinaryResult = await downloadBinaryNoExtract({\n logger: this.logger,\n baseDir: localWorkdir,\n softwareName,\n tgzName,\n arch: arch.arch,\n platform: arch.platform,\n dispatcher,\n });\n break;\n } catch (e: unknown) {\n await sleep(300);\n if (i == attempts) {\n throw new Error(`downloadAndUntar: ${attempts} attempts, last error: ${e}`);\n }\n }\n }\n state.downloadResult = notEmpty(downloadBinaryResult);\n\n state.localArchivePath = upath.resolve(state.downloadResult.archivePath);\n state.remoteDir = upath.join(state.binBasePath, state.downloadResult.baseName);\n state.remoteArchivePath = state.remoteDir + '.tgz';\n\n await this.sshClient.ensureRemoteDirCreated(state.remoteDir);\n await this.sshClient.uploadFile(state.localArchivePath, state.remoteArchivePath);\n state.uploadDone = true;\n\n try {\n await this.sshClient.exec('hash tar');\n } catch (_) {\n throw new Error(`tar is not installed on the server. Please install it before running Platforma.`);\n }\n\n // TODO: Create a proper archive to avoid xattr warnings\n const untarResult = await this.sshClient.exec(\n `tar --warning=no-all -xvf ${state.remoteArchivePath} --directory=${state.remoteDir}`,\n );\n\n if (untarResult.stderr)\n throw new Error(`downloadAndUntar: untar: stderr occurred: ${untarResult.stderr}, stdout: ${untarResult.stdout}`);\n\n state.untarDone = true;\n\n return state;\n }\n\n public async needDownload(remoteHome: string, arch: Arch) {\n const checkPathSupervisor = plpath.supervisorBin(remoteHome, arch.arch);\n const checkPathMinio = plpath.minioDir(remoteHome, arch.arch);\n const checkPathPlatforma = plpath.platformaBin(remoteHome, arch.arch);\n\n if (!await this.sshClient.checkFileExists(checkPathPlatforma)\n || !await this.sshClient.checkFileExists(checkPathMinio)\n || !await this.sshClient.checkFileExists(checkPathSupervisor)) {\n return true;\n }\n\n return false;\n }\n\n public async checkIsAliveWithInterval(shouldUseMinio: boolean, interval: number = 1000, count = 15, shouldStart = true): Promise<void> {\n const maxMs = count * interval;\n\n let total = 0;\n let alive = await this.isAlive();\n while (shouldStart ? !isAllAlive(alive, shouldUseMinio) : isAllAlive(alive, shouldUseMinio)) {\n await sleep(interval);\n total += interval;\n if (total > maxMs) {\n throw new Error(`isAliveWithInterval: The process did not ${shouldStart ? 'started' : 'stopped'} after ${maxMs} ms. Live status: ${JSON.stringify(alive)}`);\n }\n alive = await this.isAlive();\n }\n }\n\n public async readExistedConfig(remoteHome: string): Promise<ConnectionInfo> {\n const connectionInfo = await this.sshClient.readFile(plpath.connectionInfo(remoteHome));\n return parseConnectionInfo(connectionInfo);\n }\n\n public async fetchPorts(remoteHome: string, arch: Arch): Promise<SshPlPorts> {\n const ports: SshPlPorts = {\n grpc: {\n local: await getFreePort(),\n remote: await this.getFreePortForPlatformaOnServer(remoteHome, arch),\n },\n monitoring: {\n local: await getFreePort(),\n remote: await this.getFreePortForPlatformaOnServer(remoteHome, arch),\n },\n debug: {\n local: await getFreePort(),\n remote: await this.getFreePortForPlatformaOnServer(remoteHome, arch),\n },\n http: {\n local: await getFreePort(),\n remote: await this.getFreePortForPlatformaOnServer(remoteHome, arch),\n },\n minioPort: {\n local: await getFreePort(),\n remote: await this.getFreePortForPlatformaOnServer(remoteHome, arch),\n },\n minioConsolePort: {\n local: await getFreePort(),\n remote: await this.getFreePortForPlatformaOnServer(remoteHome, arch),\n },\n };\n\n return ports;\n }\n\n public async getLocalFreePort(): Promise<number> {\n return new Promise((res) => {\n const srv = net.createServer();\n srv.listen(0, () => {\n const port = (srv.address() as net.AddressInfo).port;\n srv.close((_) => res(port));\n });\n });\n }\n\n public async getFreePortForPlatformaOnServer(remoteHome: string, arch: Arch): Promise<number> {\n const freePortBin = plpath.platformaFreePortBin(remoteHome, arch.arch);\n\n const { stdout, stderr } = await this.sshClient.exec(`${freePortBin}`);\n if (stderr) {\n throw new Error(`getFreePortForPlatformaOnServer: stderr is not empty: ${stderr}, stdout: ${stdout}`);\n }\n\n return +stdout;\n }\n\n public async getArch(): Promise<Arch> {\n const { stdout, stderr } = await this.sshClient.exec('uname -s && uname -m');\n if (stderr)\n throw new Error(`getArch: stderr is not empty: ${stderr}, stdout: ${stdout}`);\n\n const arr = stdout.split('\\n');\n\n return {\n platform: arr[0],\n arch: arr[1],\n };\n }\n\n public async getUserHomeDirectory() {\n const { stdout, stderr } = await this.sshClient.exec('echo $HOME');\n\n if (stderr) {\n const home = `/home/${this.username}`;\n console.warn(`getUserHomeDirectory: stderr is not empty: ${stderr}, stdout: ${stdout}, will get a default home: ${home}`);\n\n return home;\n }\n\n return stdout.trim();\n }\n}\n\ntype Arch = { platform: string; arch: string };\n\nexport type SshPlConfig = {\n localWorkdir: string;\n license: PlLicenseMode;\n useGlobalAccess?: boolean;\n plBinary?: PlBinarySourceDownload;\n proxy?: ProxySettings;\n\n onProgress?: (...args: any) => Promise<any>;\n plConfigPostprocessing?: (config: PlConfig) => PlConfig;\n};\n\nexport type LockProcessInfo = { pid: number; user: string };\n\nconst defaultSshPlConfig: Pick<\n SshPlConfig,\n | 'useGlobalAccess'\n | 'plBinary'\n> = {\n useGlobalAccess: false,\n plBinary: {\n type: 'Download',\n version: getDefaultPlVersion(),\n },\n};\n\ntype BinPaths = {\n history?: DownloadAndUntarState[];\n minioRelPath?: string;\n downloadedPl: string;\n};\n\ntype DownloadAndUntarState = {\n binBasePath?: string;\n binBasePathCreated?: boolean;\n downloadResult?: DownloadBinaryResult;\n attempts?: number;\n\n localArchivePath?: string;\n remoteDir?: string;\n remoteArchivePath?: string;\n uploadDone?: boolean;\n untarDone?: boolean;\n};\n\ntype PlatformaInitStep =\n 'init'\n | 'detectArch'\n | 'detectHome'\n | 'checkAlive'\n | 'stopExistedPlatforma'\n | 'checkDbLock'\n | 'downloadBinaries'\n | 'fetchPorts'\n | 'generateNewConfig'\n | 'createFoldersAndSaveFiles'\n | 'configureSupervisord'\n | 'saveNewConnectionInfo'\n | 'startPlatforma';\n\ntype PlatformaInitState = {\n step: PlatformaInitStep;\n localWorkdir?: string;\n plBinaryOps?: PlBinarySourceDownload;\n arch?: Arch;\n remoteHome?: string;\n alive?: SupervisorStatus;\n existedSettings?: ConnectionInfo;\n needRestart?: boolean;\n shouldUseMinio?: boolean;\n downloadedBinaries?: DownloadAndUntarState[];\n binPaths?: BinPaths;\n ports?: SshPlPorts;\n generatedConfig?: SshPlConfigGenerationResult;\n connectionInfo?: ConnectionInfo;\n started?: boolean;\n};\n\n/**\n * Gets the glibc version on the remote system\n * @returns The glibc version as a number\n * @throws Error if version cannot be determined\n */\nasync function getGlibcVersion(logger: MiLogger, sshClient: SshClient): Promise <number> {\n try {\n const { stdout, stderr } = await sshClient.exec('ldd --version | head -n 1');\n if (stderr) {\n throw new Error(`Failed to check glibc version: ${stderr}`);\n }\n return parseGlibcVersion(stdout);\n } catch (e: unknown) {\n logger.error(`glibc version check failed: ${e}`);\n throw e;\n }\n}\n\nexport function parseGlibcVersion(output: string): number {\n const versionMatch = output.match(/\\d+\\.\\d+/);\n if (!versionMatch) {\n throw new Error(`Could not parse glibc version from: ${output}`);\n }\n\n return parseFloat(versionMatch[0]);\n}\n"],"names":["plpath.platformaCliLogs","supervisorCtlShutdown","plpath.workDir","plpath.connectionInfo","plpath.platformaDbLock","plpath.supervisorConf","plpath.supervisordDirName","plpath.minioBin","plpath.minioDirName","plpath.platformaBin","plpath.binariesDir","plpath.supervisorBin","plpath.minioDir","connectionInfo","plpath.platformaFreePortBin"],"mappings":";;;;;;;;;;;;AAsBA,MAAM,uBAAuB,GAAG,IAAI;MAEvB,KAAK,CAAA;AAGE,IAAA,MAAA;AACA,IAAA,SAAA;AACC,IAAA,QAAA;AAJX,IAAA,SAAS,GAAuB,EAAE,IAAI,EAAE,MAAM,EAAE;AACxD,IAAA,WAAA,CACkB,MAAgB,EAChB,SAAoB,EACnB,QAAgB,EAAA;QAFjB,IAAA,CAAA,MAAM,GAAN,MAAM;QACN,IAAA,CAAA,SAAS,GAAT,SAAS;QACR,IAAA,CAAA,QAAQ,GAAR,QAAQ;IACvB;IAEG,IAAI,GAAA;QACT,OAAO;YACL,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B;IACH;AAEO,IAAA,aAAa,IAAI,CAAC,MAAgB,EAAE,MAAyB,EAAA;AAClE,QAAA,IAAI;YACF,MAAM,SAAS,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC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
function platformaCliLogs(remoteHome) {
|
|
48
48
|
return upath.join(workDir(remoteHome), 'platforma_cli_logs.log');
|
|
49
49
|
}
|
|
50
|
+
function platformaDbLock(remoteHome) {
|
|
51
|
+
return upath.join(workDir(remoteHome), 'db', 'LOCK');
|
|
52
|
+
}
|
|
50
53
|
|
|
51
54
|
exports.binariesDir = binariesDir;
|
|
52
55
|
exports.connectionInfo = connectionInfo;
|
|
@@ -56,6 +59,7 @@ exports.minioDirName = minioDirName;
|
|
|
56
59
|
exports.platformaBaseDir = platformaBaseDir;
|
|
57
60
|
exports.platformaBin = platformaBin;
|
|
58
61
|
exports.platformaCliLogs = platformaCliLogs;
|
|
62
|
+
exports.platformaDbLock = platformaDbLock;
|
|
59
63
|
exports.platformaDir = platformaDir;
|
|
60
64
|
exports.platformaFreePortBin = platformaFreePortBin;
|
|
61
65
|
exports.supervisorBin = supervisorBin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pl_paths.cjs","sources":["../../src/ssh/pl_paths.ts"],"sourcesContent":["/** Just a lot of hardcoded paths of our current ssh deployment. */\n\nimport upath from 'upath';\nimport { newArch } from '../common/os_and_arch';\nimport { getDefaultPlVersion } from '../common/pl_version';\n\nexport const minioDirName = 'minio-2024-12-18T13-15-44Z';\nexport const supervisordDirName = 'supervisord-0.7.3';\nexport const supervisordSubDirName = 'supervisord_0.7.3_Linux_64-bit';\n\nexport function workDir(remoteHome: string) {\n return upath.join(remoteHome, '.platforma_ssh');\n}\n\nexport function binariesDir(remoteHome: string) {\n return upath.join(workDir(remoteHome), 'binaries');\n}\n\nexport function platformaBaseDir(remoteHome: string, arch: string) {\n return upath.join(binariesDir(remoteHome), `pl-${getDefaultPlVersion()}-${newArch(arch)}`);\n}\n\nexport function platformaDir(remoteHome: string, arch: string) {\n return upath.join(platformaBaseDir(remoteHome, arch), 'binaries');\n}\n\nexport function platformaBin(remoteHome: string, arch: string): string {\n return upath.join(platformaDir(remoteHome, arch), 'platforma');\n}\n\nexport function platformaConf(remoteHome: string): string {\n return upath.join(workDir(remoteHome), 'config.yaml');\n}\n\nexport function platformaFreePortBin(remoteHome: string, arch: string): string {\n return upath.join(platformaDir(remoteHome, arch), 'free-port');\n}\n\nexport function minioDir(remoteHome: string, arch: string) {\n return upath.join(binariesDir(remoteHome), `minio-2024-12-18T13-15-44Z-${newArch(arch)}`);\n}\n\nexport function minioBin(remoteHome: string, arch: string) {\n return upath.join(minioDir(remoteHome, arch), 'minio');\n}\n\nexport function supervisorBinDir(remoteHome: string, arch: string) {\n return upath.join(binariesDir(remoteHome), `supervisord-0.7.3-${newArch(arch)}`, supervisordSubDirName);\n}\n\nexport function supervisorBin(remoteHome: string, arch: string): string {\n return upath.join(supervisorBinDir(remoteHome, arch), 'supervisord');\n}\n\nexport function supervisorConf(remoteHome: string) {\n return upath.join(workDir(remoteHome), 'supervisor.conf');\n}\n\nexport function connectionInfo(remoteHome: string) {\n return upath.join(workDir(remoteHome), `connection.txt`);\n}\n\nexport function platformaCliLogs(remoteHome: string) {\n return upath.join(workDir(remoteHome), 'platforma_cli_logs.log');\n}\n"],"names":["getDefaultPlVersion","newArch"],"mappings":";;;;;;AAAA;AAMO,MAAM,YAAY,GAAG;AACrB,MAAM,kBAAkB,GAAG;AAC3B,MAAM,qBAAqB,GAAG;AAE/B,SAAU,OAAO,CAAC,UAAkB,EAAA;IACxC,OAAO,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,gBAAgB,CAAC;AACjD;AAEM,SAAU,WAAW,CAAC,UAAkB,EAAA;IAC5C,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC;AACpD;AAEM,SAAU,gBAAgB,CAAC,UAAkB,EAAE,IAAY,EAAA;AAC/D,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,MAAMA,8BAAmB,EAAE,IAAIC,mBAAO,CAAC,IAAI,CAAC,CAAA,CAAE,CAAC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AK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,iBAAiB,CAAC;AAC3D;AAEM,SAAU,cAAc,CAAC,UAAkB,EAAA;IAC/C,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAA,cAAA,CAAgB,CAAC;AAC1D;AAEM,SAAU,gBAAgB,CAAC,UAAkB,EAAA;IACjD,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,wBAAwB,CAAC;AAClE
|
|
1
|
+
{"version":3,"file":"pl_paths.cjs","sources":["../../src/ssh/pl_paths.ts"],"sourcesContent":["/** Just a lot of hardcoded paths of our current ssh deployment. */\n\nimport upath from 'upath';\nimport { newArch } from '../common/os_and_arch';\nimport { getDefaultPlVersion } from '../common/pl_version';\n\nexport const minioDirName = 'minio-2024-12-18T13-15-44Z';\nexport const supervisordDirName = 'supervisord-0.7.3';\nexport const supervisordSubDirName = 'supervisord_0.7.3_Linux_64-bit';\n\nexport function workDir(remoteHome: string) {\n return upath.join(remoteHome, '.platforma_ssh');\n}\n\nexport function binariesDir(remoteHome: string) {\n return upath.join(workDir(remoteHome), 'binaries');\n}\n\nexport function platformaBaseDir(remoteHome: string, arch: string) {\n return upath.join(binariesDir(remoteHome), `pl-${getDefaultPlVersion()}-${newArch(arch)}`);\n}\n\nexport function platformaDir(remoteHome: string, arch: string) {\n return upath.join(platformaBaseDir(remoteHome, arch), 'binaries');\n}\n\nexport function platformaBin(remoteHome: string, arch: string): string {\n return upath.join(platformaDir(remoteHome, arch), 'platforma');\n}\n\nexport function platformaConf(remoteHome: string): string {\n return upath.join(workDir(remoteHome), 'config.yaml');\n}\n\nexport function platformaFreePortBin(remoteHome: string, arch: string): string {\n return upath.join(platformaDir(remoteHome, arch), 'free-port');\n}\n\nexport function minioDir(remoteHome: string, arch: string) {\n return upath.join(binariesDir(remoteHome), `minio-2024-12-18T13-15-44Z-${newArch(arch)}`);\n}\n\nexport function minioBin(remoteHome: string, arch: string) {\n return upath.join(minioDir(remoteHome, arch), 'minio');\n}\n\nexport function supervisorBinDir(remoteHome: string, arch: string) {\n return upath.join(binariesDir(remoteHome), `supervisord-0.7.3-${newArch(arch)}`, supervisordSubDirName);\n}\n\nexport function supervisorBin(remoteHome: string, arch: string): string {\n return upath.join(supervisorBinDir(remoteHome, arch), 'supervisord');\n}\n\nexport function supervisorConf(remoteHome: string) {\n return upath.join(workDir(remoteHome), 'supervisor.conf');\n}\n\nexport function connectionInfo(remoteHome: string) {\n return upath.join(workDir(remoteHome), `connection.txt`);\n}\n\nexport function platformaCliLogs(remoteHome: string) {\n return upath.join(workDir(remoteHome), 'platforma_cli_logs.log');\n}\n\nexport function platformaDbLock(remoteHome: string) {\n return upath.join(workDir(remoteHome), 'db', 'LOCK');\n}\n"],"names":["getDefaultPlVersion","newArch"],"mappings":";;;;;;AAAA;AAMO,MAAM,YAAY,GAAG;AACrB,MAAM,kBAAkB,GAAG;AAC3B,MAAM,qBAAqB,GAAG;AAE/B,SAAU,OAAO,CAAC,UAAkB,EAAA;IACxC,OAAO,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,gBAAgB,CAAC;AACjD;AAEM,SAAU,WAAW,CAAC,UAAkB,EAAA;IAC5C,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC;AACpD;AAEM,SAAU,gBAAgB,CAAC,UAAkB,EAAE,IAAY,EAAA;AAC/D,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,MAAMA,8BAAmB,EAAE,IAAIC,mBAAO,CAAC,IAAI,CAAC,CAAA,CAAE,CAAC;AAC5F;AAEM,SAAU,YAAY,CAAC,UAAkB,EAAE,IAAY,EAAA;AAC3D,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE,UAAU,CAAC;AACnE;AAEM,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C,EAAE,CAAA,cAAA,CAAgB,CAAC;AAC1D;AAEM,SAAU,gBAAgB,CAAC,UAAkB,EAAA;IACjD,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,wBAAwB,CAAC;AAClE;AAEM,SAAU,eAAe,CAAC,UAAkB,EAAA;AAChD,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC;AACtD;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/ssh/pl_paths.d.ts
CHANGED
|
@@ -16,4 +16,5 @@ export declare function supervisorBin(remoteHome: string, arch: string): string;
|
|
|
16
16
|
export declare function supervisorConf(remoteHome: string): string;
|
|
17
17
|
export declare function connectionInfo(remoteHome: string): string;
|
|
18
18
|
export declare function platformaCliLogs(remoteHome: string): string;
|
|
19
|
+
export declare function platformaDbLock(remoteHome: string): string;
|
|
19
20
|
//# sourceMappingURL=pl_paths.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pl_paths.d.ts","sourceRoot":"","sources":["../../src/ssh/pl_paths.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAMnE,eAAO,MAAM,YAAY,+BAA+B,CAAC;AACzD,eAAO,MAAM,kBAAkB,sBAAsB,CAAC;AACtD,eAAO,MAAM,qBAAqB,mCAAmC,CAAC;AAEtE,wBAAgB,OAAO,CAAC,UAAU,EAAE,MAAM,UAEzC;AAED,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,UAE7C;AAED,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAEhE;AAED,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAE5D;AAED,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAErE;AAED,wBAAgB,aAAa,CAAC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,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE7E;AAED,wBAAgB,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAExD;AAED,wBAAgB,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAExD;AAED,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAEhE;AAED,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,UAEhD;AAED,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,UAEhD;AAED,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,UAElD;AAED,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,UAEjD"}
|
package/dist/ssh/pl_paths.js
CHANGED
|
@@ -45,6 +45,9 @@ function connectionInfo(remoteHome) {
|
|
|
45
45
|
function platformaCliLogs(remoteHome) {
|
|
46
46
|
return upath.join(workDir(remoteHome), 'platforma_cli_logs.log');
|
|
47
47
|
}
|
|
48
|
+
function platformaDbLock(remoteHome) {
|
|
49
|
+
return upath.join(workDir(remoteHome), 'db', 'LOCK');
|
|
50
|
+
}
|
|
48
51
|
|
|
49
|
-
export { binariesDir, connectionInfo, minioBin, minioDir, minioDirName, platformaBaseDir, platformaBin, platformaCliLogs, platformaDir, platformaFreePortBin, supervisorBin, supervisorBinDir, supervisorConf, supervisordDirName, supervisordSubDirName, workDir };
|
|
52
|
+
export { binariesDir, connectionInfo, minioBin, minioDir, minioDirName, platformaBaseDir, platformaBin, platformaCliLogs, platformaDbLock, platformaDir, platformaFreePortBin, supervisorBin, supervisorBinDir, supervisorConf, supervisordDirName, supervisordSubDirName, workDir };
|
|
50
53
|
//# sourceMappingURL=pl_paths.js.map
|
package/dist/ssh/pl_paths.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pl_paths.js","sources":["../../src/ssh/pl_paths.ts"],"sourcesContent":["/** Just a lot of hardcoded paths of our current ssh deployment. */\n\nimport upath from 'upath';\nimport { newArch } from '../common/os_and_arch';\nimport { getDefaultPlVersion } from '../common/pl_version';\n\nexport const minioDirName = 'minio-2024-12-18T13-15-44Z';\nexport const supervisordDirName = 'supervisord-0.7.3';\nexport const supervisordSubDirName = 'supervisord_0.7.3_Linux_64-bit';\n\nexport function workDir(remoteHome: string) {\n return upath.join(remoteHome, '.platforma_ssh');\n}\n\nexport function binariesDir(remoteHome: string) {\n return upath.join(workDir(remoteHome), 'binaries');\n}\n\nexport function platformaBaseDir(remoteHome: string, arch: string) {\n return upath.join(binariesDir(remoteHome), `pl-${getDefaultPlVersion()}-${newArch(arch)}`);\n}\n\nexport function platformaDir(remoteHome: string, arch: string) {\n return upath.join(platformaBaseDir(remoteHome, arch), 'binaries');\n}\n\nexport function platformaBin(remoteHome: string, arch: string): string {\n return upath.join(platformaDir(remoteHome, arch), 'platforma');\n}\n\nexport function platformaConf(remoteHome: string): string {\n return upath.join(workDir(remoteHome), 'config.yaml');\n}\n\nexport function platformaFreePortBin(remoteHome: string, arch: string): string {\n return upath.join(platformaDir(remoteHome, arch), 'free-port');\n}\n\nexport function minioDir(remoteHome: string, arch: string) {\n return upath.join(binariesDir(remoteHome), `minio-2024-12-18T13-15-44Z-${newArch(arch)}`);\n}\n\nexport function minioBin(remoteHome: string, arch: string) {\n return upath.join(minioDir(remoteHome, arch), 'minio');\n}\n\nexport function supervisorBinDir(remoteHome: string, arch: string) {\n return upath.join(binariesDir(remoteHome), `supervisord-0.7.3-${newArch(arch)}`, supervisordSubDirName);\n}\n\nexport function supervisorBin(remoteHome: string, arch: string): string {\n return upath.join(supervisorBinDir(remoteHome, arch), 'supervisord');\n}\n\nexport function supervisorConf(remoteHome: string) {\n return upath.join(workDir(remoteHome), 'supervisor.conf');\n}\n\nexport function connectionInfo(remoteHome: string) {\n return upath.join(workDir(remoteHome), `connection.txt`);\n}\n\nexport function platformaCliLogs(remoteHome: string) {\n return upath.join(workDir(remoteHome), 'platforma_cli_logs.log');\n}\n"],"names":[],"mappings":";;;;AAAA;AAMO,MAAM,YAAY,GAAG;AACrB,MAAM,kBAAkB,GAAG;AAC3B,MAAM,qBAAqB,GAAG;AAE/B,SAAU,OAAO,CAAC,UAAkB,EAAA;IACxC,OAAO,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,gBAAgB,CAAC;AACjD;AAEM,SAAU,WAAW,CAAC,UAAkB,EAAA;IAC5C,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC;AACpD;AAEM,SAAU,gBAAgB,CAAC,UAAkB,EAAE,IAAY,EAAA;AAC/D,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,MAAM,mBAAmB,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA,CAAE,CAAC;AAC5F;AAEM,SAAU,YAAY,CAAC,UAAkB,EAAE,IAAY,EAAA;AAC3D,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE,UAAU,CAAC;AACnE;AAEM,SAAU,YAAY,CAAC,UAAkB,EAAE,IAAY,EAAA;AAC3D,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE,WAAW,CAAC;AAChE;AAMM,SAAU,oBAAoB,CAAC,UAAkB,EAAE,IAAY,EAAA;AACnE,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE,WAAW,CAAC;AAChE;AAEM,SAAU,QAAQ,CAAC,UAAkB,EAAE,IAAY,EAAA;AACvD,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,CAAA,2BAAA,EAA8B,OAAO,CAAC,IAAI,CAAC,CAAA,CAAE,CAAC;AAC3F;AAEM,SAAU,QAAQ,CAAC,UAAkB,EAAE,IAAY,EAAA;AACvD,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC;AACxD;AAEM,SAAU,gBAAgB,CAAC,UAAkB,EAAE,IAAY,EAAA;AAC/D,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,CAAA,kBAAA,EAAqB,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,qBAAqB,CAAC;AACzG;AAEM,SAAU,aAAa,CAAC,UAAkB,EAAE,IAAY,EAAA;AAC5D,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE,aAAa,CAAC;AACtE;AAEM,SAAU,cAAc,CAAC,UAAkB,EAAA;IAC/C,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,iBAAiB,CAAC;AAC3D;AAEM,SAAU,cAAc,CAAC,UAAkB,EAAA;IAC/C,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAA,cAAA,CAAgB,CAAC;AAC1D;AAEM,SAAU,gBAAgB,CAAC,UAAkB,EAAA;IACjD,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,wBAAwB,CAAC;AAClE;;;;"}
|
|
1
|
+
{"version":3,"file":"pl_paths.js","sources":["../../src/ssh/pl_paths.ts"],"sourcesContent":["/** Just a lot of hardcoded paths of our current ssh deployment. */\n\nimport upath from 'upath';\nimport { newArch } from '../common/os_and_arch';\nimport { getDefaultPlVersion } from '../common/pl_version';\n\nexport const minioDirName = 'minio-2024-12-18T13-15-44Z';\nexport const supervisordDirName = 'supervisord-0.7.3';\nexport const supervisordSubDirName = 'supervisord_0.7.3_Linux_64-bit';\n\nexport function workDir(remoteHome: string) {\n return upath.join(remoteHome, '.platforma_ssh');\n}\n\nexport function binariesDir(remoteHome: string) {\n return upath.join(workDir(remoteHome), 'binaries');\n}\n\nexport function platformaBaseDir(remoteHome: string, arch: string) {\n return upath.join(binariesDir(remoteHome), `pl-${getDefaultPlVersion()}-${newArch(arch)}`);\n}\n\nexport function platformaDir(remoteHome: string, arch: string) {\n return upath.join(platformaBaseDir(remoteHome, arch), 'binaries');\n}\n\nexport function platformaBin(remoteHome: string, arch: string): string {\n return upath.join(platformaDir(remoteHome, arch), 'platforma');\n}\n\nexport function platformaConf(remoteHome: string): string {\n return upath.join(workDir(remoteHome), 'config.yaml');\n}\n\nexport function platformaFreePortBin(remoteHome: string, arch: string): string {\n return upath.join(platformaDir(remoteHome, arch), 'free-port');\n}\n\nexport function minioDir(remoteHome: string, arch: string) {\n return upath.join(binariesDir(remoteHome), `minio-2024-12-18T13-15-44Z-${newArch(arch)}`);\n}\n\nexport function minioBin(remoteHome: string, arch: string) {\n return upath.join(minioDir(remoteHome, arch), 'minio');\n}\n\nexport function supervisorBinDir(remoteHome: string, arch: string) {\n return upath.join(binariesDir(remoteHome), `supervisord-0.7.3-${newArch(arch)}`, supervisordSubDirName);\n}\n\nexport function supervisorBin(remoteHome: string, arch: string): string {\n return upath.join(supervisorBinDir(remoteHome, arch), 'supervisord');\n}\n\nexport function supervisorConf(remoteHome: string) {\n return upath.join(workDir(remoteHome), 'supervisor.conf');\n}\n\nexport function connectionInfo(remoteHome: string) {\n return upath.join(workDir(remoteHome), `connection.txt`);\n}\n\nexport function platformaCliLogs(remoteHome: string) {\n return upath.join(workDir(remoteHome), 'platforma_cli_logs.log');\n}\n\nexport function platformaDbLock(remoteHome: string) {\n return upath.join(workDir(remoteHome), 'db', 'LOCK');\n}\n"],"names":[],"mappings":";;;;AAAA;AAMO,MAAM,YAAY,G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AAC,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC;AACxD;AAEM,SAAU,gBAAgB,CAAC,UAAkB,EAAE,IAAY,EAAA;AAC/D,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,CAAA,kBAAA,EAAqB,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,qBAAqB,CAAC;AACzG;AAEM,SAAU,aAAa,CAAC,UAAkB,EAAE,IAAY,EAAA;AAC5D,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE,aAAa,CAAC;AACtE;AAEM,SAAU,cAAc,CAAC,UAAkB,EAAA;IAC/C,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,iBAAiB,CAAC;AAC3D;AAEM,SAAU,cAAc,CAAC,UAAkB,EAAA;IAC/C,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAA,cAAA,CAAgB,CAAC;AAC1D;AAEM,SAAU,gBAAgB,CAAC,UAAkB,EAAA;IACjD,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,wBAAwB,CAAC;AAClE;AAEM,SAAU,eAAe,CAAC,UAAkB,EAAA;AAChD,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC;AACtD;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/pl-deployments",
|
|
3
|
-
"version": "2.12.
|
|
3
|
+
"version": "2.12.7",
|
|
4
4
|
"pl-version": "1.44.0",
|
|
5
5
|
"description": "MiLaboratories Platforma Backend code service run wrapper",
|
|
6
6
|
"engines": {
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"utility-types": "^3.11.0",
|
|
41
41
|
"vitest": "^4.0.7",
|
|
42
42
|
"@milaboratories/build-configs": "1.0.8",
|
|
43
|
-
"@milaboratories/eslint-config": "1.0.5",
|
|
44
43
|
"@milaboratories/ts-builder": "1.0.5",
|
|
45
|
-
"@milaboratories/ts-configs": "1.0.6"
|
|
44
|
+
"@milaboratories/ts-configs": "1.0.6",
|
|
45
|
+
"@milaboratories/eslint-config": "1.0.5"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"decompress": "^4.2.1",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"upath": "^2.0.1",
|
|
53
53
|
"yaml": "^2.8.0",
|
|
54
54
|
"zod": "~3.23.8",
|
|
55
|
-
"@milaboratories/pl-config": "1.7.9",
|
|
56
55
|
"@milaboratories/pl-model-common": "1.21.7",
|
|
56
|
+
"@milaboratories/pl-config": "1.7.9",
|
|
57
57
|
"@milaboratories/ts-helpers": "1.5.4",
|
|
58
58
|
"@milaboratories/pl-http": "1.2.0"
|
|
59
59
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, it, beforeAll, expect, afterAll } from 'vitest';
|
|
1
|
+
import { describe, it, beforeAll, expect, afterAll, vi } from 'vitest';
|
|
2
2
|
import { initContainer, getConnectionForSsh, cleanUp as cleanUpT, testAssetsPath } from './common-utils';
|
|
3
3
|
import { SshPl } from '../pl';
|
|
4
4
|
import upath from 'upath';
|
|
@@ -189,6 +189,15 @@ describe('SshPl', async () => {
|
|
|
189
189
|
let isAlive = await sshPl?.isAlive();
|
|
190
190
|
expect(isAlive.platforma).toBe(true);
|
|
191
191
|
|
|
192
|
+
// Capture console output to verify lock file handling logs
|
|
193
|
+
const remoteHome = await sshPl.getUserHomeDirectory();
|
|
194
|
+
const expectedLockPath = plpath.platformaDbLock(remoteHome);
|
|
195
|
+
|
|
196
|
+
const consoleLogSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
197
|
+
const consoleErrorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
198
|
+
const consoleInfoSpy = vi.spyOn(console, 'info').mockImplementation(() => {});
|
|
199
|
+
const consoleWarnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
200
|
+
|
|
192
201
|
await sshPl.platformaInit({
|
|
193
202
|
localWorkdir: downloadDestination,
|
|
194
203
|
license: { type: 'env' },
|
|
@@ -196,6 +205,26 @@ describe('SshPl', async () => {
|
|
|
196
205
|
});
|
|
197
206
|
isAlive = await sshPl?.isAlive();
|
|
198
207
|
expect(isAlive.platforma).toBe(true);
|
|
208
|
+
|
|
209
|
+
// Collect logs from all console methods before restoring
|
|
210
|
+
const allConsoleCalls = [
|
|
211
|
+
...consoleLogSpy.mock.calls,
|
|
212
|
+
...consoleErrorSpy.mock.calls,
|
|
213
|
+
...consoleInfoSpy.mock.calls,
|
|
214
|
+
...consoleWarnSpy.mock.calls,
|
|
215
|
+
];
|
|
216
|
+
const allLogs = allConsoleCalls.map(call => call.join(' ')).join('\n');
|
|
217
|
+
|
|
218
|
+
// Restore console methods
|
|
219
|
+
consoleLogSpy.mockRestore();
|
|
220
|
+
consoleErrorSpy.mockRestore();
|
|
221
|
+
consoleInfoSpy.mockRestore();
|
|
222
|
+
consoleWarnSpy.mockRestore();
|
|
223
|
+
|
|
224
|
+
// Verify lock file handling messages
|
|
225
|
+
expect(allLogs).toContain(`DB lock file found at ${expectedLockPath}. Checking which process holds it...`);
|
|
226
|
+
expect(allLogs).toContain('Lock file exists but no process is holding it. Removing stale lock file...');
|
|
227
|
+
expect(allLogs).toContain(`Removed stale lock file ${expectedLockPath}`);
|
|
199
228
|
});
|
|
200
229
|
|
|
201
230
|
it('Download pl. We have archive and extracted data', async () => {
|