@intentsolutionsio/fairdb-ops-manager 1.0.0

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.
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "fairdb-ops-manager",
3
+ "version": "1.0.0",
4
+ "description": "Comprehensive operations manager for FairDB managed PostgreSQL service - SOPs, incident response, monitoring, and automation",
5
+ "author": {
6
+ "name": "Intent Solutions IO",
7
+ "email": "jeremy@intentsolutions.io"
8
+ },
9
+ "repository": "https://github.com/jeremylongshore/claude-code-plugins",
10
+ "license": "MIT",
11
+ "keywords": [
12
+ "database",
13
+ "postgresql",
14
+ "devops",
15
+ "operations",
16
+ "monitoring",
17
+ "backup",
18
+ "incident-response",
19
+ "sop",
20
+ "managed-services"
21
+ ]
22
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Intent Solutions IO
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,609 @@
1
+ # FairDB Operations Manager
2
+
3
+ **Comprehensive operations toolkit for managing FairDB managed PostgreSQL infrastructure**
4
+
5
+ A Claude Code plugin that provides guided SOPs, incident response procedures, monitoring tools, and automation scripts for running a production-grade managed PostgreSQL service.
6
+
7
+ ---
8
+
9
+ ## What is This?
10
+
11
+ FairDB Operations Manager is your complete operational toolkit for managing a fleet of PostgreSQL database servers. Whether you're setting up your first VPS or responding to a production incident, this plugin provides:
12
+
13
+ - **Step-by-step SOP guides** for setup and configuration
14
+ - **Autonomous agents** for incident response and auditing
15
+ - **Shell scripts** for health monitoring and backup management
16
+ - **Best practices** from production database operations
17
+
18
+ Perfect for solo operators, small teams, or anyone running managed PostgreSQL services.
19
+
20
+ ---
21
+
22
+ ## Features
23
+
24
+ ### 📚 Standard Operating Procedures (SOPs)
25
+
26
+ Detailed, beginner-friendly guides for:
27
+
28
+ - **SOP-001:** VPS Initial Setup & Hardening (60 min)
29
+ - System updates and user configuration
30
+ - SSH hardening with key authentication
31
+ - Firewall (UFW) and Fail2ban setup
32
+ - Automatic security updates
33
+ - Complete security verification
34
+
35
+ - **SOP-002:** PostgreSQL 16 Installation & Configuration (90 min)
36
+ - PostgreSQL 16 installation
37
+ - SSL/TLS encryption
38
+ - Performance tuning for available RAM
39
+ - pg_stat_statements monitoring
40
+ - Health check automation
41
+
42
+ - **SOP-003:** Backup System Setup & Verification (120 min)
43
+ - pgBackRest configuration with Wasabi S3
44
+ - AES-256 encryption
45
+ - Automated daily/weekly backups
46
+ - **Backup restoration testing** (critical!)
47
+ - Weekly verification automation
48
+
49
+ ### 🤖 Autonomous Agents
50
+
51
+ Intelligent assistants that handle complex multi-step operations:
52
+
53
+ - **fairdb-setup-wizard:** Complete guided setup from bare VPS to production-ready
54
+ - **fairdb-incident-responder:** Autonomous incident response with diagnosis and recovery
55
+ - **fairdb-ops-auditor:** Compliance auditing with detailed remediation plans
56
+
57
+ ### 🛠️ Operational Commands
58
+
59
+ Quick-access commands for daily operations:
60
+
61
+ - `/sop-001-vps-setup` - VPS hardening guide
62
+ - `/sop-002-postgres-install` - PostgreSQL setup guide
63
+ - `/sop-003-backup-setup` - Backup configuration guide
64
+ - `/daily-health-check` - Morning health check routine
65
+ - `/incident-p0-database-down` - Database down emergency response
66
+ - `/incident-p0-disk-full` - Disk space emergency procedures
67
+
68
+ ### 📊 Shell Scripts (Deploy to VPS)
69
+
70
+ Production-ready scripts for server deployment:
71
+
72
+ - **pg-health-check.sh** - Automated PostgreSQL health monitoring
73
+ - **backup-status.sh** - Visual backup status dashboard
74
+ - **sop-checklist.sh** - Interactive SOP completion verification
75
+
76
+ ---
77
+
78
+ ## Installation
79
+
80
+ ### From Your Private Repository
81
+
82
+ Since this is your personal plugin:
83
+
84
+ ```bash
85
+ # Clone the repository locally if not already
86
+ git clone https://github.com/jeremylongshore/claude-code-plugins.git
87
+ cd claude-code-plugins
88
+
89
+ # Install the plugin directly from the local path
90
+ /plugin install ./plugins/community/fairdb-ops-manager
91
+ ```
92
+
93
+ Or add as local marketplace:
94
+
95
+ ```bash
96
+ # Create symbolic link to your plugin
97
+ /plugin marketplace add /path/to/claude-code-plugins
98
+
99
+ # Install the plugin
100
+ /plugin install fairdb-ops-manager@claude-code-plugins
101
+ ```
102
+
103
+ ---
104
+
105
+ ## Quick Start
106
+
107
+ ### 1. First Time Setup (New VPS)
108
+
109
+ Use the complete setup wizard for automated guidance:
110
+
111
+ ```bash
112
+ # Launch the setup wizard agent
113
+ /agent fairdb-setup-wizard
114
+ ```
115
+
116
+ The wizard will guide you through:
117
+ 1. VPS hardening (SOP-001)
118
+ 2. PostgreSQL installation (SOP-002)
119
+ 3. Backup configuration (SOP-003)
120
+
121
+ **Total time:** 3-4 hours
122
+
123
+ ### 2. Manual Step-by-Step Setup
124
+
125
+ If you prefer manual control:
126
+
127
+ ```bash
128
+ # Step 1: Harden your VPS
129
+ /sop-001-vps-setup
130
+
131
+ # Step 2: Install PostgreSQL
132
+ /sop-002-postgres-install
133
+
134
+ # Step 3: Configure backups
135
+ /sop-003-backup-setup
136
+ ```
137
+
138
+ ### 3. Deploy Helper Scripts to VPS
139
+
140
+ Once your VPS is set up, deploy the monitoring scripts:
141
+
142
+ ```bash
143
+ # SSH to your VPS
144
+ ssh admin@your-vps-ip -p 2222
145
+
146
+ # Create scripts directory (if not exists)
147
+ sudo mkdir -p /opt/fairdb/scripts
148
+
149
+ # Copy scripts from plugin directory
150
+ # (Transfer via scp, rsync, or copy-paste)
151
+
152
+ # Make scripts executable
153
+ sudo chmod +x /opt/fairdb/scripts/*.sh
154
+
155
+ # Schedule health checks
156
+ crontab -e
157
+ # Add: */5 * * * * /opt/fairdb/scripts/pg-health-check.sh
158
+ ```
159
+
160
+ ---
161
+
162
+ ## Daily Operations
163
+
164
+ ### Morning Health Check
165
+
166
+ ```bash
167
+ # Run guided health check
168
+ /daily-health-check
169
+
170
+ # Or on VPS directly:
171
+ ssh your-vps
172
+ /opt/fairdb/scripts/pg-health-check.sh
173
+ ```
174
+
175
+ ### Check Backup Status
176
+
177
+ ```bash
178
+ # On VPS:
179
+ /opt/fairdb/scripts/backup-status.sh
180
+
181
+ # Expected output:
182
+ # ✅ Backup repository accessible
183
+ # ✅ Last backup: 8 hours ago
184
+ # ✅ No recent errors
185
+ ```
186
+
187
+ ### Verify SOP Compliance
188
+
189
+ ```bash
190
+ # Interactive checklist
191
+ ssh your-vps
192
+ /opt/fairdb/scripts/sop-checklist.sh
193
+
194
+ # Select:
195
+ # 4) ALL: Complete System Verification
196
+ ```
197
+
198
+ ---
199
+
200
+ ## Incident Response
201
+
202
+ ### P0: Database Down
203
+
204
+ ```bash
205
+ # Launch incident responder
206
+ /incident-p0-database-down
207
+
208
+ # Or use autonomous agent
209
+ /agent fairdb-incident-responder
210
+ ```
211
+
212
+ The responder will:
213
+ 1. Classify severity
214
+ 2. Run systematic diagnostics
215
+ 3. Execute recovery procedures
216
+ 4. Verify restoration
217
+ 5. Generate incident report
218
+
219
+ ### P0: Disk Space Emergency
220
+
221
+ ```bash
222
+ /incident-p0-disk-full
223
+ ```
224
+
225
+ Provides:
226
+ - Rapid space recovery procedures
227
+ - Safe cleanup strategies
228
+ - Long-term solutions
229
+
230
+ ---
231
+
232
+ ## Commands Reference
233
+
234
+ ### Setup Commands
235
+
236
+ | Command | Description | Time |
237
+ |---------|-------------|------|
238
+ | `/sop-001-vps-setup` | VPS initial hardening | 60 min |
239
+ | `/sop-002-postgres-install` | PostgreSQL 16 setup | 90 min |
240
+ | `/sop-003-backup-setup` | Backup system configuration | 120 min |
241
+
242
+ ### Operations Commands
243
+
244
+ | Command | Description | Time |
245
+ |---------|-------------|------|
246
+ | `/daily-health-check` | Morning health check routine | 10 min |
247
+ | `/incident-p0-database-down` | Database down emergency | Variable |
248
+ | `/incident-p0-disk-full` | Disk space emergency | Variable |
249
+
250
+ ### Agents
251
+
252
+ | Agent | Description | Use Case |
253
+ |-------|-------------|----------|
254
+ | `/agent fairdb-setup-wizard` | Complete setup automation | New VPS setup |
255
+ | `/agent fairdb-incident-responder` | Autonomous incident response | Production emergencies |
256
+ | `/agent fairdb-ops-auditor` | Compliance auditing | Weekly/monthly audits |
257
+
258
+ ---
259
+
260
+ ## Shell Scripts
261
+
262
+ ### pg-health-check.sh
263
+
264
+ **Purpose:** Automated PostgreSQL health monitoring
265
+
266
+ **Checks:**
267
+ - PostgreSQL service status
268
+ - Database connectivity
269
+ - Connection pool usage (warns at 90%)
270
+ - Disk space (warns at 80%)
271
+ - Long-running queries (>5 minutes)
272
+ - Recent backup errors
273
+
274
+ **Deployment:**
275
+ ```bash
276
+ # Deploy to VPS
277
+ scp scripts/pg-health-check.sh admin@vps:/opt/fairdb/scripts/
278
+
279
+ # Make executable
280
+ ssh admin@vps "chmod +x /opt/fairdb/scripts/pg-health-check.sh"
281
+
282
+ # Schedule via cron
283
+ ssh admin@vps "crontab -e"
284
+ # Add: */5 * * * * /opt/fairdb/scripts/pg-health-check.sh
285
+ ```
286
+
287
+ **Usage:**
288
+ ```bash
289
+ /opt/fairdb/scripts/pg-health-check.sh
290
+ echo $? # 0 = healthy, 1 = issues detected
291
+ ```
292
+
293
+ ### backup-status.sh
294
+
295
+ **Purpose:** Visual backup health dashboard
296
+
297
+ **Shows:**
298
+ - Repository status
299
+ - Recent backup activity
300
+ - Backup age analysis
301
+ - WAL archiving status
302
+ - Recent verification results
303
+ - Disk usage
304
+
305
+ **Usage:**
306
+ ```bash
307
+ /opt/fairdb/scripts/backup-status.sh
308
+ ```
309
+
310
+ ### sop-checklist.sh
311
+
312
+ **Purpose:** Interactive SOP completion verification
313
+
314
+ **Features:**
315
+ - Menu-driven interface
316
+ - Automated verification checks
317
+ - Color-coded results
318
+ - Per-SOP or complete system checks
319
+
320
+ **Usage:**
321
+ ```bash
322
+ /opt/fairdb/scripts/sop-checklist.sh
323
+
324
+ # Menu:
325
+ # 1) SOP-001: VPS Hardening
326
+ # 2) SOP-002: PostgreSQL
327
+ # 3) SOP-003: Backups
328
+ # 4) ALL: Complete verification
329
+ ```
330
+
331
+ ---
332
+
333
+ ## Architecture & Design
334
+
335
+ ### Plugin Structure
336
+
337
+ ```
338
+ fairdb-ops-manager/
339
+ ├── .claude-plugin/
340
+ │ └── plugin.json # Plugin metadata
341
+ ├── commands/ # Slash commands
342
+ │ ├── sop-001-vps-setup.md
343
+ │ ├── sop-002-postgres-install.md
344
+ │ ├── sop-003-backup-setup.md
345
+ │ ├── daily-health-check.md
346
+ │ ├── incident-p0-database-down.md
347
+ │ └── incident-p0-disk-full.md
348
+ ├── agents/ # Autonomous agents
349
+ │ ├── fairdb-setup-wizard.md
350
+ │ ├── fairdb-incident-responder.md
351
+ │ └── fairdb-ops-auditor.md
352
+ ├── scripts/ # Shell scripts (deploy to VPS)
353
+ │ ├── pg-health-check.sh
354
+ │ ├── backup-status.sh
355
+ │ └── sop-checklist.sh
356
+ ├── README.md # This file
357
+ └── LICENSE # MIT License
358
+ ```
359
+
360
+ ### Technology Stack
361
+
362
+ **VPS Environment:**
363
+ - Ubuntu 24.04 LTS
364
+ - PostgreSQL 16
365
+ - pgBackRest 2.x
366
+ - UFW firewall
367
+ - Fail2ban
368
+ - Wasabi S3 (backup storage)
369
+
370
+ **Plugin Components:**
371
+ - Claude Code commands (Markdown)
372
+ - Autonomous agents (Markdown)
373
+ - Bash scripts (Shell)
374
+
375
+ ---
376
+
377
+ ## Best Practices
378
+
379
+ ### Security
380
+
381
+ ✅ **DO:**
382
+ - Always use SSH key authentication
383
+ - Disable root login and password authentication
384
+ - Enable automatic security updates
385
+ - Use SSL/TLS for PostgreSQL connections
386
+ - Encrypt backups (AES-256)
387
+ - Run regular security audits
388
+
389
+ ❌ **DON'T:**
390
+ - Skip backup restoration testing
391
+ - Run as root user
392
+ - Store passwords in plain text
393
+ - Allow remote root access
394
+ - Disable firewall or Fail2ban
395
+
396
+ ### Backups
397
+
398
+ ✅ **DO:**
399
+ - Test backup restoration regularly (weekly)
400
+ - Keep encryption passwords secure but accessible
401
+ - Monitor backup age (<48 hours)
402
+ - Verify automated backups are running
403
+ - Document backup procedures
404
+
405
+ ❌ **DON'T:**
406
+ - Trust backups without testing restoration
407
+ - Delete only backup copies
408
+ - Skip weekly verification
409
+ - Ignore backup failure alerts
410
+
411
+ ### Operations
412
+
413
+ ✅ **DO:**
414
+ - Run daily health checks
415
+ - Document all changes
416
+ - Keep operations logs
417
+ - Update VPS inventory
418
+ - Review metrics regularly
419
+
420
+ ❌ **DON'T:**
421
+ - Make undocumented changes
422
+ - Skip verification steps
423
+ - Ignore warning alerts
424
+ - Defer maintenance
425
+
426
+ ---
427
+
428
+ ## Troubleshooting
429
+
430
+ ### Plugin Installation Issues
431
+
432
+ **Problem:** Plugin not found after installation
433
+
434
+ **Solution:**
435
+ ```bash
436
+ # Verify installation
437
+ /plugin list | grep fairdb
438
+
439
+ # Reinstall if needed
440
+ /plugin uninstall fairdb-ops-manager
441
+ /plugin install ./plugins/community/fairdb-ops-manager
442
+ ```
443
+
444
+ ### SSH Connection Issues
445
+
446
+ **Problem:** Can't connect after hardening
447
+
448
+ **Solution:**
449
+ 1. Use VNC console from provider (Contabo, etc.)
450
+ 2. Revert SSH config: `sudo cp /etc/ssh/sshd_config.backup /etc/ssh/sshd_config`
451
+ 3. Restart SSH: `sudo systemctl restart sshd`
452
+ 4. Verify settings before trying again
453
+
454
+ ### PostgreSQL Won't Start
455
+
456
+ **Problem:** Service fails after configuration changes
457
+
458
+ **Solution:**
459
+ ```bash
460
+ # Check logs
461
+ sudo tail -100 /var/log/postgresql/postgresql-16-main.log
462
+
463
+ # Test config syntax
464
+ sudo -u postgres /usr/lib/postgresql/16/bin/postgres --check -D /var/lib/postgresql/16/main
465
+
466
+ # Restore backup config if needed
467
+ sudo cp /etc/postgresql/16/main/postgresql.conf.backup /etc/postgresql/16/main/postgresql.conf
468
+ sudo systemctl restart postgresql
469
+ ```
470
+
471
+ ### Backup Failures
472
+
473
+ **Problem:** pgBackRest cannot connect to Wasabi
474
+
475
+ **Solution:**
476
+ ```bash
477
+ # Test internet connectivity
478
+ curl -I https://s3.wasabisys.com
479
+
480
+ # Verify credentials in /etc/pgbackrest.conf
481
+ sudo vim /etc/pgbackrest.conf
482
+
483
+ # Check pgBackRest logs
484
+ sudo tail -100 /var/log/pgbackrest/main-backup.log
485
+
486
+ # Test connection
487
+ sudo -u postgres pgbackrest --stanza=main check
488
+ ```
489
+
490
+ ---
491
+
492
+ ## FAQ
493
+
494
+ ### Q: Do I need to know PostgreSQL to use this?
495
+
496
+ **A:** No! The SOPs are designed for beginners. Each command is explained with WHY, not just HOW. The setup wizard provides hand-holding throughout the process.
497
+
498
+ ### Q: How long does initial setup take?
499
+
500
+ **A:** 3-4 hours for complete setup (VPS hardening + PostgreSQL + Backups). You can take breaks between phases.
501
+
502
+ ### Q: Can I use this for production?
503
+
504
+ **A:** Yes! This plugin is based on production best practices for managed PostgreSQL services. However, always test in a staging environment first.
505
+
506
+ ### Q: What if something goes wrong during setup?
507
+
508
+ **A:** Each SOP has verification checkpoints. If something fails, restore from VPS snapshot and start fresh. The scripts include safety checks to prevent destructive actions.
509
+
510
+ ### Q: Do I need Wasabi, or can I use AWS S3?
511
+
512
+ **A:** The SOPs use Wasabi (cheaper than AWS S3), but pgBackRest works with any S3-compatible storage. You can modify the configuration for AWS S3, Google Cloud Storage, Azure Blob, etc.
513
+
514
+ ### Q: How much does this cost to run?
515
+
516
+ **A:** Example costs:
517
+ - Contabo VPS (8GB RAM, 200GB NVMe): ~$12/month
518
+ - Wasabi storage (first 1TB free, then $6.99/TB/month)
519
+ - **Total:** ~$12-20/month for single VPS
520
+
521
+ ### Q: Can this manage multiple VPS instances?
522
+
523
+ **A:** Yes! Use the commands and agents for each VPS separately. The ops auditor can check compliance across your fleet.
524
+
525
+ ### Q: Is this suitable for enterprise use?
526
+
527
+ **A:** This plugin is designed for small-to-medium operations (1-20 VPS instances). For enterprise scale, consider additional monitoring tools (Prometheus, Grafana) and orchestration (Ansible, Terraform).
528
+
529
+ ---
530
+
531
+ ## Roadmap
532
+
533
+ ### Planned Features
534
+
535
+ - [ ] Additional incident response SOPs (SOP-201-206)
536
+ - [ ] Weekly maintenance procedures (SOP-301-304)
537
+ - [ ] Customer onboarding automation (SOP-102-103)
538
+ - [ ] Performance optimization guides
539
+ - [ ] Automated compliance reporting
540
+ - [ ] Integration with monitoring tools (Grafana, Datadog)
541
+
542
+ ### Community Contributions
543
+
544
+ Since this is a personal plugin, contributions are managed directly. If you want similar functionality, feel free to fork and customize for your needs.
545
+
546
+ ---
547
+
548
+ ## Support & Contact
549
+
550
+ **Plugin Author:** Intent Solutions IO
551
+ **Email:** jeremy@intentsolutions.io
552
+ **Repository:** https://github.com/jeremylongshore/claude-code-plugins
553
+
554
+ **For issues or questions:**
555
+ 1. Check the Troubleshooting section
556
+ 2. Review the SOP documentation
557
+ 3. Use the `/agent fairdb-ops-auditor` for compliance checks
558
+ 4. Contact via email for complex issues
559
+
560
+ ---
561
+
562
+ ## License
563
+
564
+ MIT License - See [LICENSE](LICENSE) file for details.
565
+
566
+ Copyright (c) 2025 Intent Solutions IO
567
+
568
+ ---
569
+
570
+ ## Acknowledgments
571
+
572
+ Built for **FairDB** - transparent, affordable, managed PostgreSQL as a service.
573
+
574
+ Based on production operational experience running managed database infrastructure.
575
+
576
+ Designed for Claude Code by Anthropic.
577
+
578
+ ---
579
+
580
+ **Version:** 1.0.0
581
+ **Last Updated:** October 2025
582
+ **Status:** Production Ready (Personal Use)
583
+
584
+ ---
585
+
586
+ ## Quick Links
587
+
588
+ - [Installation](#installation)
589
+ - [Quick Start](#quick-start)
590
+ - [Commands Reference](#commands-reference)
591
+ - [Troubleshooting](#troubleshooting)
592
+ - [FAQ](#faq)
593
+
594
+ ---
595
+
596
+ **Ready to get started?**
597
+
598
+ ```bash
599
+ # Install the plugin
600
+ /plugin install ./plugins/community/fairdb-ops-manager
601
+
602
+ # Launch the setup wizard
603
+ /agent fairdb-setup-wizard
604
+
605
+ # Or start with VPS hardening
606
+ /sop-001-vps-setup
607
+ ```
608
+
609
+ **Happy database operations! 🚀**