Store events and config in SQLite

Replace the JSON-file event and config stores with a SQLite database
(modernc.org/sqlite, pure-Go so the static build keeps CGO_ENABLED=0).
Last-write-wins now rides on the upsert's WHERE clause rather than a
Go-side map compare; the sync protocol and HTTP handlers are unchanged.

On first start the server auto-imports any legacy events.json/config.json
sitting in the data dir, renaming them to *.imported. The -data flag now
points at puppy.db; photos still live on the filesystem alongside it.
This commit is contained in:
Alexander Heldt
2026-07-09 16:56:35 +00:00
parent da692d84da
commit 9207aaa4aa
6 changed files with 281 additions and 129 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ in
"${cfg.package}/bin/puppy-tracker-server"
"-addr ${cfg.address}:${toString cfg.port}"
"-static ${cfg.staticPackage}/share/puppy-tracker"
"-data /var/lib/puppy-tracker/events.json"
"-data /var/lib/puppy-tracker/puppy.db"
];
DynamicUser = true;