postStart.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. echo "[devcontainer] postStart: launching Pixelle-Video Web UI in background..."
  4. cd /workspaces/Pixelle-Video
  5. # Set Streamlit config for headless mode and proper port binding
  6. export STREAMLIT_SERVER_PORT=8501
  7. export STREAMLIT_SERVER_ADDRESS=0.0.0.0
  8. export STREAMLIT_SERVER_HEADLESS=true
  9. export STREAMLIT_LOGGER_LEVEL=info
  10. export UV_LINK_MODE=copy
  11. # Start the web UI in background so the forwarded port is ready
  12. nohup bash start_web.sh > /tmp/pixelle_streamlit.log 2>&1 &
  13. WEB_PID=$!
  14. echo "[devcontainer] Streamlit started with PID $WEB_PID (logs: /tmp/pixelle_streamlit.log)"
  15. # Wait briefly for startup and show success message
  16. sleep 3
  17. if ps -p $WEB_PID > /dev/null 2>&1; then
  18. echo ""
  19. echo "✅ Pixelle-Video Web UI is launching on port 8501"
  20. echo "🌐 The URL will be available shortly (usually within 5-10 seconds)"
  21. echo ""
  22. else
  23. echo ""
  24. echo "⚠️ Warning: Process may have exited. Check logs with: tail -f /tmp/pixelle_streamlit.log"
  25. echo ""
  26. fi
  27. echo "Common commands:"
  28. echo "1. View logs:"
  29. echo " tail -f /tmp/pixelle_streamlit.log"
  30. echo "2. Stop service:"
  31. echo " pkill -f 'streamlit run web/app.py'"
  32. echo "3. Restart service:"
  33. echo " pkill -f 'streamlit run web/app.py' && nohup bash start_web.sh > /tmp/pixelle_streamlit.log 2>&1 &"
  34. echo "4. Check port usage:"
  35. echo " lsof -i:8501"
  36. echo "5. View processes:"
  37. echo " ps aux | grep streamlit"
  38. echo ""
  39. echo "For more help, see README or run 'ps aux | grep streamlit'."