@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,354 @@
1
+ #!/bin/bash
2
+ # FairDB SOP Completion Checklist
3
+ # Interactive checklist for tracking SOP completion
4
+ # Deploy to: /opt/fairdb/scripts/sop-checklist.sh
5
+
6
+ # Colors for output
7
+ GREEN='\033[0;32m'
8
+ RED='\033[0;31m'
9
+ YELLOW='\033[1;33m'
10
+ NC='\033[0m' # No Color
11
+
12
+ # Function to check status
13
+ check_item() {
14
+ local description="$1"
15
+ local command="$2"
16
+
17
+ echo -n " Checking: $description... "
18
+ if eval "$command" &>/dev/null; then
19
+ echo -e "${GREEN}✅ PASS${NC}"
20
+ return 0
21
+ else
22
+ echo -e "${RED}❌ FAIL${NC}"
23
+ return 1
24
+ fi
25
+ }
26
+
27
+ # Function to print header
28
+ print_header() {
29
+ echo ""
30
+ echo "======================================"
31
+ echo " $1"
32
+ echo "======================================"
33
+ echo ""
34
+ }
35
+
36
+ # Main menu
37
+ show_menu() {
38
+ clear
39
+ echo "======================================"
40
+ echo " FairDB SOP Completion Checker"
41
+ echo "======================================"
42
+ echo ""
43
+ echo "Select SOP to verify:"
44
+ echo ""
45
+ echo " 1) SOP-001: VPS Initial Setup & Hardening"
46
+ echo " 2) SOP-002: PostgreSQL Installation & Configuration"
47
+ echo " 3) SOP-003: Backup System Setup & Verification"
48
+ echo " 4) ALL: Complete System Verification"
49
+ echo " 5) Exit"
50
+ echo ""
51
+ read -p "Enter choice [1-5]: " choice
52
+ }
53
+
54
+ # SOP-001 Checklist
55
+ check_sop_001() {
56
+ print_header "SOP-001: VPS Initial Setup & Hardening"
57
+
58
+ local passed=0
59
+ local total=0
60
+
61
+ # Check system updates
62
+ ((total++))
63
+ if check_item "System packages up to date" "test \$(apt list --upgradable 2>/dev/null | wc -l) -lt 5"; then
64
+ ((passed++))
65
+ fi
66
+
67
+ # Check non-root user
68
+ ((total++))
69
+ if check_item "Non-root admin user exists" "id admin &>/dev/null || id \$USER &>/dev/null"; then
70
+ ((passed++))
71
+ fi
72
+
73
+ # Check SSH configuration
74
+ ((total++))
75
+ if check_item "Root login disabled" "sudo grep -q '^PermitRootLogin no' /etc/ssh/sshd_config"; then
76
+ ((passed++))
77
+ fi
78
+
79
+ ((total++))
80
+ if check_item "Password authentication disabled" "sudo grep -q '^PasswordAuthentication no' /etc/ssh/sshd_config"; then
81
+ ((passed++))
82
+ fi
83
+
84
+ ((total++))
85
+ if check_item "SSH keys configured" "test -f ~/.ssh/authorized_keys"; then
86
+ ((passed++))
87
+ fi
88
+
89
+ # Check firewall
90
+ ((total++))
91
+ if check_item "UFW firewall active" "sudo ufw status | grep -q 'Status: active'"; then
92
+ ((passed++))
93
+ fi
94
+
95
+ # Check Fail2ban
96
+ ((total++))
97
+ if check_item "Fail2ban running" "systemctl is-active --quiet fail2ban"; then
98
+ ((passed++))
99
+ fi
100
+
101
+ # Check automatic updates
102
+ ((total++))
103
+ if check_item "Automatic security updates enabled" "systemctl is-active --quiet unattended-upgrades"; then
104
+ ((passed++))
105
+ fi
106
+
107
+ # Check timezone and NTP
108
+ ((total++))
109
+ if check_item "NTP synchronized" "timedatectl status | grep -q 'NTP.*yes'"; then
110
+ ((passed++))
111
+ fi
112
+
113
+ # Check directory structure
114
+ ((total++))
115
+ if check_item "Operations directory exists" "test -d /opt/fairdb"; then
116
+ ((passed++))
117
+ fi
118
+
119
+ echo ""
120
+ echo "======================================"
121
+ echo -e "SOP-001 Status: ${passed}/${total} checks passed"
122
+ if [ $passed -eq $total ]; then
123
+ echo -e "${GREEN}✅ SOP-001 COMPLETE${NC}"
124
+ else
125
+ echo -e "${RED}⚠️ SOP-001 INCOMPLETE${NC}"
126
+ fi
127
+ echo "======================================"
128
+ }
129
+
130
+ # SOP-002 Checklist
131
+ check_sop_002() {
132
+ print_header "SOP-002: PostgreSQL Installation & Configuration"
133
+
134
+ local passed=0
135
+ local total=0
136
+
137
+ # Check PostgreSQL installed
138
+ ((total++))
139
+ if check_item "PostgreSQL 16 installed" "dpkg -l | grep -q postgresql-16"; then
140
+ ((passed++))
141
+ fi
142
+
143
+ # Check PostgreSQL running
144
+ ((total++))
145
+ if check_item "PostgreSQL service running" "systemctl is-active --quiet postgresql"; then
146
+ ((passed++))
147
+ fi
148
+
149
+ # Check can connect
150
+ ((total++))
151
+ if check_item "Database connection works" "sudo -u postgres psql -c 'SELECT 1' &>/dev/null"; then
152
+ ((passed++))
153
+ fi
154
+
155
+ # Check SSL enabled
156
+ ((total++))
157
+ if check_item "SSL enabled" "sudo -u postgres psql -t -c 'SHOW ssl' | grep -q 'on'"; then
158
+ ((passed++))
159
+ fi
160
+
161
+ # Check remote connections
162
+ ((total++))
163
+ if check_item "Remote connections enabled" "sudo grep -q '^listen_addresses.*\*' /etc/postgresql/16/main/postgresql.conf"; then
164
+ ((passed++))
165
+ fi
166
+
167
+ # Check pg_stat_statements
168
+ ((total++))
169
+ if check_item "pg_stat_statements enabled" "sudo -u postgres psql -c '\\dx' | grep -q pg_stat_statements"; then
170
+ ((passed++))
171
+ fi
172
+
173
+ # Check health check script
174
+ ((total++))
175
+ if check_item "Health check script exists" "test -x /opt/fairdb/scripts/pg-health-check.sh"; then
176
+ ((passed++))
177
+ fi
178
+
179
+ # Check health check scheduled
180
+ ((total++))
181
+ if check_item "Health check scheduled" "sudo -u postgres crontab -l 2>/dev/null | grep -q pg-health-check"; then
182
+ ((passed++))
183
+ fi
184
+
185
+ # Check monitoring queries
186
+ ((total++))
187
+ if check_item "Monitoring queries exist" "test -f /opt/fairdb/scripts/pg-queries.sql"; then
188
+ ((passed++))
189
+ fi
190
+
191
+ # Check PostgreSQL config documented
192
+ ((total++))
193
+ if check_item "PostgreSQL config documented" "test -f ~/fairdb/POSTGRESQL-CONFIG.md"; then
194
+ ((passed++))
195
+ fi
196
+
197
+ echo ""
198
+ echo "======================================"
199
+ echo -e "SOP-002 Status: ${passed}/${total} checks passed"
200
+ if [ $passed -eq $total ]; then
201
+ echo -e "${GREEN}✅ SOP-002 COMPLETE${NC}"
202
+ else
203
+ echo -e "${RED}⚠️ SOP-002 INCOMPLETE${NC}"
204
+ fi
205
+ echo "======================================"
206
+ }
207
+
208
+ # SOP-003 Checklist
209
+ check_sop_003() {
210
+ print_header "SOP-003: Backup System Setup & Verification"
211
+
212
+ local passed=0
213
+ local total=0
214
+
215
+ # Check pgBackRest installed
216
+ ((total++))
217
+ if check_item "pgBackRest installed" "command -v pgbackrest &>/dev/null"; then
218
+ ((passed++))
219
+ fi
220
+
221
+ # Check pgBackRest config
222
+ ((total++))
223
+ if check_item "pgBackRest config exists" "sudo test -f /etc/pgbackrest.conf"; then
224
+ ((passed++))
225
+ fi
226
+
227
+ # Check config permissions
228
+ ((total++))
229
+ if check_item "Config permissions secure (640)" "sudo stat -c %a /etc/pgbackrest.conf | grep -q 640"; then
230
+ ((passed++))
231
+ fi
232
+
233
+ # Check WAL archiving enabled
234
+ ((total++))
235
+ if check_item "WAL archiving enabled" "sudo -u postgres psql -t -c 'SHOW archive_mode' | grep -q 'on'"; then
236
+ ((passed++))
237
+ fi
238
+
239
+ # Check stanza created
240
+ ((total++))
241
+ if check_item "pgBackRest stanza exists" "sudo -u postgres pgbackrest --stanza=main info &>/dev/null"; then
242
+ ((passed++))
243
+ fi
244
+
245
+ # Check backup exists
246
+ ((total++))
247
+ if check_item "At least one backup exists" "sudo -u postgres pgbackrest --stanza=main info 2>/dev/null | grep -q 'full backup'"; then
248
+ ((passed++))
249
+ fi
250
+
251
+ # Check backup age
252
+ ((total++))
253
+ if command -v jq &>/dev/null; then
254
+ BACKUP_AGE=$(sudo -u postgres pgbackrest --stanza=main info --output=json 2>/dev/null | jq -r '.[0].backup[-1].timestamp.stop' 2>/dev/null)
255
+ if [ -n "$BACKUP_AGE" ] && [ "$BACKUP_AGE" != "null" ]; then
256
+ HOURS=$(( ($(date +%s) - $(date -d "$BACKUP_AGE" +%s 2>/dev/null || echo 999999999)) / 3600 ))
257
+ if [ $HOURS -lt 48 ]; then
258
+ echo -e " Checking: Backup is recent (<48 hours)... ${GREEN}✅ PASS${NC} (${HOURS}h old)"
259
+ ((passed++))
260
+ else
261
+ echo -e " Checking: Backup is recent (<48 hours)... ${RED}❌ FAIL${NC} (${HOURS}h old)"
262
+ fi
263
+ else
264
+ echo -e " Checking: Backup age... ${YELLOW}⚠️ SKIP${NC} (cannot determine)"
265
+ fi
266
+ else
267
+ echo -e " Checking: Backup age... ${YELLOW}⚠️ SKIP${NC} (jq not installed)"
268
+ fi
269
+
270
+ # Check backup script
271
+ ((total++))
272
+ if check_item "Backup script exists" "sudo test -x /opt/fairdb/scripts/pgbackrest-backup.sh"; then
273
+ ((passed++))
274
+ fi
275
+
276
+ # Check backup scheduled
277
+ ((total++))
278
+ if check_item "Automated backups scheduled" "sudo -u postgres crontab -l 2>/dev/null | grep -q pgbackrest-backup"; then
279
+ ((passed++))
280
+ fi
281
+
282
+ # Check verification script
283
+ ((total++))
284
+ if check_item "Verification script exists" "sudo test -x /opt/fairdb/scripts/pgbackrest-verify.sh"; then
285
+ ((passed++))
286
+ fi
287
+
288
+ # Check verification scheduled
289
+ ((total++))
290
+ if check_item "Verification scheduled" "sudo -u postgres crontab -l 2>/dev/null | grep -q pgbackrest-verify"; then
291
+ ((passed++))
292
+ fi
293
+
294
+ # Check backup config documented
295
+ ((total++))
296
+ if check_item "Backup config documented" "test -f ~/fairdb/BACKUP-CONFIG.md"; then
297
+ ((passed++))
298
+ fi
299
+
300
+ echo ""
301
+ echo "======================================"
302
+ echo -e "SOP-003 Status: ${passed}/${total} checks passed"
303
+ if [ $passed -eq $total ]; then
304
+ echo -e "${GREEN}✅ SOP-003 COMPLETE${NC}"
305
+ else
306
+ echo -e "${RED}⚠️ SOP-003 INCOMPLETE${NC}"
307
+ fi
308
+ echo "======================================"
309
+ }
310
+
311
+ # Complete system verification
312
+ check_all() {
313
+ check_sop_001
314
+ sleep 2
315
+ check_sop_002
316
+ sleep 2
317
+ check_sop_003
318
+
319
+ echo ""
320
+ print_header "OVERALL SYSTEM STATUS"
321
+
322
+ # Quick summary
323
+ echo "System Summary:"
324
+ echo " - Security: $(systemctl is-active postgresql && echo -e "${GREEN}✅${NC}" || echo -e "${RED}❌${NC}")"
325
+ echo " - Database: $(systemctl is-active postgresql && echo -e "${GREEN}✅${NC}" || echo -e "${RED}❌${NC}")"
326
+ echo " - Backups: $(sudo -u postgres pgbackrest --stanza=main info &>/dev/null && echo -e "${GREEN}✅${NC}" || echo -e "${RED}❌${NC}")"
327
+ echo ""
328
+
329
+ # Disk space check
330
+ DISK_USAGE=$(df -h / | awk 'NR==2 {print $5}' | sed 's/%//')
331
+ echo -n " - Disk Space: "
332
+ if [ "$DISK_USAGE" -lt 80 ]; then
333
+ echo -e "${GREEN}${DISK_USAGE}% used${NC}"
334
+ elif [ "$DISK_USAGE" -lt 90 ]; then
335
+ echo -e "${YELLOW}${DISK_USAGE}% used (warning)${NC}"
336
+ else
337
+ echo -e "${RED}${DISK_USAGE}% used (critical)${NC}"
338
+ fi
339
+
340
+ echo ""
341
+ }
342
+
343
+ # Main program loop
344
+ while true; do
345
+ show_menu
346
+ case $choice in
347
+ 1) check_sop_001; read -p "Press Enter to continue..." ;;
348
+ 2) check_sop_002; read -p "Press Enter to continue..." ;;
349
+ 3) check_sop_003; read -p "Press Enter to continue..." ;;
350
+ 4) check_all; read -p "Press Enter to continue..." ;;
351
+ 5) echo "Exiting..."; exit 0 ;;
352
+ *) echo "Invalid choice. Please try again."; sleep 2 ;;
353
+ esac
354
+ done
@@ -0,0 +1,5 @@
1
+ # Assets
2
+
3
+ Bundled resources for fairdb-ops-manager skill
4
+
5
+ - [ ] example_backup_report.txt: Example backup report output
@@ -0,0 +1,32 @@
1
+ {
2
+ "skill": {
3
+ "name": "skill-name",
4
+ "version": "1.0.0",
5
+ "enabled": true,
6
+ "settings": {
7
+ "verbose": false,
8
+ "autoActivate": true,
9
+ "toolRestrictions": true
10
+ }
11
+ },
12
+ "triggers": {
13
+ "keywords": [
14
+ "example-trigger-1",
15
+ "example-trigger-2"
16
+ ],
17
+ "patterns": []
18
+ },
19
+ "tools": {
20
+ "allowed": [
21
+ "Read",
22
+ "Grep",
23
+ "Bash"
24
+ ],
25
+ "restricted": []
26
+ },
27
+ "metadata": {
28
+ "author": "Plugin Author",
29
+ "category": "general",
30
+ "tags": []
31
+ }
32
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "Claude Skill Configuration",
4
+ "type": "object",
5
+ "required": ["name", "description"],
6
+ "properties": {
7
+ "name": {
8
+ "type": "string",
9
+ "pattern": "^[a-z0-9-]+$",
10
+ "maxLength": 64,
11
+ "description": "Skill identifier (lowercase, hyphens only)"
12
+ },
13
+ "description": {
14
+ "type": "string",
15
+ "maxLength": 1024,
16
+ "description": "What the skill does and when to use it"
17
+ },
18
+ "allowed-tools": {
19
+ "type": "string",
20
+ "description": "Comma-separated list of allowed tools"
21
+ },
22
+ "version": {
23
+ "type": "string",
24
+ "pattern": "^\\d+\\.\\d+\\.\\d+$",
25
+ "description": "Semantic version (x.y.z)"
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "testCases": [
3
+ {
4
+ "name": "Basic activation test",
5
+ "input": "trigger phrase example",
6
+ "expected": {
7
+ "activated": true,
8
+ "toolsUsed": ["Read", "Grep"],
9
+ "success": true
10
+ }
11
+ },
12
+ {
13
+ "name": "Complex workflow test",
14
+ "input": "multi-step trigger example",
15
+ "expected": {
16
+ "activated": true,
17
+ "steps": 3,
18
+ "toolsUsed": ["Read", "Write", "Bash"],
19
+ "success": true
20
+ }
21
+ }
22
+ ],
23
+ "fixtures": {
24
+ "sampleInput": "example data",
25
+ "expectedOutput": "processed result"
26
+ }
27
+ }
@@ -0,0 +1,4 @@
1
+ # References
2
+
3
+ Bundled resources for fairdb-ops-manager skill
4
+
@@ -0,0 +1,69 @@
1
+ # Skill Best Practices
2
+
3
+ Guidelines for optimal skill usage and development.
4
+
5
+ ## For Users
6
+
7
+ ### Activation Best Practices
8
+
9
+ 1. **Use Clear Trigger Phrases**
10
+ - Match phrases from skill description
11
+ - Be specific about intent
12
+ - Provide necessary context
13
+
14
+ 2. **Provide Sufficient Context**
15
+ - Include relevant file paths
16
+ - Specify scope of analysis
17
+ - Mention any constraints
18
+
19
+ 3. **Understand Tool Permissions**
20
+ - Check allowed-tools in frontmatter
21
+ - Know what the skill can/cannot do
22
+ - Request appropriate actions
23
+
24
+ ### Workflow Optimization
25
+
26
+ - Start with simple requests
27
+ - Build up to complex workflows
28
+ - Verify each step before proceeding
29
+ - Use skill consistently for related tasks
30
+
31
+ ## For Developers
32
+
33
+ ### Skill Development Guidelines
34
+
35
+ 1. **Clear Descriptions**
36
+ - Include explicit trigger phrases
37
+ - Document all capabilities
38
+ - Specify limitations
39
+
40
+ 2. **Proper Tool Permissions**
41
+ - Use minimal necessary tools
42
+ - Document security implications
43
+ - Test with restricted tools
44
+
45
+ 3. **Comprehensive Documentation**
46
+ - Provide usage examples
47
+ - Document common pitfalls
48
+ - Include troubleshooting guide
49
+
50
+ ### Maintenance
51
+
52
+ - Keep version updated
53
+ - Test after tool updates
54
+ - Monitor user feedback
55
+ - Iterate on descriptions
56
+
57
+ ## Performance Tips
58
+
59
+ - Scope skills to specific domains
60
+ - Avoid overlapping trigger phrases
61
+ - Keep descriptions under 1024 chars
62
+ - Test activation reliability
63
+
64
+ ## Security Considerations
65
+
66
+ - Never include secrets in skill files
67
+ - Validate all inputs
68
+ - Use read-only tools when possible
69
+ - Document security requirements
@@ -0,0 +1,73 @@
1
+ # Skill Usage Examples
2
+
3
+ This document provides practical examples of how to use this skill effectively.
4
+
5
+ ## Basic Usage
6
+
7
+ ### Example 1: Simple Activation
8
+
9
+ **User Request:**
10
+ ```
11
+ [Describe trigger phrase here]
12
+ ```
13
+
14
+ **Skill Response:**
15
+ 1. Analyzes the request
16
+ 2. Performs the required action
17
+ 3. Returns results
18
+
19
+ ### Example 2: Complex Workflow
20
+
21
+ **User Request:**
22
+ ```
23
+ [Describe complex scenario]
24
+ ```
25
+
26
+ **Workflow:**
27
+ 1. Step 1: Initial analysis
28
+ 2. Step 2: Data processing
29
+ 3. Step 3: Result generation
30
+ 4. Step 4: Validation
31
+
32
+ ## Advanced Patterns
33
+
34
+ ### Pattern 1: Chaining Operations
35
+
36
+ Combine this skill with other tools:
37
+ ```
38
+ Step 1: Use this skill for [purpose]
39
+ Step 2: Chain with [other tool]
40
+ Step 3: Finalize with [action]
41
+ ```
42
+
43
+ ### Pattern 2: Error Handling
44
+
45
+ If issues occur:
46
+ - Check trigger phrase matches
47
+ - Verify context is available
48
+ - Review allowed-tools permissions
49
+
50
+ ## Tips & Best Practices
51
+
52
+ - ✅ Be specific with trigger phrases
53
+ - ✅ Provide necessary context
54
+ - ✅ Check tool permissions match needs
55
+ - ❌ Avoid vague requests
56
+ - ❌ Don't mix unrelated tasks
57
+
58
+ ## Common Issues
59
+
60
+ **Issue:** Skill doesn't activate
61
+ **Solution:** Use exact trigger phrases from description
62
+
63
+ **Issue:** Unexpected results
64
+ **Solution:** Check input format and context
65
+
66
+ ## See Also
67
+
68
+ - Main SKILL.md for full documentation
69
+ - scripts/ for automation helpers
70
+ - assets/ for configuration examples
71
+
72
+ ---
73
+ *[Tons of Skills](https://tonsofskills.com) by [Intent Solutions](https://intentsolutions.io) | [jeremylongshore.com](https://jeremylongshore.com)*
@@ -0,0 +1,11 @@
1
+ # Scripts
2
+
3
+ Bundled resources for fairdb-ops-manager skill
4
+
5
+ - [ ] vps_setup.sh: Automates initial VPS setup and hardening (SOP-001)
6
+ - [ ] pg_install.sh: Automates PostgreSQL 16 installation and configuration (SOP-002)
7
+ - [ ] backup_setup.sh: Automates backup system setup and verification (SOP-003)
8
+ - [ ] health_check.sh: Script to perform health checks on the PostgreSQL server
9
+ - [ ] backup_restore_test.sh: Script to test backup restoration process
10
+ - [ ] incident_diagnosis.sh: Script for diagnosing common PostgreSQL incidents
11
+ - [ ] compliance_audit.sh: Script for running compliance audits on the PostgreSQL server
@@ -0,0 +1,42 @@
1
+ #!/bin/bash
2
+ # Helper script template for skill automation
3
+ # Customize this for your skill's specific needs
4
+
5
+ set -e
6
+
7
+ function show_usage() {
8
+ echo "Usage: $0 [options]"
9
+ echo ""
10
+ echo "Options:"
11
+ echo " -h, --help Show this help message"
12
+ echo " -v, --verbose Enable verbose output"
13
+ echo ""
14
+ }
15
+
16
+ # Parse arguments
17
+ VERBOSE=false
18
+
19
+ while [[ $# -gt 0 ]]; do
20
+ case $1 in
21
+ -h|--help)
22
+ show_usage
23
+ exit 0
24
+ ;;
25
+ -v|--verbose)
26
+ VERBOSE=true
27
+ shift
28
+ ;;
29
+ *)
30
+ echo "Unknown option: $1"
31
+ show_usage
32
+ exit 1
33
+ ;;
34
+ esac
35
+ done
36
+
37
+ # Your skill logic here
38
+ if [ "$VERBOSE" = true ]; then
39
+ echo "Running skill automation..."
40
+ fi
41
+
42
+ echo "✅ Complete"
@@ -0,0 +1,32 @@
1
+ #!/bin/bash
2
+ # Skill validation helper
3
+ # Validates skill activation and functionality
4
+
5
+ set -e
6
+
7
+ echo "🔍 Validating skill..."
8
+
9
+ # Check if SKILL.md exists
10
+ if [ ! -f "../SKILL.md" ]; then
11
+ echo "❌ Error: SKILL.md not found"
12
+ exit 1
13
+ fi
14
+
15
+ # Validate frontmatter
16
+ if ! grep -q "^---$" "../SKILL.md"; then
17
+ echo "❌ Error: No frontmatter found"
18
+ exit 1
19
+ fi
20
+
21
+ # Check required fields
22
+ if ! grep -q "^name:" "../SKILL.md"; then
23
+ echo "❌ Error: Missing 'name' field"
24
+ exit 1
25
+ fi
26
+
27
+ if ! grep -q "^description:" "../SKILL.md"; then
28
+ echo "❌ Error: Missing 'description' field"
29
+ exit 1
30
+ fi
31
+
32
+ echo "✅ Skill validation passed"