Fix Coolify routing for Frappe frontend on port 8080

Use SERVICE_FQDN_FRONTEND_8080 so Traefik targets nginx:8080, pass
$$host to FRAPPE_SITE_NAME_HEADER, and healthcheck via currentsite.txt.
This commit is contained in:
epistemophiliac 2026-06-16 22:19:01 -04:00
parent 416b0f8109
commit 7bdf4a0b9b
3 changed files with 10 additions and 10 deletions

View file

@ -156,7 +156,7 @@ services:
migrator:
condition: service_completed_successfully
healthcheck:
test: ['CMD-SHELL', 'curl -sf -H "Host: $$SERVICE_FQDN_FRONTEND" http://127.0.0.1:8000/api/method/ping || exit 1']
test: ['CMD-SHELL', 'H=$$(tr -d "\r\n" < sites/currentsite.txt 2>/dev/null); curl -sf -H "Host: $$H" http://127.0.0.1:8000/api/method/ping || exit 1']
interval: 15s
timeout: 10s
retries: 15
@ -177,11 +177,10 @@ services:
command:
- nginx-entrypoint.sh
environment:
- SERVICE_URL_FRONTEND_8080
- SERVICE_FQDN_FRONTEND
- SERVICE_FQDN_FRONTEND_8080
- 'BACKEND=backend:8000'
- 'SOCKETIO=websocket:9000'
- 'FRAPPE_SITE_NAME_HEADER=${SERVICE_FQDN_FRONTEND}'
- 'FRAPPE_SITE_NAME_HEADER=$$host'
- 'UPSTREAM_REAL_IP_ADDRESS=${UPSTREAM_REAL_IP_ADDRESS:-127.0.0.1}'
- 'UPSTREAM_REAL_IP_HEADER=${UPSTREAM_REAL_IP_HEADER:-X-Forwarded-For}'
- 'UPSTREAM_REAL_IP_RECURSIVE=${UPSTREAM_REAL_IP_RECURSIVE:-off}'
@ -195,7 +194,7 @@ services:
websocket:
condition: service_started
healthcheck:
test: ['CMD-SHELL', 'curl -sf -H "Host: $$SERVICE_FQDN_FRONTEND" http://127.0.0.1:8080/api/method/ping || exit 1']
test: ['CMD-SHELL', 'H=$$(tr -d "\r\n" < sites/currentsite.txt 2>/dev/null); curl -sf -H "Host: $$H" http://127.0.0.1:8080/api/method/ping || exit 1']
interval: 15s
timeout: 10s
retries: 15

View file

@ -29,7 +29,7 @@ Copy from [`coolify.env.example`](../coolify.env.example). **Required before fir
| `ADMIN_PASSWORD` | yes | Frappe `Administrator` password |
| `INSTALL_APPS` | yes | `erpnext,payments,hrms,lending,lms` |
| `SITE_NAME` | **no** (auto) | From Coolify domain via `SERVICE_FQDN_FRONTEND` |
| `FRAPPE_SITE_NAME_HEADER` | **no** (auto) | Same as domain via `SERVICE_FQDN_FRONTEND` |
| `FRAPPE_SITE_NAME_HEADER` | **no** (auto) | Compose sets `$$host` — nginx uses incoming Host header |
> **Coolify env cache:** If you previously set `SITE_NAME=erp.example.com` in Coolify, **delete it** so compose defaults use your real domain. Changing `docker-compose.yml` defaults alone does not update stored values.
@ -80,6 +80,7 @@ Login: `https://your-domain` — user `Administrator`, password = `ADMIN_PASSWOR
| Symptom | Fix |
|---------|-----|
| Traefik `404 page not found` / URL unreachable | Domain must be on service `frontend` port **8080**; app `ports_exposes` must be 8080 not 3000 |
| Backend unhealthy / deploy fails after migrator | Healthcheck must send `Host: <site>` — fixed in compose; redeploy |
| `SITE_NAME empty` on create-site | Assign domain on `frontend:8080` before deploy (`SERVICE_FQDN_FRONTEND`) |
| Wrong site / 404 nginx | Delete old `SITE_NAME` in Coolify UI; ensure header matches domain |

View file

@ -59,11 +59,11 @@ else
pass "[DC-02] no host ports (Coolify-safe)"
fi
# SERVICE_URL on frontend with port 8080 (Frappe nginx default)
if grep -q 'SERVICE_URL_FRONTEND_8080' "$COMPOSE_FILE"; then
pass "[DC-03] SERVICE_URL_FRONTEND_8080 present"
# SERVICE_FQDN on frontend with port 8080 (Frappe nginx default; Coolify Traefik target)
if grep -q 'SERVICE_FQDN_FRONTEND_8080' "$COMPOSE_FILE"; then
pass "[DC-03] SERVICE_FQDN_FRONTEND_8080 present"
else
err "[DC-03] missing SERVICE_URL_FRONTEND_8080 on frontend"
err "[DC-03] missing SERVICE_FQDN_FRONTEND_8080 on frontend"
fi
if grep -q 'SERVICE_FQDN_FRONTEND' "$COMPOSE_FILE"; then