# Syncthing Setup ## Overview Syncthing provides real-time file synchronization across all devices. Files sync automatically when devices connect. ## Devices | Device | ID Prefix | Local IP | Tailscale IP | Port | Role | |--------|-----------|----------|--------------|------|------| | Mac Mini | L3PJR73 | 10.10.10.123 | 100.108.89.58 | 22000 | Primary workstation | | MacBook Pro | 3TFMYEI | 10.10.10.147 | 100.88.161.1 | 22000 | Laptop | | TrueNAS | TPO72EY | 10.10.10.200 | 100.100.94.71 | 20978 | Storage server (central hub) | | Windows PC | YDCPUQK | 10.10.10.150 | 100.120.97.76 | 22000 | Windows workstation | | Phone (Android) | XLMZCCH | 10.10.10.54 | 100.106.175.37 | 22000 | Android, Notes only, HTTPS API | ## Network Configuration **IPv4 Only** - All devices configured with explicit IPv4 addresses (no dynamic/IPv6): - Local network: `10.10.10.0/24` - Tailscale network: `100.x.x.x` Device address format: `tcp4://IP:PORT` (e.g., `tcp4://10.10.10.123:22000`) ## Synced Folders | Folder | Path | Devices | Notes | |--------|------|---------|-------| | Downloads | ~/Downloads | Mac Mini, MacBook, TrueNAS, Windows | Large folder, 3600s rescan | | Notes | ~/Notes | Mac Mini, MacBook, TrueNAS | Documentation | | Projects | ~/Projects | Mac Mini, MacBook, TrueNAS | Code repositories | | bin | ~/bin | Mac Mini, MacBook, TrueNAS | Scripts and tools | | Documents | ~/Documents | Mac Mini, MacBook, TrueNAS | Personal documents | | Desktop | ~/Desktop | Mac Mini, MacBook, TrueNAS | Desktop files | | config | ~/.config | Mac Mini, MacBook | Shell configs, app settings | | Antigravity | ~/.gemini | Mac Mini, MacBook, TrueNAS | Gemini config | ## API Access ### Mac Mini ```bash API_KEY="oSQSrPnMnrEXuHqjWrRdrvq3TSXesAT5" curl -s "http://127.0.0.1:8384/rest/system/status" -H "X-API-Key: $API_KEY" ``` ### MacBook Pro ```bash API_KEY="qYkNdVLwy9qZZZ6MqnJr7tHX7KKdxGMJ" curl -s "http://127.0.0.1:8384/rest/system/status" -H "X-API-Key: $API_KEY" ``` ### Windows PC ```bash API_KEY="KPHGteJv6APPE7zFun33b3qM3Vn5KSA7" curl -s "http://10.10.10.150:8384/rest/system/status" -H "X-API-Key: $API_KEY" ``` ### Phone (Android) - Uses HTTPS ```bash API_KEY="Xxz3jDT4akUJe6psfwZsbZwG2LhfZuDM" # Access via local IP (use -k to skip cert verification) curl -sk "https://10.10.10.54:8384/rest/system/status" -H "X-API-Key: $API_KEY" # Or via Tailscale curl -sk "https://100.106.175.37:8384/rest/system/status" -H "X-API-Key: $API_KEY" ``` ## Common Commands ### Check Status ```bash # Folder status curl -s "http://127.0.0.1:8384/rest/db/status?folder=downloads" -H "X-API-Key: $API_KEY" # Connection status curl -s "http://127.0.0.1:8384/rest/system/connections" -H "X-API-Key: $API_KEY" # Device completion for a folder curl -s "http://127.0.0.1:8384/rest/db/completion?folder=downloads&device=DEVICE_ID" -H "X-API-Key: $API_KEY" ``` ### Check Errors ```bash curl -s "http://127.0.0.1:8384/rest/folder/errors?folder=downloads" -H "X-API-Key: $API_KEY" ``` ### Rescan Folder ```bash curl -X POST "http://127.0.0.1:8384/rest/db/scan?folder=downloads" -H "X-API-Key: $API_KEY" ``` ## Configuration Files | Device | Config Path | |--------|-------------| | Mac Mini | ~/Library/Application Support/Syncthing/config.xml | | MacBook Pro | ~/Library/Application Support/Syncthing/config.xml | | TrueNAS | /mnt/tank/syncthing/config/config.xml | ## Performance Tuning ### Speed Optimizations (2024-12-17) #### Global Options | Setting | Value | Effect | |---------|-------|--------| | `numConnections` | 4 | Parallel transfers per device | | `compression` | never | No CPU overhead on fast LAN | | `setLowPriority` | false | Normal CPU priority | | `connectionPriorityQuicLan` | 10 | QUIC preferred on LAN | | `connectionPriorityTcpLan` | 20 | TCP fallback on LAN | | `connectionPriorityQuicWan` | 30 | QUIC preferred on WAN | | `connectionPriorityTcpWan` | 40 | TCP fallback on WAN | | `progressUpdateIntervalS` | -1 | Disabled progress updates (reduces overhead) | | `maxConcurrentIncomingRequestKiB` | 1048576 | 1GB buffer for incoming requests | **Applied to**: Mac Mini, MacBook, Windows PC (Phone uses 512MB buffer) #### Folder-Level Settings | Setting | Value | Effect | |---------|-------|--------| | `pullerMaxPendingKiB` | 131072-262144 | 128-256MB pending data buffer per folder | **Applied to**: downloads, projects, documents, desktop, notes folders ### Rescan Intervals (set to 3600s for large folders) Large folders like Downloads use 1-hour rescan intervals to reduce CPU usage: - File system watcher handles real-time changes - Hourly rescan catches anything missed ### Power Optimization From CLAUDE.md - Syncthing rescan optimization saved ~60-80W on TrueNAS VM. ## Troubleshooting ### Device Not Syncing 1. Check connection status: ```bash curl -s "http://127.0.0.1:8384/rest/system/connections" -H "X-API-Key: $API_KEY" | python3 -c "import sys,json; d=json.load(sys.stdin)['connections']; [print(f'{k[:7]}: {v[\"connected\"]}') for k,v in d.items()]" ``` 2. Check folder completion: ```bash curl -s "http://127.0.0.1:8384/rest/db/status?folder=FOLDER" -H "X-API-Key: $API_KEY" ``` 3. Check for errors: ```bash curl -s "http://127.0.0.1:8384/rest/folder/errors?folder=FOLDER" -H "X-API-Key: $API_KEY" ``` ### Many Pending Deletes If a device shows thousands of "needDeletes", it means files were deleted elsewhere and need to propagate. This is normal after reorganization - let it complete. ### Web UI Access Syncthing web interface at http://127.0.0.1:8384 ## SSH Access to Devices ### MacBook Pro (via Tailscale) ```bash sshpass -p 'GrilledCh33s3#' ssh -o StrictHostKeyChecking=no hutson@100.88.161.1 ``` ### Check Syncthing remotely ```bash sshpass -p 'GrilledCh33s3#' ssh hutson@100.88.161.1 'curl -s "http://127.0.0.1:8384/rest/db/status?folder=downloads" -H "X-API-Key: qYkNdVLwy9qZZZ6MqnJr7tHX7KKdxGMJ"' ```