Fix marketing container never recreating on AutoDeploy

Confirmed the hard way, live in production: Docker Compose only
recreates a container when its own service definition changes (image,
env, labels...), never from a bind-mounted file's content changing on
disk by itself. marketing's service definition never changes between
deploys, so Dokploy's AutoDeploy -- which wipes and re-clones the whole
git checkout, including bettersightbox-index.html, on every push -- had
never once recreated that container. It kept serving a September-dated,
weeks-stale copy of the page indefinitely, orphaned from the fresh file
sitting right next to it on disk, through every single deploy since
Stage 1.

generate-dokploy-compose.sh now computes a real sha256-based hash of
bettersightbox-index.html and bakes it into the marketing service as a
literal content-hash label -- the one value in the whole generated file
that's deliberately NOT left as a live ${VAR} reference, since its only
job is to actually change when the file's content changes, giving
Compose's own diffing a real reason to recreate the container. Local
dev (where this bug doesn't apply, no AutoDeploy wipe-and-reclone cycle)
keeps the ${MARKETING_HTML_HASH:-dev} default.

Documented in CLAUDE.md and CICD_PLAYBOOK.md: regenerate
docker-compose.dokploy.yml any time bettersightbox-index.html changes,
not just when docker-compose.yml itself changes -- skipping it silently
leaves the marketing page stale with no error anywhere.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012pc2x7vyuUofdT3kLuqF3Y
This commit is contained in:
JasonFraser 2026-10-04 14:05:40 -04:00
parent f75cb61d08
commit 219af05c74
5 changed files with 49 additions and 10 deletions

View File

@ -145,8 +145,14 @@ sightbox/
file. `docker-compose.dokploy.yml` is the same deployment, pre-flattened
(`include:` resolved, `frappe_docker`'s files merged in) by
`./generate-dokploy-compose.sh`. Regenerate it any time
`docker-compose.yml` changes or `frappe_docker`'s pinned commit moves
(`.gitmodules`); it's committed, generated output — never hand-edited.
`docker-compose.yml` changes, `frappe_docker`'s pinned commit moves
(`.gitmodules`), **or `bettersightbox-index.html` changes** — the last
one bakes a fresh content-hash label into the `marketing` service so
Dokploy's AutoDeploy actually recreates that container; skipping it
means the marketing page silently keeps serving old content indefinitely
(confirmed the hard way — see that service's own comment in
`docker-compose.yml`). It's committed, generated output — never
hand-edited.
- **One VPS can host multiple clients.** `docker compose up` stands up one
bench (the shared Frappe/ERPNext containers, MariaDB, Redis, and the
`backend-billing` service) — it doesn't imply one client. Each client is

View File

@ -1,6 +1,7 @@
# GENERATED FILE — do not edit by hand.
# Produced by ./generate-dokploy-compose.sh from docker-compose.yml + the
# frappe_docker files it includes. Regenerate after changing either.
# frappe_docker files it includes. Regenerate after changing either, or
# after changing bettersightbox-index.html (see MARKETING_HTML_HASH above).
# This is what Dokploy's Compose Path should point to — not
# docker-compose.yml itself, which Dokploy's validator rejects (see
# this script's own header comment for why).
@ -144,6 +145,8 @@ services:
volume: {}
marketing:
image: nginx:alpine
labels:
- content-hash=9156ba6f79dd
networks:
default: null
ports:

View File

@ -60,6 +60,20 @@ services:
# the demo guides with a real client's names (see CLAUDE.md).
image: nginx:alpine
restart: unless-stopped
# content-hash label — confirmed the hard way, in production: Docker
# Compose only recreates a container when its own service DEFINITION
# changes (image, env, labels, ...), never from a bind-mounted file's
# content changing on disk by itself. Since this service's definition
# is otherwise 100% static, Dokploy's AutoDeploy — which wipes and
# re-clones the whole git checkout, including this HTML file, on every
# deploy — never had a reason to recreate this one container, so it
# kept running against the OLD file's now-orphaned inode indefinitely.
# generate-dokploy-compose.sh computes a real hash of
# bettersightbox-index.html and bakes it in here as a literal value;
# the default below (${MARKETING_HTML_HASH:-dev}) only applies to
# local dev, where this doesn't matter.
labels:
- "content-hash=${MARKETING_HTML_HASH:-dev}"
volumes:
- ./bettersightbox-index.html:/usr/share/nginx/html/index.html:ro
ports:

View File

@ -52,9 +52,18 @@
# which is what every `depends_on` entry in this file actually uses.
#
# Usage: ./generate-dokploy-compose.sh
# Run this any time docker-compose.yml changes, or any time frappe_docker
# is repointed at a different pinned commit (see .gitmodules) — this file
# is generated output, never hand-edited.
# Run this any time docker-compose.yml changes, bettersightbox-index.html
# changes, or frappe_docker is repointed at a different pinned commit (see
# .gitmodules) — this file is generated output, never hand-edited.
#
# MARKETING_HTML_HASH: baked in below as a literal value (not left as
# ${VAR}, unlike everything else --no-interpolate preserves) — this is
# what actually forces Dokploy's AutoDeploy to recreate the marketing
# container when only bettersightbox-index.html changed; see that
# service's own comment in docker-compose.yml for the full story. Every
# other variable stays a live ${VAR} reference on purpose; this one
# specifically must not, since its entire job is to be a different literal
# string every time the file's content changes.
set -euo pipefail
@ -62,11 +71,13 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
OUT="docker-compose.dokploy.yml"
MARKETING_HTML_HASH="$(sha256sum bettersightbox-index.html | cut -c1-12)"
{
echo "# GENERATED FILE — do not edit by hand."
echo "# Produced by ./generate-dokploy-compose.sh from docker-compose.yml + the"
echo "# frappe_docker files it includes. Regenerate after changing either."
echo "# frappe_docker files it includes. Regenerate after changing either, or"
echo "# after changing bettersightbox-index.html (see MARKETING_HTML_HASH above)."
echo "# This is what Dokploy's Compose Path should point to — not"
echo "# docker-compose.yml itself, which Dokploy's validator rejects (see"
echo "# this script's own header comment for why)."
@ -80,8 +91,9 @@ text = re.sub(r'^(\s*)- path: (.+)\n\s*required: (?:true|false)\s*\$', lambda m:
# depends_on: drop required:, keep condition: (Dokploy rejection #3).
text = re.sub(r'^(\s*condition: .+)\n\s*required: (?:true|false)\s*\$', r'\1', text, flags=re.MULTILINE)
sys.stdout.write(text)
"
" \
| sed "s/\${MARKETING_HTML_HASH:-dev}/${MARKETING_HTML_HASH}/"
} > "$OUT"
echo "Wrote ${OUT}."
echo "Wrote ${OUT} (marketing content-hash: ${MARKETING_HTML_HASH})."
echo "Set Dokploy's Compose Path to ./${OUT}, not ./docker-compose.yml, and redeploy."

View File

@ -207,7 +207,11 @@ Applying the pattern above here, concretely:
unresolved Dokploy issues, [#3116](https://github.com/Dokploy/dokploy/issues/3116) and
[#1727](https://github.com/Dokploy/dokploy/issues/1727)). `docker-compose.dokploy.yml` is the
same deployment pre-flattened by `./generate-dokploy-compose.sh` — regenerate it any time
`docker-compose.yml` changes, never hand-edit it. Also enable this Application's **Enable
`docker-compose.yml` or `bettersightbox-index.html` changes, never hand-edit it (the latter
bakes a fresh content-hash into the `marketing` service specifically so AutoDeploy actually
recreates that container — skipping it leaves the marketing page serving stale content
indefinitely, confirmed the hard way; see `docker-compose.yml`'s own comment on that service).
Also enable this Application's **Enable
Submodules** toggle (confirmed working against our `frappe_docker` mirror submodule — see
`.gitmodules`). Set environment variables to match `.env.example`/`backup/.env.example` —
`SIGHTBOX_DATA_DIR`, `SENTRY_DSN`, `ENVIRONMENT=production`, `BACKEND_BILLING_IMAGE`/`_TAG`,