@constellation-network/node-pilot 0.0.15 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/dist/checks/check-dependencies.js +2 -2
- package/dist/checks/check-hardware.js +1 -3
- package/dist/helpers/project-helper.js +5 -7
- package/dist/helpers/status-table-helper.d.ts +6 -0
- package/dist/helpers/status-table-helper.js +58 -19
- package/dist/helpers/status-table.js +35 -31
- package/dist/services/cluster-service.js +14 -18
- package/dist/services/fastforward-service.js +1 -2
- package/dist/services/node-service.js +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ $ npm install -g @constellation-network/node-pilot
|
|
|
21
21
|
$ cpilot COMMAND
|
|
22
22
|
running command...
|
|
23
23
|
$ cpilot (--version|-v)
|
|
24
|
-
@constellation-network/node-pilot/0.0.
|
|
24
|
+
@constellation-network/node-pilot/0.0.17 darwin-arm64 node-v24.8.0
|
|
25
25
|
$ cpilot --help [COMMAND]
|
|
26
26
|
USAGE
|
|
27
27
|
$ cpilot COMMAND
|
|
@@ -62,7 +62,7 @@ EXAMPLES
|
|
|
62
62
|
$ cpilot config
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
_See code: [src/commands/config.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.0.
|
|
65
|
+
_See code: [src/commands/config.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.0.17/src/commands/config.ts)_
|
|
66
66
|
|
|
67
67
|
## `cpilot config get [NAME]`
|
|
68
68
|
|
|
@@ -86,7 +86,7 @@ EXAMPLES
|
|
|
86
86
|
$ cpilot config get gl0:CL_PUBLIC_HTTP_PORT
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
-
_See code: [src/commands/config/get.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.0.
|
|
89
|
+
_See code: [src/commands/config/get.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.0.17/src/commands/config/get.ts)_
|
|
90
90
|
|
|
91
91
|
## `cpilot config set NAME VALUE`
|
|
92
92
|
|
|
@@ -109,7 +109,7 @@ EXAMPLES
|
|
|
109
109
|
$ cpilot config set gl0:CL_PUBLIC_HTTP_PORT 9000
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
-
_See code: [src/commands/config/set.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.0.
|
|
112
|
+
_See code: [src/commands/config/set.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.0.17/src/commands/config/set.ts)_
|
|
113
113
|
|
|
114
114
|
## `cpilot help [COMMAND]`
|
|
115
115
|
|
|
@@ -146,7 +146,7 @@ EXAMPLES
|
|
|
146
146
|
$ cpilot info
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
-
_See code: [src/commands/info.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.0.
|
|
149
|
+
_See code: [src/commands/info.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.0.17/src/commands/info.ts)_
|
|
150
150
|
|
|
151
151
|
## `cpilot logs LAYER`
|
|
152
152
|
|
|
@@ -170,7 +170,7 @@ EXAMPLES
|
|
|
170
170
|
$ cpilot logs
|
|
171
171
|
```
|
|
172
172
|
|
|
173
|
-
_See code: [src/commands/logs.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.0.
|
|
173
|
+
_See code: [src/commands/logs.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.0.17/src/commands/logs.ts)_
|
|
174
174
|
|
|
175
175
|
## `cpilot restart [LAYER]`
|
|
176
176
|
|
|
@@ -198,7 +198,7 @@ EXAMPLES
|
|
|
198
198
|
$ cpilot restart
|
|
199
199
|
```
|
|
200
200
|
|
|
201
|
-
_See code: [src/commands/restart.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.0.
|
|
201
|
+
_See code: [src/commands/restart.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.0.17/src/commands/restart.ts)_
|
|
202
202
|
|
|
203
203
|
## `cpilot shutdown`
|
|
204
204
|
|
|
@@ -215,7 +215,7 @@ EXAMPLES
|
|
|
215
215
|
$ cpilot shutdown
|
|
216
216
|
```
|
|
217
217
|
|
|
218
|
-
_See code: [src/commands/shutdown.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.0.
|
|
218
|
+
_See code: [src/commands/shutdown.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.0.17/src/commands/shutdown.ts)_
|
|
219
219
|
|
|
220
220
|
## `cpilot status`
|
|
221
221
|
|
|
@@ -229,5 +229,5 @@ DESCRIPTION
|
|
|
229
229
|
Display node status and configuration settings
|
|
230
230
|
```
|
|
231
231
|
|
|
232
|
-
_See code: [src/commands/status.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.0.
|
|
232
|
+
_See code: [src/commands/status.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.0.17/src/commands/status.ts)_
|
|
233
233
|
<!-- commandsstop -->
|
|
@@ -30,8 +30,8 @@ export const checkDependencies = async () => {
|
|
|
30
30
|
await promptHelper.doYouWishToContinue();
|
|
31
31
|
}
|
|
32
32
|
clm.debug(`Running install-dependencies.sh from ${pilotDir}`);
|
|
33
|
-
const silent = !process.env.DEBUG;
|
|
34
|
-
const result = shell.exec('bash install-dependencies.sh', { cwd: pilotDir
|
|
33
|
+
// const silent = !process.env.DEBUG;
|
|
34
|
+
const result = shell.exec('bash install-dependencies.sh', { cwd: pilotDir });
|
|
35
35
|
if (result.code > 0) {
|
|
36
36
|
console.log(result.stderr);
|
|
37
37
|
clm.error(`Failed to install dependencies. Please try again after resolving any errors.`);
|
|
@@ -13,9 +13,7 @@ export const checkHardware = {
|
|
|
13
13
|
const totalSpaceGB = (r.bsize * r.blocks / (1024 * 1024 * 1024)).toFixed(2);
|
|
14
14
|
// const usage = diskusage.checkSync(os.homedir());
|
|
15
15
|
// const usableSpaceGB = (usage.total / (1024 * 1024 * 1024)).toFixed(2);
|
|
16
|
-
|
|
17
|
-
const totalMemoryBytes = os.totalmem();
|
|
18
|
-
const totalMemoryGB = (totalMemoryBytes / (1024 * 1024 * 1024)).toFixed(2);
|
|
16
|
+
const totalMemoryGB = (os.totalmem() / (1024 * 1024 * 1024)).toFixed(2);
|
|
19
17
|
// Retrieve number of CPU cores
|
|
20
18
|
const numOfCores = os.availableParallelism();
|
|
21
19
|
let allPassed = true;
|
|
@@ -66,16 +66,14 @@ export const projectHelper = {
|
|
|
66
66
|
const { projectDir } = configStore.getProjectInfo();
|
|
67
67
|
const { platform } = configStore.getSystemInfo();
|
|
68
68
|
// Create gl0 folder for the fast-forward feature before Docker does
|
|
69
|
+
const gl0DataDir = path.join(projectDir, 'gl0', 'data');
|
|
70
|
+
fs.mkdirSync(path.join(gl0DataDir, 'incremental_snapshot'), { recursive: true });
|
|
71
|
+
fs.mkdirSync(path.join(gl0DataDir, 'snapshot_info'));
|
|
72
|
+
fs.mkdirSync(path.join(gl0DataDir, 'tmp'));
|
|
69
73
|
if (platform === 'linux') {
|
|
70
74
|
const layerDir = path.join(projectDir, 'gl0');
|
|
71
75
|
// set permission for group "docker" on the layer folder and any subfolders created later
|
|
72
|
-
await shellService.runCommand(`sudo setfacl -
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
const gl0DataDir = path.join(projectDir, 'gl0', 'data');
|
|
76
|
-
fs.mkdirSync(path.join(gl0DataDir, 'incremental_snapshot'), { recursive: true });
|
|
77
|
-
fs.mkdirSync(path.join(gl0DataDir, 'snapshot_info'));
|
|
78
|
-
fs.mkdirSync(path.join(gl0DataDir, 'tmp'));
|
|
76
|
+
await shellService.runCommand(`sudo setfacl -Rm g:docker:rwX -dm g:docker:rwX ${layerDir}`);
|
|
79
77
|
}
|
|
80
78
|
this.importEnvFiles();
|
|
81
79
|
},
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export declare function formatTime(time: number, includeSeconds: boolean): string;
|
|
2
|
+
export declare function formatTimeAgo(value: number): string | null;
|
|
1
3
|
export declare const statusTableHeader: ({
|
|
2
4
|
color: string;
|
|
3
5
|
headerColor: string;
|
|
@@ -21,7 +23,11 @@ export type NodeStatusInfo = {
|
|
|
21
23
|
clusterOrdinal: number;
|
|
22
24
|
clusterSession: string;
|
|
23
25
|
clusterState: string;
|
|
26
|
+
cpuUsage: string;
|
|
24
27
|
error: string;
|
|
28
|
+
errorDate: number;
|
|
29
|
+
lastError: string;
|
|
30
|
+
memUsage: string;
|
|
25
31
|
ordinal: number;
|
|
26
32
|
pilotSession: string;
|
|
27
33
|
session: string;
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
class CellFormatter {
|
|
2
|
+
formatCpu(value) {
|
|
3
|
+
if (value === '-')
|
|
4
|
+
return value;
|
|
5
|
+
const num = Number.parseInt(value, 10);
|
|
6
|
+
if (num === 0)
|
|
7
|
+
return value;
|
|
8
|
+
if (num < 60)
|
|
9
|
+
return this.style(value.toString(), "green");
|
|
10
|
+
if (num < 99)
|
|
11
|
+
return this.style(value.toString(), "yellow", "bold");
|
|
12
|
+
return this.style(value.toString(), "bgRed", "bold");
|
|
13
|
+
}
|
|
2
14
|
formatDistance(value) {
|
|
3
15
|
if (value === '-')
|
|
4
16
|
return value;
|
|
5
17
|
const num = Number(value);
|
|
6
18
|
if (num === 0)
|
|
7
19
|
return value;
|
|
8
|
-
if (num <
|
|
9
|
-
return this.style(value.toString(), "bgYellow", "bold");
|
|
20
|
+
if (num < 9)
|
|
21
|
+
return this.style(value.toString(), "bgYellow", "whiteBright", "bold");
|
|
10
22
|
return this.style(value.toString(), "bgRed", "bold");
|
|
11
23
|
}
|
|
12
24
|
formatError(value) {
|
|
@@ -14,10 +26,22 @@ class CellFormatter {
|
|
|
14
26
|
return value;
|
|
15
27
|
return this.style(value, "bgRed", "bold");
|
|
16
28
|
}
|
|
29
|
+
formatMem(value) {
|
|
30
|
+
if (value === '-')
|
|
31
|
+
return value;
|
|
32
|
+
const num = Number.parseInt(value.split('(')[1], 10);
|
|
33
|
+
if (num === 0)
|
|
34
|
+
return value;
|
|
35
|
+
if (num < 70)
|
|
36
|
+
return this.style(value.toString(), "green");
|
|
37
|
+
if (num < 90)
|
|
38
|
+
return this.style(value.toString(), "yellow", "bold");
|
|
39
|
+
return this.style(value.toString(), "red", "bold");
|
|
40
|
+
}
|
|
17
41
|
formatOrdinal(value) {
|
|
18
42
|
const [v, changed] = value.split(':');
|
|
19
43
|
if (changed) {
|
|
20
|
-
return this.style(v, "bgCyan");
|
|
44
|
+
return this.style(v, "bgCyan", "whiteBright", "bold");
|
|
21
45
|
}
|
|
22
46
|
return this.style(v, "cyan");
|
|
23
47
|
}
|
|
@@ -33,30 +57,45 @@ class CellFormatter {
|
|
|
33
57
|
return this.style(value, "white");
|
|
34
58
|
}
|
|
35
59
|
formatUpTIme(startTime) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const upTimeMs = Date.now() - Number(startTime);
|
|
39
|
-
const upTimeSec = Math.floor(upTimeMs / 1000);
|
|
40
|
-
const hours = Math.floor(upTimeSec / 3600);
|
|
41
|
-
const minutes = Math.floor((upTimeSec % 3600) / 60);
|
|
42
|
-
const seconds = upTimeSec % 60;
|
|
43
|
-
if (hours < 1 && minutes < 1)
|
|
44
|
-
return `${seconds}s`;
|
|
45
|
-
return hours > 0 ? `${hours}h ${minutes}m ${seconds}s` : `${minutes}m ${seconds}s`;
|
|
60
|
+
const formattedTime = formatTime(Date.now() - Number(startTime), true);
|
|
61
|
+
return formattedTime ?? '-';
|
|
46
62
|
}
|
|
47
|
-
style(value, color,
|
|
48
|
-
return `c${color}v${value}s${
|
|
63
|
+
style(value, color, style1, style2) {
|
|
64
|
+
return `c${color}v${value}s${style1}-${style2}`;
|
|
49
65
|
}
|
|
50
66
|
}
|
|
51
|
-
const { formatDistance, formatError, formatOrdinal, formatState, formatUpTIme } = new CellFormatter();
|
|
52
|
-
|
|
67
|
+
const { formatCpu, formatDistance, formatError, formatMem, formatOrdinal, formatState, formatUpTIme } = new CellFormatter();
|
|
68
|
+
export function formatTime(time, includeSeconds) {
|
|
69
|
+
if (!time)
|
|
70
|
+
return '';
|
|
71
|
+
const upTimeMs = Number(time);
|
|
72
|
+
const upTimeSec = Math.floor(upTimeMs / 1000);
|
|
73
|
+
const hours = Math.floor(upTimeSec / 3600);
|
|
74
|
+
const minutes = Math.floor((upTimeSec % 3600) / 60);
|
|
75
|
+
const seconds = upTimeSec % 60;
|
|
76
|
+
if (hours < 1 && minutes < 1)
|
|
77
|
+
return `${seconds}s`;
|
|
78
|
+
if (includeSeconds) {
|
|
79
|
+
return hours > 0 ? `${hours}h ${minutes}m ${seconds}s` : `${minutes}m ${seconds}s`;
|
|
80
|
+
}
|
|
81
|
+
return hours > 0 ? `${hours}h ${minutes}m` : `${minutes}m`;
|
|
82
|
+
}
|
|
83
|
+
export function formatTimeAgo(value) {
|
|
84
|
+
const timeAgo = formatTime(value, false);
|
|
85
|
+
if (!timeAgo)
|
|
86
|
+
return null;
|
|
87
|
+
return timeAgo + ' ago';
|
|
88
|
+
}
|
|
89
|
+
// Layer | Uptime | State | Ordinal | Distance from cluster | Cluster State | CPU Usage | Mem Usage | Error
|
|
53
90
|
export const statusTableHeader = [
|
|
54
91
|
{ color: 'white', headerColor: 'whiteBright', value: 'Network' },
|
|
55
92
|
{ color: 'whiteBright', headerColor: 'whiteBright', value: 'Layer' },
|
|
56
93
|
{ color: 'white', formatter: formatUpTIme, headerColor: 'whiteBright', value: 'Uptime' },
|
|
57
|
-
{ color: 'white', formatter: formatState, headerColor: 'whiteBright', value: 'Node State', width:
|
|
94
|
+
{ color: 'white', formatter: formatState, headerColor: 'whiteBright', value: 'Node State', width: 24 },
|
|
58
95
|
{ color: 'white', formatter: formatOrdinal, headerColor: 'whiteBright', value: 'Ordinal' },
|
|
59
|
-
{ color: 'white', formatter: formatDistance, headerColor: 'whiteBright', value: '
|
|
96
|
+
{ color: 'white', formatter: formatDistance, headerColor: 'whiteBright', value: 'Distance' },
|
|
60
97
|
{ color: 'white', formatter: formatState, headerColor: 'whiteBright', value: 'Cluster State', width: 16 },
|
|
98
|
+
{ color: 'white', formatter: formatCpu, headerColor: 'whiteBright', value: 'CPU Usage', width: 12 },
|
|
99
|
+
{ color: 'white', formatter: formatMem, headerColor: 'whiteBright', value: 'Mem Usage (GB)', width: 16 },
|
|
61
100
|
{ color: 'white', formatter: formatError, headerColor: 'whiteBright', value: 'Error', width: 22 },
|
|
62
101
|
];
|
|
@@ -1,27 +1,11 @@
|
|
|
1
1
|
import { createPrompt, useKeypress } from '@inquirer/core';
|
|
2
|
+
import chalk from "chalk";
|
|
2
3
|
import fs from "node:fs";
|
|
3
4
|
import os from "node:os";
|
|
4
5
|
import ttyTable from "tty-table";
|
|
5
6
|
import { clm } from "../clm.js";
|
|
6
7
|
import { configStore } from "../config-store.js";
|
|
7
|
-
import { statusTableHeader } from "./status-table-helper.js";
|
|
8
|
-
// mismatched snapshot hash, cluster fork, lagging behind cluster, stalled state, missing snapshot
|
|
9
|
-
// const possibleErrors = [
|
|
10
|
-
// '-',
|
|
11
|
-
// 'Bad snapshot hash',
|
|
12
|
-
// 'Cluster fork',
|
|
13
|
-
// 'Lagging behind',
|
|
14
|
-
// 'Stalled state',
|
|
15
|
-
// 'Missing snapshot',
|
|
16
|
-
// ]
|
|
17
|
-
//
|
|
18
|
-
// const possibleStates =
|
|
19
|
-
// [
|
|
20
|
-
// 'Ready',
|
|
21
|
-
// 'Restarting',
|
|
22
|
-
// 'Offline',
|
|
23
|
-
// 'SessionStarted'
|
|
24
|
-
// ]
|
|
8
|
+
import { formatTimeAgo, statusTableHeader } from "./status-table-helper.js";
|
|
25
9
|
export class StatusTable {
|
|
26
10
|
alreadyRendered = false;
|
|
27
11
|
previousHeight = 0;
|
|
@@ -62,13 +46,10 @@ export class StatusTable {
|
|
|
62
46
|
configStore.setActiveProject(activeProject);
|
|
63
47
|
return info;
|
|
64
48
|
}
|
|
65
|
-
// Layer | Uptime | State | Ordinal | Distance from cluster | Cluster State | Error
|
|
66
|
-
// state: Restarting...
|
|
67
|
-
// cluster state: Ready, Offline, Restarting...
|
|
68
|
-
// possibleErrors: mismatched snapshot hash, cluster fork, lagging behind cluster, stalled state, missing snapshot
|
|
69
49
|
async monitorState() {
|
|
70
50
|
const projects = this.getProjectInfo();
|
|
71
51
|
const values = {};
|
|
52
|
+
const err = { date: '', layer: '', msg: '', timeAgo: '' };
|
|
72
53
|
while (true) {
|
|
73
54
|
const rows = [];
|
|
74
55
|
for (const p of projects) {
|
|
@@ -87,29 +68,52 @@ export class StatusTable {
|
|
|
87
68
|
n.ordinal ? ordinal : '-',
|
|
88
69
|
distance,
|
|
89
70
|
n.clusterState || 'Ready',
|
|
71
|
+
n.cpuUsage || '-',
|
|
72
|
+
n.memUsage || '-',
|
|
90
73
|
n.error || '-'
|
|
91
74
|
]);
|
|
92
75
|
values[p.layer].ordinal = n.ordinal;
|
|
76
|
+
if ((p.layer === 'gl0' || p.layer === 'ml0') && n.lastError) {
|
|
77
|
+
err.layer = p.layer.toUpperCase();
|
|
78
|
+
err.msg = n.lastError;
|
|
79
|
+
err.date = new Date(n.errorDate).toISOString();
|
|
80
|
+
err.timeAgo = formatTimeAgo(Date.now() - n.errorDate) || '';
|
|
81
|
+
}
|
|
93
82
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
process.stdout.write(" *press any key to cancel");
|
|
83
|
+
this.render(rows, err.msg !== '');
|
|
84
|
+
if (err.msg) {
|
|
85
|
+
process.stdout.write(chalk.green(` AUTO HEALED (${err.timeAgo}): `) + chalk.red(`${err.layer}:${err.msg} - ${err.date}\n`));
|
|
86
|
+
}
|
|
87
|
+
process.stdout.write(" * press any key to cancel");
|
|
100
88
|
// eslint-disable-next-line no-await-in-loop
|
|
101
89
|
await sleep(1);
|
|
102
90
|
}
|
|
103
91
|
}
|
|
104
|
-
render(
|
|
92
|
+
render(rows, hasError = false) {
|
|
93
|
+
const header = [...statusTableHeader];
|
|
94
|
+
// const emptyColumns = Array.from({length: rows[0].length}).fill(0) as number[];
|
|
95
|
+
// for (const [, row] of rows.entries()) {
|
|
96
|
+
// for (const [j, cell] of row.entries()) {
|
|
97
|
+
// if (cell === '-') emptyColumns[j] += 1;
|
|
98
|
+
// }
|
|
99
|
+
// }
|
|
100
|
+
//
|
|
101
|
+
// for (const [j, cell] of emptyColumns.entries()) {
|
|
102
|
+
// if(cell === rows.length) {
|
|
103
|
+
// header.splice(j, 1);
|
|
104
|
+
// for (const [, row] of rows.entries()) {
|
|
105
|
+
// row.splice(j, 1);
|
|
106
|
+
// }
|
|
107
|
+
// }
|
|
108
|
+
// }
|
|
105
109
|
const options = { terminalAdapter: true };
|
|
106
|
-
const t1 = ttyTable(
|
|
110
|
+
const t1 = ttyTable(header, rows, options);
|
|
107
111
|
// hide cursor
|
|
108
112
|
console.log("\u001B[?25l");
|
|
109
113
|
// wipe existing if already rendered
|
|
110
114
|
if (this.alreadyRendered) {
|
|
111
115
|
// move cursor up number to the top of the previous print before deleting
|
|
112
|
-
console.log(`\u001B[${this.previousHeight + 3}A`);
|
|
116
|
+
console.log(`\u001B[${this.previousHeight + (hasError ? 4 : 3)}A`);
|
|
113
117
|
// delete to end of terminal
|
|
114
118
|
console.log("\u001B[0J");
|
|
115
119
|
}
|
|
@@ -4,29 +4,25 @@ import { configStore } from "../config-store.js";
|
|
|
4
4
|
import { FastforwardService } from "./fastforward-service.js";
|
|
5
5
|
export const clusterService = {
|
|
6
6
|
async fastForwardSnapshot() {
|
|
7
|
-
const { fastForward } = configStore.getProjectInfo();
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
// const { fastForward } = configStore.getProjectInfo();
|
|
8
|
+
//
|
|
9
|
+
// if (fastForward === false) {
|
|
10
|
+
// return;
|
|
11
|
+
// }
|
|
11
12
|
if (!configStore.getProjectInfo().layersToRun.includes('gl0')) {
|
|
12
13
|
return;
|
|
13
14
|
}
|
|
14
|
-
if
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
configStore.setProjectInfo({ fastForward: true });
|
|
15
|
+
// if(fastForward === undefined) {
|
|
16
|
+
const answer = await input({
|
|
17
|
+
default: 'y', message: 'Do you want to use the snapshot fast forward feature? (y/n): '
|
|
18
|
+
});
|
|
19
|
+
if (answer !== 'y') {
|
|
20
|
+
configStore.setProjectInfo({ fastForward: false });
|
|
21
|
+
return;
|
|
23
22
|
}
|
|
23
|
+
configStore.setProjectInfo({ fastForward: true });
|
|
24
|
+
// }
|
|
24
25
|
await FastforwardService.synctoLatestSnapshot();
|
|
25
|
-
// await archiverService.syncToLatestSnapshot()
|
|
26
|
-
// .catch(() => {
|
|
27
|
-
// clm.warn(`Failed to download latest snapshots using Starchiver. Using fast forward to latest snapshot.`);
|
|
28
|
-
// clusterService.fastForwardSnapshot();
|
|
29
|
-
// })
|
|
30
26
|
},
|
|
31
27
|
async getClusterInfo(layer) {
|
|
32
28
|
return this.makeClusterRequest('cluster/info', layer);
|
|
@@ -16,10 +16,9 @@ export class FastforwardService {
|
|
|
16
16
|
const { projectDir } = configStore.getProjectInfo();
|
|
17
17
|
const { type } = configStore.getNetworkInfo();
|
|
18
18
|
this.network = type;
|
|
19
|
-
this.tmpDir = path.join(projectDir, 'gl0', 'tmp');
|
|
20
19
|
this.dataDir = path.join(projectDir, 'gl0', 'data');
|
|
20
|
+
this.tmpDir = path.join(projectDir, 'gl0', 'data', 'tmp');
|
|
21
21
|
fs.mkdirSync(this.tmpDir, { recursive: true });
|
|
22
|
-
fs.mkdirSync(this.dataDir, { recursive: true });
|
|
23
22
|
// const env = configStore.getEnvNetworkInfo(type);
|
|
24
23
|
this.lbUrl = `https://l0-lb-${this.network}.constellationnetwork.io`;
|
|
25
24
|
// this.lbUrl = `http://${env.CL_L0_PEER_HTTP_HOST}:${env.CL_L0_PEER_HTTP_PORT}`;
|
|
@@ -13,7 +13,7 @@ export const nodeService = {
|
|
|
13
13
|
.then(res => {
|
|
14
14
|
if (res.ok)
|
|
15
15
|
return res.json().then(i => ({ ...i, layer }));
|
|
16
|
-
clm.
|
|
16
|
+
clm.debug(`Failed to get node info from ${res.url} (${res.status})`);
|
|
17
17
|
throw new Error(`Failed`);
|
|
18
18
|
})
|
|
19
19
|
.catch(() => ({ layer, state: "Unavailable" }));
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED