@constellation-network/node-pilot 0.2.0 → 0.3.0
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 +16 -16
- package/dist/checks/check-pilot.d.ts +1 -0
- package/dist/checks/check-pilot.js +14 -4
- package/dist/commands/clean.d.ts +2 -2
- package/dist/commands/clean.js +27 -17
- package/dist/commands/info.js +4 -1
- package/dist/helpers/status-table.js +3 -3
- package/oclif.manifest.json +11 -11
- package/package.json +1 -1
- package/projects/hypergraph/Dockerfile +1 -1
- package/projects/hypergraph/docker-compose.yml +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.
|
|
24
|
+
@constellation-network/node-pilot/0.3.0 darwin-arm64 node-v22.15.0
|
|
25
25
|
$ cpilot --help [COMMAND]
|
|
26
26
|
USAGE
|
|
27
27
|
$ cpilot COMMAND
|
|
@@ -37,7 +37,7 @@ If no command is entered, node-pilot will automatically perform a series of chec
|
|
|
37
37
|
|
|
38
38
|
# Commands
|
|
39
39
|
<!-- commands -->
|
|
40
|
-
* [`cpilot clean LAYER`](#cpilot-clean-layer)
|
|
40
|
+
* [`cpilot clean [LAYER]`](#cpilot-clean-layer)
|
|
41
41
|
* [`cpilot config`](#cpilot-config)
|
|
42
42
|
* [`cpilot config get [NAME]`](#cpilot-config-get-name)
|
|
43
43
|
* [`cpilot config set NAME VALUE`](#cpilot-config-set-name-value)
|
|
@@ -48,21 +48,21 @@ If no command is entered, node-pilot will automatically perform a series of chec
|
|
|
48
48
|
* [`cpilot shutdown`](#cpilot-shutdown)
|
|
49
49
|
* [`cpilot status`](#cpilot-status)
|
|
50
50
|
|
|
51
|
-
## `cpilot clean LAYER`
|
|
51
|
+
## `cpilot clean [LAYER]`
|
|
52
52
|
|
|
53
53
|
Remove data and/or logs from a validator node
|
|
54
54
|
|
|
55
55
|
```
|
|
56
56
|
USAGE
|
|
57
|
-
$ cpilot clean LAYER [-
|
|
57
|
+
$ cpilot clean [LAYER] [-d] [-j] [-l]
|
|
58
58
|
|
|
59
59
|
ARGUMENTS
|
|
60
60
|
LAYER network layer to clean. e.g. gl0
|
|
61
61
|
|
|
62
62
|
FLAGS
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
-l, --logs remove logs
|
|
63
|
+
-d, --data remove only data
|
|
64
|
+
-j, --jars remove only jars
|
|
65
|
+
-l, --logs remove only logs
|
|
66
66
|
|
|
67
67
|
DESCRIPTION
|
|
68
68
|
Remove data and/or logs from a validator node
|
|
@@ -71,7 +71,7 @@ EXAMPLES
|
|
|
71
71
|
$ cpilot clean
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
_See code: [src/commands/clean.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
74
|
+
_See code: [src/commands/clean.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.3.0/src/commands/clean.ts)_
|
|
75
75
|
|
|
76
76
|
## `cpilot config`
|
|
77
77
|
|
|
@@ -88,7 +88,7 @@ EXAMPLES
|
|
|
88
88
|
$ cpilot config
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
_See code: [src/commands/config.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
91
|
+
_See code: [src/commands/config.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.3.0/src/commands/config.ts)_
|
|
92
92
|
|
|
93
93
|
## `cpilot config get [NAME]`
|
|
94
94
|
|
|
@@ -112,7 +112,7 @@ EXAMPLES
|
|
|
112
112
|
$ cpilot config get gl0:CL_PUBLIC_HTTP_PORT
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
-
_See code: [src/commands/config/get.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
115
|
+
_See code: [src/commands/config/get.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.3.0/src/commands/config/get.ts)_
|
|
116
116
|
|
|
117
117
|
## `cpilot config set NAME VALUE`
|
|
118
118
|
|
|
@@ -135,7 +135,7 @@ EXAMPLES
|
|
|
135
135
|
$ cpilot config set gl0:CL_PUBLIC_HTTP_PORT 9000
|
|
136
136
|
```
|
|
137
137
|
|
|
138
|
-
_See code: [src/commands/config/set.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
138
|
+
_See code: [src/commands/config/set.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.3.0/src/commands/config/set.ts)_
|
|
139
139
|
|
|
140
140
|
## `cpilot help [COMMAND]`
|
|
141
141
|
|
|
@@ -172,7 +172,7 @@ EXAMPLES
|
|
|
172
172
|
$ cpilot info
|
|
173
173
|
```
|
|
174
174
|
|
|
175
|
-
_See code: [src/commands/info.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
175
|
+
_See code: [src/commands/info.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.3.0/src/commands/info.ts)_
|
|
176
176
|
|
|
177
177
|
## `cpilot logs LAYER`
|
|
178
178
|
|
|
@@ -198,7 +198,7 @@ EXAMPLES
|
|
|
198
198
|
$ cpilot logs
|
|
199
199
|
```
|
|
200
200
|
|
|
201
|
-
_See code: [src/commands/logs.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
201
|
+
_See code: [src/commands/logs.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.3.0/src/commands/logs.ts)_
|
|
202
202
|
|
|
203
203
|
## `cpilot restart [LAYER]`
|
|
204
204
|
|
|
@@ -226,7 +226,7 @@ EXAMPLES
|
|
|
226
226
|
$ cpilot restart
|
|
227
227
|
```
|
|
228
228
|
|
|
229
|
-
_See code: [src/commands/restart.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
229
|
+
_See code: [src/commands/restart.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.3.0/src/commands/restart.ts)_
|
|
230
230
|
|
|
231
231
|
## `cpilot shutdown`
|
|
232
232
|
|
|
@@ -246,7 +246,7 @@ EXAMPLES
|
|
|
246
246
|
$ cpilot shutdown
|
|
247
247
|
```
|
|
248
248
|
|
|
249
|
-
_See code: [src/commands/shutdown.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
249
|
+
_See code: [src/commands/shutdown.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.3.0/src/commands/shutdown.ts)_
|
|
250
250
|
|
|
251
251
|
## `cpilot status`
|
|
252
252
|
|
|
@@ -260,5 +260,5 @@ DESCRIPTION
|
|
|
260
260
|
Display node status and configuration settings
|
|
261
261
|
```
|
|
262
262
|
|
|
263
|
-
_See code: [src/commands/status.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.
|
|
263
|
+
_See code: [src/commands/status.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.3.0/src/commands/status.ts)_
|
|
264
264
|
<!-- commandsstop -->
|
|
@@ -36,12 +36,12 @@ export const checkNodePilot = {
|
|
|
36
36
|
if (os.platform() !== 'linux')
|
|
37
37
|
return;
|
|
38
38
|
const hasMajorMinorChange = latestVer.major !== currentVer.major || latestVer.minor !== currentVer.minor;
|
|
39
|
+
const dockerIsRunning = await dockerService.isRunning();
|
|
39
40
|
if (hasMajorMinorChange) {
|
|
40
|
-
const dockerIsRunning = await dockerService.isRunning();
|
|
41
41
|
if (dockerIsRunning) {
|
|
42
42
|
clm.warn('This update requires the Node to shutdown before proceeding.');
|
|
43
43
|
}
|
|
44
|
-
if (await promptHelper.confirmPrompt('Do you wish to
|
|
44
|
+
if (await promptHelper.confirmPrompt('Do you wish to update now?')) {
|
|
45
45
|
if (dockerIsRunning) {
|
|
46
46
|
await dockerService.dockerDown();
|
|
47
47
|
}
|
|
@@ -52,8 +52,13 @@ export const checkNodePilot = {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
else {
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
if (dockerIsRunning) {
|
|
56
|
+
clm.preStep('This update includes a minor change. Your Node will remain up and running during the update.');
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
clm.preStep('This update includes a minor change.');
|
|
60
|
+
}
|
|
61
|
+
if (!await promptHelper.confirmPrompt('Do you wish to update now?')) {
|
|
57
62
|
clm.postStep('Skipping update...');
|
|
58
63
|
return;
|
|
59
64
|
}
|
|
@@ -67,6 +72,11 @@ export const checkNodePilot = {
|
|
|
67
72
|
clm.postStep('Update completed. Run cpilot again to use the latest version');
|
|
68
73
|
process.exit(0);
|
|
69
74
|
},
|
|
75
|
+
isDiscordAlertsEnabled() {
|
|
76
|
+
const hcStorage = getHcStorage();
|
|
77
|
+
const user = hcStorage.getItem('user');
|
|
78
|
+
return user && user.webHookEnabled;
|
|
79
|
+
},
|
|
70
80
|
async promptDiscordRegistration() {
|
|
71
81
|
const hcStorage = getHcStorage();
|
|
72
82
|
const join = await promptHelper.confirmPrompt('Do you want to enable Discord notifications for your node?:');
|
package/dist/commands/clean.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
2
|
export default class Clean extends Command {
|
|
3
3
|
static args: {
|
|
4
|
-
layer: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
4
|
+
layer: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
5
5
|
};
|
|
6
6
|
static description: string;
|
|
7
7
|
static examples: string[];
|
|
8
8
|
static flags: {
|
|
9
|
-
all: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
9
|
data: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
jars: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
11
|
logs: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
12
|
};
|
|
13
13
|
run(): Promise<void>;
|
package/dist/commands/clean.js
CHANGED
|
@@ -7,40 +7,50 @@ import { dockerService } from "../services/docker-service.js";
|
|
|
7
7
|
import { shellService } from "../services/shell-service.js";
|
|
8
8
|
export default class Clean extends Command {
|
|
9
9
|
static args = {
|
|
10
|
-
layer: Args.string({ description: 'network layer to clean. e.g. gl0', required:
|
|
10
|
+
layer: Args.string({ description: 'network layer to clean. e.g. gl0', required: false }),
|
|
11
11
|
};
|
|
12
12
|
static description = 'Remove data and/or logs from a validator node';
|
|
13
13
|
static examples = [
|
|
14
14
|
'<%= config.bin %> <%= command.id %>',
|
|
15
15
|
];
|
|
16
16
|
static flags = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
logs: Flags.boolean({ char: 'l', description: 'remove logs' })
|
|
17
|
+
data: Flags.boolean({ char: 'd', description: 'remove only data' }),
|
|
18
|
+
jars: Flags.boolean({ char: 'j', description: 'remove only jars' }),
|
|
19
|
+
logs: Flags.boolean({ char: 'l', description: 'remove only logs' })
|
|
20
20
|
};
|
|
21
21
|
async run() {
|
|
22
22
|
const { args, flags } = await this.parse(Clean);
|
|
23
23
|
const { layersToRun } = configStore.getProjectInfo();
|
|
24
|
-
if (!layersToRun.includes(args.layer)) {
|
|
24
|
+
if (args.layer && !layersToRun.includes(args.layer)) {
|
|
25
25
|
this.error(`Invalid layer: ${args.layer}. Available layers: ${layersToRun.join(',')}`);
|
|
26
26
|
}
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
const layers = args.layer ? [args.layer] : layersToRun;
|
|
28
|
+
const deleteAll = !flags.data && !flags.logs && !flags.jars;
|
|
29
|
+
const deleteLogs = flags.logs || deleteAll;
|
|
30
|
+
const deleteData = flags.data || deleteAll;
|
|
31
|
+
const deleteJars = flags.jars || deleteAll;
|
|
32
32
|
if (await dockerService.isRunning()) {
|
|
33
33
|
clm.preStep('The validator node must be stopped first.');
|
|
34
34
|
await promptHelper.doYouWishToContinue();
|
|
35
35
|
await dockerService.dockerDown();
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
for (const layer of layers) {
|
|
38
|
+
if (deleteData) {
|
|
39
|
+
// eslint-disable-next-line no-await-in-loop
|
|
40
|
+
await shellService.runProjectCommand(`sudo rm -rf ${layer}/data`);
|
|
41
|
+
if (layer === 'gl0') {
|
|
42
|
+
projectHelper.prepareDataFolder();
|
|
43
|
+
configStore.setProjectFlag('discordChecked', false);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (deleteLogs) {
|
|
47
|
+
// eslint-disable-next-line no-await-in-loop
|
|
48
|
+
await shellService.runProjectCommand(`sudo rm -rf ${layer}/logs`);
|
|
49
|
+
}
|
|
50
|
+
if (deleteJars) {
|
|
51
|
+
// eslint-disable-next-line no-await-in-loop
|
|
52
|
+
await shellService.runProjectCommand(`sudo rm -rf ${layer}/dist`);
|
|
53
|
+
}
|
|
44
54
|
}
|
|
45
55
|
}
|
|
46
56
|
}
|
package/dist/commands/info.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
2
|
import { configStore } from "../config-store.js";
|
|
3
3
|
import { configHelper } from "../helpers/config-helper.js";
|
|
4
|
+
import { checkNodePilot } from "../checks/check-pilot.js";
|
|
4
5
|
export default class Info extends Command {
|
|
5
6
|
static description = 'Display general info about the validator node';
|
|
6
7
|
static examples = [
|
|
@@ -28,6 +29,8 @@ export default class Info extends Command {
|
|
|
28
29
|
// Project Directory
|
|
29
30
|
configHelper.showEnvInfo('Project Directory', projectInfo.projectDir);
|
|
30
31
|
// Fast Forward
|
|
31
|
-
configHelper.showEnvInfo('Fast Forward Enabled', (projectInfo.fastForward === undefined || Boolean(projectInfo.fastForward)).toString());
|
|
32
|
+
// configHelper.showEnvInfo('Fast Forward Enabled', (projectInfo.fastForward === undefined || Boolean(projectInfo.fastForward)).toString());
|
|
33
|
+
// Discord alerts
|
|
34
|
+
configHelper.showEnvInfo('Discord Alerts Enabled', checkNodePilot.isDiscordAlertsEnabled());
|
|
32
35
|
}
|
|
33
36
|
}
|
|
@@ -19,7 +19,7 @@ export class StatusTable {
|
|
|
19
19
|
});
|
|
20
20
|
const table = new StatusTable();
|
|
21
21
|
const cols = process.stdout.columns;
|
|
22
|
-
console.log(String('Colspan: ' + cols));
|
|
22
|
+
// console.log(String('Colspan: ' + cols));
|
|
23
23
|
if (cols > 120) {
|
|
24
24
|
table.monitorWide();
|
|
25
25
|
}
|
|
@@ -94,7 +94,7 @@ export class StatusTable {
|
|
|
94
94
|
tables.push({ error: errorMsg, label, row1: [row1], row2: [row2] });
|
|
95
95
|
}
|
|
96
96
|
this.renderNarrow(tables);
|
|
97
|
-
process.stdout.write("\n * press any key to
|
|
97
|
+
process.stdout.write("\n * press any key to stop monitoring");
|
|
98
98
|
// eslint-disable-next-line no-await-in-loop
|
|
99
99
|
await sleep(1);
|
|
100
100
|
}
|
|
@@ -141,7 +141,7 @@ export class StatusTable {
|
|
|
141
141
|
// projects.push({ error: errorMsg, label, row1, row2 });
|
|
142
142
|
}
|
|
143
143
|
this.renderWide({ error: errorMsg, label: '', row1: rows, row2: [] });
|
|
144
|
-
process.stdout.write("\n * press any key to
|
|
144
|
+
process.stdout.write("\n * press any key to stop monitoring");
|
|
145
145
|
// eslint-disable-next-line no-await-in-loop
|
|
146
146
|
await sleep(1);
|
|
147
147
|
}
|
package/oclif.manifest.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"layer": {
|
|
7
7
|
"description": "network layer to clean. e.g. gl0",
|
|
8
8
|
"name": "layer",
|
|
9
|
-
"required":
|
|
9
|
+
"required": false
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
"description": "Remove data and/or logs from a validator node",
|
|
@@ -14,23 +14,23 @@
|
|
|
14
14
|
"<%= config.bin %> <%= command.id %>"
|
|
15
15
|
],
|
|
16
16
|
"flags": {
|
|
17
|
-
"all": {
|
|
18
|
-
"char": "a",
|
|
19
|
-
"description": "remove all data and logs",
|
|
20
|
-
"name": "all",
|
|
21
|
-
"allowNo": false,
|
|
22
|
-
"type": "boolean"
|
|
23
|
-
},
|
|
24
17
|
"data": {
|
|
25
18
|
"char": "d",
|
|
26
|
-
"description": "remove data",
|
|
19
|
+
"description": "remove only data",
|
|
27
20
|
"name": "data",
|
|
28
21
|
"allowNo": false,
|
|
29
22
|
"type": "boolean"
|
|
30
23
|
},
|
|
24
|
+
"jars": {
|
|
25
|
+
"char": "j",
|
|
26
|
+
"description": "remove only jars",
|
|
27
|
+
"name": "jars",
|
|
28
|
+
"allowNo": false,
|
|
29
|
+
"type": "boolean"
|
|
30
|
+
},
|
|
31
31
|
"logs": {
|
|
32
32
|
"char": "l",
|
|
33
|
-
"description": "remove logs",
|
|
33
|
+
"description": "remove only logs",
|
|
34
34
|
"name": "logs",
|
|
35
35
|
"allowNo": false,
|
|
36
36
|
"type": "boolean"
|
|
@@ -349,5 +349,5 @@
|
|
|
349
349
|
]
|
|
350
350
|
}
|
|
351
351
|
},
|
|
352
|
-
"version": "0.
|
|
352
|
+
"version": "0.3.0"
|
|
353
353
|
}
|
package/package.json
CHANGED
|
@@ -39,7 +39,7 @@ COPY dist/gl0.jar /app/jars/gl0.jar
|
|
|
39
39
|
#COPY ./health-check /health-check
|
|
40
40
|
#RUN chmod +x /health-check/bin/run.sh
|
|
41
41
|
#RUN chmod +x /health-check/bin/hydrate.sh
|
|
42
|
-
RUN npm install -g "@constellation-network/node-pilot-health-check@0.0.
|
|
42
|
+
RUN npm install -g "@constellation-network/node-pilot-health-check@0.0.17"
|
|
43
43
|
|
|
44
44
|
# Add entrypoint
|
|
45
45
|
COPY ./entrypoint.sh /app/entrypoint.sh
|
|
@@ -20,8 +20,8 @@ services:
|
|
|
20
20
|
volumes:
|
|
21
21
|
- ./gl0/data:/app/data
|
|
22
22
|
- ./gl0/logs:/app/logs
|
|
23
|
+
- ./seedlist:/app/seedlist
|
|
23
24
|
- ./key.p12:/app/key.p12:ro
|
|
24
|
-
- ./seedlist:/app/seedlist:ro
|
|
25
25
|
healthcheck:
|
|
26
26
|
test: ["CMD", "cpilotHC"]
|
|
27
27
|
# test: ["CMD", "/health-check/bin/run.sh"]
|