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 on a real second-domain setup: TLS issuance
succeeded, the domain's Traefik labels were correctly applied to
frontend, and curl still got a clean 504 the entire time — because
dokploy-traefik (auto-provisioned once per VPS by Dokploy itself, not by
this project) had come back attached only to the default bridge network,
not dokploy-network, so it had no path to the container it was routing
to. Every other symptom pointed at a labels/DNS problem; it wasn't.
Documents the check (docker inspect dokploy-traefik's NetworkSettings)
and fix (docker network connect dokploy-network dokploy-traefik), plus
the caveat that the fix isn't persistent — it would need reapplying if
Dokploy ever recreates its own Traefik container.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012pc2x7vyuUofdT3kLuqF3Y
Adds the previously-undocumented step between bringing up the stack and
creating a site: how a real client actually gets a reachable domain.
Decision (discussed with the user): subdomains of box.bettersight.io,
dot-hierarchy (client1.box.bettersight.io, not client1-box.bettersight.io)
specifically so one wildcard DNS record covers every future client
forever, no DNS touched again per onboarding.
Folded into Stage 1 (one-time wildcard A record at Namecheap, skipped for
local dev and for every client after the first) and Stage 2, split into
2a (Dokploy Domain entry routing the subdomain to frontend:8080 with
Let's Encrypt) and 2b (bench new-site using that exact domain, since
FRAPPE_SITE_NAME_HEADER=$host means the site folder name must match the
Host header verbatim). Deliberately did not renumber Stage 2 onward —
too many other files cross-reference exact stage numbers.
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