Migrate to KasmVNC 1.3.1 (fixed deps)
This commit is contained in:
parent
af84b12ed3
commit
a99548e16e
3 changed files with 53 additions and 35 deletions
56
Dockerfile
56
Dockerfile
|
|
@ -9,13 +9,15 @@ RUN npm run build
|
||||||
# Production stage
|
# Production stage
|
||||||
FROM python:3.11-slim
|
FROM python:3.11-slim
|
||||||
|
|
||||||
# Install system dependencies for Playwright, VNC, and noVNC
|
# Install system dependencies
|
||||||
|
# Combined list for Playwright, KasmVNC, and general utilities
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
wget \
|
wget \
|
||||||
curl \
|
curl \
|
||||||
gnupg \
|
gnupg \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
|
openbox \
|
||||||
# Playwright dependencies
|
# Playwright dependencies
|
||||||
libnss3 \
|
libnss3 \
|
||||||
libnspr4 \
|
libnspr4 \
|
||||||
|
|
@ -35,27 +37,49 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
libatspi2.0-0 \
|
libatspi2.0-0 \
|
||||||
libgtk-3-0 \
|
libgtk-3-0 \
|
||||||
fonts-liberation \
|
fonts-liberation \
|
||||||
# VNC and display
|
# KasmVNC dependencies
|
||||||
xvfb \
|
libjpeg62-turbo \
|
||||||
xauth \
|
libpng16-16 \
|
||||||
x11vnc \
|
libx11-6 \
|
||||||
|
libxcursor1 \
|
||||||
|
libxext6 \
|
||||||
|
libxi6 \
|
||||||
|
libxinerama1 \
|
||||||
|
libxrender1 \
|
||||||
|
libxtst6 \
|
||||||
|
zlib1g \
|
||||||
|
libssl3 \
|
||||||
|
adduser \
|
||||||
|
libfontconfig1 \
|
||||||
|
libgl1 \
|
||||||
|
libpixman-1-0 \
|
||||||
|
libxfont2 \
|
||||||
|
libxkbfile1 \
|
||||||
|
xfonts-base \
|
||||||
|
xfonts-75dpi \
|
||||||
|
xfonts-100dpi \
|
||||||
|
python3-yaml \
|
||||||
supervisor \
|
supervisor \
|
||||||
# noVNC dependencies
|
|
||||||
python3-numpy \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Install noVNC
|
# Install KasmVNC (Debian Bookworm)
|
||||||
RUN mkdir -p /opt/noVNC/utils/websockify \
|
RUN wget -q https://github.com/kasmtech/KasmVNC/releases/download/v1.3.1/kasmvncserver_bookworm_1.3.1_amd64.deb -O /tmp/kasmvnc.deb \
|
||||||
&& wget -qO- https://github.com/novnc/noVNC/archive/refs/tags/v1.4.0.tar.gz | tar xz --strip 1 -C /opt/noVNC \
|
&& apt-get update \
|
||||||
&& wget -qO- https://github.com/novnc/websockify/archive/refs/tags/v0.11.0.tar.gz | tar xz --strip 1 -C /opt/noVNC/utils/websockify \
|
&& apt-get install -y --no-install-recommends /tmp/kasmvnc.deb \
|
||||||
&& ln -s /opt/noVNC/vnc.html /opt/noVNC/index.html
|
&& rm /tmp/kasmvnc.deb \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Setup KasmVNC user
|
||||||
|
# KasmVNC requires a non-root user for security best practices, but we run as root in this simple container.
|
||||||
|
# We will run vncserver as root (not recommended but easiest for migration) or create a user.
|
||||||
|
# Let's try running as root first with specific flags.
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy backend requirements and install
|
# Copy backend requirements and install
|
||||||
COPY backend/requirements.txt ./
|
COPY backend/requirements.txt ./
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
# Install Playwright browsers with retries
|
# Install Playwright browsers
|
||||||
RUN mkdir -p /root/.cache/ms-playwright && \
|
RUN mkdir -p /root/.cache/ms-playwright && \
|
||||||
for i in 1 2 3; do \
|
for i in 1 2 3; do \
|
||||||
playwright install chromium && break || \
|
playwright install chromium && break || \
|
||||||
|
|
@ -78,16 +102,18 @@ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||||
ENV PYTHONUNBUFFERED=1
|
ENV PYTHONUNBUFFERED=1
|
||||||
ENV CACHE_DIR=/app/cache
|
ENV CACHE_DIR=/app/cache
|
||||||
ENV DISPLAY=:99
|
ENV DISPLAY=:99
|
||||||
|
# KasmVNC envs
|
||||||
|
ENV KASM_VNC_ARGS="-httpport 6080 -FrameRate 60 -sslOnly 0"
|
||||||
|
|
||||||
# Set working directory to backend for correct imports
|
# Set working directory to backend for correct imports
|
||||||
WORKDIR /app/backend
|
WORKDIR /app/backend
|
||||||
|
|
||||||
# Expose ports (8002 = app, 6080 = noVNC)
|
# Expose ports (8002 = app, 6080 = KasmVNC)
|
||||||
EXPOSE 8002 6080
|
EXPOSE 8002 6080
|
||||||
|
|
||||||
# Health check
|
# Health check
|
||||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
||||||
CMD curl -f http://localhost:8002/health || exit 1
|
CMD curl -f http://localhost:8002/health || exit 1
|
||||||
|
|
||||||
# Start services using supervisor
|
# Start services
|
||||||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,8 @@ export const Login: React.FC = () => {
|
||||||
|
|
||||||
const getVncUrl = () => {
|
const getVncUrl = () => {
|
||||||
const host = window.location.hostname;
|
const host = window.location.hostname;
|
||||||
// autoconnect=true, resize=scale to fit, quality=9 for clear text
|
// KasmVNC params: autoconnect=1, resize=scale (fit to screen), negotiate items
|
||||||
return `http://${host}:6080/vnc.html?autoconnect=true&resize=scale&quality=9`;
|
return `http://${host}:6080/vnc.html?autoconnect=1&resize=scale&encrypt=0`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleVncLogin = async () => {
|
const handleVncLogin = async () => {
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ logfile=/dev/stdout
|
||||||
logfile_maxbytes=0
|
logfile_maxbytes=0
|
||||||
loglevel=info
|
loglevel=info
|
||||||
|
|
||||||
[program:xvfb]
|
[program:kasmvnc]
|
||||||
command=Xvfb :99 -screen 0 1920x1080x24
|
command=/usr/bin/vncserver -fg :99 -select-de -http-port 6080 -FrameRate 60 -SecurityTypes None -sslOnly 0 -geometry 1920x1080
|
||||||
autorestart=true
|
autorestart=true
|
||||||
priority=100
|
priority=100
|
||||||
stdout_logfile=/dev/stdout
|
stdout_logfile=/dev/stdout
|
||||||
|
|
@ -13,8 +13,9 @@ stdout_logfile_maxbytes=0
|
||||||
stderr_logfile=/dev/stderr
|
stderr_logfile=/dev/stderr
|
||||||
stderr_logfile_maxbytes=0
|
stderr_logfile_maxbytes=0
|
||||||
|
|
||||||
[program:x11vnc]
|
[program:openbox]
|
||||||
command=x11vnc -display :99 -forever -shared -rfbport 5900 -nopw -xkb
|
command=openbox
|
||||||
|
environment=DISPLAY=":99"
|
||||||
autorestart=true
|
autorestart=true
|
||||||
priority=200
|
priority=200
|
||||||
stdout_logfile=/dev/stdout
|
stdout_logfile=/dev/stdout
|
||||||
|
|
@ -22,21 +23,12 @@ stdout_logfile_maxbytes=0
|
||||||
stderr_logfile=/dev/stderr
|
stderr_logfile=/dev/stderr
|
||||||
stderr_logfile_maxbytes=0
|
stderr_logfile_maxbytes=0
|
||||||
|
|
||||||
[program:novnc]
|
|
||||||
command=/opt/noVNC/utils/novnc_proxy --vnc localhost:5900 --listen 6080
|
|
||||||
autorestart=true
|
|
||||||
priority=300
|
|
||||||
stdout_logfile=/dev/stdout
|
|
||||||
stdout_logfile_maxbytes=0
|
|
||||||
stderr_logfile=/dev/stderr
|
|
||||||
stderr_logfile_maxbytes=0
|
|
||||||
|
|
||||||
[program:app]
|
[program:app]
|
||||||
command=python -m uvicorn main:app --host 0.0.0.0 --port 8002
|
command=python -m uvicorn main:app --host 0.0.0.0 --port 8002
|
||||||
directory=/app/backend
|
directory=/app/backend
|
||||||
environment=DISPLAY=":99",PYTHONUNBUFFERED="1"
|
environment=DISPLAY=":99",PYTHONUNBUFFERED="1"
|
||||||
autorestart=true
|
autorestart=true
|
||||||
priority=400
|
priority=300
|
||||||
stdout_logfile=/dev/stdout
|
stdout_logfile=/dev/stdout
|
||||||
stdout_logfile_maxbytes=0
|
stdout_logfile_maxbytes=0
|
||||||
stderr_logfile=/dev/stderr
|
stderr_logfile=/dev/stderr
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue