This document walks through running the sqlite-watcher service on Linux, macOS, and Windows. The watcher process should run beside the .sqlite file so it can tail the WAL and expose change batches over the embedded gRPC API.
All platforms share these basics:
- Create a token file (default
~/.seren/sqlite-watcher/token) with restrictive permissions (owner read/write only). - Choose a queue database path (default
~/.seren/sqlite-watcher/changes.db). Ensure the parent directory is0700on Unix. - Run
sqlite-watcher serve --queue-db <path> --listen <endpoint> --token-file <file>to start the gRPC service. Endpoints use theunix:/pathortcp:host:portsyntax.
-
Install binaries:
sudo install -m 0755 database-replicator /usr/local/bin/database-replicator sudo install -m 0755 sqlite-watcher /usr/local/bin/sqlite-watcher
-
Create token + queue directories:
install -d -m 0700 ~/.seren/sqlite-watcher openssl rand -hex 32 > ~/.seren/sqlite-watcher/token
-
Create
/etc/systemd/system/sqlite-watcher.service:[Unit] Description=sqlite-watcher for /srv/app.db After=network-online.target [Service] User=replicator ExecStart=/usr/local/bin/sqlite-watcher serve \ --queue-db /var/lib/sqlite-watcher/changes.db \ --listen unix:/run/sqlite-watcher.sock \ --token-file /home/replicator/.seren/sqlite-watcher/token Restart=on-failure [Install] WantedBy=multi-user.target
-
Enable/start:
sudo systemctl daemon-reload sudo systemctl enable --now sqlite-watcher.service
-
Copy binaries into
/usr/local/bin. -
Save the following to
~/Library/LaunchAgents/com.seren.sqlite-watcher.plist:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>com.seren.sqlite-watcher</string> <key>ProgramArguments</key> <array> <string>/usr/local/bin/sqlite-watcher</string> <string>serve</string> <string>--queue-db</string> <string>/Users/you/.seren/sqlite-watcher/changes.db</string> <string>--listen</string> <string>unix:/Users/you/.seren/sqlite-watcher/watcher.sock</string> <string>--token-file</string> <string>/Users/you/.seren/sqlite-watcher/token</string> </array> <key>RunAtLoad</key> <true/> <key>KeepAlive</key> <true/> <key>StandardOutPath</key> <string>/Users/you/Library/Logs/sqlite-watcher.log</string> <key>StandardErrorPath</key> <string>/Users/you/Library/Logs/sqlite-watcher.log</string> </dict> </plist>
-
Load the agent:
launchctl load ~/Library/LaunchAgents/com.seren.sqlite-watcher.plist.
-
Copy
database-replicator.exeandsqlite-watcher.exeto a directory on%PATH%(e.g.C:\Program Files\Seren). -
Create a token file under
%USERPROFILE%\.seren\sqlite-watcher\token. -
Use the built-in
sc.exeto install a service (or NSSM if you prefer a GUI):sc.exe create sqlite-watcher binPath= "C:\Program Files\Seren\sqlite-watcher.exe serve --queue-db C:\data\sqlite-watcher\changes.db --listen tcp:127.0.0.1:6000 --token-file %USERPROFILE%\.seren\sqlite-watcher\token" start= auto
-
Start the service with
sc.exe start sqlite-watcher.
Remember to open the firewall only if the watcher must accept remote TCP connections. In most deployments, keep it bound to loopback or Unix sockets.
- Linux/macOS: use cron or systemd timers to run
database-replicator sync-sqlite ...periodically. - Windows: create a Scheduled Task pointing at
database-replicator.exe sync-sqlite ....
Consult the smoke test (scripts/test-sqlite-delta.sh) to see a minimal end-to-end example.