Skip to main content

Dev VNC Server

🖥️ 通用开发用远程桌面服务 - 用于 SSH 远程连接时的 GUI 应用调试
🖥️ A general-purpose remote desktop service for development, designed for GUI debugging over SSH

功能特点 / Features

  • 🚀 一键启动虚拟桌面环境 / One-click virtual desktop startup
  • 🌐 支持浏览器访问 (noVNC) / Browser access via noVNC
  • 🔌 支持 VNC 客户端连接 / VNC client support
  • ⚙️ 可配置分辨率、端口、窗口管理器 / Configurable resolution, ports, and window manager
  • 🐍 提供 Python CLI 接口 / Python CLI included
  • 📦 易于安装和管理 / Easy to install and manage

快速开始 / Quick Start

安装 / Install

# 克隆项目 / Clone repository
cd /home/henry/workspace/dev_app_vnc

# 运行安装脚本 / Run install script
./scripts/install.sh

使用 / Usage

# 启动远程桌面 / Start remote desktop
dev-vnc start

# 查看状态 / Show status
dev-vnc status

# 查看访问信息 / Show access info
dev-vnc info

# 在 VNC 环境中运行程序 / Run command in VNC
dev-vnc run python my_gui_app.py

# 停止服务 / Stop service
dev-vnc stop

访问方式 / Access

启动服务后,打开浏览器访问 / After starting the service, open in browser:

  • http://localhost:6080/vnc.html
  • http://<服务器IP>:6080/vnc.html

VNC 客户端 / VNC Client

使用任意 VNC 客户端连接 / Connect with any VNC client:

  • 地址 / Address: localhost:5999 或 <服务器IP>:5999
  • 密码 / Password: devvnc123 (可配置 / configurable)

配置 / Configuration

配置文件 / Config file

配置文件位于 ~/.config/dev-vnc/config.env / Config file location: ~/.config/dev-vnc/config.env

# 显示器编号 / Display number
DEV_VNC_DISPLAY=99

# VNC 端口 / VNC port
DEV_VNC_PORT=5999

# noVNC Web 端口 / noVNC web port
DEV_VNC_NOVNC_PORT=6080

# 分辨率 / Resolution
DEV_VNC_RESOLUTION=1920x1080x24

# VNC 密码 / VNC password
DEV_VNC_PASSWORD=devvnc123

# 窗口管理器 (fluxbox, openbox, i3) / Window manager
DEV_VNC_WM=fluxbox

环境变量 / Environment variables

也可以通过环境变量覆盖配置 / Override with environment variables:

DEV_VNC_RESOLUTION=2560x1440x24 dev-vnc start

命令参考 / Command reference

命令 / Command 说明 / Description
dev-vnc start 启动远程桌面服务 / Start remote desktop
dev-vnc stop 停止远程桌面服务 / Stop remote desktop
dev-vnc restart 重启服务 / Restart service
dev-vnc status 显示服务状态 / Show status
dev-vnc info 显示访问信息 / Show access info
dev-vnc logs [type] 显示日志 (vnc/novnc/all) / Show logs
dev-vnc run <cmd> 在 VNC 环境中运行命令 / Run command in VNC
dev-vnc config 显示当前配置 / Show configuration
dev-vnc install-deps 安装系统依赖 / Install dependencies
dev-vnc help 显示帮助信息 / Show help

Python CLI

也可以使用 Python CLI / You can also use the Python CLI:

# 安装 / Install
pip install -e .

# 使用 / Usage
devvnc start
devvnc status
devvnc run python my_app.py

系统要求 / System requirements

支持的操作系统 / Supported OS

  • Ubuntu / Debian
  • Fedora / CentOS / RHEL
  • Arch Linux

依赖 / Dependencies

  • Xvfb
  • x11vnc
  • fluxbox (或其他窗口管理器)
  • noVNC
  • websockify
  • Python 3.8+

典型使用场景 / Typical use cases

远程 GUI 开发 / Remote GUI development

在 SSH 连接的远程服务器上调试 GUI 应用 / Debug GUI apps over SSH:

# SSH 连接到服务器 / SSH into server
ssh user@server

# 启动远程桌面 / Start remote desktop
dev-vnc start

# 在本地浏览器打开 / Open in local browser

# 运行 GUI 应用 / Run GUI app
dev-vnc run python my_gui_app.py

CI/CD 中的 GUI 测试 / GUI testing in CI/CD

在无头环境中运行 GUI 测试 / Run GUI tests in headless environments:

# 启动虚拟桌面 / Start virtual desktop
dev-vnc start

# 运行 GUI 测试 / Run GUI tests
dev-vnc run pytest tests/gui/

容器中的 GUI 应用 / GUI apps in containers

在 Docker 容器中运行 GUI 应用 / Run GUI apps in Docker:

FROM ubuntu:22.04

# 安装依赖 / Install dependencies
RUN apt-get update && apt-get install -y \
    xvfb x11vnc fluxbox novnc websockify

# 复制 dev-vnc / Copy dev-vnc
COPY . /app/dev-vnc
RUN /app/dev-vnc/scripts/install.sh

EXPOSE 5999 6080

CMD ["dev-vnc", "start"]

项目结构 / Project structure

dev_app_vnc/
├── README.md
├── pyproject.toml
├── config/
│   └── config.env.example
├── devvnc/
│   ├── __init__.py
│   ├── cli.py
│   ├── server.py
│   └── config.py
├── scripts/
│   ├── dev-vnc-server.sh
│   └── install.sh
├── tests/
│   └── test_server.py
└── docs/
    └── ...

故障排除 / Troubleshooting

服务无法启动 / Service won't start

  1. 检查依赖是否安装 / Check dependencies:

    dev-vnc install-deps
    
  2. 检查端口是否被占用 / Check port usage:

    netstat -tlnp | grep -E '5999|6080'
    
  3. 查看日志 / View logs:

    dev-vnc logs
    

无法连接 / Cannot connect

  1. 检查防火墙设置 / Check firewall:

    sudo ufw allow 5999
    sudo ufw allow 6080
    
  2. 确认服务正在运行 / Confirm service is running:

    dev-vnc status
    

License

MIT License

Metadata

Release files for dev-vnc 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dev-vnc 1.0.0
File Size Uploaded Provenance Actions
dev_vnc-1.0.0.tar.gz 12.3 kB Without provenance Details for dev_vnc-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dev-vnc 1.0.0
File Interpreter ABI Platform Actions
dev_vnc-1.0.0-py3-none-any.whl Python 3 none any Details for dev_vnc-1.0.0-py3-none-any.whl

Total release size: 24.7 kB

Release files / dev_vnc-1.0.0.tar.gz

Download URL dev_vnc-1.0.0.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
010e512c6058cd66845ac6a35da57833a2a72b00565d25cbd26ee4b8bb140795
BLAKE2b-256 checksum
How to use checksums
617d8350fa2fde62b0dac2db7973cb94118555a8daa06d516d7350a2b5ea0ae3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release files / dev_vnc-1.0.0-py3-none-any.whl

Download URL dev_vnc-1.0.0-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9a6a6eb6e413f2cd9aff3c30a5d98b6141dabda4c3b8f312eb32fe33ca032636
BLAKE2b-256 checksum
How to use checksums
5509f692e9665e36d2e7456cc6eafc40383d3ea405c78aacbe4f34afe2d58b9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Security for dev-vnc 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page