Commit graph

14 commits

Author SHA1 Message Date
Johannes Millan
a52b7716aa refactor(sync): remove tombstone system
Tombstones were used for tracking deleted entities but are no longer
needed with the operation log architecture. This removes:

- Tombstone table from Prisma schema
- Tombstone-related methods from SyncService
- Tombstone mocks and tests from all test files
- Database migration to drop tombstones table

The operation log now handles deletions through DEL operations,
making the separate tombstone tracking redundant.
2025-12-28 12:08:28 +01:00
Johannes Millan
78d4e4245a feat(sync-server): add operation analysis to monitor CLI
- Add 'ops' command to analyze operation payload sizes
- Show breakdown by entity type with count, total, avg, max sizes
- Display largest operation with payload structure analysis
- Enhance 'usage' command to show ops vs snapshot breakdown
- Show operation count, average size per user
2025-12-19 16:23:52 +01:00
Johannes Millan
90a8190cb8 refactor(sync-server): change usage-history to pivot table format
Shows users as rows with snapshot dates as columns for easier
comparison across time.
2025-12-19 16:19:49 +01:00
Johannes Millan
5917e0d052 feat(sync-server): add per-user growth table to usage-history
Shows each user's storage change between first and last snapshot,
sorted by growth (highest first).
2025-12-19 16:16:57 +01:00
Johannes Millan
a42f0025cb feat(sync-server): add usage history tracking
Each run of `npm run monitor -- usage` now saves a snapshot to
logs/usage-history.jsonl. New command `usage-history` shows past
snapshots with growth stats between runs.
2025-12-19 16:15:38 +01:00
Johannes Millan
754f7fb676 feat(sync-server): add disk space and table size monitoring
- Add disk space info to monitor stats (root filesystem, data dir)
- Add top 5 tables by size to database stats
- Add GHCR login to deploy.sh for private image pulls
2025-12-19 15:54:09 +01:00
Johannes Millan
f056e1224c feat(sync-server): add GHCR-based deployment workflow
Switch from server-side builds to pre-built images:
- Add build-and-push.sh for local builds to GHCR
- Update deploy.sh to pull from registry (30s vs 20min)
- Add docker-compose.build.yml for local build fallback
- Update docker-compose.yml to use registry image
- Add GHCR_USER/GHCR_TOKEN to env.example
- Add npm scripts: docker:build, docker:deploy, docker:backup
2025-12-19 15:24:20 +01:00
Johannes Millan
57766f29dd feat(sync-server): add deployment and monitoring scripts
Add production deployment tooling:
- docker-compose.monitoring.yml: Dozzle + Uptime Kuma stack
- scripts/deploy.sh: Git pull + rebuild with health check
- scripts/backup.sh: PostgreSQL dump with optional rclone upload
2025-12-19 14:26:12 +01:00
Johannes Millan
2c42cf65cb feat(super-sync-server): Add basic monitoring tool
This commit introduces a lightweight monitoring CLI tool for the super-sync-server.

Changes include:
- Enhanced logging:  now supports writing logs to a file () when  is set, enabling persistent log storage.
- New monitoring script:  provides commands for:
    - : Displays system vitals (CPU, RAM) and database connectivity/size.
    - : Shows top 20 users by data storage usage within the database.
    - : Allows tailing, searching, and filtering server logs from the file.
-  update: Added a  script to easily run the tool.
2025-12-12 20:48:40 +01:00
Johannes Millan
2a4dbd7ad0 fix(superSync): Update admin scripts and README for Postgres compatibility
Refactored 'delete-user.ts' and 'clear-data.ts' to use Prisma Client, aligning them with the current PostgreSQL architecture.
Updated 'packages/super-sync-server/README.md' to reflect the Docker-based, PostgreSQL setup and added documentation for the administrative scripts.
Removed '@types/better-sqlite3' from 'package.json' as it's no longer needed.
2025-12-12 20:48:40 +01:00
Johannes Millan
7201eebe85 fix(sync): wrap full-state operation payloads in appDataComplete
SYNC_IMPORT, BACKUP_IMPORT, and Repair operations contain full app state
in their payload. When these operations were downloaded by another client
and applied via applyOperations(), convertOpToAction() was spreading the
payload directly into the action. But reducers expect action.appDataComplete,
so they received undefined and fell back to empty/initial state.

This caused complete data loss (no projects, no tags, tasks in wrong project)
when syncing SYNC_IMPORT operations between clients.

Fix: Add extractFullStatePayload() that wraps the payload in appDataComplete
for full-state operation types, matching what loadAllData action expects.

Also clears file-based storage directories in the clear-data script.
2025-12-12 20:47:48 +01:00
Johannes Millan
27b4da775a fix(super-sync): ensure clear-data script checks for DB existence
Previously,  would silently create a new empty database if the configured  was incorrect or missing, leading to a confusing 'success' message (deleting 0 rows) while the actual data remained untouched. Now, the script verifies that  exists at the expected path before proceeding, and exits with an error if it's missing.
2025-12-12 20:46:26 +01:00
Johannes Millan
9a2f972e4e feat(syncServer): add script to clear sync data for users 2025-12-12 20:46:25 +01:00
Johannes Millan
4570ed965f feat(syncServer): add email verification route and user deletion script 2025-12-12 20:46:04 +01:00