| name | highway-demo-server |
| description | Start an HTTP service in Devbox and expose it to colleagues via infra highway tunnel. Covers tmux session setup, python http.server, highway tunnel creation, and warp access. Use when needing to share HTML demos, comparison pages, Streamlit/Gradio apps, or any HTTP service with teammates. |
Highway Demo Server
Overview
在 Devbox 中启动 HTTP 服务并通过 infra highway 暴露给同事访问。适用于分享 HTML 对比页面、Streamlit/Gradio 应用、FastAPI 服务等。
Quick Start
1. 在 tmux 中启动 HTTP 服务
tmux new-session -d -s demo 'python3 -m http.server 8080 -d /path/to/your/project'
对于其他框架:
tmux new-session -d -s demo 'streamlit run app.py --server.port 8080'
tmux new-session -d -s demo 'python3 app.py'
tmux new-session -d -s demo 'uvicorn main:app --host 0.0.0.0 --port 8080'
2. 创建 highway tunnel
tmux new-window -t demo
tmux send-keys -t demo 'infra highway http 8080' Enter
输出中会包含公开 URL:
Go to: https://xxxxx-yyyyy-zzzzz.highway.canva-internal.dev
3. 允许同事通过 warp 访问
infra highway allow --route xxxxx-yyyyy-zzzzz.highway.canva-internal.dev --warp
4. 查看已有的 highway 服务
infra highway list
5. 复用之前的 highway 名称
infra highway run --route xxxxx-yyyyy-zzzzz --port 8080
注意事项
完整一键脚本示例
#!/bin/bash
PORT=${1:-8080}
DIR=${2:-.}
SESSION="demo-server"
tmux new-session -d -s $SESSION "python3 -m http.server $PORT -d $DIR"
tmux new-window -t $SESSION "infra highway http $PORT"
sleep 8
URL=$(tmux capture-pane -t $SESSION -p -S -50 | grep -oP 'https://\S+\.highway\.canva-internal\.dev')
ROUTE=$(echo $URL | sed 's|https://||')
infra highway allow --route $ROUTE --warp
echo "Service running at: $URL"
echo "tmux session: $SESSION (window 1: server, window 2: tunnel)"