This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch fix/docker-static-assets-race-condition-30183
in repository https://gitbox.apache.org/repos/asf/superset.git

commit e4f0e0a71b45f29e0a2d4e3cb80845b3ede94385
Author: Evan Rusackas <[email protected]>
AuthorDate: Sat Feb 21 21:51:14 2026 -0800

    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 <[email protected]>
---
 docker-compose.yml | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/docker-compose.yml b/docker-compose.yml
index bd474a83ef4..2d7b2b54b85 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -61,6 +61,9 @@ 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
 
   redis:
     image: redis:7
@@ -186,6 +189,14 @@ 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:

Reply via email to