postgresai 0.18.0-beta.2 → 0.18.0-beta.4
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/bin/postgres-ai.js +18 -16
- package/package.json +1 -1
package/dist/bin/postgres-ai.js
CHANGED
|
@@ -13533,7 +13533,7 @@ var {
|
|
|
13533
13533
|
// package.json
|
|
13534
13534
|
var package_default = {
|
|
13535
13535
|
name: "postgresai",
|
|
13536
|
-
version: "0.18.0-beta.
|
|
13536
|
+
version: "0.18.0-beta.4",
|
|
13537
13537
|
description: "postgres_ai CLI",
|
|
13538
13538
|
license: "Apache-2.0",
|
|
13539
13539
|
private: false,
|
|
@@ -16893,7 +16893,7 @@ var Result = import_lib.default.Result;
|
|
|
16893
16893
|
var TypeOverrides = import_lib.default.TypeOverrides;
|
|
16894
16894
|
var defaults = import_lib.default.defaults;
|
|
16895
16895
|
// package.json
|
|
16896
|
-
var version = "0.18.0-beta.
|
|
16896
|
+
var version = "0.18.0-beta.4";
|
|
16897
16897
|
var package_default2 = {
|
|
16898
16898
|
name: "postgresai",
|
|
16899
16899
|
version,
|
|
@@ -35758,13 +35758,13 @@ function registerDblabAccessCommands(dblab, deps) {
|
|
|
35758
35758
|
var MONITORING_STEPS = [
|
|
35759
35759
|
{ key: "preparing", label: "Prepare the database" },
|
|
35760
35760
|
{ key: "provisioning", label: "Create the monitoring box" },
|
|
35761
|
-
{ key: "box", label: "Install monitoring (
|
|
35761
|
+
{ key: "box", label: "Install monitoring (1-5 min)" },
|
|
35762
35762
|
{ key: "ready", label: "Ready" }
|
|
35763
35763
|
];
|
|
35764
35764
|
var SUPABASE_STEPS = [
|
|
35765
35765
|
{ key: "preparing", label: "Connect Supabase" },
|
|
35766
35766
|
{ key: "provisioning", label: "Create the monitoring box" },
|
|
35767
|
-
{ key: "box", label: "Prepare the database and install monitoring (
|
|
35767
|
+
{ key: "box", label: "Prepare the database and install monitoring (1-5 min)" },
|
|
35768
35768
|
{ key: "ready", label: "Ready" }
|
|
35769
35769
|
];
|
|
35770
35770
|
var monitoringSteps = (provider) => provider === "supabase" ? SUPABASE_STEPS : MONITORING_STEPS;
|
|
@@ -47772,7 +47772,7 @@ async function removeDemoContainers(projectDir) {
|
|
|
47772
47772
|
const present = String(ps.stdout ?? "").split(/\s+/).filter((s) => s === "target-db" || s === "target-standby");
|
|
47773
47773
|
if (ps.status !== 0 || present.length === 0)
|
|
47774
47774
|
return;
|
|
47775
|
-
console.log(`Removing ${present.join("
|
|
47775
|
+
console.log(`Removing the demo database (containers ${present.join(", ")}): this install monitors your own database. Its data volumes are kept.`);
|
|
47776
47776
|
await runCompose(["rm", "-f", "-s", ...present], undefined, { COMPOSE_PROFILES: DEMO_PROFILE });
|
|
47777
47777
|
}
|
|
47778
47778
|
async function syncDemoProfile(projectDir, instancesPath) {
|
|
@@ -47781,7 +47781,7 @@ async function syncDemoProfile(projectDir, instancesPath) {
|
|
|
47781
47781
|
return;
|
|
47782
47782
|
if (instancesUseDemoTarget(instancesPath)) {
|
|
47783
47783
|
setEnvValues(projectDir, { COMPOSE_PROFILES: composeProfilesValue(current, true, DEMO_PROFILE) });
|
|
47784
|
-
console.log(`
|
|
47784
|
+
console.log(`Kept the demo database running: instances.yml monitors it (added '${DEMO_PROFILE}' to COMPOSE_PROFILES in .env)`);
|
|
47785
47785
|
return;
|
|
47786
47786
|
}
|
|
47787
47787
|
await removeDemoContainers(projectDir);
|
|
@@ -47834,13 +47834,15 @@ async function ensureGrafanaPassword(cfgPath) {
|
|
|
47834
47834
|
}
|
|
47835
47835
|
function prestartRefusal(projectDir) {
|
|
47836
47836
|
for (const marker of [PRESTARTED_MARKER, PRESTARTED_DONE_MARKER]) {
|
|
47837
|
-
if (fs10.existsSync(path8.join(projectDir, marker)))
|
|
47838
|
-
return
|
|
47837
|
+
if (fs10.existsSync(path8.join(projectDir, marker))) {
|
|
47838
|
+
return "This stack was already started with --prestart";
|
|
47839
|
+
}
|
|
47839
47840
|
}
|
|
47840
47841
|
const { containers } = checkRunningContainers();
|
|
47841
47842
|
const pgwatch = containers.filter((c) => c.startsWith("pgwatch"));
|
|
47842
|
-
if (pgwatch.length > 0)
|
|
47843
|
-
return `
|
|
47843
|
+
if (pgwatch.length > 0) {
|
|
47844
|
+
return `A configured monitoring stack is already running (${pgwatch.join(", ")}); --prestart is only for a fresh box`;
|
|
47845
|
+
}
|
|
47844
47846
|
return null;
|
|
47845
47847
|
}
|
|
47846
47848
|
function runningComposeServices(projectDir) {
|
|
@@ -47890,7 +47892,7 @@ async function runPrestart(projectDir, instancesPath, imageTag) {
|
|
|
47890
47892
|
encoding: "utf8",
|
|
47891
47893
|
mode: 384
|
|
47892
47894
|
});
|
|
47893
|
-
console.log(`\u2713 Monitoring infrastructure started; finish with
|
|
47895
|
+
console.log(`\u2713 Monitoring infrastructure started; finish with 'postgresai mon local-install --continue-prestarted --db-url <url> --api-key <key>'
|
|
47894
47896
|
`);
|
|
47895
47897
|
}
|
|
47896
47898
|
async function reloadHostMetricsFiles(projectDir) {
|
|
@@ -47903,7 +47905,7 @@ async function reloadHostMetricsFiles(projectDir) {
|
|
|
47903
47905
|
if (files.length === 0)
|
|
47904
47906
|
return;
|
|
47905
47907
|
if (await runCompose(["kill", "-s", "SIGHUP", "sink-prometheus"]) !== 0) {
|
|
47906
|
-
console.error("\u26A0 Could not reload
|
|
47908
|
+
console.error("\u26A0 Could not reload the metrics store; host metrics start after 'postgresai mon restart'");
|
|
47907
47909
|
}
|
|
47908
47910
|
}
|
|
47909
47911
|
async function applyInstanceJobsProfile(projectDir, enabled) {
|
|
@@ -48466,7 +48468,7 @@ mon.command("local-install").description("install local monitoring stack (genera
|
|
|
48466
48468
|
" PGAI_ENABLE_IPV6=false (accepted: true|false|yes|no, lowercase)",
|
|
48467
48469
|
""
|
|
48468
48470
|
].join(`
|
|
48469
|
-
`)).option("--demo", "demo mode with sample database", false).option("--api-key <key>", "Postgres AI API key for automated report uploads").option("--org <alias>", `organization alias (or ${ORG_ENV}); required to register with a global token`).option("--org-id <id>", `organization id (or ${ORG_ID_ENV}); alternative to --org`).option("--db-url <url>", "PostgreSQL connection URL to monitor (or PGAI_DB_URL)").option("--tag <tag>", "Docker image tag to use (e.g., 0.14.0, 0.14.0-dev.33)").option("--project <name>", "Docker Compose project name (default: postgres_ai)").option("--instance-id <uuid>", "adopt a console-provisioned monitoring instance instead of self-registering a new one (set automatically by the provisioning flow; PGAI_INSTANCE_ID env also works)").option("--vcpus <n>", "source DB vCPU count used for AAS zone thresholds (PGAI_VCPUS env also works). Omit or 0 = unknown: the platform keeps the value it stamped at provision time. An explicit non-zero value overwrites the stored one; changing it re-arms the AAS backfill.").option("--instance-jobs", "enable the instance-jobs compose profile (outbound collection channel; PGAI_INSTANCE_JOBS env also works). Writes COMPOSE_PROFILES into the stack .env, so every later mon command covers the container").option("--no-instance-jobs", "disable the instance-jobs compose profile and remove its container").option("--prestart", "
|
|
48471
|
+
`)).option("--demo", "demo mode with sample database", false).option("--api-key <key>", "Postgres AI API key for automated report uploads").option("--org <alias>", `organization alias (or ${ORG_ENV}); required to register with a global token`).option("--org-id <id>", `organization id (or ${ORG_ID_ENV}); alternative to --org`).option("--db-url <url>", "PostgreSQL connection URL to monitor (or PGAI_DB_URL)").option("--tag <tag>", "Docker image tag to use (e.g., 0.14.0, 0.14.0-dev.33)").option("--project <name>", "Docker Compose project name (default: postgres_ai)").option("--instance-id <uuid>", "adopt a console-provisioned monitoring instance instead of self-registering a new one (set automatically by the provisioning flow; PGAI_INSTANCE_ID env also works)").option("--vcpus <n>", "source DB vCPU count used for AAS zone thresholds (PGAI_VCPUS env also works). Omit or 0 = unknown: the platform keeps the value it stamped at provision time. An explicit non-zero value overwrites the stored one; changing it re-arms the AAS backfill.").option("--instance-jobs", "enable the instance-jobs compose profile (outbound collection channel; PGAI_INSTANCE_JOBS env also works). Writes COMPOSE_PROFILES into the stack .env, so every later mon command covers the container").option("--no-instance-jobs", "disable the instance-jobs compose profile and remove its container").option("--prestart", "for PostgresAI-managed images only: at first boot, start storage, Grafana and self-monitoring with fresh secrets, ports on 127.0.0.1, no target, no API calls", false).option("--continue-prestarted", "for PostgresAI-managed images only: finish an install on a stack started by --prestart, recreating only what changed", false).option("-y, --yes", "accept all defaults and skip interactive prompts", false).action(async (opts) => {
|
|
48470
48472
|
const globalOpts = program2.opts();
|
|
48471
48473
|
let apiKey = opts.apiKey || globalOpts.apiKey || (process.env.PGAI_DB_URL ? process.env.PGAI_API_KEY : undefined);
|
|
48472
48474
|
opts.dbUrl ??= process.env.PGAI_DB_URL;
|
|
@@ -48489,7 +48491,7 @@ mon.command("local-install").description("install local monitoring stack (genera
|
|
|
48489
48491
|
}
|
|
48490
48492
|
const refusal = prestartRefusal(projectDir);
|
|
48491
48493
|
if (refusal) {
|
|
48492
|
-
console.error(`\u2717 ${refusal}
|
|
48494
|
+
console.error(`\u2717 ${refusal}. Nothing was changed.`);
|
|
48493
48495
|
process.exitCode = 1;
|
|
48494
48496
|
return;
|
|
48495
48497
|
}
|
|
@@ -48542,7 +48544,7 @@ Use demo mode without API key: postgres-ai mon local-install --demo`);
|
|
|
48542
48544
|
}
|
|
48543
48545
|
const onPrestarted = opts.continuePrestarted && fs10.existsSync(path8.join(projectDir, PRESTARTED_MARKER));
|
|
48544
48546
|
if (opts.continuePrestarted && !onPrestarted) {
|
|
48545
|
-
console.log(`(
|
|
48547
|
+
console.log(`(this stack was not started with --prestart: installing as usual)
|
|
48546
48548
|
`);
|
|
48547
48549
|
}
|
|
48548
48550
|
const { running, containers } = checkRunningContainers();
|
|
@@ -49012,7 +49014,7 @@ function monitoringHealthServices(instanceJobsEnabled = false, demoEnabled = fal
|
|
|
49012
49014
|
{ name: "Prometheus", container: "sink-prometheus" },
|
|
49013
49015
|
{ name: "PGWatch (Postgres)", container: "pgwatch-postgres" },
|
|
49014
49016
|
{ name: "PGWatch (Prometheus)", container: "pgwatch-prometheus" },
|
|
49015
|
-
{ name: "
|
|
49017
|
+
{ name: "Demo DB", container: "target-db", ...demoEnabled ? {} : { optional: true } },
|
|
49016
49018
|
{ name: "Sink Postgres", container: "sink-postgres" },
|
|
49017
49019
|
{
|
|
49018
49020
|
name: "Instance jobs",
|