feat: Major directory reorganization and cleanup
Reorganized project structure for better maintainability and reduced disk usage by 95.9% (11 GB -> 451 MB). Directory Reorganization (85% reduction in root files): - Created docs/ with subdirectories (deployment, testing, database, etc.) - Created infrastructure/vpn-configs/ for VPN scripts - Moved 90+ files from root to organized locations - Archived obsolete documentation (context system, offline mode, zombie debugging) - Moved all test files to tests/ directory - Root directory: 119 files -> 18 files Disk Cleanup (10.55 GB recovered): - Deleted Rust build artifacts: 9.6 GB (target/ directories) - Deleted Python virtual environments: 161 MB (venv/ directories) - Deleted Python cache: 50 KB (__pycache__/) New Structure: - docs/ - All documentation organized by category - docs/archives/ - Obsolete but preserved documentation - infrastructure/ - VPN configs and SSH setup - tests/ - All test files consolidated - logs/ - Ready for future logs Benefits: - Cleaner root directory (18 vs 119 files) - Logical organization of documentation - 95.9% disk space reduction - Faster navigation and discovery - Better portability (build artifacts excluded) Build artifacts can be regenerated: - Rust: cargo build --release (5-15 min per project) - Python: pip install -r requirements.txt (2-3 min) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
136
docs/deployment/DEPLOY_STEPS.txt
Normal file
136
docs/deployment/DEPLOY_STEPS.txt
Normal file
@@ -0,0 +1,136 @@
|
||||
================================================================================
|
||||
ClaudeTools Recall Endpoint - Manual Deployment Steps
|
||||
================================================================================
|
||||
|
||||
STEP 1: Copy file to RMM server
|
||||
--------------------------------
|
||||
Run this command in PowerShell:
|
||||
|
||||
pscp D:\ClaudeTools\api\routers\conversation_contexts.py guru@172.16.3.30:/tmp/conversation_contexts.py
|
||||
|
||||
Enter password when prompted.
|
||||
Expected output: "conversation_contexts.py | 9 kB | 9.x kB/s | ETA: 00:00:00 | 100%"
|
||||
|
||||
|
||||
STEP 2: Connect to RMM server via SSH
|
||||
--------------------------------------
|
||||
Run:
|
||||
|
||||
plink guru@172.16.3.30
|
||||
|
||||
Enter password when prompted.
|
||||
You should see: guru@gururmm:~$
|
||||
|
||||
|
||||
STEP 3: Move file to production location
|
||||
-----------------------------------------
|
||||
In the SSH session, run:
|
||||
|
||||
sudo mv /tmp/conversation_contexts.py /opt/claudetools/api/routers/conversation_contexts.py
|
||||
|
||||
Enter sudo password when prompted.
|
||||
|
||||
|
||||
STEP 4: Fix file ownership
|
||||
---------------------------
|
||||
In the SSH session, run:
|
||||
|
||||
sudo chown claudetools:claudetools /opt/claudetools/api/routers/conversation_contexts.py
|
||||
|
||||
|
||||
STEP 5: Verify file was updated
|
||||
--------------------------------
|
||||
In the SSH session, run:
|
||||
|
||||
grep -c "search_term.*Query" /opt/claudetools/api/routers/conversation_contexts.py
|
||||
|
||||
Expected output: "1" (or higher) = NEW CODE DEPLOYED
|
||||
If output is "0" = OLD CODE STILL PRESENT (something went wrong)
|
||||
|
||||
|
||||
STEP 6: Restart API service
|
||||
----------------------------
|
||||
In the SSH session, run:
|
||||
|
||||
sudo systemctl restart claudetools-api
|
||||
|
||||
Wait 5 seconds, then check status:
|
||||
|
||||
sudo systemctl status claudetools-api --no-pager | head -15
|
||||
|
||||
Look for "Active: active (running)" with a RECENT timestamp (today's date).
|
||||
|
||||
|
||||
STEP 7: Exit SSH
|
||||
----------------
|
||||
Type:
|
||||
|
||||
exit
|
||||
|
||||
|
||||
STEP 8: Test the API
|
||||
--------------------
|
||||
Back in PowerShell, run:
|
||||
|
||||
python -c "import requests; jwt='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJpbXBvcnQtc2NyaXB0Iiwic2NvcGVzIjpbImFkbWluIiwiaW1wb3J0Il0sImV4cCI6MTc3MTI3NTEyOX0.-DJF50tq0MaNwVQBdO7cGYNuO5pQuXte-tTj5DpHi2U'; r=requests.get('http://172.16.3.30:8001/api/conversation-contexts/recall', headers={'Authorization': f'Bearer {jwt}'}, params={'search_term': 'dataforth', 'limit': 2}); print(f'Status: {r.status_code}'); print(f'Keys: {list(r.json().keys())}'); print('[SUCCESS] NEW CODE!' if 'contexts' in r.json() else '[FAILED] Still old code'); print(f'Found {len(r.json().get(\"contexts\", []))} contexts' if 'contexts' in r.json() else '')"
|
||||
|
||||
Expected output if successful:
|
||||
Status: 200
|
||||
Keys: ['total', 'limit', 'search_term', 'project_id', 'tags', 'min_relevance_score', 'contexts']
|
||||
[SUCCESS] NEW CODE!
|
||||
Found 2 contexts
|
||||
|
||||
Expected output if failed:
|
||||
Status: 200
|
||||
Keys: ['context', 'project_id', 'tags', 'limit', 'min_relevance_score']
|
||||
[FAILED] Still old code
|
||||
|
||||
|
||||
================================================================================
|
||||
QUICK REFERENCE COMMANDS
|
||||
================================================================================
|
||||
|
||||
Copy file:
|
||||
pscp D:\ClaudeTools\api\routers\conversation_contexts.py guru@172.16.3.30:/tmp/conversation_contexts.py
|
||||
|
||||
SSH to RMM:
|
||||
plink guru@172.16.3.30
|
||||
|
||||
Deploy on RMM (in SSH session):
|
||||
sudo mv /tmp/conversation_contexts.py /opt/claudetools/api/routers/conversation_contexts.py
|
||||
sudo chown claudetools:claudetools /opt/claudetools/api/routers/conversation_contexts.py
|
||||
grep -c "search_term.*Query" /opt/claudetools/api/routers/conversation_contexts.py
|
||||
sudo systemctl restart claudetools-api
|
||||
sudo systemctl status claudetools-api --no-pager | head -15
|
||||
exit
|
||||
|
||||
Test (in PowerShell):
|
||||
python -c "import requests; r=requests.get('http://172.16.3.30:8001/api/conversation-contexts/recall', headers={'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJpbXBvcnQtc2NyaXB0Iiwic2NvcGVzIjpbImFkbWluIiwiaW1wb3J0Il0sImV4cCI6MTc3MTI3NTEyOX0.-DJF50tq0MaNwVQBdO7cGYNuO5pQuXte-tTj5DpHi2U'}, params={'search_term': 'dataforth', 'limit': 2}); print('SUCCESS!' if 'contexts' in r.json() else 'FAILED - still old format')"
|
||||
|
||||
|
||||
================================================================================
|
||||
TROUBLESHOOTING
|
||||
================================================================================
|
||||
|
||||
If test shows "FAILED - still old format":
|
||||
1. Check if file was actually copied: ls -lh /tmp/conversation_contexts.py
|
||||
2. Check if file was moved: ls -lh /opt/claudetools/api/routers/conversation_contexts.py
|
||||
3. Verify new code: grep "search_term" /opt/claudetools/api/routers/conversation_contexts.py
|
||||
4. Check service restarted: sudo systemctl status claudetools-api
|
||||
5. Try restarting again: sudo systemctl restart claudetools-api
|
||||
|
||||
If API returns 401 Unauthorized:
|
||||
- JWT token may have expired, but should be valid until 2026-02-16
|
||||
|
||||
If API is unreachable:
|
||||
- Check service status: sudo systemctl status claudetools-api
|
||||
- Check firewall: sudo ufw status
|
||||
- Check API logs: sudo journalctl -u claudetools-api -n 50
|
||||
|
||||
|
||||
================================================================================
|
||||
Generated: 2026-01-18
|
||||
Local File: D:\ClaudeTools\api\routers\conversation_contexts.py
|
||||
Target Server: guru@172.16.3.30
|
||||
Target Path: /opt/claudetools/api/routers/conversation_contexts.py
|
||||
================================================================================
|
||||
Reference in New Issue
Block a user