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