@milaboratories/pl-deployments 1.1.13 → 1.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +118 -108
- package/dist/index.mjs.map +1 -1
- package/dist/ssh/connection_info.d.ts +4 -1
- package/dist/ssh/connection_info.d.ts.map +1 -1
- package/dist/ssh/pl.d.ts +8 -4
- package/dist/ssh/pl.d.ts.map +1 -1
- package/dist/ssh/pl_paths.d.ts.map +1 -1
- package/dist/ssh/ssh.d.ts +1 -1
- package/dist/ssh/ssh.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ssh/__tests__/pl-docker.test.ts +24 -1
- package/src/ssh/__tests__/ssh-docker.test.ts +7 -7
- package/src/ssh/connection_info.ts +5 -0
- package/src/ssh/pl.ts +33 -17
- package/src/ssh/pl_paths.ts +1 -1
- package/src/ssh/ssh.ts +1 -1
package/dist/ssh/pl.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { DownloadBinaryResult } from '../common/pl_binary_download';
|
|
|
4
4
|
import { PlLicenseMode, SshPlConfigGenerationResult } from '@milaboratories/pl-config';
|
|
5
5
|
import { SupervisorStatus } from './supervisord';
|
|
6
6
|
import { ConnectionInfo, SshPlPorts } from './connection_info';
|
|
7
|
+
import { PlBinarySourceDownload } from '../common/pl_binary';
|
|
7
8
|
import type * as ssh from 'ssh2';
|
|
8
9
|
export declare class SshPl {
|
|
9
10
|
readonly logger: MiLogger;
|
|
@@ -33,7 +34,7 @@ export declare class SshPl {
|
|
|
33
34
|
* generates all the configs, creates necessary dirs,
|
|
34
35
|
* and finally starts all the services. */
|
|
35
36
|
platformaInit(options: SshPlConfig): Promise<ConnectionInfo>;
|
|
36
|
-
downloadBinariesAndUploadToTheServer(localWorkdir: string, remoteHome: string, arch: Arch): Promise<{
|
|
37
|
+
downloadBinariesAndUploadToTheServer(localWorkdir: string, plBinary: PlBinarySourceDownload, remoteHome: string, arch: Arch): Promise<{
|
|
37
38
|
history: DownloadAndUntarState[];
|
|
38
39
|
minioRelPath: string;
|
|
39
40
|
downloadedPl: string;
|
|
@@ -62,11 +63,12 @@ export type SshPlConfig = {
|
|
|
62
63
|
localWorkdir: string;
|
|
63
64
|
license: PlLicenseMode;
|
|
64
65
|
useGlobalAccess?: boolean;
|
|
66
|
+
plBinary?: PlBinarySourceDownload;
|
|
65
67
|
};
|
|
66
68
|
type BinPaths = {
|
|
67
69
|
history?: DownloadAndUntarState[];
|
|
68
70
|
minioRelPath: string;
|
|
69
|
-
downloadedPl:
|
|
71
|
+
downloadedPl: string;
|
|
70
72
|
};
|
|
71
73
|
type DownloadAndUntarState = {
|
|
72
74
|
binBasePath?: string;
|
|
@@ -76,15 +78,17 @@ type DownloadAndUntarState = {
|
|
|
76
78
|
localArchivePath?: string;
|
|
77
79
|
remoteDir?: string;
|
|
78
80
|
remoteArchivePath?: string;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
uploadDone?: boolean;
|
|
82
|
+
untarDone?: boolean;
|
|
81
83
|
};
|
|
82
84
|
type PlatformaInitState = {
|
|
83
85
|
localWorkdir?: string;
|
|
86
|
+
plBinaryOps?: PlBinarySourceDownload;
|
|
84
87
|
arch?: Arch;
|
|
85
88
|
remoteHome?: string;
|
|
86
89
|
alive?: SupervisorStatus;
|
|
87
90
|
userCredentials?: ConnectionInfo;
|
|
91
|
+
needRestart?: boolean;
|
|
88
92
|
downloadedBinaries?: DownloadAndUntarState[];
|
|
89
93
|
binPaths?: BinPaths;
|
|
90
94
|
ports?: SshPlPorts;
|
package/dist/ssh/pl.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pl.d.ts","sourceRoot":"","sources":["../../src/ssh/pl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACl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,CAAC;CACnB,CAAC"}
|
|
@@ -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,
|
|
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,UAAU,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,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"}
|
package/dist/ssh/ssh.d.ts
CHANGED
|
@@ -120,7 +120,7 @@ export declare class SshClient {
|
|
|
120
120
|
* @param remotePath - The path to the remote directory.
|
|
121
121
|
* @returns A promise that resolves when the directory is created.
|
|
122
122
|
*/
|
|
123
|
-
|
|
123
|
+
ensureRemoteDirCreated(remotePath: string, mode?: number): Promise<void>;
|
|
124
124
|
/**
|
|
125
125
|
* Downloads a file from the remote server to a local path via SFTP.
|
|
126
126
|
* @param remotePath - The remote file path on the server.
|
package/dist/ssh/ssh.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssh.d.ts","sourceRoot":"","sources":["../../src/ssh/ssh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAiB,WAAW,EAAE,MAAM,MAAM,CAAC;AACtE,OAAO,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,GAAG,MAAM,KAAK,CAAC;AAKtB,OAAO,EAAoB,KAAK,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAQ7E,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,UAAU,CAAC;AACtD,MAAM,MAAM,oB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AAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAapD,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAahC,eAAe,CAAC,UAAU,EAAE,MAAM;IAgBlC,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,OAAO,CAAC;QAAC,WAAW,EAAE,OAAO,CAAA;KAAE,CAAC;YAoBhG,SAAS;IAWhB,2BAA2B,CAAC,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,GAAE,MAAc;YAgBnG,iBAAiB;IA8B/B;;;;;OAKG;IACU,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,GAAE,MAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAatG;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB;IA8B/B;;;;;OAKG;IACI,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,GAAE,MAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IA6BtF;;;;;OAKG;IACU,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAalF;;OAEG;IACI,KAAK,IAAI,IAAI;CAIrB;AAED,MAAM,MAAM,aAAa,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -65,7 +65,12 @@ describe('SshPl', async () => {
|
|
|
65
65
|
const arch = await sshPl.getArch();
|
|
66
66
|
const remoteHome = await sshPl.getUserHomeDirectory();
|
|
67
67
|
await sshPl.stop(); // ensure stopped
|
|
68
|
-
await sshPl.downloadBinariesAndUploadToTheServer(
|
|
68
|
+
await sshPl.downloadBinariesAndUploadToTheServer(
|
|
69
|
+
downloadDestination,
|
|
70
|
+
{ type: 'Download', version: getDefaultPlVersion() },
|
|
71
|
+
remoteHome,
|
|
72
|
+
arch,
|
|
73
|
+
);
|
|
69
74
|
|
|
70
75
|
const pathSupervisor = `${plpath.supervisorBinDir(remoteHome, arch.arch)}/supervisord`;
|
|
71
76
|
const pathMinio = `${plpath.minioDir(remoteHome, arch.arch)}/minio`;
|
|
@@ -179,6 +184,24 @@ describe('SshPl', async () => {
|
|
|
179
184
|
expect(config).contain('bin-ga');
|
|
180
185
|
});
|
|
181
186
|
|
|
187
|
+
it('Start ssh with old platforma, restart it with newer one', async () => {
|
|
188
|
+
await sshPl.platformaInit({
|
|
189
|
+
localWorkdir: downloadDestination,
|
|
190
|
+
license: { type: 'env' },
|
|
191
|
+
plBinary: { type: 'Download', version: '1.18.3' },
|
|
192
|
+
});
|
|
193
|
+
let isAlive = await sshPl?.isAlive();
|
|
194
|
+
expect(isAlive.allAlive).toBe(true);
|
|
195
|
+
|
|
196
|
+
await sshPl.platformaInit({
|
|
197
|
+
localWorkdir: downloadDestination,
|
|
198
|
+
license: { type: 'env' },
|
|
199
|
+
// latest version of pl binary will be get by default
|
|
200
|
+
});
|
|
201
|
+
isAlive = await sshPl?.isAlive();
|
|
202
|
+
expect(isAlive.allAlive).toBe(true);
|
|
203
|
+
});
|
|
204
|
+
|
|
182
205
|
it('Download pl. We have archive and extracted data', async () => {
|
|
183
206
|
const arch = await sshPl.getArch();
|
|
184
207
|
|
|
@@ -44,7 +44,7 @@ describe('SSH Tests', () => {
|
|
|
44
44
|
});
|
|
45
45
|
it('should create all directories if none exist', async () => {
|
|
46
46
|
const remotePath = '/home/pl-doctor/upload/nested/directory';
|
|
47
|
-
await expect(client.
|
|
47
|
+
await expect(client.ensureRemoteDirCreated(remotePath)).resolves.not.toThrow();
|
|
48
48
|
|
|
49
49
|
// Additional check to ensure the directory exists
|
|
50
50
|
await client.withSftp(async (sftp) => {
|
|
@@ -61,14 +61,14 @@ describe('SSH Tests', () => {
|
|
|
61
61
|
it('should handle existing directories gracefully', async () => {
|
|
62
62
|
const remotePath = '/home/pl-doctor/upload/nested';
|
|
63
63
|
|
|
64
|
-
await expect(client.
|
|
65
|
-
await expect(client.
|
|
64
|
+
await expect(client.ensureRemoteDirCreated(remotePath)).resolves.not.toThrow();
|
|
65
|
+
await expect(client.ensureRemoteDirCreated(remotePath)).resolves.not.toThrow();
|
|
66
66
|
});
|
|
67
67
|
|
|
68
68
|
it('should throw an error if an invalid path is provided', async () => {
|
|
69
69
|
const remotePath = '/invalid_path/nested';
|
|
70
70
|
|
|
71
|
-
await expect(client.
|
|
71
|
+
await expect(client.ensureRemoteDirCreated(remotePath)).rejects.toThrow();
|
|
72
72
|
});
|
|
73
73
|
|
|
74
74
|
it('Upload directory', async () => {
|
|
@@ -133,9 +133,9 @@ describe('SSH Tests', () => {
|
|
|
133
133
|
|
|
134
134
|
it('Remove directory', async () => {
|
|
135
135
|
const rootFolder = '/home/pl-doctor/upload';
|
|
136
|
-
await client.
|
|
137
|
-
await client.
|
|
138
|
-
await client.
|
|
136
|
+
await client.ensureRemoteDirCreated(`${rootFolder}/upload/nested`);
|
|
137
|
+
await client.ensureRemoteDirCreated(`${rootFolder}/2-nested`);
|
|
138
|
+
await client.ensureRemoteDirCreated(`${rootFolder}/2-nested/3-sub`);
|
|
139
139
|
await client.writeFileOnTheServer(`${rootFolder}/2-nested/3-sub/qwerty.txt`, 'HELLO FROM SSH');
|
|
140
140
|
|
|
141
141
|
const text = await client.readFile(`${rootFolder}/2-nested/3-sub/qwerty.txt`);
|
|
@@ -31,6 +31,9 @@ export const ConnectionInfo = z.object({
|
|
|
31
31
|
// It's false by default because it was added later,
|
|
32
32
|
// and in some deployments there won't be useGlobalAccess flag in the file.
|
|
33
33
|
useGlobalAccess: z.boolean().default(false),
|
|
34
|
+
|
|
35
|
+
// We added the field afterwards, the pl backend was this version.
|
|
36
|
+
plVersion: z.string().default('1.18.3'),
|
|
34
37
|
});
|
|
35
38
|
/** The content of the file that holds all the info about the connection on the remote server. */
|
|
36
39
|
export type ConnectionInfo = z.infer<typeof ConnectionInfo>;
|
|
@@ -44,12 +47,14 @@ export function newConnectionInfo(
|
|
|
44
47
|
plPassword: string,
|
|
45
48
|
ports: SshPlPorts,
|
|
46
49
|
useGlobalAccess: boolean,
|
|
50
|
+
plVersion: string,
|
|
47
51
|
): ConnectionInfo {
|
|
48
52
|
return {
|
|
49
53
|
plUser,
|
|
50
54
|
plPassword,
|
|
51
55
|
ports,
|
|
52
56
|
useGlobalAccess,
|
|
57
|
+
plVersion,
|
|
53
58
|
};
|
|
54
59
|
}
|
|
55
60
|
|
package/src/ssh/pl.ts
CHANGED
|
@@ -15,6 +15,7 @@ import type { SupervisorStatus } from './supervisord';
|
|
|
15
15
|
import { supervisorStatus, supervisorStop as supervisorCtlShutdown, generateSupervisordConfig, supervisorCtlStart } from './supervisord';
|
|
16
16
|
import type { ConnectionInfo, SshPlPorts } from './connection_info';
|
|
17
17
|
import { newConnectionInfo, parseConnectionInfo, stringifyConnectionInfo } from './connection_info';
|
|
18
|
+
import type { PlBinarySourceDownload } from '../common/pl_binary';
|
|
18
19
|
|
|
19
20
|
export class SshPl {
|
|
20
21
|
private initState: PlatformaInitState = {};
|
|
@@ -99,13 +100,13 @@ export class SshPl {
|
|
|
99
100
|
|
|
100
101
|
/** Stops platforma and deletes its state. */
|
|
101
102
|
public async stopAndClean(): Promise<void> {
|
|
102
|
-
const
|
|
103
|
+
const remoteHome = await this.getUserHomeDirectory();
|
|
103
104
|
|
|
104
105
|
this.logger.info(`pl.reset: Stop Platforma on the server`);
|
|
105
106
|
await this.stop();
|
|
106
107
|
|
|
107
|
-
this.logger.info(`pl.reset: Deleting Platforma workDir ${workDir} on the server`);
|
|
108
|
-
await this.sshClient.deleteFolder(plpath.workDir(
|
|
108
|
+
this.logger.info(`pl.reset: Deleting Platforma workDir ${plpath.workDir(remoteHome)} on the server`);
|
|
109
|
+
await this.sshClient.deleteFolder(plpath.workDir(remoteHome));
|
|
109
110
|
}
|
|
110
111
|
|
|
111
112
|
/** Downloads binaries and untar them on the server,
|
|
@@ -120,6 +121,7 @@ export class SshPl {
|
|
|
120
121
|
...defaultSshPlConfig,
|
|
121
122
|
...options,
|
|
122
123
|
};
|
|
124
|
+
state.plBinaryOps = ops.plBinary;
|
|
123
125
|
state.arch = await this.getArch();
|
|
124
126
|
state.remoteHome = await this.getUserHomeDirectory();
|
|
125
127
|
state.alive = await this.isAlive();
|
|
@@ -129,16 +131,19 @@ export class SshPl {
|
|
|
129
131
|
if (!state.userCredentials) {
|
|
130
132
|
throw new Error(`SshPl.platformaInit: platforma is alive but userCredentials are not found`);
|
|
131
133
|
}
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
+
const sameGA = state.userCredentials.useGlobalAccess == ops.useGlobalAccess;
|
|
135
|
+
const samePlVersion = state.userCredentials.plVersion == ops.plBinary!.version;
|
|
136
|
+
state.needRestart = !(sameGA && samePlVersion);
|
|
137
|
+
this.logger.info(`SshPl.platformaInit: need restart? ${state.needRestart}`);
|
|
138
|
+
|
|
139
|
+
if (!state.needRestart)
|
|
134
140
|
return state.userCredentials;
|
|
135
141
|
|
|
136
|
-
|
|
137
|
-
await this.stopAndClean();
|
|
142
|
+
await this.stop();
|
|
138
143
|
}
|
|
139
144
|
|
|
140
145
|
const downloadRes = await this.downloadBinariesAndUploadToTheServer(
|
|
141
|
-
ops.localWorkdir, state.remoteHome, state.arch,
|
|
146
|
+
ops.localWorkdir, ops.plBinary!, state.remoteHome, state.arch,
|
|
142
147
|
);
|
|
143
148
|
state.binPaths = { ...downloadRes, history: undefined };
|
|
144
149
|
state.downloadedBinaries = downloadRes.history;
|
|
@@ -176,7 +181,7 @@ export class SshPl {
|
|
|
176
181
|
}
|
|
177
182
|
|
|
178
183
|
for (const dir of config.dirsToCreate) {
|
|
179
|
-
await this.sshClient.
|
|
184
|
+
await this.sshClient.ensureRemoteDirCreated(dir);
|
|
180
185
|
this.logger.info(`Created directory ${dir}`);
|
|
181
186
|
}
|
|
182
187
|
|
|
@@ -200,6 +205,7 @@ export class SshPl {
|
|
|
200
205
|
config.plPassword,
|
|
201
206
|
state.ports,
|
|
202
207
|
notEmpty(ops.useGlobalAccess),
|
|
208
|
+
ops.plBinary!.version,
|
|
203
209
|
);
|
|
204
210
|
await this.sshClient.writeFileOnTheServer(
|
|
205
211
|
plpath.connectionInfo(state.remoteHome),
|
|
@@ -221,6 +227,7 @@ export class SshPl {
|
|
|
221
227
|
|
|
222
228
|
public async downloadBinariesAndUploadToTheServer(
|
|
223
229
|
localWorkdir: string,
|
|
230
|
+
plBinary: PlBinarySourceDownload,
|
|
224
231
|
remoteHome: string,
|
|
225
232
|
arch: Arch,
|
|
226
233
|
) {
|
|
@@ -228,7 +235,7 @@ export class SshPl {
|
|
|
228
235
|
try {
|
|
229
236
|
const pl = await this.downloadAndUntar(
|
|
230
237
|
localWorkdir, remoteHome, arch,
|
|
231
|
-
'pl', `pl-${
|
|
238
|
+
'pl', `pl-${plBinary.version}`,
|
|
232
239
|
);
|
|
233
240
|
state.push(pl);
|
|
234
241
|
|
|
@@ -273,7 +280,7 @@ export class SshPl {
|
|
|
273
280
|
): Promise<DownloadAndUntarState> {
|
|
274
281
|
const state: DownloadAndUntarState = {};
|
|
275
282
|
state.binBasePath = plpath.binariesDir(remoteHome);
|
|
276
|
-
await this.sshClient.
|
|
283
|
+
await this.sshClient.ensureRemoteDirCreated(state.binBasePath);
|
|
277
284
|
state.binBasePathCreated = true;
|
|
278
285
|
|
|
279
286
|
let downloadBinaryResult: DownloadBinaryResult | null = null;
|
|
@@ -301,8 +308,9 @@ export class SshPl {
|
|
|
301
308
|
state.remoteDir = upath.join(state.binBasePath, state.downloadResult.baseName);
|
|
302
309
|
state.remoteArchivePath = state.remoteDir + '.tgz';
|
|
303
310
|
|
|
304
|
-
await this.sshClient.
|
|
311
|
+
await this.sshClient.ensureRemoteDirCreated(state.remoteDir);
|
|
305
312
|
await this.sshClient.uploadFile(state.localArchivePath, state.remoteArchivePath);
|
|
313
|
+
state.uploadDone = true;
|
|
306
314
|
|
|
307
315
|
// TODO: Create a proper archive to avoid xattr warnings
|
|
308
316
|
const untarResult = await this.sshClient.exec(
|
|
@@ -312,7 +320,7 @@ export class SshPl {
|
|
|
312
320
|
if (untarResult.stderr)
|
|
313
321
|
throw Error(`downloadAndUntar: untar: stderr occurred: ${untarResult.stderr}, stdout: ${untarResult.stdout}`);
|
|
314
322
|
|
|
315
|
-
state.
|
|
323
|
+
state.untarDone = true;
|
|
316
324
|
|
|
317
325
|
return state;
|
|
318
326
|
}
|
|
@@ -432,19 +440,25 @@ export type SshPlConfig = {
|
|
|
432
440
|
localWorkdir: string;
|
|
433
441
|
license: PlLicenseMode;
|
|
434
442
|
useGlobalAccess?: boolean;
|
|
443
|
+
plBinary?: PlBinarySourceDownload;
|
|
435
444
|
};
|
|
436
445
|
|
|
437
446
|
const defaultSshPlConfig: Pick<
|
|
438
447
|
SshPlConfig,
|
|
439
|
-
'useGlobalAccess'
|
|
448
|
+
| 'useGlobalAccess'
|
|
449
|
+
| 'plBinary'
|
|
440
450
|
> = {
|
|
441
451
|
useGlobalAccess: false,
|
|
452
|
+
plBinary: {
|
|
453
|
+
type: 'Download',
|
|
454
|
+
version: getDefaultPlVersion(),
|
|
455
|
+
},
|
|
442
456
|
};
|
|
443
457
|
|
|
444
458
|
type BinPaths = {
|
|
445
459
|
history?: DownloadAndUntarState[];
|
|
446
460
|
minioRelPath: string;
|
|
447
|
-
downloadedPl:
|
|
461
|
+
downloadedPl: string;
|
|
448
462
|
};
|
|
449
463
|
|
|
450
464
|
type DownloadAndUntarState = {
|
|
@@ -456,16 +470,18 @@ type DownloadAndUntarState = {
|
|
|
456
470
|
localArchivePath?: string;
|
|
457
471
|
remoteDir?: string;
|
|
458
472
|
remoteArchivePath?: string;
|
|
459
|
-
|
|
460
|
-
|
|
473
|
+
uploadDone?: boolean;
|
|
474
|
+
untarDone?: boolean;
|
|
461
475
|
};
|
|
462
476
|
|
|
463
477
|
type PlatformaInitState = {
|
|
464
478
|
localWorkdir?: string;
|
|
479
|
+
plBinaryOps?: PlBinarySourceDownload;
|
|
465
480
|
arch?: Arch;
|
|
466
481
|
remoteHome?: string;
|
|
467
482
|
alive?: SupervisorStatus;
|
|
468
483
|
userCredentials?: ConnectionInfo;
|
|
484
|
+
needRestart?: boolean;
|
|
469
485
|
downloadedBinaries?: DownloadAndUntarState[];
|
|
470
486
|
binPaths?: BinPaths;
|
|
471
487
|
ports?: SshPlPorts;
|
package/src/ssh/pl_paths.ts
CHANGED
|
@@ -24,7 +24,7 @@ export function platformaDir(remoteHome: string, arch: string) {
|
|
|
24
24
|
return upath.join(platformaBaseDir(remoteHome, arch), 'binaries');
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
export function platformaBin(remoteHome: string, arch: string) {
|
|
27
|
+
export function platformaBin(remoteHome: string, arch: string): string {
|
|
28
28
|
return upath.join(platformaDir(remoteHome, arch), 'platforma');
|
|
29
29
|
}
|
|
30
30
|
|
package/src/ssh/ssh.ts
CHANGED
|
@@ -586,7 +586,7 @@ export class SshClient {
|
|
|
586
586
|
* @param remotePath - The path to the remote directory.
|
|
587
587
|
* @returns A promise that resolves when the directory is created.
|
|
588
588
|
*/
|
|
589
|
-
public
|
|
589
|
+
public ensureRemoteDirCreated(remotePath: string, mode: number = 0o755): Promise<void> {
|
|
590
590
|
return this.withSftp(async (sftp) => {
|
|
591
591
|
const directories = remotePath.split('/');
|
|
592
592
|
let currentPath = '';
|