feat: complete SyncServer implementation

Full-stack Go monolith with embedded React frontend for orchestrating
rsync-over-SSH file synchronization with Wake-on-LAN support.

Features:
- JWT auth (HS256) with bcrypt password hashing
- CRUD for machines (with WoL config) and sync_pairs
- Ed25519 SSH key generation and known_hosts management
- WoL magic packet sender + TCP-connect waiter with backoff
- Sync engine: rsync subprocess, per-pair job queue, progress parsing
- Homebrew cron parser for scheduled syncs
- SSE stream for live job status (queued/waking_up/running/success/failed)
- React+TS+Vite+Tailwind SPA embedded via embed.FS
- Debian packaging with systemd unit, postinst/prerm/postrm

Tech stack:
- Go 1.22+ (CGO_ENABLED=0, pure SQLite via modernc.org/sqlite)
- chi router for HTTP API
- TypeScript + React 18 + Tailwind CSS frontend
- Cross-compiled to Linux amd64 for Proxmox LXC deployment

Tests: wol (MAC parsing, magic packet), syncengine/queue, scheduler/cron
This commit is contained in:
2026-07-07 15:03:22 -04:00
parent 1a66ac58cd
commit 8e08c73f60
69 changed files with 7949 additions and 152 deletions
+32
View File
@@ -0,0 +1,32 @@
#!/bin/bash
set -euo pipefail
VERSION="${VERSION:-$(git describe --tags --always --dirty 2>/dev/null || echo dev)}"
GOARCH="${GOARCH:-amd64}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
echo "=== Building SyncServer v${VERSION} for ${GOARCH} ==="
echo "=== Building frontend ==="
cd "$PROJECT_DIR/web"
npm ci --silent 2>/dev/null || npm install --silent
npm run build
echo "=== Copying frontend dist to Go embed dir ==="
rm -rf "$PROJECT_DIR/internal/webui/dist"
cp -R "$PROJECT_DIR/web/dist" "$PROJECT_DIR/internal/webui/dist"
echo "=== Building Go binary ==="
cd "$PROJECT_DIR"
CGO_ENABLED=0 GOOS=linux GOARCH="${GOARCH}" \
go build -trimpath \
-ldflags="-s -w -X main.version=${VERSION}" \
-o "packaging/debian/usr/bin/syncserver" \
./cmd/server
echo "=== Binary size ==="
ls -lh "packaging/debian/usr/bin/syncserver"
echo "=== Done ==="
echo "Run: ./scripts/package-deb.sh to create the .deb package"