frappe_docker/overrides/compose.local-origin.yaml
abounoone a3cac96a17 fix: sync assets between backend overlay and named frontend volume
bench build writes compiled bundles to the backend container's overlay
filesystem (apps/*/public/dist/), while nginx reads from the named
frappe-project_assets volume. Without syncing, frontend serves stale
bundle hashes from the original image.

- Makefile: rewrite 'assets' target to run bench build then sync-assets
- Makefile: add 'sync-assets' target that:
  - copies dist/ directories from backend container to frappe-project_assets
  - updates assets.json in the volume
  - deletes the stale pickle-encoded assets_json key from Redis (skipped
    by bench clear-cache because it uses a raw key, not Frappe's prefixed cache)
  - restarts frontend
- overrides/compose.local-origin.yaml: fix socket.io "Invalid origin" by
  patching nginx to pass browser's real Origin header ($http_origin) instead
  of forcing the site name (erp.local), which mismatches when browser
  connects via localhost or an external domain

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 18:35:39 +00:00

18 lines
702 B
YAML

services:
frontend:
# Fix socket.io "Invalid origin" when accessing via localhost.
# By default nginx forces "Origin: http://erp.local" for websocket proxying,
# but the browser sends Host: localhost:8090 — they don't match.
# Strategy: run nginx-entrypoint.sh to generate /etc/nginx/conf.d/frappe.conf,
# then patch the generated file (template dir is read-only), then start nginx.
entrypoint:
- bash
- -c
- |
nginx-entrypoint.sh &
NGINX_PID=$$!
sleep 1
sed -i 's|proxy_set_header Origin .*|proxy_set_header Origin $$http_origin;|' \
/etc/nginx/conf.d/frappe.conf
nginx -s reload
wait $$NGINX_PID