WFDASH-WEBAPP/scripts/pb-hooks/README.md
Dave 6b99f52dac chore(pocketbase): track live quotes hook and add git-based hook sync
quotes.pb.js is copied byte-for-byte from the live WFDASH PocketBase.
DEPLOY lists the hooks the VPS cron syncs into the hooks volume; the
audit hooks stay undeployed for now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 15:34:41 +02:00

24 lines
1.1 KiB
Markdown

# PocketBase hooks sync (WFDASH)
The live WFDASH PocketBase (Coolify service `pocketbase-wfdash`, container
`pocketbase-gnqc88suy8fqk6wyryjjdpvl`, PocketBase 0.39.8) loads its hooks
from the Docker volume `gnqc88suy8fqk6wyryjjdpvl_pocketbase-hooks`, mounted
at `/app/pb_hooks`.
Hooks are deployed from git, not edited on the server:
1. Edit or add files in `pocketbase/pb_hooks/` in this repo.
2. List every file to deploy in `pocketbase/pb_hooks/DEPLOY`.
3. Push to `main` on Forgejo.
Within ~2 minutes the VPS cron runs `sync-pb-hooks.sh`, which pulls `main`
into `/opt/wfdash-pb-hooks/repo` (sparse clone, read-only deploy key) and
copies the listed files into the volume. PocketBase reloads itself when a hook
file changes. A `.js` file on the server that isn't in `DEPLOY` is removed.
- Log: `/var/log/wfdash-pb-hooks-sync.log` on the VPS.
- Force a sync: `/opt/wfdash-pb-hooks/repo/scripts/pb-hooks/sync-pb-hooks.sh --force`
- Roll back: revert the commit (or remove the line from `DEPLOY`) and push.
- Pause syncing: comment out the cron line (`crontab -e` as root).
The sync never touches `pb_data` (the database).