添加Codespace一键启动配置及管理命令提示

This commit is contained in:
puke committed 2026-01-29 08:39:50 +00:00
1 parent 2205a5a65b
commit e801ec3bbf
4 files changed
+85

No files matched your search

+8
View File
@@ -0,0 +1,8 @@
{
"name": "Pixelle-Video Codespace",
"image": "mcr.microsoft.com/devcontainers/python:1-3.11",
"forwardPorts": [8501],
"postCreateCommand": ".devcontainer/postCreate.sh",
"postStartCommand": ".devcontainer/postStart.sh",
"remoteUser": "vscode"
}
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -euo pipefail
echo "[devcontainer] Running postCreate tasks..."
cd /workspaces/Pixelle-Video
if [ -f scripts/codespace_setup.sh ]; then
bash scripts/codespace_setup.sh
fi
echo "[devcontainer] Installing Python dependencies..."
python -m pip install --upgrade pip
python -m pip install -e . || true
echo "[devcontainer] postCreate complete. You can start the app with .devcontainer/postStart.sh or let postStart run it automatically."
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -euo pipefail
echo "[devcontainer] postStart: launching Pixelle-Video Web UI in background..."
cd /workspaces/Pixelle-Video
# Start the web UI in background so the forwarded port is ready
nohup bash start_web.sh > /tmp/pixelle_streamlit.log 2>&1 &
echo "[devcontainer] Streamlit started (logs: /tmp/pixelle_streamlit.log)"
WEB_PID=$!
echo ""
echo "Common commands:"
echo "1. View logs:"
echo " tail -f /tmp/pixelle_streamlit.log"
echo "2. Stop service:"
echo " pkill -f 'streamlit run web/app.py'"
echo "3. Restart service:"
echo " pkill -f 'streamlit run web/app.py' && nohup bash start_web.sh > /tmp/pixelle_streamlit.log 2>&1 &"
echo "4. Check port usage:"
echo " lsof -i:8501"
echo "5. View processes:"
echo " ps aux | grep streamlit"
echo ""
echo "For more help, see README or run 'ps aux | grep streamlit'."
+37
View File
@@ -0,0 +1,37 @@
#!/usr/bin/env bash
set -euo pipefail
echo "[codespace-setup] Starting Codespace system setup..."
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update -y
# Install system packages needed by the project (idempotent)
sudo apt-get install -y --no-install-recommends \
ffmpeg \
fontconfig \
fonts-liberation \
fonts-noto-cjk \
wget \
xdg-utils \
ca-certificates || true
# Try installing chromium via common package names (some images use different package names)
sudo apt-get install -y --no-install-recommends chromium chromium-driver || true
sudo apt-get install -y --no-install-recommends chromium-browser chromium-driver || true
echo "[codespace-setup] System packages installation complete. Verifying fonts and chromium..."
echo "[codespace-setup] Chinese fonts (sample):"
fc-list :lang=zh | head -n 10 || true
if command -v chromium >/dev/null 2>&1; then
echo "[codespace-setup] chromium -> $(command -v chromium)"
elif command -v chromium-browser >/dev/null 2>&1; then
echo "[codespace-setup] chromium-browser -> $(command -v chromium-browser)"
else
echo "[codespace-setup] Warning: chromium not found in PATH"
fi
echo "[codespace-setup] Done. Next: install Python deps in postCreate step."