postgresai 0.14.0-dev.66 → 0.14.0-dev.67
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/bin/postgres-ai.ts +41 -3
- package/dist/bin/postgres-ai.js +32 -4
- package/lib/metrics-embedded.ts +1 -1
- package/package.json +1 -1
package/bin/postgres-ai.ts
CHANGED
|
@@ -1155,8 +1155,14 @@ async function runCompose(args: string[], grafanaPassword?: string): Promise<num
|
|
|
1155
1155
|
}
|
|
1156
1156
|
}
|
|
1157
1157
|
|
|
1158
|
+
// On macOS, node-exporter can't mount host root filesystem - skip it
|
|
1159
|
+
const finalArgs = [...args];
|
|
1160
|
+
if (process.platform === "darwin" && args.includes("up")) {
|
|
1161
|
+
finalArgs.push("--scale", "node-exporter=0");
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1158
1164
|
return new Promise<number>((resolve) => {
|
|
1159
|
-
const child = spawn(cmd[0], [...cmd.slice(1), "-f", composeFile, ...
|
|
1165
|
+
const child = spawn(cmd[0], [...cmd.slice(1), "-f", composeFile, ...finalArgs], {
|
|
1160
1166
|
stdio: "inherit",
|
|
1161
1167
|
env: env,
|
|
1162
1168
|
cwd: projectDir
|
|
@@ -1215,8 +1221,8 @@ mon
|
|
|
1215
1221
|
if (pwdMatch) existingPassword = pwdMatch[1].trim();
|
|
1216
1222
|
}
|
|
1217
1223
|
|
|
1218
|
-
// Priority: CLI --tag flag > existing .env > package version
|
|
1219
|
-
const imageTag = opts.tag || existingTag || pkg.version;
|
|
1224
|
+
// Priority: CLI --tag flag > PGAI_TAG env var > existing .env > package version
|
|
1225
|
+
const imageTag = opts.tag || process.env.PGAI_TAG || existingTag || pkg.version;
|
|
1220
1226
|
|
|
1221
1227
|
const envLines: string[] = [`PGAI_TAG=${imageTag}`];
|
|
1222
1228
|
if (existingRegistry) {
|
|
@@ -1527,6 +1533,34 @@ mon
|
|
|
1527
1533
|
if (code !== 0) process.exitCode = code;
|
|
1528
1534
|
});
|
|
1529
1535
|
|
|
1536
|
+
// Known container names for cleanup
|
|
1537
|
+
const MONITORING_CONTAINERS = [
|
|
1538
|
+
"postgres-ai-config-init",
|
|
1539
|
+
"node-exporter",
|
|
1540
|
+
"cadvisor",
|
|
1541
|
+
"grafana-with-datasources",
|
|
1542
|
+
"sink-postgres",
|
|
1543
|
+
"sink-prometheus",
|
|
1544
|
+
"target-db",
|
|
1545
|
+
"pgwatch-postgres",
|
|
1546
|
+
"pgwatch-prometheus",
|
|
1547
|
+
"postgres-exporter-sink",
|
|
1548
|
+
"flask-pgss-api",
|
|
1549
|
+
"sources-generator",
|
|
1550
|
+
"postgres-reports",
|
|
1551
|
+
];
|
|
1552
|
+
|
|
1553
|
+
/** Remove orphaned containers that docker compose down might miss */
|
|
1554
|
+
async function removeOrphanedContainers(): Promise<void> {
|
|
1555
|
+
for (const container of MONITORING_CONTAINERS) {
|
|
1556
|
+
try {
|
|
1557
|
+
await execFilePromise("docker", ["rm", "-f", container]);
|
|
1558
|
+
} catch {
|
|
1559
|
+
// Container doesn't exist, ignore
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1530
1564
|
mon
|
|
1531
1565
|
.command("stop")
|
|
1532
1566
|
.description("stop monitoring services")
|
|
@@ -1784,6 +1818,10 @@ mon
|
|
|
1784
1818
|
console.log("⚠ Could not stop services (may not be running)");
|
|
1785
1819
|
}
|
|
1786
1820
|
|
|
1821
|
+
// Remove any orphaned containers that docker compose down missed
|
|
1822
|
+
await removeOrphanedContainers();
|
|
1823
|
+
console.log("✓ Removed orphaned containers");
|
|
1824
|
+
|
|
1787
1825
|
// Remove orphaned volumes from previous installs with different project names
|
|
1788
1826
|
if (!options.keepVolumes) {
|
|
1789
1827
|
const volumePatterns = [
|
package/dist/bin/postgres-ai.js
CHANGED
|
@@ -13064,7 +13064,7 @@ var {
|
|
|
13064
13064
|
// package.json
|
|
13065
13065
|
var package_default = {
|
|
13066
13066
|
name: "postgresai",
|
|
13067
|
-
version: "0.14.0-dev.
|
|
13067
|
+
version: "0.14.0-dev.67",
|
|
13068
13068
|
description: "postgres_ai CLI",
|
|
13069
13069
|
license: "Apache-2.0",
|
|
13070
13070
|
private: false,
|
|
@@ -15887,7 +15887,7 @@ var Result = import_lib.default.Result;
|
|
|
15887
15887
|
var TypeOverrides = import_lib.default.TypeOverrides;
|
|
15888
15888
|
var defaults = import_lib.default.defaults;
|
|
15889
15889
|
// package.json
|
|
15890
|
-
var version = "0.14.0-dev.
|
|
15890
|
+
var version = "0.14.0-dev.67";
|
|
15891
15891
|
var package_default2 = {
|
|
15892
15892
|
name: "postgresai",
|
|
15893
15893
|
version,
|
|
@@ -27182,8 +27182,12 @@ async function runCompose(args, grafanaPassword) {
|
|
|
27182
27182
|
}
|
|
27183
27183
|
}
|
|
27184
27184
|
}
|
|
27185
|
+
const finalArgs = [...args];
|
|
27186
|
+
if (process.platform === "darwin" && args.includes("up")) {
|
|
27187
|
+
finalArgs.push("--scale", "node-exporter=0");
|
|
27188
|
+
}
|
|
27185
27189
|
return new Promise((resolve6) => {
|
|
27186
|
-
const child = spawn2(cmd[0], [...cmd.slice(1), "-f", composeFile, ...
|
|
27190
|
+
const child = spawn2(cmd[0], [...cmd.slice(1), "-f", composeFile, ...finalArgs], {
|
|
27187
27191
|
stdio: "inherit",
|
|
27188
27192
|
env,
|
|
27189
27193
|
cwd: projectDir
|
|
@@ -27224,7 +27228,7 @@ mon.command("local-install").description("install local monitoring stack (genera
|
|
|
27224
27228
|
if (pwdMatch)
|
|
27225
27229
|
existingPassword = pwdMatch[1].trim();
|
|
27226
27230
|
}
|
|
27227
|
-
const imageTag = opts.tag || existingTag || package_default.version;
|
|
27231
|
+
const imageTag = opts.tag || process.env.PGAI_TAG || existingTag || package_default.version;
|
|
27228
27232
|
const envLines = [`PGAI_TAG=${imageTag}`];
|
|
27229
27233
|
if (existingRegistry) {
|
|
27230
27234
|
envLines.push(`PGAI_REGISTRY=${existingRegistry}`);
|
|
@@ -27546,6 +27550,28 @@ mon.command("start").description("start monitoring services").action(async () =>
|
|
|
27546
27550
|
if (code !== 0)
|
|
27547
27551
|
process.exitCode = code;
|
|
27548
27552
|
});
|
|
27553
|
+
var MONITORING_CONTAINERS = [
|
|
27554
|
+
"postgres-ai-config-init",
|
|
27555
|
+
"node-exporter",
|
|
27556
|
+
"cadvisor",
|
|
27557
|
+
"grafana-with-datasources",
|
|
27558
|
+
"sink-postgres",
|
|
27559
|
+
"sink-prometheus",
|
|
27560
|
+
"target-db",
|
|
27561
|
+
"pgwatch-postgres",
|
|
27562
|
+
"pgwatch-prometheus",
|
|
27563
|
+
"postgres-exporter-sink",
|
|
27564
|
+
"flask-pgss-api",
|
|
27565
|
+
"sources-generator",
|
|
27566
|
+
"postgres-reports"
|
|
27567
|
+
];
|
|
27568
|
+
async function removeOrphanedContainers() {
|
|
27569
|
+
for (const container of MONITORING_CONTAINERS) {
|
|
27570
|
+
try {
|
|
27571
|
+
await execFilePromise("docker", ["rm", "-f", container]);
|
|
27572
|
+
} catch {}
|
|
27573
|
+
}
|
|
27574
|
+
}
|
|
27549
27575
|
mon.command("stop").description("stop monitoring services").action(async () => {
|
|
27550
27576
|
const code = await runCompose(["down"]);
|
|
27551
27577
|
if (code !== 0)
|
|
@@ -27760,6 +27786,8 @@ mon.command("clean").description("cleanup monitoring services artifacts (stops s
|
|
|
27760
27786
|
} else {
|
|
27761
27787
|
console.log("\u26A0 Could not stop services (may not be running)");
|
|
27762
27788
|
}
|
|
27789
|
+
await removeOrphanedContainers();
|
|
27790
|
+
console.log("\u2713 Removed orphaned containers");
|
|
27763
27791
|
if (!options.keepVolumes) {
|
|
27764
27792
|
const volumePatterns = [
|
|
27765
27793
|
"monitoring_grafana_data",
|
package/lib/metrics-embedded.ts
CHANGED