Add bind-mount liveness guard to cron container

DokPloy rm-rf's the host code dir on every redeploy, orphaning the
long-running cron container's ./content and ./.git bind mounts (pinned to
the now-deleted inode). The wiki export then spins forever in fs.mkdir
against the dead directory and never commits.

mount-guard.sh detects a stale mount (directory hard-link count < 2 = a
deleted inode) and re-binds it via docker restart, run every 15 min from
cron and once at the top of export-content-cron.sh as a fast-fail.
This commit is contained in:
Jennie Robinson Faber 2026-05-24 15:28:45 +01:00
parent 9ed1518d83
commit 15a5c49324
3 changed files with 48 additions and 0 deletions

View file

@ -7,6 +7,12 @@ set -euo pipefail
REPO_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$REPO_DIR"
# Bail out (and self-heal) if a DokPloy redeploy left our bind mounts pinned to
# a deleted inode — otherwise the fs.mkdir in export-content.js spins forever.
# mount-guard.sh restarts the container to re-bind; this run is then aborted and
# the next scheduled export runs against fresh mounts.
"$(dirname "$0")/mount-guard.sh"
# Source env vars from outline.env if it exists (for host-based cron),
# otherwise rely on env vars from docker-compose env_file
if [[ -f outline.env ]]; then