@constellation-network/node-pilot 0.8.0 → 0.9.0-testnet

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 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.8.0 darwin-arm64 node-v22.15.0
24
+ @constellation-network/node-pilot/0.9.0-testnet darwin-arm64 node-v22.15.0
25
25
  $ cpilot --help [COMMAND]
26
26
  USAGE
27
27
  $ cpilot COMMAND
@@ -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.8.0/src/commands/clean.ts)_
74
+ _See code: [src/commands/clean.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.9.0-testnet/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.8.0/src/commands/config.ts)_
91
+ _See code: [src/commands/config.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.9.0-testnet/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.8.0/src/commands/config/get.ts)_
115
+ _See code: [src/commands/config/get.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.9.0-testnet/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.8.0/src/commands/config/set.ts)_
138
+ _See code: [src/commands/config/set.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.9.0-testnet/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.8.0/src/commands/info.ts)_
175
+ _See code: [src/commands/info.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.9.0-testnet/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.8.0/src/commands/logs.ts)_
201
+ _See code: [src/commands/logs.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.9.0-testnet/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.8.0/src/commands/restart.ts)_
229
+ _See code: [src/commands/restart.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.9.0-testnet/src/commands/restart.ts)_
230
230
 
231
231
  ## `cpilot shutdown`
232
232
 
@@ -243,7 +243,7 @@ EXAMPLES
243
243
  $ cpilot shutdown
244
244
  ```
245
245
 
246
- _See code: [src/commands/shutdown.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.8.0/src/commands/shutdown.ts)_
246
+ _See code: [src/commands/shutdown.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.9.0-testnet/src/commands/shutdown.ts)_
247
247
 
248
248
  ## `cpilot status`
249
249
 
@@ -257,5 +257,5 @@ DESCRIPTION
257
257
  Display node status and configuration settings
258
258
  ```
259
259
 
260
- _See code: [src/commands/status.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.8.0/src/commands/status.ts)_
260
+ _See code: [src/commands/status.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.9.0-testnet/src/commands/status.ts)_
261
261
  <!-- commandsstop -->
@@ -74,7 +74,9 @@ export const checkNodePilot = {
74
74
  if (!result) {
75
75
  return { currentVer: undefined, latestVer: undefined };
76
76
  }
77
- const latestVer = semver.parse(result['dist-tags'].latest);
77
+ const { type } = configStore.getNetworkInfo();
78
+ const networkTag = type === 'testnet' ? 'testnet' : 'latest';
79
+ const latestVer = semver.parse(result['dist-tags'][networkTag]);
78
80
  const currentVer = semver.parse(packageJson.version);
79
81
  return { currentVer, latestVer };
80
82
  },
@@ -1,4 +1,5 @@
1
1
  export declare const checkProject: {
2
+ checkJavaMemory(): Promise<void>;
2
3
  hasVersionChanged(): Promise<boolean>;
3
4
  projectInstallation(): Promise<void>;
4
5
  releaseVersion(): Promise<void>;
@@ -9,6 +9,12 @@ import { dockerService } from "../services/docker-service.js";
9
9
  import { shellService } from "../services/shell-service.js";
10
10
  import { checkNetwork } from "./check-network.js";
11
11
  export const checkProject = {
12
+ async checkJavaMemory() {
13
+ if (configStore.hasProjectFlag('javaMemoryChecked')) {
14
+ return;
15
+ }
16
+ await promptHelper.configureJavaMemoryArguments();
17
+ },
12
18
  async hasVersionChanged() {
13
19
  const clusterVersion = await clusterService.getReleaseVersion();
14
20
  const rInfo = await configHelper.getReleaseInfo();
@@ -17,7 +23,7 @@ export const checkProject = {
17
23
  async projectInstallation() {
18
24
  let updateNetworkType = false;
19
25
  let updateLayers = false;
20
- if (!configStore.hasProjects() || process.env.PILOT_ENV === 'test') {
26
+ if (!configStore.hasProjects()) {
21
27
  await projectHelper.selectProject();
22
28
  await checkNetwork.configureIpAddress();
23
29
  updateNetworkType = true;
@@ -12,12 +12,13 @@ export default class Info extends Command {
12
12
  const projectInfo = configStore.getProjectInfo();
13
13
  const networkInfo = configStore.getNetworkInfo();
14
14
  const { CL_EXTERNAL_IP: currentIpAddress } = configStore.getEnvInfo();
15
+ const { CL_DOCKER_JAVA_OPTS } = configStore.getEnvLayerInfo(networkInfo.type, 'gl0');
15
16
  // Project Name
16
17
  configHelper.showEnvInfo('Project Name', projectInfo.name);
17
- // DAG Address
18
- configHelper.showEnvInfo('DAG Address', projectInfo.dagAddress);
19
18
  // External IP Address
20
19
  configHelper.showEnvInfo('External IP Address', currentIpAddress);
20
+ // DAG Address
21
+ configHelper.showEnvInfo('DAG Address', projectInfo.dagAddress);
21
22
  // Node ID
22
23
  configHelper.showEnvInfo('Node ID', projectInfo.nodeId);
23
24
  // Layers to Run
@@ -26,6 +27,8 @@ export default class Info extends Command {
26
27
  configHelper.showEnvInfo('Network', networkInfo.type);
27
28
  // Network version
28
29
  configHelper.showEnvInfo('Network Version', networkInfo.version);
30
+ // Java Memory
31
+ configHelper.showEnvInfo('GL0 Java Opts', CL_DOCKER_JAVA_OPTS);
29
32
  // Project Directory
30
33
  configHelper.showEnvInfo('Project Directory', projectInfo.projectDir);
31
34
  // Fast Forward
@@ -7,6 +7,7 @@ import { checkNodePilot } from "../checks/check-pilot.js";
7
7
  import { checkProject } from "../checks/check-project.js";
8
8
  import { checkWallet } from "../checks/check-wallet.js";
9
9
  import { keyFileHelper } from "../helpers/key-file-helper.js";
10
+ import { migrationService } from "../services/migration-service.js";
10
11
  export default class Status extends Command {
11
12
  // eslint-disable-next-line no-warning-comments
12
13
  // TODO add -f flag to continuously monitor status
@@ -16,8 +17,10 @@ export default class Status extends Command {
16
17
  }
17
18
  }
18
19
  export async function checkInstallationAndConfigurationStatus() {
20
+ migrationService.runMigrations();
19
21
  await checkInitialSetup.firstTimeRun();
20
22
  await checkProject.projectInstallation();
23
+ await checkProject.checkJavaMemory();
21
24
  await checkNetwork.checkExternalIpAddress();
22
25
  await checkNetwork.isNetworkConnectable();
23
26
  await checkNodePilot.checkDiscordRegistration();
@@ -117,6 +117,7 @@ export type ProjectInfo = {
117
117
  name: string;
118
118
  nodeId: string;
119
119
  projectDir: string;
120
+ version: string;
120
121
  };
121
122
  export type NetworkInfo = {
122
123
  supportedTypes: NetworkType[];
@@ -83,7 +83,7 @@ class ConfigStore {
83
83
  return this.projectStore.getItem('network');
84
84
  }
85
85
  getProjectInfo() {
86
- return this.projectStore.getItem('project');
86
+ return this.projectStore.getItem('project') || {};
87
87
  }
88
88
  getProjects() {
89
89
  const { projects } = this.pilotStore.getItem('pilot');
@@ -1,7 +1,12 @@
1
1
  import { checkbox, input, number, select } from "@inquirer/prompts";
2
2
  import chalk from "chalk";
3
+ import os from "node:os";
3
4
  import { clm } from "../clm.js";
4
5
  import { configStore } from "../config-store.js";
6
+ function getJavaMemoryOptions(mem) {
7
+ const linuxOpt = (os.platform() === 'linux') ? ' -XX:+UseZGC' : '';
8
+ return `-Xms${mem}g -Xmx${mem}g -XX:+UnlockExperimentalVMOptions${linuxOpt} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./heap_dumps/ -XX:+ExitOnOutOfMemoryError`;
9
+ }
5
10
  export const promptHelper = {
6
11
  async configureJavaMemoryArguments() {
7
12
  const { memory } = configStore.getSystemInfo();
@@ -30,13 +35,14 @@ export const promptHelper = {
30
35
  const network = type.toUpperCase();
31
36
  const logMethod = type === currentNetwork ? clm.postStep : clm.debug;
32
37
  logMethod(`${network}:: ${layersToRun[0]} memory allocation: ${mainLayerMem}GB`);
33
- configStore.setEnvLayerInfo(type, layersToRun[0], { CL_DOCKER_JAVA_OPTS: `-Xms1024M -Xmx${mainLayerMem}G -Xss256K` });
38
+ configStore.setEnvLayerInfo(type, layersToRun[0], { CL_DOCKER_JAVA_OPTS: getJavaMemoryOptions(mainLayerMem) });
34
39
  if (subLayerMem) {
35
40
  logMethod(`${network}:: ${layersToRun[1]} memory allocation: ${subLayerMem}GB`);
36
41
  configStore.setEnvLayerInfo(type, layersToRun[1], { CL_DOCKER_JAVA_OPTS: `-Xms1024M -Xmx${subLayerMem}G -Xss256K` });
37
42
  }
38
43
  }
39
44
  }
45
+ configStore.setProjectFlag('javaMemoryChecked', true);
40
46
  },
41
47
  async confirmPrompt(msg) {
42
48
  const result = await input({
@@ -0,0 +1,3 @@
1
+ export declare const migrationService: {
2
+ runMigrations(): void;
3
+ };
@@ -0,0 +1,35 @@
1
+ import semver from "semver";
2
+ import packageJson from '../../package.json' with { type: 'json' };
3
+ import { clm } from "../clm.js";
4
+ import { configStore } from "../config-store.js";
5
+ export const migrationService = {
6
+ runMigrations() {
7
+ const migrations = {
8
+ '0.8.0': m080,
9
+ // add more migrations as needed
10
+ };
11
+ const { version = '0.0.0' } = configStore.getProjectInfo();
12
+ const lastMigratedVersion = semver.parse(version);
13
+ const currentVersion = semver.parse(packageJson.version);
14
+ if (!lastMigratedVersion || !currentVersion) {
15
+ return;
16
+ }
17
+ // console.log(`Running migrations from ${lastMigratedVersion.version} to ${currentVersion.version}`);
18
+ // console.log(`semver.gt(v, version): ${semver.gt('0.8.0', version)}`);
19
+ // console.log(`semver.lte(v, currentVersion.version): ${semver.lte('0.8.0', currentVersion.version)}`)
20
+ const migrationVersions = Object.keys(migrations)
21
+ .filter(v => semver.gt(v, version) && semver.lte(v, currentVersion.version))
22
+ .sort(semver.compare);
23
+ if (migrationVersions.length > 0) {
24
+ clm.preStep(`Migration versions to run: ${migrationVersions}`);
25
+ for (const version of migrationVersions) {
26
+ migrations[version]();
27
+ }
28
+ }
29
+ configStore.setProjectInfo({ version: currentVersion.toString() });
30
+ }
31
+ };
32
+ function m080() {
33
+ clm.step('Running migration 0.8.0...');
34
+ configStore.setProjectFlag('javaMemoryChecked', false);
35
+ }
@@ -117,7 +117,7 @@ export const nodeService = {
117
117
  clm.postStep(`${layer} is ${expectedState}`);
118
118
  return true;
119
119
  }
120
- if (state === "Unavailable" && i > 2) {
120
+ if (state === "Unavailable" && i > 6) {
121
121
  clm.warn(`${layer} is not connectable. Please try again later.`);
122
122
  return false;
123
123
  }
@@ -340,5 +340,5 @@
340
340
  ]
341
341
  }
342
342
  },
343
- "version": "0.8.0"
343
+ "version": "0.9.0-testnet"
344
344
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@constellation-network/node-pilot",
3
3
  "description": "An easy deployment and monitoring tool for Constellation nodes.",
4
- "version": "0.8.0",
4
+ "version": "0.9.0-testnet",
5
5
  "author": "Frank Fox",
6
6
  "bin": {
7
7
  "cpilot": "bin/run.js"
@@ -21,7 +21,7 @@
21
21
  "version": "oclif readme && git add README.md",
22
22
  "start": "./bin/dev.js",
23
23
  "debug": "DEBUG=true ./bin/dev.js",
24
- "pub": "npm publish --access public"
24
+ "pub": "npm publish --access public --tag testnet"
25
25
  },
26
26
  "types": "dist/index.d.ts",
27
27
  "engines": {
@@ -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.22"
42
+ RUN npm install -g "@constellation-network/node-pilot-health-check@0.0.23"
43
43
 
44
44
  # Add entrypoint
45
45
  COPY ./entrypoint.sh /app/entrypoint.sh