@constellation-network/node-pilot 0.24.0-devnet → 0.24.0-devnet.1
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 +11 -11
- package/dist/services/docker-service.js +3 -1
- package/dist/services/migration-service.js +50 -57
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/projects/hypergraph/Dockerfile +3 -1
- package/projects/hypergraph/scripts/docker-build.sh +3 -2
- package/projects/hypergraph/scripts/install-dependencies.sh +30 -21
- package/projects/hypergraph/scripts/install.sh +5 -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.0-devnet darwin-arm64 node-v22.15.0
|
|
24
|
+
@constellation-network/node-pilot/0.24.0-devnet.1 darwin-arm64 node-v22.15.0
|
|
25
25
|
$ cpilot --help [COMMAND]
|
|
26
26
|
USAGE
|
|
27
27
|
$ cpilot COMMAND
|
|
@@ -72,7 +72,7 @@ EXAMPLES
|
|
|
72
72
|
$ cpilot clean
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
_See code: [src/commands/clean.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet/src/commands/clean.ts)_
|
|
75
|
+
_See code: [src/commands/clean.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet.1/src/commands/clean.ts)_
|
|
76
76
|
|
|
77
77
|
## `cpilot config`
|
|
78
78
|
|
|
@@ -89,7 +89,7 @@ EXAMPLES
|
|
|
89
89
|
$ cpilot config
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
_See code: [src/commands/config.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet/src/commands/config.ts)_
|
|
92
|
+
_See code: [src/commands/config.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet.1/src/commands/config.ts)_
|
|
93
93
|
|
|
94
94
|
## `cpilot config get [NAME]`
|
|
95
95
|
|
|
@@ -113,7 +113,7 @@ EXAMPLES
|
|
|
113
113
|
$ cpilot config get gl0:CL_PUBLIC_HTTP_PORT
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
-
_See code: [src/commands/config/get.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet/src/commands/config/get.ts)_
|
|
116
|
+
_See code: [src/commands/config/get.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet.1/src/commands/config/get.ts)_
|
|
117
117
|
|
|
118
118
|
## `cpilot config set NAME VALUE`
|
|
119
119
|
|
|
@@ -136,7 +136,7 @@ EXAMPLES
|
|
|
136
136
|
$ cpilot config set gl0:CL_PUBLIC_HTTP_PORT 9000
|
|
137
137
|
```
|
|
138
138
|
|
|
139
|
-
_See code: [src/commands/config/set.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet/src/commands/config/set.ts)_
|
|
139
|
+
_See code: [src/commands/config/set.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet.1/src/commands/config/set.ts)_
|
|
140
140
|
|
|
141
141
|
## `cpilot help [COMMAND]`
|
|
142
142
|
|
|
@@ -173,7 +173,7 @@ EXAMPLES
|
|
|
173
173
|
$ cpilot info
|
|
174
174
|
```
|
|
175
175
|
|
|
176
|
-
_See code: [src/commands/info.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet/src/commands/info.ts)_
|
|
176
|
+
_See code: [src/commands/info.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet.1/src/commands/info.ts)_
|
|
177
177
|
|
|
178
178
|
## `cpilot logs LAYER`
|
|
179
179
|
|
|
@@ -199,7 +199,7 @@ EXAMPLES
|
|
|
199
199
|
$ cpilot logs
|
|
200
200
|
```
|
|
201
201
|
|
|
202
|
-
_See code: [src/commands/logs.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet/src/commands/logs.ts)_
|
|
202
|
+
_See code: [src/commands/logs.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet.1/src/commands/logs.ts)_
|
|
203
203
|
|
|
204
204
|
## `cpilot restart [LAYER]`
|
|
205
205
|
|
|
@@ -223,7 +223,7 @@ EXAMPLES
|
|
|
223
223
|
$ cpilot restart
|
|
224
224
|
```
|
|
225
225
|
|
|
226
|
-
_See code: [src/commands/restart.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet/src/commands/restart.ts)_
|
|
226
|
+
_See code: [src/commands/restart.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet.1/src/commands/restart.ts)_
|
|
227
227
|
|
|
228
228
|
## `cpilot shutdown`
|
|
229
229
|
|
|
@@ -240,7 +240,7 @@ EXAMPLES
|
|
|
240
240
|
$ cpilot shutdown
|
|
241
241
|
```
|
|
242
242
|
|
|
243
|
-
_See code: [src/commands/shutdown.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet/src/commands/shutdown.ts)_
|
|
243
|
+
_See code: [src/commands/shutdown.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet.1/src/commands/shutdown.ts)_
|
|
244
244
|
|
|
245
245
|
## `cpilot status`
|
|
246
246
|
|
|
@@ -254,7 +254,7 @@ DESCRIPTION
|
|
|
254
254
|
Display node status and configuration settings
|
|
255
255
|
```
|
|
256
256
|
|
|
257
|
-
_See code: [src/commands/status.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet/src/commands/status.ts)_
|
|
257
|
+
_See code: [src/commands/status.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet.1/src/commands/status.ts)_
|
|
258
258
|
|
|
259
259
|
## `cpilot uninstall`
|
|
260
260
|
|
|
@@ -271,5 +271,5 @@ EXAMPLES
|
|
|
271
271
|
$ cpilot uninstall
|
|
272
272
|
```
|
|
273
273
|
|
|
274
|
-
_See code: [src/commands/uninstall.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet/src/commands/uninstall.ts)_
|
|
274
|
+
_See code: [src/commands/uninstall.ts](https://github.com/Constellation-Labs/node-pilot/blob/v0.24.0-devnet.1/src/commands/uninstall.ts)_
|
|
275
275
|
<!-- commandsstop -->
|
|
@@ -16,7 +16,9 @@ export const dockerService = {
|
|
|
16
16
|
else {
|
|
17
17
|
clm.preStep('Building the node container...');
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
const { type: network } = configStore.getNetworkInfo();
|
|
20
|
+
const JAVA_VERSION = network === 'mainnet' ? '11' : '21';
|
|
21
|
+
await shellService.runProjectCommand('bash scripts/docker-build.sh', { JAVA_VERSION }, silent);
|
|
20
22
|
if (silent) {
|
|
21
23
|
spinner.stop();
|
|
22
24
|
}
|
|
@@ -2,18 +2,25 @@ import semver from "semver";
|
|
|
2
2
|
import { clm } from "../clm.js";
|
|
3
3
|
import { configStore } from "../config-store.js";
|
|
4
4
|
import { projectHelper } from "../helpers/project-helper.js";
|
|
5
|
+
import { dockerService } from "./docker-service.js";
|
|
6
|
+
import { nodeService } from "./node-service.js";
|
|
5
7
|
import { shellService } from "./shell-service.js";
|
|
8
|
+
const migrations = {
|
|
9
|
+
'0.24.0-0': {
|
|
10
|
+
description: 'host Java 21; container Java is network-aware (11 for mainnet, 21 elsewhere)',
|
|
11
|
+
requiresNodeRestart: true,
|
|
12
|
+
async run() {
|
|
13
|
+
configStore.setProjectFlag('javaMemoryChecked', false);
|
|
14
|
+
projectHelper.upgradeHypergraph();
|
|
15
|
+
const { type: network } = configStore.getNetworkInfo();
|
|
16
|
+
const JAVA_VERSION = network === 'mainnet' ? '11' : '21';
|
|
17
|
+
await shellService.runProjectCommand('bash scripts/install-dependencies.sh', { JAVA_VERSION });
|
|
18
|
+
await refreshJavaHome();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
6
22
|
export const migrationService = {
|
|
7
23
|
async runMigrations() {
|
|
8
|
-
const migrations = {
|
|
9
|
-
'0.12.5': m0125,
|
|
10
|
-
'0.13.9': m0139,
|
|
11
|
-
'0.14.0-intnet.1': m0140intnet1,
|
|
12
|
-
'0.18.7-intnet': m01807,
|
|
13
|
-
'0.19.2-intnet': m0192intnet,
|
|
14
|
-
'0.24.0-0': m0240
|
|
15
|
-
// add more migrations as needed
|
|
16
|
-
};
|
|
17
24
|
const { version = '0.0.0' } = configStore.getProjectInfo();
|
|
18
25
|
const { version: pilotVersion } = configStore.getPilotReleaseInfo();
|
|
19
26
|
const lastMigratedVersion = semver.parse(version);
|
|
@@ -22,27 +29,46 @@ export const migrationService = {
|
|
|
22
29
|
return;
|
|
23
30
|
}
|
|
24
31
|
clm.debug(`Running migrations from ${lastMigratedVersion.version} to ${currentVersion.version}`);
|
|
25
|
-
|
|
26
|
-
clm.debug(`semver.lte(v, currentVersion.version): ${semver.lte('0.8.0', currentVersion.version)}`);
|
|
27
|
-
const migrationVersions = Object.keys(migrations)
|
|
32
|
+
const migrationKeys = Object.keys(migrations)
|
|
28
33
|
.filter(v => semver.gt(v, version) && semver.lte(v, currentVersion.version))
|
|
29
34
|
.sort(semver.compare);
|
|
30
|
-
if (
|
|
31
|
-
clm.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
if (migrationKeys.length === 0) {
|
|
36
|
+
clm.debug('No migrations applicable.');
|
|
37
|
+
configStore.setProjectInfo({ version: currentVersion.toString() });
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const summary = migrationKeys.map(k => `${k} (${migrations[k].description})`).join(', ');
|
|
41
|
+
clm.preStep(`Migration versions to run: ${summary}`);
|
|
42
|
+
for (const key of migrationKeys) {
|
|
43
|
+
// eslint-disable-next-line no-await-in-loop
|
|
44
|
+
await runMigration(key, migrations[key]);
|
|
45
|
+
// Stamp per-migration so a later failure doesn't re-run earlier ones.
|
|
46
|
+
configStore.setProjectInfo({ version: key });
|
|
36
47
|
}
|
|
37
48
|
configStore.setProjectInfo({ version: currentVersion.toString() });
|
|
38
49
|
}
|
|
39
50
|
};
|
|
40
|
-
async function
|
|
41
|
-
clm.step(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
51
|
+
async function runMigration(key, migration) {
|
|
52
|
+
clm.step(`Running migration ${key} — ${migration.description}...`);
|
|
53
|
+
if (!migration.requiresNodeRestart) {
|
|
54
|
+
await migration.run();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const wasRunning = await dockerService.isRunning();
|
|
58
|
+
if (wasRunning) {
|
|
59
|
+
clm.preStep('Shutting down node to apply migration changes...');
|
|
60
|
+
const { layersToRun } = configStore.getProjectInfo();
|
|
61
|
+
await nodeService.leaveClusterAllLayers();
|
|
62
|
+
await nodeService.pollForLayersState(layersToRun, 'Offline');
|
|
63
|
+
await dockerService.dockerDown();
|
|
64
|
+
}
|
|
65
|
+
await migration.run();
|
|
66
|
+
if (wasRunning) {
|
|
67
|
+
clm.preStep('Rebuilding container with refreshed Dockerfile...');
|
|
68
|
+
await dockerService.dockerBuild();
|
|
69
|
+
clm.preStep('Restarting node...');
|
|
70
|
+
await dockerService.dockerRestartAll();
|
|
71
|
+
}
|
|
46
72
|
}
|
|
47
73
|
async function refreshJavaHome() {
|
|
48
74
|
if (process.platform !== 'linux')
|
|
@@ -55,36 +81,3 @@ async function refreshJavaHome() {
|
|
|
55
81
|
clm.debug(`JAVA_HOME refreshed to ${javaHome} for current process`);
|
|
56
82
|
}
|
|
57
83
|
}
|
|
58
|
-
function m0192intnet() {
|
|
59
|
-
clm.step('Running migration 0.19.2-intnet...');
|
|
60
|
-
projectHelper.upgradeHypergraph();
|
|
61
|
-
}
|
|
62
|
-
function m01807() {
|
|
63
|
-
clm.step('Running migration 0.18.7...');
|
|
64
|
-
projectHelper.upgradeHypergraph();
|
|
65
|
-
}
|
|
66
|
-
function m0140intnet1() {
|
|
67
|
-
configStore.setProjectFlag('javaMemoryChecked', false);
|
|
68
|
-
}
|
|
69
|
-
function m0139() {
|
|
70
|
-
clm.step('Running migration 0.13.9...');
|
|
71
|
-
configStore.setProjectFlag('javaMemoryChecked', false);
|
|
72
|
-
projectHelper.upgradeHypergraph();
|
|
73
|
-
}
|
|
74
|
-
function m0125() {
|
|
75
|
-
clm.step('Running migration 0.12.5...');
|
|
76
|
-
configStore.setProjectFlag('javaMemoryChecked', false);
|
|
77
|
-
// projectHelper.upgradeHypergraph();
|
|
78
|
-
// installJava21();
|
|
79
|
-
}
|
|
80
|
-
// function installJava21() {
|
|
81
|
-
// const pilotDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), `../..`);
|
|
82
|
-
// clm.debug(`Running install-java-21.sh from ${pilotDir}`);
|
|
83
|
-
//
|
|
84
|
-
// const result = shell.exec('bash install-java-21.sh', {cwd: pilotDir});
|
|
85
|
-
//
|
|
86
|
-
// if (result.code > 0) {
|
|
87
|
-
// console.log(result.stderr);
|
|
88
|
-
// clm.error(`Failed to install dependencies. Please try again after resolving any errors.`);
|
|
89
|
-
// }
|
|
90
|
-
// }
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -3,5 +3,6 @@ SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
3
3
|
|
|
4
4
|
# --- build image ---
|
|
5
5
|
DOCKER_IMAGE_VERSION="${DOCKER_IMAGE_VERSION:-test}"
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
JAVA_VERSION="${JAVA_VERSION:-21}"
|
|
7
|
+
echo "Building tessellation image: constellationnetwork/tessellation:$DOCKER_IMAGE_VERSION (Java $JAVA_VERSION)"
|
|
8
|
+
docker build --build-arg JAVA_VERSION="$JAVA_VERSION" -t "constellationnetwork/tessellation:$DOCKER_IMAGE_VERSION" -f "$SCRIPT_DIR/../Dockerfile" .
|
|
@@ -21,57 +21,66 @@ check_java_home() {
|
|
|
21
21
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
# Check and install Java
|
|
24
|
+
# Check and install Java. Version is controlled by the JAVA_VERSION env
|
|
25
|
+
# var (default 21). For mainnet (JAVA_VERSION=11), accept any existing
|
|
26
|
+
# Java install — host utilities (keytool.jar, wallet.jar) work fine on
|
|
27
|
+
# 11 or newer, so don't force-upgrade users who already have a JDK.
|
|
25
28
|
check_java() {
|
|
26
|
-
|
|
29
|
+
JAVA_VERSION="${JAVA_VERSION:-21}"
|
|
30
|
+
|
|
27
31
|
if command -v java >/dev/null 2>&1; then
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if [[ "$
|
|
31
|
-
|
|
32
|
+
java_version_str=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}')
|
|
33
|
+
|
|
34
|
+
if [[ "$JAVA_VERSION" == "11" ]]; then
|
|
35
|
+
# Mainnet: accept whatever's installed (don't force-upgrade)
|
|
36
|
+
echo "✅ Java is installed: $java_version_str (mainnet — keeping existing JDK)"
|
|
37
|
+
return 0
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
if [[ "$java_version_str" == "$JAVA_VERSION"* ]] || [[ "$java_version_str" == "1.$JAVA_VERSION"* ]]; then
|
|
41
|
+
echo "✅ Java $JAVA_VERSION is installed."
|
|
32
42
|
return 0
|
|
33
|
-
else
|
|
34
|
-
echo "⚠️ Java is installed but not version 21. Will attempt to install Java 21."
|
|
35
43
|
fi
|
|
44
|
+
|
|
45
|
+
echo "⚠️ Java is installed but not version $JAVA_VERSION. Will attempt to install Java $JAVA_VERSION."
|
|
36
46
|
else
|
|
37
|
-
echo "⚠️ Java not found. Will attempt to install Java
|
|
47
|
+
echo "⚠️ Java not found. Will attempt to install Java $JAVA_VERSION."
|
|
38
48
|
fi
|
|
39
49
|
|
|
40
50
|
|
|
41
51
|
case "$(uname)" in
|
|
42
52
|
Linux)
|
|
43
53
|
if command -v apt >/dev/null 2>&1; then
|
|
44
|
-
echo "Installing Java
|
|
45
|
-
sudo apt install -y openjdk-
|
|
54
|
+
echo "Installing Java $JAVA_VERSION using apt..."
|
|
55
|
+
sudo apt install -y "openjdk-${JAVA_VERSION}-jdk"
|
|
46
56
|
elif command -v yum >/dev/null 2>&1; then
|
|
47
|
-
echo "Installing Java
|
|
48
|
-
sudo yum install -y java-
|
|
57
|
+
echo "Installing Java $JAVA_VERSION using yum..."
|
|
58
|
+
sudo yum install -y "java-${JAVA_VERSION}-openjdk-devel"
|
|
49
59
|
else
|
|
50
|
-
echo "⚠️ Unsupported Linux distribution. Please install Java
|
|
60
|
+
echo "⚠️ Unsupported Linux distribution. Please install Java $JAVA_VERSION manually."
|
|
51
61
|
return 1
|
|
52
62
|
fi
|
|
53
63
|
;;
|
|
54
64
|
Darwin)
|
|
55
65
|
if command -v brew >/dev/null 2>&1; then
|
|
56
|
-
echo "Installing Java
|
|
57
|
-
|
|
58
|
-
brew install --cask temurin@21
|
|
66
|
+
echo "Installing Java $JAVA_VERSION using Homebrew..."
|
|
67
|
+
brew install --cask "temurin@${JAVA_VERSION}"
|
|
59
68
|
else
|
|
60
|
-
echo "⚠️ Homebrew not found. Please install Java
|
|
69
|
+
echo "⚠️ Homebrew not found. Please install Java $JAVA_VERSION manually."
|
|
61
70
|
return 1
|
|
62
71
|
fi
|
|
63
72
|
;;
|
|
64
73
|
MINGW*|MSYS*|CYGWIN*)
|
|
65
|
-
echo "On Windows, please install Java
|
|
74
|
+
echo "On Windows, please install Java $JAVA_VERSION manually from https://adoptium.net/"
|
|
66
75
|
return 1
|
|
67
76
|
;;
|
|
68
77
|
*)
|
|
69
|
-
echo "⚠️ Unsupported OS: $(uname). Please install Java
|
|
78
|
+
echo "⚠️ Unsupported OS: $(uname). Please install Java $JAVA_VERSION manually."
|
|
70
79
|
return 1
|
|
71
80
|
;;
|
|
72
81
|
esac
|
|
73
82
|
|
|
74
|
-
echo "✅ Java
|
|
83
|
+
echo "✅ Java $JAVA_VERSION installation complete."
|
|
75
84
|
return 0
|
|
76
85
|
}
|
|
77
86
|
|
|
@@ -44,7 +44,11 @@ if [ -f "$OUTPUT_DIR/version.sh" ]; then
|
|
|
44
44
|
fi
|
|
45
45
|
else
|
|
46
46
|
[[ -z "${NETWORK}" ]] && { echo "No network specified."; usage; }
|
|
47
|
-
|
|
47
|
+
if [ "$NETWORK" = "mainnet" ]; then
|
|
48
|
+
JAVA_VERSION=11 bash "$SCRIPT_DIR/install-dependencies.sh"
|
|
49
|
+
else
|
|
50
|
+
JAVA_VERSION=21 bash "$SCRIPT_DIR/install-dependencies.sh"
|
|
51
|
+
fi
|
|
48
52
|
INSTALLED_NETWORK_TYPE=""
|
|
49
53
|
fi
|
|
50
54
|
|