mirror of
https://github.com/myronblair/ai-context
synced 2026-06-30 17:50:08 -05:00
3.4 KiB
3.4 KiB
Critical Gotchas — Read Before Running Commands
PHP / OLS
- NEVER use
lsphp -lfor syntax check — it segfaults. Usephp8.3 -l file.php - Run CLI scripts with:
/usr/local/lsws/lsphp85/bin/lsphp /path/script.php - If endpoint uses
ob_start()+ header.php pattern → addob_end_clean()before CSV/JSON output - MySQL charset: always
utf8mb4_unicode_ci— mixing withgeneral_cibreaks JOINs (error 1267)
SSH / Networking
- DO server (165.22.1.228) cannot reach local network (10.48.200.x) directly
- To reach local VMs from DO: use agent commands (shell type) or FortiGate DDNS
- PVE1 SSH via DDNS works:
root@orbisne.fortiddns.com(Joker1974!!!) - PVE2 has no external port forward — only reachable locally or via cluster API through PVE1
- Proxmox API port 8006 IS forwarded:
orbisne.fortiddns.com:8006works from DO
JARVIS Agents
- Agent config:
/etc/jarvis-agent/config.json| Runtime state:/var/lib/jarvis-agent/state.json - 401 "Invalid agent key" → state.json has stale key. Fix: overwrite state.json with correct agent_id + api_key from
registered_agentstable, thensystemctl restart jarvis-agent - Agent heartbeat uses
X-Agent-Keyheader (NOT body field) shellcommand type requires{"command":"...","allowed":true}in command_data- Metrics stored as JSON in
metric_datacolumn — useJSON_EXTRACT(metric_data,'$.cpu_percent')NOT direct columns
Groq AI
- Model name:
compound-beta-mini— NOTgroq/compound-beta-mini(that's OpenAI router syntax, 404s)
Proxmox
- stats_cache.php uses
orbisne.fortiddns.com:8006NOTPROXMOX_HOST(local IP unreachable from DO) --nameserverin Proxmox must be space-separated:"8.8.8.8 1.1.1.1"(comma causes netplan bug)- Run commands in VMs:
qm guest exec <VMID> -- bash -c 'cmd'(requires guest agent installed)
Deploy
- Always
git add + commit + pushafter editing files on server — webhook auto-deploys within 1 min - PHP syntax validated before deploy — bad commits auto-reverted
- LSAPI session deadlock:
session_write_close()must be called in api.php after auth check
API Endpoint Auth
- Netscan endpoint (
/api/netscan) bypasses main auth — usesX-Registration-Keyheader - Admin portal uses separate PHP session name (
jarvis_admin) — different from main JARVIS session - Cloudflare real IP: use
$_SERVER['HTTP_CF_CONNECTING_IP']notREMOTE_ADDR
Network Scan
- The JARVIS "RUN NETWORK SCAN" button does NOT scan from DO (can't reach local network)
- It queues a shell command to PVE1 agent → PVE1 runs nmap → pushes results to /api/netscan
- Results appear ~40 seconds after clicking (10s for agent pickup + 30s nmap)
- Chat "scan network" intent returns real DB data — never hallucinated
FusionPBX
- SIP config changes need cache delete before they take effect:
rm /var/cache/fusionpbx/FusionPBX.configuration.sofia.conf - mod_presence is NOT installed on this server
Backup Agent State Fix (Common Issue)
# If an agent shows "Invalid agent key" after reinstall:
# 1. Get correct values from DB
mysql -u jarvis_user -pJ4rv1s_Pr0t0c0l_2026! jarvis_db -e \
"SELECT agent_id, api_key FROM registered_agents WHERE hostname='<hostname>';"
# 2. Overwrite state on the agent machine
cat > /var/lib/jarvis-agent/state.json << EOF
{"api_key": "<api_key_from_db>", "agent_id": "<agent_id_from_db>"}
EOF
systemctl restart jarvis-agent