DaCrow13 commited on
Commit
859da78
·
1 Parent(s): 5ea22fe

fix: final proxy tuning and log tailing

Browse files
Files changed (2) hide show
  1. nginx.conf +7 -2
  2. scripts/start_space.sh +5 -2
nginx.conf CHANGED
@@ -22,11 +22,11 @@ http {
22
  keepalive_timeout 65;
23
 
24
  upstream streamlit {
25
- server 127.0.0.1:8501;
26
  }
27
 
28
  upstream fastapi {
29
- server 127.0.0.1:8000;
30
  }
31
 
32
  server {
@@ -76,12 +76,17 @@ http {
76
  proxy_set_header X-Real-IP $remote_addr;
77
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
78
  proxy_set_header X-Forwarded-Proto $scheme;
 
79
 
80
  # WebSocket support for Streamlit
81
  proxy_http_version 1.1;
82
  proxy_set_header Upgrade $http_upgrade;
83
  proxy_set_header Connection "upgrade";
84
  proxy_read_timeout 86400;
 
 
 
 
85
  }
86
  }
87
  }
 
22
  keepalive_timeout 65;
23
 
24
  upstream streamlit {
25
+ server localhost:8501;
26
  }
27
 
28
  upstream fastapi {
29
+ server localhost:8000;
30
  }
31
 
32
  server {
 
76
  proxy_set_header X-Real-IP $remote_addr;
77
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
78
  proxy_set_header X-Forwarded-Proto $scheme;
79
+ proxy_set_header X-Forwarded-Host $host;
80
 
81
  # WebSocket support for Streamlit
82
  proxy_http_version 1.1;
83
  proxy_set_header Upgrade $http_upgrade;
84
  proxy_set_header Connection "upgrade";
85
  proxy_read_timeout 86400;
86
+
87
+ # Prevent 502 if Streamlit is slow
88
+ proxy_connect_timeout 60s;
89
+ proxy_send_timeout 60s;
90
  }
91
  }
92
  }
scripts/start_space.sh CHANGED
@@ -74,9 +74,12 @@ echo "$(date) - Final backend check before starting Streamlit..."
74
  curl -v http://127.0.0.1:8000/health || echo "FastAPI health check failed!"
75
 
76
  echo "$(date) - Starting Streamlit application on 0.0.0.0:8501..."
77
- export API_BASE_URL="http://127.0.0.1:8000"
78
  streamlit run hopcroft_skill_classification_tool_competition/streamlit_app.py \
79
  --server.port 8501 \
80
  --server.address 0.0.0.0 \
81
  --server.enableCORS=false \
82
- --server.enableXsrfProtection=false
 
 
 
 
74
  curl -v http://127.0.0.1:8000/health || echo "FastAPI health check failed!"
75
 
76
  echo "$(date) - Starting Streamlit application on 0.0.0.0:8501..."
77
+ export API_BASE_URL="http://localhost:8000"
78
  streamlit run hopcroft_skill_classification_tool_competition/streamlit_app.py \
79
  --server.port 8501 \
80
  --server.address 0.0.0.0 \
81
  --server.enableCORS=false \
82
+ --server.enableXsrfProtection=false &
83
+
84
+ echo "$(date) - Process started. Tailing Nginx logs for debug..."
85
+ tail -f /tmp/nginx_startup.log /tmp/fastapi.log