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
+1
View File
@@ -0,0 +1 @@
/etc/syncserver/config.yaml
+12
View File
@@ -0,0 +1,12 @@
Package: syncserver
Version: 1a66ac5
Architecture: amd64
Section: net
Priority: optional
Depends: rsync, openssh-client, ca-certificates
Maintainer: SyncServer Team <syncserver@example.com>
Description: Self-hosted file sync orchestrator with Wake-on-LAN and web UI
SyncServer is a Go-based server that provides a web interface to manage
and execute file synchronizations between multiple machines using rsync
over SSH, with optional Wake-on-LAN support to power on remote machines
before syncing.
+47
View File
@@ -0,0 +1,47 @@
#!/bin/bash
set -e
case "$1" in
configure)
if ! id syncserver > /dev/null 2>&1; then
useradd --system --no-create-home --shell /usr/sbin/nologin syncserver || true
fi
install -d -o syncserver -g syncserver -m 0750 /var/lib/syncserver/data || true
install -d -o syncserver -g syncserver -m 0750 /var/lib/syncserver/ssh || true
install -d -o syncserver -g syncserver -m 0750 /var/lib/syncserver/logs || true
install -d -o root -g root -m 0755 /etc/syncserver || true
if [ ! -f /etc/syncserver/config.yaml ]; then
cat > /etc/syncserver/config.yaml << 'EOF'
# SyncServer configuration
# Copy this file and edit as needed.
# Environment variables SYNCSERVER_* take precedence over this file.
data_dir: /var/lib/syncserver
addr: :8080
auth:
jwt_secret: "" # Leave empty to generate a random one on startup
jwt_expiry_hours: 24
scheduler:
timezone: UTC
EOF
chown root:root /etc/syncserver/config.yaml
chmod 0644 /etc/syncserver/config.yaml
fi
if command -v systemctl > /dev/null 2>&1; then
systemctl daemon-reload 2>/dev/null || true
systemctl enable syncserver.service 2>/dev/null || true
systemctl start syncserver.service 2>/dev/null || true
fi
;;
abort-upgrade|abort-remove|abort-configure)
exit 0
;;
esac
exit 0
+21
View File
@@ -0,0 +1,21 @@
#!/bin/bash
set -e
case "$1" in
purge|remove)
if [ "$1" = "purge" ]; then
rm -rf /var/lib/syncserver || true
fi
;;
upgrade)
;;
failed-upgrade)
;;
abort-install|abort-upgrade)
;;
*)
exit 0
;;
esac
exit 0
+20
View File
@@ -0,0 +1,20 @@
#!/bin/bash
set -e
case "$1" in
remove|purge|deconfigure)
if command -v systemctl > /dev/null 2>&1; then
systemctl stop syncserver.service 2>/dev/null || true
systemctl disable syncserver.service 2>/dev/null || true
fi
;;
upgrade)
;;
failed-upgrade)
;;
*)
exit 0
;;
esac
exit 0
@@ -0,0 +1,27 @@
[Unit]
Description=SyncServer - File sync orchestrator with Wake-on-LAN and web UI
Documentation=https://github.com/syncserver/syncserver
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=syncserver
Group=syncserver
ExecStart=/usr/bin/syncserver --config /etc/syncserver/config.yaml --data-dir /var/lib/syncserver
Restart=on-failure
RestartSec=5
StandardOutput=journal
StandardError=journal
SyslogIdentifier=syncserver
# Hardening
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/var/lib/syncserver /run
UMask=0077
[Install]
WantedBy=multi-user.target