@cortex-context/cli 0.0.7 → 0.0.8
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 +38 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -18210,6 +18210,16 @@ var import_child_process = require("child_process");
|
|
|
18210
18210
|
var import_fs5 = require("fs");
|
|
18211
18211
|
var import_path5 = require("path");
|
|
18212
18212
|
var import_os3 = require("os");
|
|
18213
|
+
function tryFixLxcSysctl() {
|
|
18214
|
+
try {
|
|
18215
|
+
(0, import_child_process.execSync)("sysctl -w net.ipv4.ip_unprivileged_port_start=0", {
|
|
18216
|
+
stdio: "ignore"
|
|
18217
|
+
});
|
|
18218
|
+
return { applied: true };
|
|
18219
|
+
} catch {
|
|
18220
|
+
return { applied: false };
|
|
18221
|
+
}
|
|
18222
|
+
}
|
|
18213
18223
|
async function deployLocalStack(workspacePath) {
|
|
18214
18224
|
const templatePath = (0, import_path5.join)(
|
|
18215
18225
|
__dirname,
|
|
@@ -18234,9 +18244,12 @@ async function deployLocalStack(workspacePath) {
|
|
|
18234
18244
|
);
|
|
18235
18245
|
return { started: true };
|
|
18236
18246
|
} catch (err) {
|
|
18247
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
18248
|
+
const isLxcSysctlError = msg.includes("ip_unprivileged_port_start") || msg.includes("sysctl");
|
|
18237
18249
|
return {
|
|
18238
18250
|
started: false,
|
|
18239
|
-
|
|
18251
|
+
isLxcSysctlError,
|
|
18252
|
+
error: `docker compose failed: ${msg}`
|
|
18240
18253
|
};
|
|
18241
18254
|
}
|
|
18242
18255
|
}
|
|
@@ -28146,12 +28159,33 @@ async function serverCommand(options) {
|
|
|
28146
28159
|
}
|
|
28147
28160
|
console.log("");
|
|
28148
28161
|
console.log(source_default.bold(" Step 3: Starting Cortex stack"));
|
|
28162
|
+
const sysctlFix = tryFixLxcSysctl();
|
|
28163
|
+
if (sysctlFix.applied) {
|
|
28164
|
+
console.log(source_default.dim(" (applied net.ipv4.ip_unprivileged_port_start=0 for LXC compatibility)"));
|
|
28165
|
+
}
|
|
28149
28166
|
const startSpinner = ora(" Running docker compose up -d...").start();
|
|
28150
28167
|
const startResult = await deployLocalStack(workDir);
|
|
28151
28168
|
if (!startResult.started) {
|
|
28152
|
-
startSpinner.fail(
|
|
28153
|
-
|
|
28154
|
-
|
|
28169
|
+
startSpinner.fail(source_default.red(" \u2717 Docker Compose failed"));
|
|
28170
|
+
if (startResult.isLxcSysctlError) {
|
|
28171
|
+
console.log("");
|
|
28172
|
+
console.log(source_default.bold.yellow(" \u26A0 Proxmox LXC sysctl restriction detected"));
|
|
28173
|
+
console.log("");
|
|
28174
|
+
console.log(source_default.dim(" runc >= 1.1 tries to configure net.ipv4.ip_unprivileged_port_start"));
|
|
28175
|
+
console.log(source_default.dim(" inside each container's network namespace. Proxmox LXC containers"));
|
|
28176
|
+
console.log(source_default.dim(" block this unless the sysctl is explicitly allowed in the LXC config."));
|
|
28177
|
+
console.log("");
|
|
28178
|
+
console.log(source_default.bold(" Fix (run on the Proxmox host):"));
|
|
28179
|
+
console.log("");
|
|
28180
|
+
console.log(source_default.cyan(" CTID=<your-container-id>"));
|
|
28181
|
+
console.log(source_default.cyan(' echo "lxc.sysctl.net.ipv4.ip_unprivileged_port_start = 0" \\'));
|
|
28182
|
+
console.log(source_default.cyan(" >> /etc/pve/lxc/${CTID}.conf"));
|
|
28183
|
+
console.log(source_default.cyan(" pct restart ${CTID}"));
|
|
28184
|
+
console.log("");
|
|
28185
|
+
console.log(source_default.dim(" Then run cortex-context server again inside the LXC."));
|
|
28186
|
+
} else {
|
|
28187
|
+
console.log(source_default.dim(` ${startResult.error}`));
|
|
28188
|
+
}
|
|
28155
28189
|
process.exit(1);
|
|
28156
28190
|
}
|
|
28157
28191
|
startSpinner.succeed(source_default.green(" \u2713 Containers started"));
|