openvibers/openvibe.host Commits

Data role: the pgBackRest step reads the stanza's status instead of guessing. A second run while the first full backup was still going took 'no valid backups' for 'no stanza' and tried stanza-create against the backup's lock. Now it creates the stanza only when pgBackRest says it is missing (status 1 or 3), starts a full backup only when none is valid and none is running (status 2), and warns on any other status.

OP OpenVibers committed 28 Sept 2026 · 16cf27bb9c · 1 file, +10 −2


Changes

ddiff --git a/roles/data/provision.sh b/roles/data/provision.sh
iindex b17a9b2..af53e76 100755
---- a/roles/data/provision.sh
++++ b/roles/data/provision.sh
@@@ -169,12 +169,20 @@ done
# ── 8. The pgBackRest stanza and its schedule ───────────────────────────────────────────────
if [ "$HAVE_REPO" = 1 ]; then
-- if ! runuser -u postgres -- pgbackrest --stanza=openvibe info --output=json 2>/dev/null | grep -q '"status":{"code":0'; then
++ # pgBackRest info status: 0 ok, 1 missing stanza path, 2 no valid backups, 3 missing stanza data (others: errors).
++ code=$(runuser -u postgres -- pgbackrest --stanza=openvibe info --output=json 2>/dev/null \
++ | python3 -c 'import json,sys; d=json.load(sys.stdin); print(d[0]["status"]["code"] if d else 1)' 2>/dev/null || echo 1)
++ if [ "$code" = 1 ] || [ "$code" = 3 ]; then
log "creating the pgBackRest stanza"
runuser -u postgres -- pgbackrest --stanza=openvibe stanza-create
runuser -u postgres -- pgbackrest --stanza=openvibe check
-- log "starting the first full backup ([email protected])"
++ code=2
++ fi
++ if [ "$code" = 2 ] && ! systemctl is-active -q [email protected]; then
++ log "no valid backup yet: starting a full backup ([email protected])"
systemctl start --no-block [email protected]
++ elif [ "$code" != 0 ] && [ "$code" != 2 ]; then
++ log "WARNING: pgBackRest reports status $code for stanza openvibe (run: sudo -u postgres pgbackrest --stanza=openvibe info)"
fi
systemctl enable -q --now pgbackrest-full.timer pgbackrest-diff.timer
fi