postgresai 0.14.0-dev.60 → 0.14.0-dev.61
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 +47 -17
- package/dist/bin/postgres-ai.js +37 -14
- package/lib/metrics-embedded.ts +1 -1
- package/package.json +1 -1
package/bin/postgres-ai.ts
CHANGED
|
@@ -1765,34 +1765,64 @@ mon
|
|
|
1765
1765
|
});
|
|
1766
1766
|
mon
|
|
1767
1767
|
.command("clean")
|
|
1768
|
-
.description("cleanup monitoring services artifacts")
|
|
1769
|
-
.
|
|
1770
|
-
|
|
1768
|
+
.description("cleanup monitoring services artifacts (stops services and removes volumes)")
|
|
1769
|
+
.option("--keep-volumes", "keep data volumes (only stop and remove containers)")
|
|
1770
|
+
.action(async (options: { keepVolumes?: boolean }) => {
|
|
1771
|
+
console.log("Cleaning up monitoring services...\n");
|
|
1771
1772
|
|
|
1772
1773
|
try {
|
|
1773
|
-
//
|
|
1774
|
-
const
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1774
|
+
// First, use docker-compose down to properly stop and remove containers/volumes
|
|
1775
|
+
const downArgs = options.keepVolumes ? ["down"] : ["down", "-v"];
|
|
1776
|
+
console.log(options.keepVolumes
|
|
1777
|
+
? "Stopping and removing containers (keeping volumes)..."
|
|
1778
|
+
: "Stopping and removing containers and volumes...");
|
|
1779
|
+
|
|
1780
|
+
const downCode = await runCompose(downArgs);
|
|
1781
|
+
if (downCode === 0) {
|
|
1782
|
+
console.log("✓ Monitoring services stopped and removed");
|
|
1779
1783
|
} else {
|
|
1780
|
-
console.log("
|
|
1784
|
+
console.log("⚠ Could not stop services (may not be running)");
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
// Remove orphaned volumes from previous installs with different project names
|
|
1788
|
+
if (!options.keepVolumes) {
|
|
1789
|
+
const volumePatterns = [
|
|
1790
|
+
"monitoring_grafana_data",
|
|
1791
|
+
"monitoring_postgres_ai_configs",
|
|
1792
|
+
"monitoring_sink_postgres_data",
|
|
1793
|
+
"monitoring_target_db_data",
|
|
1794
|
+
"monitoring_victoria_metrics_data",
|
|
1795
|
+
"postgres_ai_configs_grafana_data",
|
|
1796
|
+
"postgres_ai_configs_sink_postgres_data",
|
|
1797
|
+
"postgres_ai_configs_target_db_data",
|
|
1798
|
+
"postgres_ai_configs_victoria_metrics_data",
|
|
1799
|
+
"postgres_ai_configs_postgres_ai_configs",
|
|
1800
|
+
];
|
|
1801
|
+
|
|
1802
|
+
const { stdout: existingVolumes } = await execFilePromise("docker", ["volume", "ls", "-q"]);
|
|
1803
|
+
const volumeList = existingVolumes.trim().split('\n').filter(Boolean);
|
|
1804
|
+
const orphanedVolumes = volumeList.filter(v => volumePatterns.includes(v));
|
|
1805
|
+
|
|
1806
|
+
if (orphanedVolumes.length > 0) {
|
|
1807
|
+
for (const vol of orphanedVolumes) {
|
|
1808
|
+
try {
|
|
1809
|
+
await execFilePromise("docker", ["volume", "rm", vol]);
|
|
1810
|
+
} catch {
|
|
1811
|
+
// Volume might be in use, skip
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
console.log(`✓ Removed ${orphanedVolumes.length} orphaned volume(s) from previous installs`);
|
|
1815
|
+
}
|
|
1781
1816
|
}
|
|
1782
1817
|
|
|
1783
|
-
// Remove
|
|
1784
|
-
await execFilePromise("docker", ["volume", "prune", "-f"]);
|
|
1785
|
-
console.log("✓ Removed unused volumes");
|
|
1786
|
-
|
|
1787
|
-
// Remove unused networks
|
|
1818
|
+
// Remove any dangling resources
|
|
1788
1819
|
await execFilePromise("docker", ["network", "prune", "-f"]);
|
|
1789
1820
|
console.log("✓ Removed unused networks");
|
|
1790
1821
|
|
|
1791
|
-
// Remove dangling images
|
|
1792
1822
|
await execFilePromise("docker", ["image", "prune", "-f"]);
|
|
1793
1823
|
console.log("✓ Removed dangling images");
|
|
1794
1824
|
|
|
1795
|
-
console.log("\
|
|
1825
|
+
console.log("\n✓ Cleanup completed - ready for fresh install");
|
|
1796
1826
|
} catch (error) {
|
|
1797
1827
|
const message = error instanceof Error ? error.message : String(error);
|
|
1798
1828
|
console.error(`Error during cleanup: ${message}`);
|
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.61",
|
|
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.61";
|
|
15891
15891
|
var package_default2 = {
|
|
15892
15892
|
name: "postgresai",
|
|
15893
15893
|
version,
|
|
@@ -27748,27 +27748,50 @@ Stopping services and removing data...`);
|
|
|
27748
27748
|
process.exitCode = 1;
|
|
27749
27749
|
}
|
|
27750
27750
|
});
|
|
27751
|
-
mon.command("clean").description("cleanup monitoring services artifacts").action(async () => {
|
|
27752
|
-
console.log(`Cleaning up
|
|
27751
|
+
mon.command("clean").description("cleanup monitoring services artifacts (stops services and removes volumes)").option("--keep-volumes", "keep data volumes (only stop and remove containers)").action(async (options) => {
|
|
27752
|
+
console.log(`Cleaning up monitoring services...
|
|
27753
27753
|
`);
|
|
27754
27754
|
try {
|
|
27755
|
-
const
|
|
27756
|
-
|
|
27757
|
-
|
|
27758
|
-
|
|
27759
|
-
|
|
27760
|
-
console.log("\u2713 Removed stopped containers");
|
|
27755
|
+
const downArgs = options.keepVolumes ? ["down"] : ["down", "-v"];
|
|
27756
|
+
console.log(options.keepVolumes ? "Stopping and removing containers (keeping volumes)..." : "Stopping and removing containers and volumes...");
|
|
27757
|
+
const downCode = await runCompose(downArgs);
|
|
27758
|
+
if (downCode === 0) {
|
|
27759
|
+
console.log("\u2713 Monitoring services stopped and removed");
|
|
27761
27760
|
} else {
|
|
27762
|
-
console.log("\
|
|
27761
|
+
console.log("\u26A0 Could not stop services (may not be running)");
|
|
27762
|
+
}
|
|
27763
|
+
if (!options.keepVolumes) {
|
|
27764
|
+
const volumePatterns = [
|
|
27765
|
+
"monitoring_grafana_data",
|
|
27766
|
+
"monitoring_postgres_ai_configs",
|
|
27767
|
+
"monitoring_sink_postgres_data",
|
|
27768
|
+
"monitoring_target_db_data",
|
|
27769
|
+
"monitoring_victoria_metrics_data",
|
|
27770
|
+
"postgres_ai_configs_grafana_data",
|
|
27771
|
+
"postgres_ai_configs_sink_postgres_data",
|
|
27772
|
+
"postgres_ai_configs_target_db_data",
|
|
27773
|
+
"postgres_ai_configs_victoria_metrics_data",
|
|
27774
|
+
"postgres_ai_configs_postgres_ai_configs"
|
|
27775
|
+
];
|
|
27776
|
+
const { stdout: existingVolumes } = await execFilePromise("docker", ["volume", "ls", "-q"]);
|
|
27777
|
+
const volumeList = existingVolumes.trim().split(`
|
|
27778
|
+
`).filter(Boolean);
|
|
27779
|
+
const orphanedVolumes = volumeList.filter((v) => volumePatterns.includes(v));
|
|
27780
|
+
if (orphanedVolumes.length > 0) {
|
|
27781
|
+
for (const vol of orphanedVolumes) {
|
|
27782
|
+
try {
|
|
27783
|
+
await execFilePromise("docker", ["volume", "rm", vol]);
|
|
27784
|
+
} catch {}
|
|
27785
|
+
}
|
|
27786
|
+
console.log(`\u2713 Removed ${orphanedVolumes.length} orphaned volume(s) from previous installs`);
|
|
27787
|
+
}
|
|
27763
27788
|
}
|
|
27764
|
-
await execFilePromise("docker", ["volume", "prune", "-f"]);
|
|
27765
|
-
console.log("\u2713 Removed unused volumes");
|
|
27766
27789
|
await execFilePromise("docker", ["network", "prune", "-f"]);
|
|
27767
27790
|
console.log("\u2713 Removed unused networks");
|
|
27768
27791
|
await execFilePromise("docker", ["image", "prune", "-f"]);
|
|
27769
27792
|
console.log("\u2713 Removed dangling images");
|
|
27770
27793
|
console.log(`
|
|
27771
|
-
Cleanup completed`);
|
|
27794
|
+
\u2713 Cleanup completed - ready for fresh install`);
|
|
27772
27795
|
} catch (error2) {
|
|
27773
27796
|
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
27774
27797
|
console.error(`Error during cleanup: ${message}`);
|
package/lib/metrics-embedded.ts
CHANGED