tom-hermes / entry.sh
tkgray's picture
fix ws handshake + restore ownership: entry.sh
9deb9a8 verified
Raw History Blame Contribute Delete
829 Bytes
#!/bin/sh
# Restore /opt/data from the bucket (fresh volume only), start the snapshot
# loop, then hand off to the image's normal s6 entrypoint dispatcher.
set -e
PY=/opt/hermes/.venv/bin/python
if [ -n "${HF_TOKEN:-}" ]; then
"$PY" /opt/bucket/bucket_sync.py restore || echo "[bucket] restore error (continuing)"
# The restore runs as root, so extracted files land root-owned. Hermes runs as
# `hermes` and must WRITE those databases — without this chown the log fills
# with "kanban.db ... read-only for this user" and state writes fail.
chown -R hermes:hermes /opt/data 2>/dev/null || echo "[bucket] chown skipped"
else
echo "[bucket] HF_TOKEN unset — persistence disabled"
fi
if [ -n "${HF_TOKEN:-}" ]; then
"$PY" /opt/bucket/bucket_sync.py loop &
fi
exec /opt/hermes/docker/entrypoint-dispatch.sh "$@"