Skip to content

Commit c72dd45

Browse files
committed
docs: migrate from deprecated bash CLI to Node.js CLI
- Update README.md with `npm install -g postgresai` and `postgresai mon` commands - Update CONTRIBUTING.md with Node.js CLI commands - Update terraform/aws/README.md with Node.js CLI commands - Update config/Dockerfile comment to reference `mon local-install --demo` - Mark postgres_ai bash script as deprecated with warning message The bash CLI is kept for backwards compatibility but shows a deprecation warning on every invocation, directing users to use `postgresai mon` instead.
1 parent 5676bcf commit c72dd45

5 files changed

Lines changed: 54 additions & 55 deletions

File tree

CONTRIBUTING.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ The demo DB is initialized by `config/target-db/init.sql` and creates the `monit
124124
PGPASSWORD='...' npx postgresai prepare-db postgresql://admin@host:5432/dbname
125125
```
126126

127-
- Add your instance to `instances.yml` (or use the helper CLI: `./postgres_ai add-instance 'postgresql://user:pass@host:port/db' my-db`)
127+
- Add your instance to `instances.yml` (or use the CLI: `postgresai mon targets add 'postgresql://user:pass@host:port/db' my-db`)
128128
- Make sure `is_enabled: true` for that instance.
129129

130130
#### 2) Generate pgwatch sources from `instances.yml`
@@ -296,12 +296,12 @@ make up
296296
make up-local
297297
```
298298

299-
### Option A: Run via the `postgres_ai` script (recommended)
299+
### Option A: Run via the CLI (recommended)
300300

301-
`postgres_ai` uses a single compose file path stored in `COMPOSE_FILE`. You can override it to include the local compose override:
301+
Use the CLI with `COMPOSE_FILE` to include the local compose override:
302302

303303
```bash
304-
COMPOSE_FILE="docker-compose.yml:docker-compose.local.yml" ./postgres_ai quickstart --demo -y
304+
COMPOSE_FILE="docker-compose.yml:docker-compose.local.yml" postgresai mon local-install --demo -y
305305
```
306306

307307
To rebuild on every run:
@@ -310,7 +310,7 @@ To rebuild on every run:
310310
COMPOSE_FILE="docker-compose.yml:docker-compose.local.yml" \
311311
docker compose -f docker-compose.yml -f docker-compose.local.yml build --no-cache
312312

313-
COMPOSE_FILE="docker-compose.yml:docker-compose.local.yml" ./postgres_ai restart
313+
COMPOSE_FILE="docker-compose.yml:docker-compose.local.yml" postgresai mon restart
314314
```
315315

316316
### Option B: Run Docker Compose directly
@@ -333,22 +333,22 @@ docker compose -f docker-compose.yml -f docker-compose.local.yml up -d --force-r
333333
### Reset everything
334334

335335
```bash
336-
./postgres_ai reset
336+
postgresai mon reset
337337
```
338338

339339
### View logs
340340

341341
```bash
342-
./postgres_ai logs
343-
./postgres_ai logs grafana
344-
./postgres_ai logs monitoring_flask_backend
342+
postgresai mon logs
343+
postgresai mon logs grafana
344+
postgresai mon logs monitoring_flask_backend
345345
```
346346

347347
### Stop / start
348348

349349
```bash
350-
./postgres_ai stop
351-
./postgres_ai start
350+
postgresai mon stop
351+
postgresai mon start
352352
```
353353

354354

README.md

Lines changed: 22 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -143,29 +143,29 @@ If you see errors like `permission denied` / `insufficient_privilege` / code `42
143143
npx postgresai prepare-db --print-sql -d mydb
144144
```
145145

146-
**One command setup:**
146+
**Install the CLI:**
147147

148148
```bash
149-
# Download the CLI
150-
curl -o postgres_ai https://gitlab.com/postgres-ai/postgres_ai/-/raw/main/postgres_ai \
151-
&& chmod +x postgres_ai
149+
npm install -g postgresai
152150
```
153151

154-
Now, start it and wait for a few minutes. To obtain a PostgresAI access token for your organization, visit https://console.postgres.ai (`Your org name → Manage → Access tokens`):
152+
**Start monitoring:**
153+
154+
To obtain a PostgresAI access token for your organization, visit https://console.postgres.ai (`Your org name → Manage → Access tokens`):
155155

156156
```bash
157157
# Production setup with your Access token
158-
./postgres_ai quickstart --api-key=your_access_token
158+
postgresai mon local-install --api-key=your_access_token
159159
```
160160
**Note:** You can also add your database instance in the same command:
161161
```bash
162-
./postgres_ai quickstart --api-key=your_access_token --add-instance="postgresql://user:pass@host:port/DB"
162+
postgresai mon local-install --api-key=your_access_token --db-url="postgresql://user:pass@host:port/DB"
163163
```
164164

165165
Or if you want to just check out how it works:
166166
```bash
167167
# Complete setup with demo database
168-
./postgres_ai quickstart --demo
168+
postgresai mon local-install --demo
169169
```
170170

171171
That's it! Everything is installed, configured, and running.
@@ -203,32 +203,32 @@ Failure to secure these ports may expose sensitive database information!
203203
204204
**For developers:**
205205
```bash
206-
./postgres_ai quickstart --demo
206+
postgresai mon local-install --demo
207207
```
208208
Get a complete monitoring setup with demo data in under 2 minutes.
209209
210210
**For production:**
211211
```bash
212-
./postgres_ai quickstart --api-key=your_key
212+
postgresai mon local-install --api-key=your_key
213213
# Then add your databases
214-
./postgres_ai add-instance "postgresql://user:pass@host:port/DB"
214+
postgresai mon targets add "postgresql://user:pass@host:port/DB"
215215
```
216216
217217
## 🔧 Management commands
218218
219219
```bash
220220
# Instance management
221-
./postgres_ai add-instance "postgresql://user:pass@host:port/DB"
222-
./postgres_ai list-instances
223-
./postgres_ai test-instance my-DB
221+
postgresai mon targets add "postgresql://user:pass@host:port/DB"
222+
postgresai mon targets list
223+
postgresai mon targets test my-DB
224224
225-
# Service management
226-
./postgres_ai status
227-
./postgres_ai logs
228-
./postgres_ai restart
225+
# Service management
226+
postgresai mon status
227+
postgresai mon logs
228+
postgresai mon restart
229229
230230
# Health check
231-
./postgres_ai health
231+
postgresai mon health
232232
```
233233
234234
## 📋 Checkup reports
@@ -295,9 +295,9 @@ postgres_ai monitoring generates automated health check reports based on [postgr
295295
296296
## 🌐 Access points
297297
298-
After running quickstart:
298+
After running local-install:
299299
300-
- **🚀 MAIN: Grafana Dashboard**: http://localhost:3000 (login: `monitoring`; password is shown at the end of quickstart)
300+
- **🚀 MAIN: Grafana Dashboard**: http://localhost:3000 (login: `monitoring`; password is shown at the end of local-install)
301301
302302
Technical URLs (for advanced users):
303303
- **Demo DB**: postgresql://postgres:postgres@localhost:55432/target_database
@@ -307,27 +307,8 @@ Technical URLs (for advanced users):
307307
## 📖 Help
308308
309309
```bash
310-
./postgres_ai help
311-
```
312-
313-
### Node.js CLI (early preview)
314-
315-
```bash
316-
# run without install
317-
node ./cli/bin/postgres-ai.js --help
318-
319-
# local dev: install aliases into PATH
320-
npm --prefix cli install --no-audit --no-fund
321-
npm link ./cli
322-
postgres-ai --help
323310
postgresai --help
324-
pgai --help
325-
326-
# or install globally after publish (planned)
327-
# npm i -g @postgresai/cli
328-
# postgres-ai --help
329-
# postgresai --help
330-
# pgai --help
311+
postgresai mon --help
331312
```
332313
333314
## 🔑 PostgresAI access token

config/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ COPY pgwatch-postgres/metrics.yml /postgres_ai_configs/pgwatch/metrics.yml
2525
COPY pgwatch-prometheus/metrics.yml /postgres_ai_configs/pgwatch-prometheus/metrics.yml
2626
COPY prometheus/ /postgres_ai_configs/prometheus/
2727
COPY sink-postgres/ /postgres_ai_configs/sink-postgres/
28-
# Demo DB – used only for `quickstart --demo`
28+
# Demo DB – used only for `mon local-install --demo`
2929
COPY target-db/ /postgres_ai_configs/target-db/
3030

3131
# Copy infrastructure scripts (entrypoints, generators, etc.)

postgres_ai

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
11
#!/bin/bash
22

3-
# Postgres AI CLI
3+
# ============================================================================
4+
# DEPRECATED: This bash CLI is deprecated and will be removed in a future release.
5+
# Please use the Node.js CLI instead:
6+
#
7+
# npx postgresai mon local-install --demo # Instead of: ./postgres_ai quickstart --demo
8+
# npx postgresai mon targets add <url> # Instead of: ./postgres_ai add-instance <url>
9+
# npx postgresai mon targets list # Instead of: ./postgres_ai list-instances
10+
# npx postgresai mon status # Instead of: ./postgres_ai status
11+
# npx postgresai mon --help # For all available commands
12+
#
13+
# See README.md for full documentation.
14+
# ============================================================================
15+
16+
# Postgres AI CLI (DEPRECATED)
417
# A CLI tool for managing the PostgreSQL monitoring system with Docker Compose
518

619
set -e
720

21+
# Show deprecation warning on every invocation
22+
echo "⚠️ WARNING: This bash CLI is deprecated. Please use 'npx postgresai mon' instead." >&2
23+
echo " See: npx postgresai mon --help" >&2
24+
echo "" >&2
25+
826
# Configuration
927
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1028
PROJECT_NAME="postgres-ai-mon"

terraform/aws/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ Method 2: Manual configuration (avoids credentials in state):
179179
ssh ubuntu@your-ip
180180
cd /home/postgres_ai/postgres_ai
181181
sudo -u postgres_ai vim instances.yml
182-
sudo -u postgres_ai ./postgres_ai update-config
182+
sudo -u postgres_ai postgresai mon update-config
183183
```
184184

185185
### Backup

0 commit comments

Comments
 (0)