Files
darroyo 8e08c73f60 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
2026-07-07 15:03:22 -04:00

38 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
VERSION="${VERSION:-$(git describe --tags --always --dirty 2>/dev/null || echo dev)}"
ARCH="${ARCH:-amd64}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
OUTPUT_DIR="$PROJECT_DIR/dist"
DEB_DIR="$PROJECT_DIR/packaging/debian"
echo "=== Packaging SyncServer v${VERSION} for ${ARCH} ==="
mkdir -p "$OUTPUT_DIR"
DEB_PATH="$OUTPUT_DIR/syncserver_${VERSION}_${ARCH}.deb"
sed "s/@@VERSION@@/${VERSION}/" "$DEB_DIR/DEBIAN/control" > "$DEB_DIR/DEBIAN/control.tmp"
mv "$DEB_DIR/DEBIAN/control.tmp" "$DEB_DIR/DEBIAN/control"
chmod 0755 "$DEB_DIR/DEBIAN/postinst"
chmod 0755 "$DEB_DIR/DEBIAN/prerm"
chmod 0755 "$DEB_DIR/DEBIAN/postrm"
chmod 0644 "$DEB_DIR/DEBIAN/conffiles"
chmod 0644 "$DEB_DIR/etc/syncserver/config.yaml"
chmod 0644 "$DEB_DIR/lib/systemd/system/syncserver.service"
echo "=== Building .deb ==="
dpkg-deb --build --root-owner-group "$DEB_DIR" "$DEB_PATH"
echo "=== Package info ==="
dpkg-deb -I "$DEB_PATH"
echo ""
echo "=== Package contents (first 30) ==="
dpkg-deb -c "$DEB_PATH" | head -30
echo ""
echo "=== Output: $DEB_PATH ==="