@@ -4,21 +4,6 @@ The supported production deployment is one Node 24 backend under systemd, one
44SQLite database, and an HTTPS reverse proxy. Never run two backend instances for
55the same installation.
66
7- ## Switch from an older backend
8-
9- From a clean checkout of the commit to deploy, run:
10-
11- ``` bash
12- scripts/switch-backend.sh --fresh
13- ```
14-
15- The script keeps supported credentials and endpoints from
16- ` /etc/slashmon-backend.env ` , installs the current commit, removes the old service
17- unit, and starts ` slashmon-backend.service ` . It permanently removes the old and
18- new Slashmon state directories plus ` /var/backups/slashmon ` ; it creates no
19- database backup and provides no automatic rollback. Run it only when losing all
20- existing watches, events, delivery state, and checkpoints is intended.
21-
227## Prepare
238
249Install Node 24 at ` /usr/local/bin/node ` , enable Corepack, and create the
@@ -53,7 +38,7 @@ Override `AZTEC_SENTINEL_POLL_INTERVAL_MS`,
5338` AZTEC_SENTINEL_EPOCH_END_BUFFER_SLOTS ` ,
5439` AZTEC_SENTINEL_VALIDATOR_CONCURRENCY ` , or
5540` AZTEC_SENTINEL_VALIDATOR_MAX_RESPONSE_BYTES ` only for an observed node or RPC
56- constraint. The fresh-switch script preserves these settings.
41+ constraint. The deployment script preserves these settings.
5742
5843Telegram and Web Push are independently optional. Create one Telegram bot or
5944generate a stable VAPID keypair:
@@ -64,26 +49,27 @@ pnpm --filter @slashmon/backend exec web-push generate-vapid-keys
6449
6550Changing VAPID keys requires browsers to subscribe again.
6651
67- ## Install
52+ ## Deploy
6853
69- Create an immutable release and install production dependencies :
54+ Run one mode from a clean checkout of the commit to deploy :
7055
7156``` bash
72- revision=" $( git rev-parse --short=12 HEAD) "
73- release=" /opt/slashmon/releases/$revision "
74- sudo install -d -m 0755 " $release "
75- git archive HEAD | sudo tar -x -C " $release "
76- sudo corepack pnpm --dir " $release " install --prod --frozen-lockfile
77- sudo ln -sfn " $release " /opt/slashmon/current
78- sudo install -m 0644 collector/deploy/slashmon-backend.service /etc/systemd/system/
79- sudo systemctl daemon-reload
80- sudo systemctl enable --now slashmon-backend.service
57+ scripts/deploy-backend.sh --fresh
58+ scripts/deploy-backend.sh --upgrade
8159```
8260
83- The unit creates ` /var/lib/slashmon ` and stores
84- ` /var/lib/slashmon/slashmon.sqlite ` . Startup accepts an empty database or the
85- current schema only. Archive any database from an older Slashmon implementation
86- and start clean; there is intentionally no migration path.
61+ Use ` --fresh ` for the first deployment or an intentionally incompatible reset.
62+ It permanently removes all Slashmon state and ` /var/backups/slashmon ` ; it
63+ creates no backup. Use ` --upgrade ` for a compatible release. It stops the only
64+ writer, checkpoints and checks SQLite, saves a timestamped database under
65+ ` /var/backups/slashmon ` , switches the immutable release, and restarts the
66+ service without deleting state. Keep the previous release and backup until
67+ source polls and test deliveries succeed. Neither mode provides automatic
68+ rollback.
69+
70+ The unit stores the database at ` /var/lib/slashmon/slashmon.sqlite ` . Startup
71+ accepts an empty database or the current schema only; there is no migration
72+ path.
8773
8874To self-host the PWA, install all dependencies and run ` pnpm build ` in the
8975release. Serve ` dist/ ` as static files. Frontend RPC URLs must be public HTTPS
@@ -137,23 +123,5 @@ Repeatedly restarting does not repair a stale node or RPC. Web Push 404/410 is
137123endpoint-specific; shared authentication failures keep urgent work retryable
138124and degrade channel health.
139125
140- ## Backup and upgrade
141-
142- Stop the only writer, checkpoint and check SQLite, then copy the database:
143-
144- ``` bash
145- sudo systemctl stop slashmon-backend.service
146- database=/var/lib/slashmon/slashmon.sqlite
147- sudo sqlite3 " $database " ' PRAGMA wal_checkpoint(TRUNCATE);'
148- test " $( sudo sqlite3 " $database " ' PRAGMA quick_check;' ) " = ok
149- sudo install -d -m 0700 /var/backups/slashmon
150- sudo cp --preserve=mode,ownership,timestamps " $database " /var/backups/slashmon/
151- sudo systemctl start slashmon-backend.service
152- ```
153-
154- For an upgrade, install a new immutable release, take this backup, switch the
155- ` /opt/slashmon/current ` symlink while stopped, and start the service. Keep the
156- previous release and backup until source polls and test deliveries succeed.
157-
158126Delivery is at-least-once. A crash after provider acceptance but before the
159127success commit can duplicate an alert; stable event IDs are the comparison key.
0 commit comments