feat: update system architecture workflow to use ripgrep
✅ Performance Improvements - Replaced find/grep with ripgrep (rg) for better performance - Updated code path analysis to use rg --type py for Python files - Updated SystemD service analysis to use ripgrep - Updated path rewire operations to use ripgrep with xargs - Updated final verification to use ripgrep - Updated troubleshooting commands to use ripgrep ✅ Benefits of Ripgrep - Faster searching with optimized algorithms - Respects gitignore rules automatically - Better file type filtering with --type py - More efficient for large codebases - Cleaner syntax and better error handling ✅ Workflow Enhancements - More efficient path discovery and analysis - Faster file processing for rewire operations - Better performance for large repositories - Improved error handling with ripgrep 🚀 System architecture audit workflow now uses ripgrep for optimal performance!
This commit is contained in:
@@ -53,50 +53,50 @@ find /opt/aitbc -name "data" -o -name "config" -o -name "logs" 2>/dev/null || ec
|
|||||||
|
|
||||||
#### 1.2 Code Path Analysis
|
#### 1.2 Code Path Analysis
|
||||||
```bash
|
```bash
|
||||||
# Analyze code for incorrect path references
|
# Analyze code for incorrect path references using ripgrep
|
||||||
echo "=== 2. CODE PATH ANALYSIS ==="
|
echo "=== 2. CODE PATH ANALYSIS ==="
|
||||||
|
|
||||||
# Find repository data references
|
# Find repository data references
|
||||||
echo "Repository Data References:"
|
echo "Repository Data References:"
|
||||||
find /opt/aitbc -name "*.py" -exec grep -l "/opt/aitbc/data" {} \; 2>/dev/null || echo "✅ No repository data references"
|
rg -l "/opt/aitbc/data" --type py /opt/aitbc/ 2>/dev/null || echo "✅ No repository data references"
|
||||||
|
|
||||||
# Find repository config references
|
# Find repository config references
|
||||||
echo "Repository Config References:"
|
echo "Repository Config References:"
|
||||||
find /opt/aitbc -name "*.py" -exec grep -l "/opt/aitbc/config" {} \; 2>/dev/null || echo "✅ No repository config references"
|
rg -l "/opt/aitbc/config" --type py /opt/aitbc/ 2>/dev/null || echo "✅ No repository config references"
|
||||||
|
|
||||||
# Find repository log references
|
# Find repository log references
|
||||||
echo "Repository Log References:"
|
echo "Repository Log References:"
|
||||||
find /opt/aitbc -name "*.py" -exec grep -l "/opt/aitbc/logs" {} \; 2>/dev/null || echo "✅ No repository log references"
|
rg -l "/opt/aitbc/logs" --type py /opt/aitbc/ 2>/dev/null || echo "✅ No repository log references"
|
||||||
|
|
||||||
# Find production data references
|
# Find production data references
|
||||||
echo "Production Data References:"
|
echo "Production Data References:"
|
||||||
find /opt/aitbc -name "*.py" -exec grep -l "/opt/aitbc/production/data" {} \; 2>/dev/null || echo "✅ No production data references"
|
rg -l "/opt/aitbc/production/data" --type py /opt/aitbc/ 2>/dev/null || echo "✅ No production data references"
|
||||||
|
|
||||||
# Find production config references
|
# Find production config references
|
||||||
echo "Production Config References:"
|
echo "Production Config References:"
|
||||||
find /opt/aitbc -name "*.py" -exec grep -l "/opt/aitbc/production/.env" {} \; 2>/dev/null || echo "✅ No production config references"
|
rg -l "/opt/aitbc/production/.env" --type py /opt/aitbc/ 2>/dev/null || echo "✅ No production config references"
|
||||||
|
|
||||||
# Find production log references
|
# Find production log references
|
||||||
echo "Production Log References:"
|
echo "Production Log References:"
|
||||||
find /opt/aitbc -name "*.py" -exec grep -l "/opt/aitbc/production/logs" {} \; 2>/dev/null || echo "✅ No production log references"
|
rg -l "/opt/aitbc/production/logs" --type py /opt/aitbc/ 2>/dev/null || echo "✅ No production log references"
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 1.3 SystemD Service Analysis
|
#### 1.3 SystemD Service Analysis
|
||||||
```bash
|
```bash
|
||||||
# Analyze SystemD service configurations
|
# Analyze SystemD service configurations using ripgrep
|
||||||
echo "=== 3. SYSTEMD SERVICE ANALYSIS ==="
|
echo "=== 3. SYSTEMD SERVICE ANALYSIS ==="
|
||||||
|
|
||||||
# Check service file paths
|
# Check service file paths
|
||||||
echo "Service File Analysis:"
|
echo "Service File Analysis:"
|
||||||
grep -r "EnvironmentFile" /etc/systemd/system/aitbc-*.service 2>/dev/null || echo "✅ No EnvironmentFile issues"
|
rg "EnvironmentFile" /etc/systemd/system/aitbc-*.service 2>/dev/null || echo "✅ No EnvironmentFile issues"
|
||||||
|
|
||||||
# Check ReadWritePaths
|
# Check ReadWritePaths
|
||||||
echo "ReadWritePaths Analysis:"
|
echo "ReadWritePaths Analysis:"
|
||||||
grep -r "ReadWritePaths" /etc/systemd/system/aitbc-*.service 2>/dev/null || echo "✅ No ReadWritePaths issues"
|
rg "ReadWritePaths" /etc/systemd/system/aitbc-*.service 2>/dev/null || echo "✅ No ReadWritePaths issues"
|
||||||
|
|
||||||
# Check for incorrect paths in services
|
# Check for incorrect paths in services
|
||||||
echo "Incorrect Service Paths:"
|
echo "Incorrect Service Paths:"
|
||||||
grep -r "/opt/aitbc/data\|/opt/aitbc/config\|/opt/aitbc/logs" /etc/systemd/system/aitbc-*.service 2>/dev/null || echo "✅ No incorrect service paths"
|
rg "/opt/aitbc/data|/opt/aitbc/config|/opt/aitbc/logs" /etc/systemd/system/aitbc-*.service 2>/dev/null || echo "✅ No incorrect service paths"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Phase 2: Architecture Compliance Check
|
### Phase 2: Architecture Compliance Check
|
||||||
@@ -172,20 +172,20 @@ echo "=== 6. PYTHON CODE PATH REWIRE ==="
|
|||||||
|
|
||||||
# Rewire data paths
|
# Rewire data paths
|
||||||
echo "Rewiring Data Paths:"
|
echo "Rewiring Data Paths:"
|
||||||
find /opt/aitbc -name "*.py" -exec sed -i 's|/opt/aitbc/data|/var/lib/aitbc/data|g' {} \;
|
rg -l "/opt/aitbc/data" --type py /opt/aitbc/ | xargs sed -i 's|/opt/aitbc/data|/var/lib/aitbc/data|g' 2>/dev/null || echo "No data paths to rewire"
|
||||||
find /opt/aitbc -name "*.py" -exec sed -i 's|/opt/aitbc/production/data|/var/lib/aitbc/data|g' {} \;
|
rg -l "/opt/aitbc/production/data" --type py /opt/aitbc/ | xargs sed -i 's|/opt/aitbc/production/data|/var/lib/aitbc/data|g' 2>/dev/null || echo "No production data paths to rewire"
|
||||||
echo "✅ Data paths rewired"
|
echo "✅ Data paths rewired"
|
||||||
|
|
||||||
# Rewire config paths
|
# Rewire config paths
|
||||||
echo "Rewiring Config Paths:"
|
echo "Rewiring Config Paths:"
|
||||||
find /opt/aitbc -name "*.py" -exec sed -i 's|/opt/aitbc/config|/etc/aitbc|g' {} \;
|
rg -l "/opt/aitbc/config" --type py /opt/aitbc/ | xargs sed -i 's|/opt/aitbc/config|/etc/aitbc|g' 2>/dev/null || echo "No config paths to rewire"
|
||||||
find /opt/aitbc -name "*.py" -exec sed -i 's|/opt/aitbc/production/.env|/etc/aitbc/production.env|g' {} \;
|
rg -l "/opt/aitbc/production/.env" --type py /opt/aitbc/ | xargs sed -i 's|/opt/aitbc/production/.env|/etc/aitbc/production.env|g' 2>/dev/null || echo "No production config paths to rewire"
|
||||||
echo "✅ Config paths rewired"
|
echo "✅ Config paths rewired"
|
||||||
|
|
||||||
# Rewire log paths
|
# Rewire log paths
|
||||||
echo "Rewiring Log Paths:"
|
echo "Rewiring Log Paths:"
|
||||||
find /opt/aitbc -name "*.py" -exec sed -i 's|/opt/aitbc/logs|/var/log/aitbc|g' {} \;
|
rg -l "/opt/aitbc/logs" --type py /opt/aitbc/ | xargs sed -i 's|/opt/aitbc/logs|/var/log/aitbc|g' 2>/dev/null || echo "No log paths to rewire"
|
||||||
find /opt/aitbc -name "*.py" -exec sed -i 's|/opt/aitbc/production/logs|/var/log/aitbc/production|g' {} \;
|
rg -l "/opt/aitbc/production/logs" --type py /opt/aitbc/ | xargs sed -i 's|/opt/aitbc/production/logs|/var/log/aitbc/production|g' 2>/dev/null || echo "No production log paths to rewire"
|
||||||
echo "✅ Log paths rewired"
|
echo "✅ Log paths rewired"
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -196,14 +196,14 @@ echo "=== 7. SYSTEMD SERVICE PATH REWIRE ==="
|
|||||||
|
|
||||||
# Rewire EnvironmentFile paths
|
# Rewire EnvironmentFile paths
|
||||||
echo "Rewiring EnvironmentFile Paths:"
|
echo "Rewiring EnvironmentFile Paths:"
|
||||||
find /etc/systemd/system/aitbc-*.service -exec sed -i 's|EnvironmentFile=/opt/aitbc/.env|EnvironmentFile=/etc/aitbc/.env|g' {} \;
|
rg -l "EnvironmentFile=/opt/aitbc/.env" /etc/systemd/system/aitbc-*.service | xargs sed -i 's|EnvironmentFile=/opt/aitbc/.env|EnvironmentFile=/etc/aitbc/.env|g' 2>/dev/null || echo "No .env paths to rewire"
|
||||||
find /etc/systemd/system/aitbc-*.service -exec sed -i 's|EnvironmentFile=/opt/aitbc/production/.env|EnvironmentFile=/etc/aitbc/production.env|g' {} \;
|
rg -l "EnvironmentFile=/opt/aitbc/production/.env" /etc/systemd/system/aitbc-*.service | xargs sed -i 's|EnvironmentFile=/opt/aitbc/production/.env|EnvironmentFile=/etc/aitbc/production.env|g' 2>/dev/null || echo "No production .env paths to rewire"
|
||||||
echo "✅ EnvironmentFile paths rewired"
|
echo "✅ EnvironmentFile paths rewired"
|
||||||
|
|
||||||
# Rewire ReadWritePaths
|
# Rewire ReadWritePaths
|
||||||
echo "Rewiring ReadWritePaths:"
|
echo "Rewiring ReadWritePaths:"
|
||||||
find /etc/systemd/system/aitbc-*.service -exec sed -i 's|/opt/aitbc/production/data|/var/lib/aitbc/data|g' {} \;
|
rg -l "/opt/aitbc/production/data" /etc/systemd/system/aitbc-*.service | xargs sed -i 's|/opt/aitbc/production/data|/var/lib/aitbc/data|g' 2>/dev/null || echo "No production data ReadWritePaths to rewire"
|
||||||
find /etc/systemd/system/aitbc-*.service -exec sed -i 's|/opt/aitbc/production/logs|/var/log/aitbc/production|g' {} \;
|
rg -l "/opt/aitbc/production/logs" /etc/systemd/system/aitbc-*.service | xargs sed -i 's|/opt/aitbc/production/logs|/var/log/aitbc/production|g' 2>/dev/null || echo "No production logs ReadWritePaths to rewire"
|
||||||
echo "✅ ReadWritePaths rewired"
|
echo "✅ ReadWritePaths rewired"
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -213,8 +213,8 @@ echo "✅ ReadWritePaths rewired"
|
|||||||
echo "=== 8. DROP-IN CONFIGURATION REWIRE ==="
|
echo "=== 8. DROP-IN CONFIGURATION REWIRE ==="
|
||||||
|
|
||||||
# Find and rewire drop-in files
|
# Find and rewire drop-in files
|
||||||
find /etc/systemd/system/aitbc-*.service.d/ -name "*.conf" -exec sed -i 's|EnvironmentFile=/opt/aitbc/.env|EnvironmentFile=/etc/aitbc/.env|g' {} \;
|
rg -l "EnvironmentFile=/opt/aitbc/.env" /etc/systemd/system/aitbc-*.service.d/*.conf 2>/dev/null | xargs sed -i 's|EnvironmentFile=/opt/aitbc/.env|EnvironmentFile=/etc/aitbc/.env|g' || echo "No drop-in .env paths to rewire"
|
||||||
find /etc/systemd/system/aitbc-*.service.d/ -name "*.conf" -exec sed -i 's|/opt/aitbc/production/.env|EnvironmentFile=/etc/aitbc/production.env|g' {} \;
|
rg -l "EnvironmentFile=/opt/aitbc/production/.env" /etc/systemd/system/aitbc-*.service.d/*.conf 2>/dev/null | xargs sed -i 's|EnvironmentFile=/opt/aitbc/production/.env|EnvironmentFile=/etc/aitbc/production.env|g' || echo "No drop-in production .env paths to rewire"
|
||||||
echo "✅ Drop-in configurations rewired"
|
echo "✅ Drop-in configurations rewired"
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -371,9 +371,9 @@ echo "No logs dir: $(test ! -d /opt/aitbc/logs && echo "✅" || echo "❌")"
|
|||||||
|
|
||||||
# Check path references
|
# Check path references
|
||||||
echo "Path References:"
|
echo "Path References:"
|
||||||
echo "No repo data refs: $(find /opt/aitbc -name "*.py" -exec grep -l "/opt/aitbc/data" {} \; 2>/dev/null | wc -l)"
|
echo "No repo data refs: $(rg -l "/opt/aitbc/data" --type py /opt/aitbc/ 2>/dev/null | wc -l)"
|
||||||
echo "No repo config refs: $(find /opt/aitbc -name "*.py" -exec grep -l "/opt/aitbc/config" {} \; 2>/dev/null | wc -l)"
|
echo "No repo config refs: $(rg -l "/opt/aitbc/config" --type py /opt/aitbc/ 2>/dev/null | wc -l)"
|
||||||
echo "No repo log refs: $(find /opt/aitbc -name "*.py" -exec grep -l "/opt/aitbc/logs" {} \; 2>/dev/null | wc -l)"
|
echo "No repo log refs: $(rg -l "/opt/aitbc/logs" --type py /opt/aitbc/ 2>/dev/null | wc -l)"
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 7.2 Generate Report
|
#### 7.2 Generate Report
|
||||||
@@ -427,7 +427,7 @@ systemctl daemon-reload
|
|||||||
systemctl restart aitbc-*.service
|
systemctl restart aitbc-*.service
|
||||||
|
|
||||||
# Path verification
|
# Path verification
|
||||||
find /opt/aitbc -name "*.py" -exec grep -l "/opt/aitbc/data\|/opt/aitbc/config\|/opt/aitbc/logs" {} \;
|
rg -l "/opt/aitbc/data|/opt/aitbc/config|/opt/aitbc/logs" --type py /opt/aitbc/ 2>/dev/null
|
||||||
|
|
||||||
# Directory verification
|
# Directory verification
|
||||||
ls -la /var/lib/aitbc/ /etc/aitbc/ /var/log/aitbc/
|
ls -la /var/lib/aitbc/ /etc/aitbc/ /var/log/aitbc/
|
||||||
|
|||||||
Reference in New Issue
Block a user