Confirmed the hard way, live: "curl ... | sh" failed outright with a
bare "Syntax error: ( unexpected" on the actual Ubuntu VPS, since
/bin/sh there is dash (POSIX-only) and rclone's install script relies
on bash-specific syntax. Same bug existed in both backup.sh (just added
this session) and restore.sh (pre-existing, never actually exercised
live until now) -- piping to bash instead fixes both.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012pc2x7vyuUofdT3kLuqF3Y
Confirmed the hard way, live, on the migrated deployment: backup.sh
stopped every writer container, archived everything, restarted
containers -- all successfully -- and only failed on "rclone: command
not found" that run. Re-running after the rclone self-install fix then
hit a second, deeper problem: backup/.env itself had been wiped by the
Dokploy redeploy in between, since it lived next to backup.sh inside the
git checkout. This is the exact backup/restore-vs-AutoDeploy
architectural tension flagged earlier in this project but never
resolved until now -- same category of bug as backend/.env and
tenants.json before it.
BACKUP_ENV_FILE (new, defaults to the old next-to-the-script path for
local dev / a traditional non-Dokploy VPS, where the checkout is
stable) lets a Dokploy deployment's cron entry point backup.sh at
$SIGHTBOX_DATA_DIR/backup.env instead -- durable, survives every
redeploy, same pattern as TENANTS_JSON_PATH. Documented in both
INSTALLATION_PLAYBOOK.md Stage 10 and BACKUP_RESTORE.md, including the
corrected cron entry (the Dokploy-managed checkout path, not the
traditional /opt/sightbox/app assumption the original cron example
baked in).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012pc2x7vyuUofdT3kLuqF3Y
Confirmed the hard way on a fresh VPS: backup.sh stopped every writer
container, archived everything, then failed outright on "rclone:
command not found" during the upload step -- restore.sh already
self-installs rclone (same rclone.org/install.sh) for exactly this
scenario, backup.sh just never got the same treatment. Checked up front
now, before anything stateful (stopping containers) happens.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012pc2x7vyuUofdT3kLuqF3Y
Confirmed the hard way on a fresh second deployment: the default bind
source (./backend/tenants.json, relative to the repo checkout) gets wiped
on every Dokploy AutoDeploy same as backend/.env used to — except worse,
Docker silently creates an empty DIRECTORY at a missing bind-mount source
instead of failing, which crashes backend-billing with a confusing
IsADirectoryError instead of an obvious missing-file error.
TENANTS_JSON_PATH (new, defaults to the old relative path for local dev)
lets production point this at an absolute path inside $SIGHTBOX_DATA_DIR
instead — survives every redeploy, and is already covered by backup.sh's
nightly snapshot for free, resolving the tenants.json backup-fidelity gap
flagged earlier but never addressed.
Also fixes a second bug this surfaced: generate-dokploy-compose.sh's
--no-interpolate flag leaves a variable-based bind source as a literal
unresolved string, which `docker compose config` can't recognize as a
path and silently mis-normalizes to type: volume instead of type: bind —
Dokploy then rejects it as "refers to undefined volume". Declaring
type: bind explicitly in docker-compose.yml's long-form volume entry
removes the guesswork regardless of interpolation.
Stage 1 now seeds the file empty (valid, zero-tenant config) before the
first docker compose up. Stage 9, BACKUP_RESTORE.md, and both backup
scripts updated to match where the file actually lives now.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012pc2x7vyuUofdT3kLuqF3Y
Confirmed the hard way against a live Dokploy AutoDeploy: the code/
checkout is deleted and re-cloned on every deploy, so backend/.env (an
env_file: mount) never survived to the next deploy. Moved its four values
to plain environment: vars sourced from Dokploy's own Environment tab,
which persists across deploys independent of the git-clone wipe.
Also switches backend-billing to the same build-locally-push-to-registry-
pull pattern already used for erpnext-image, so the Dokploy VPS never
builds anything itself (backend/build.sh) — the user's explicit goal of
making this resilient to future frappe_docker/dependency changes, not
just today's deploy error.
Propagated through docker-compose.yml/.dokploy.yml, .env + .env.example,
CLAUDE.md, INSTALLATION_PLAYBOOK.md, CICD_PLAYBOOK.md, BACKUP_RESTORE.md,
backup.sh/restore.sh, and .gitignore's comments.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012pc2x7vyuUofdT3kLuqF3Y
Native ERPNext/Frappe configuration (provisioning script, playbooks,
demo guides), the backend/ billing service (the one piece of custom
code), erpnext-image branding, backup/restore tooling, and
frappe_docker as a pinned submodule.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012pc2x7vyuUofdT3kLuqF3Y