packages/super-sync-server/DOCKER-MONITORING.md
Quick reference for monitoring your SuperSync production Docker container.
supersync-server)export SUPERSYNC_CONTAINER=your-container-namecd packages/super-sync-server
# View current storage usage (your use case!)
npm run docker:monitor:usage
# Complete monitoring suite (saves to file in container)
npm run docker:monitor:all
# Interactive shell
npm run docker:shell
# System vitals (CPU, memory, disk, DB)
./scripts/docker-monitor.sh stats
# Top 20 users by storage (MOST USEFUL for your current investigation)
./scripts/docker-monitor.sh usage
# Active user counts and engagement metrics
./scripts/docker-monitor.sh active-users
# Recent operations
./scripts/docker-monitor.sh ops --tail 100
# Server logs
./scripts/docker-monitor.sh logs --tail 200
./scripts/docker-monitor.sh logs --error
Based on your production data, investigate the anomalies:
# User #29 with 28k operations (171 bytes avg)
./scripts/docker-monitor.sh analyze user-deep-dive --user 29
./scripts/docker-monitor.sh analyze rapid-fire --threshold 3
# User #27 with huge operations (54 KB avg)
./scripts/docker-monitor.sh analyze user-deep-dive --user 27
./scripts/docker-monitor.sh analyze large-ops --limit 20
# Compare the two
./scripts/docker-monitor.sh analyze compare-users 27 29
# Operation size distribution
./scripts/docker-monitor.sh analyze operation-sizes
./scripts/docker-monitor.sh analyze operation-sizes --user 29
# Detect sync loops/rapid-fire
./scripts/docker-monitor.sh analyze rapid-fire --threshold 5
# Find largest operations
./scripts/docker-monitor.sh analyze large-ops --limit 50
# Timeline analysis (daily/hourly patterns)
./scripts/docker-monitor.sh analyze operation-timeline --user 29
# Operation type breakdown
./scripts/docker-monitor.sh analyze operation-types --user 29
# Snapshot analysis
./scripts/docker-monitor.sh analyze snapshot-analysis
# Export data for offline analysis
./scripts/docker-monitor.sh analyze export-ops --user 29 --limit 1000
# Run all checks (takes 1-3 minutes)
./scripts/docker-monitor.sh monitor-all
# Quick mode (skip deep analysis, ~30 seconds)
./scripts/docker-monitor.sh monitor-all --quick
# Save report to file in container
./scripts/docker-monitor.sh monitor-all --save
# Focus on specific user
./scripts/docker-monitor.sh monitor-all --user 29 --save
# Copy all reports from container to host
./scripts/docker-monitor.sh get-reports ./my-reports
# Files copied:
# - monitoring-reports/*.txt (from monitor-all --save)
# - analysis-output/*.json (from export-ops)
# - usage-history.jsonl (usage tracking over time)
If you prefer not to use the wrapper script:
# Basic monitoring (uses compiled JS)
docker exec -it supersync-server node dist/scripts/monitor.js usage
docker exec -it supersync-server node dist/scripts/monitor.js stats
docker exec -it supersync-server node dist/scripts/monitor.js active-users
docker exec -it supersync-server node dist/scripts/monitor.js ops --user 29
# Analysis (requires tsx - auto-installed on first use)
docker exec -it supersync-server tsx scripts/analyze-storage.ts user-deep-dive --user 29
# Interactive shell
docker exec -it supersync-server sh
# Inside the shell:
cd /app
tsx scripts/analyze-storage.ts --help
node dist/scripts/monitor.js --help
Set up cron jobs on the Docker host:
# Add to host crontab
crontab -e
# Daily usage snapshot at 2 AM
0 2 * * * cd /path/to/super-productivity/packages/super-sync-server && ./scripts/docker-monitor.sh usage >> /var/log/supersync-daily.log 2>&1
# Weekly full report every Sunday at 3 AM
0 3 * * 0 cd /path/to/super-productivity/packages/super-sync-server && ./scripts/docker-monitor.sh monitor-all --save
# Hourly rapid-fire detection
0 * * * * cd /path/to/super-productivity/packages/super-sync-server && ./scripts/docker-monitor.sh analyze rapid-fire >> /var/log/supersync-rapid-fire.log 2>&1
Based on your current production findings:
./scripts/docker-monitor.sh monitor-all --save
./scripts/docker-monitor.sh get-reports ./investigation-$(date +%Y%m%d)
./scripts/docker-monitor.sh analyze user-deep-dive --user 29
./scripts/docker-monitor.sh analyze rapid-fire --threshold 3
./scripts/docker-monitor.sh analyze operation-timeline --user 29
./scripts/docker-monitor.sh analyze user-deep-dive --user 27
./scripts/docker-monitor.sh analyze large-ops --limit 10
./scripts/docker-monitor.sh analyze export-ops --user 29 --limit 5000
./scripts/docker-monitor.sh analyze export-ops --user 27 --limit 1000
./scripts/docker-monitor.sh get-reports ./exports
# List running containers
docker ps
# Set custom container name
export SUPERSYNC_CONTAINER=my-container-name
./scripts/docker-monitor.sh usage
The script automatically installs tsx globally in the container on first use. This persists until the container is recreated.
To manually install:
docker exec supersync-server npm install -g tsx
chmod +x packages/super-sync-server/scripts/docker-monitor.sh
Increase Docker memory limit or reduce analysis scope:
# Reduce limits
./scripts/docker-monitor.sh analyze large-ops --limit 10
./scripts/docker-monitor.sh analyze export-ops --user 29 --limit 100
Run a command with --save first:
./scripts/docker-monitor.sh monitor-all --save
./scripts/docker-monitor.sh get-reports .
supersync user inside the container/app/monitoring-reports//app/analysis-output//app/logs/usage-history.jsonl/app/logs/app.logAfter gathering data:
For detailed command documentation, see MONITORING-README.md.