mirror of
https://github.com/apache/superset.git
synced 2026-05-07 08:54:23 +00:00
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.
This commit is contained in:
@@ -61,9 +61,22 @@ services:
|
||||
volumes:
|
||||
- ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
- ./docker/nginx/templates:/etc/nginx/templates:ro
|
||||
depends_on:
|
||||
superset-node:
|
||||
condition: service_healthy
|
||||
# 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
|
||||
@@ -189,14 +202,6 @@ services:
|
||||
- path: docker/.env-local # optional override
|
||||
required: false
|
||||
volumes: *superset-volumes
|
||||
healthcheck:
|
||||
# Check if webpack dev server is responding on port 9000
|
||||
# This prevents nginx from proxying before the frontend is ready
|
||||
test: ["CMD-SHELL", "node -e \"const http = require('http'); http.get('http://localhost:9000', (r) => process.exit(r.statusCode === 200 ? 0 : 1)).on('error', () => process.exit(1))\""]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 30
|
||||
start_period: 60s
|
||||
|
||||
superset-worker:
|
||||
build:
|
||||
|
||||
Reference in New Issue
Block a user