Compare commits

...

2 Commits

Author SHA1 Message Date
Evan Rusackas
014bca8eea address review: wait for webpack in nginx, probe manifest.json
Move the wait-for-dev-server logic out of a superset-node healthcheck
and into an nginx startup wait loop, and probe manifest.json (served
directly by webpack) instead of / (which proxies to the backend).

- Healthcheck on / was passing on backend-driven redirects and failing
  when the backend wasn't up yet; manifest.json is served by webpack
  itself at its devMiddleware publicPath and only exists after the
  first compile, which is exactly the signal we want.
- Waiting in nginx (via curl to host.docker.internal:9000) works for
  both BUILD_SUPERSET_FRONTEND_IN_DOCKER=true (dev server inside the
  superset-node container) and =false (dev server run on the host),
  so the "skip" workflow is preserved — no breaking change.
- Drops the superset-node healthcheck and the service_healthy gate
  on nginx, since nginx now polls the upstream directly.
2026-04-22 12:28:10 -07:00
Evan Rusackas
e4f0e0a71b fix(docker): prevent static asset 404s by waiting for webpack dev server
When running `docker compose up`, nginx would start immediately and begin
proxying `/static` requests to port 9000 (webpack dev server) before the
`superset-node` container had finished running `npm install` and starting
the dev server. This resulted in 404 errors for all static assets.

This fix adds:
1. A health check to `superset-node` that verifies the webpack dev server
   is responding on port 9000
2. A `depends_on` condition on `nginx` that waits for `superset-node` to
   be healthy before starting

The health check:
- Uses Node.js (already available in the container) to make HTTP requests
- Has a 60-second start period to allow for `npm install`
- Retries up to 30 times at 10-second intervals (5+ minutes total)
- Prevents nginx from proxying to a non-existent server

Fixes #30183

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-21 21:51:14 -08:00

View File

@@ -61,6 +61,22 @@ services:
volumes:
- ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./docker/nginx/templates:/etc/nginx/templates:ro
# Wait for the webpack dev server's manifest.json to be served before
# starting nginx. This prevents 404s on static assets at startup. The
# probe targets host.docker.internal so it works regardless of whether
# the dev server runs in the superset-node container
# (BUILD_SUPERSET_FRONTEND_IN_DOCKER=true, the default) or directly on
# the host (BUILD_SUPERSET_FRONTEND_IN_DOCKER=false).
command:
- /bin/bash
- -c
- |
echo "Waiting for webpack dev server at host.docker.internal:9000/static/assets/manifest.json..."
until curl -sf -o /dev/null http://host.docker.internal:9000/static/assets/manifest.json; do
sleep 2
done
echo "Webpack dev server is ready; starting nginx."
exec nginx -g 'daemon off;'
redis:
image: redis:7