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
+69
View File
@@ -0,0 +1,69 @@
package api
type MachineRequest struct {
Name string `json:"name"`
Host string `json:"host"`
Port int `json:"port"`
SSHUser string `json:"ssh_user"`
SSHKeyID *int64 `json:"ssh_key_id"`
MACAddress *string `json:"mac_address"`
WoLEnabled bool `json:"wol_enabled"`
BroadcastAddr *string `json:"broadcast_addr"`
WakeTimeoutSeconds int `json:"wake_timeout_seconds"`
WakeCheckIntervalSeconds int `json:"wake_check_interval_seconds"`
}
type MachineResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
Host string `json:"host"`
Port int `json:"port"`
SSHUser string `json:"ssh_user"`
SSHKeyID *int64 `json:"ssh_key_id"`
MACAddress *string `json:"mac_address"`
WoLEnabled bool `json:"wol_enabled"`
BroadcastAddr *string `json:"broadcast_addr"`
WakeTimeoutSeconds int `json:"wake_timeout_seconds"`
WakeCheckIntervalSeconds int `json:"wake_check_interval_seconds"`
FingerprintConfirmed bool `json:"fingerprint_confirmed"`
Status string `json:"status"`
}
type SyncPairRequest struct {
Name string `json:"name"`
SourceMachineID *int64 `json:"source_machine_id"`
SourcePath string `json:"source_path"`
DestMachineID *int64 `json:"dest_machine_id"`
DestPath string `json:"dest_path"`
Direction string `json:"direction"`
RsyncFlags string `json:"rsync_flags"`
ExcludePatterns string `json:"exclude_patterns"`
Enabled bool `json:"enabled"`
}
type SyncPairResponse struct {
ID int64 `json:"id"`
Name string `json:"name"`
SourceMachineID *int64 `json:"source_machine_id"`
SourcePath string `json:"source_path"`
DestMachineID *int64 `json:"dest_machine_id"`
DestPath string `json:"dest_path"`
Direction string `json:"direction"`
RsyncFlags string `json:"rsync_flags"`
ExcludePatterns string `json:"exclude_patterns"`
Enabled bool `json:"enabled"`
}
type JobResponse struct {
ID int64 `json:"id"`
SyncPairID int64 `json:"sync_pair_id"`
TriggerType string `json:"trigger_type"`
Status string `json:"status"`
StartedAt *string `json:"started_at"`
FinishedAt *string `json:"finished_at"`
LogFile *string `json:"log_file"`
}
type ErrorResponse struct {
Error string `json:"error"`
}