fix(mcp,db,systemd,logrotate): move telemetry DB to /var/lib/hyperstitionstud.io/api-telemetry.db via StateDirectory=hyperstitionstud.io and catch sqlite3.Error (v2.0.22)
This commit is contained in:
1 parent
95a5fc8618
commit
9716a0ab61
24 files changed
+140
-84
No files matched your search
@@ -6,10 +6,11 @@
|
||||
# writers hold locks corrupts the SQLite B-tree page header and WAL frame index.
|
||||
# Instead, `prerotate` invokes `hyperstitionstud_io.db.sqlite_meta --truncate-quiescent --compress-archive`, which:
|
||||
# 1. Sets `PRAGMA busy_timeout = 30000` (waits up to 30s for in-flight requests to finish),
|
||||
# 2. Acquires `BEGIN EXCLUSIVE` to guarantee 100% SQLite reader/writer quiescence,
|
||||
# 2. Flushes committed WAL frames via `PRAGMA wal_checkpoint(TRUNCATE)`,
|
||||
# 3. Writes a consistent point-in-time SQLite snapshot and compresses it with `gzip -9`
|
||||
# to `<db_path>.1.gz` (rotating `.1.gz` .. `.12.gz` rather than removing history),
|
||||
# 4. Purges the live telemetry tables and commits cleanly,
|
||||
# 4. Acquires `BEGIN EXCLUSIVE` to guarantee 100% SQLite reader/writer quiescence,
|
||||
# purges the live telemetry tables, and commits cleanly,
|
||||
# 5. Executes `PRAGMA wal_checkpoint(TRUNCATE)` + `VACUUM` + `PRAGMA optimize` on the live DB, and
|
||||
# 6. Verifies `PRAGMA integrity_check == 'ok'` on the live DB.
|
||||
#
|
||||
@@ -17,7 +18,7 @@
|
||||
# - Default logrotate trigger: `size 100M` (100 MB)
|
||||
# - Runtime override: export `HYPERSTITION_SQLITE_MAX_MB` (default `100`) or `HYPERSTITION_SQLITE_MAX_BYTES`.
|
||||
|
||||
/tmp/hyperstition-api-telemetry.db /var/lib/hyperstitionstud.io/api-telemetry.db {
|
||||
/var/lib/hyperstitionstud.io/api-telemetry.db {
|
||||
size 100M
|
||||
rotate 12
|
||||
compress
|
||||
@@ -27,7 +28,7 @@
|
||||
nocreate
|
||||
sharedscripts
|
||||
prerotate
|
||||
TARGET_DB="${1:-${HYPERSTITION_TELEMETRY_DB_PATH:-/tmp/hyperstition-api-telemetry.db}}"
|
||||
TARGET_DB="${1:-${HYPERSTITION_TELEMETRY_DB_PATH:-/var/lib/hyperstitionstud.io/api-telemetry.db}}"
|
||||
MAX_MB="${HYPERSTITION_SQLITE_MAX_MB:-100}"
|
||||
MAX_BYTES="${HYPERSTITION_SQLITE_MAX_BYTES:-$((MAX_MB * 1024 * 1024))}"
|
||||
ROTATE_KEEP="${HYPERSTITION_SQLITE_ROTATE_KEEP:-12}"
|
||||
|
||||
Reference in new issue
Block a user