mirror of
https://github.com/kasmtech/KasmVNC.git
synced 2025-06-26 12:41:31 +02:00
Merge branch 'feature/KASM-7202_run_web_code_with_node' into 'master'
KASM-7202 run web code from source using node Closes KASM-7202 See merge request kasm-technologies/internal/KasmVNC!173
This commit is contained in:
commit
0dbe6f9896
36
BUILDING.txt
36
BUILDING.txt
@ -78,7 +78,7 @@ Building the KasmVNC Server using Docker
|
|||||||
git submodule init
|
git submodule init
|
||||||
git submodule update --remote --merge
|
git submodule update --remote --merge
|
||||||
sudo docker build -t kasmvnc:dev -f builder/dockerfile.ubuntu_jammy.dev .
|
sudo docker build -t kasmvnc:dev -f builder/dockerfile.ubuntu_jammy.dev .
|
||||||
sudo docker run -it -v ./:/src -p 6901:6901 kasmvnc:dev
|
sudo docker run -it --rm -v ./:/src -p 6901:6901 -p 8443:8443 --name kasmvnc_dev kasmvnc:dev
|
||||||
```
|
```
|
||||||
|
|
||||||
Now from inside the container.
|
Now from inside the container.
|
||||||
@ -89,9 +89,9 @@ cd kasmweb
|
|||||||
npm install
|
npm install
|
||||||
npm run build # <-- only run this on subsequent changes to front-end code
|
npm run build # <-- only run this on subsequent changes to front-end code
|
||||||
cd ..
|
cd ..
|
||||||
# build dependencies
|
# build dependencies, this is optional as they are pre-built in the docker image. Only rebuild if you made version changes and need to test.
|
||||||
sudo builder/scripts/build-webp
|
# sudo builder/scripts/build-webp
|
||||||
sudo builder/scripts/build-libjpeg-turbo
|
# sudo builder/scripts/build-libjpeg-turbo
|
||||||
# Build KasmVNC
|
# Build KasmVNC
|
||||||
builder/build.sh
|
builder/build.sh
|
||||||
```
|
```
|
||||||
@ -105,6 +105,34 @@ Now run Xvnc and Xfce4 from inside the container
|
|||||||
|
|
||||||
Now open a browser and navigate to your dev VM on port 6901.
|
Now open a browser and navigate to your dev VM on port 6901.
|
||||||
|
|
||||||
|
Running noVNC from source
|
||||||
|
-------------------------
|
||||||
|
If you need to debug or make changes to the UI code, use the following procedures to use npm to serve the web code. The code will automatically rebuild when changes are made and the code will not be packaged.
|
||||||
|
These steps assume you are inside the kasmvnc:dev container started in the above steps.
|
||||||
|
|
||||||
|
Now from inside the container. **This assumes KasmVNC is already built, follow steps above if you need to build KasmVNC**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Run KasmVNC
|
||||||
|
/src/xorg.build/bin/Xvnc -interface 0.0.0.0 -PublicIP 127.0.0.1 -disableBasicAuth -RectThreads 0 -Log *:stdout:100 -httpd /src/kasmweb/dist -sslOnly 0 -SecurityTypes None -websocketPort 6901 :1 &
|
||||||
|
/usr/bin/xfce4-session --display :1 &
|
||||||
|
|
||||||
|
sudo nginx
|
||||||
|
cd kasmweb
|
||||||
|
npm install # only needs done first time
|
||||||
|
npm run serve # <-- Needs to run in foreground
|
||||||
|
```
|
||||||
|
|
||||||
|
Now open a browser and navigate to your dev VM on port 8443 over https.
|
||||||
|
|
||||||
|
NGINX is proxying the websocket to KasmVNC and all other requests go to the node server. NGINX listens on 8443 with ssl.
|
||||||
|
|
||||||
|
Since `npm run serve` needs to run in the foreground, you may need to exec into the container from another terminal to run additional commands like stopping Xvnc, rebuilding KasmVNC, etc.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo docker exec -it kasmvnc_dev /bin/bash
|
||||||
|
```
|
||||||
|
|
||||||
Building the KasmVNC Server on Modern Unix/Linux Systems
|
Building the KasmVNC Server on Modern Unix/Linux Systems
|
||||||
---------------------------------------------------------
|
---------------------------------------------------------
|
||||||
|
|
||||||
|
@ -124,6 +124,7 @@ make -j"$(nproc)"
|
|||||||
# modifications for the servertarball
|
# modifications for the servertarball
|
||||||
cd /src
|
cd /src
|
||||||
mkdir -p xorg.build/bin
|
mkdir -p xorg.build/bin
|
||||||
|
mkdir -p xorg.build/lib
|
||||||
cd xorg.build/bin/
|
cd xorg.build/bin/
|
||||||
ln -sfn /src/unix/xserver/hw/vnc/Xvnc Xvnc
|
ln -sfn /src/unix/xserver/hw/vnc/Xvnc Xvnc
|
||||||
cd ..
|
cd ..
|
||||||
|
42
builder/conf/nginx_kasm.conf
Normal file
42
builder/conf/nginx_kasm.conf
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
server {
|
||||||
|
listen 8443 ssl;
|
||||||
|
ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
|
||||||
|
ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://127.0.0.1:5173;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /api/ {
|
||||||
|
proxy_pass https://127.0.0.1:6901;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /websockify {
|
||||||
|
# The following configurations must be configured when proxying to Kasm Workspaces
|
||||||
|
|
||||||
|
# WebSocket Support
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
|
||||||
|
# Host and X headers
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
|
||||||
|
# Connectivity Options
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_read_timeout 1800s;
|
||||||
|
proxy_send_timeout 1800s;
|
||||||
|
proxy_connect_timeout 1800s;
|
||||||
|
proxy_buffering off;
|
||||||
|
|
||||||
|
# Allow large requests to support file uploads to sessions
|
||||||
|
client_max_body_size 10M;
|
||||||
|
|
||||||
|
# # Proxy to KasmVNC using SSL
|
||||||
|
#proxy_pass https://127.0.0.1:6901;
|
||||||
|
# Proxy to KasmVNC without SSL
|
||||||
|
proxy_pass http://127.0.0.1:6901;
|
||||||
|
}
|
||||||
|
}
|
@ -10,6 +10,8 @@ EXPOSE 6901
|
|||||||
|
|
||||||
USER root
|
USER root
|
||||||
|
|
||||||
|
COPY builder/conf/nginx_kasm.conf /etc/nginx/conf.d/
|
||||||
|
|
||||||
RUN sed -i 's$# deb-src$deb-src$' /etc/apt/sources.list && \
|
RUN sed -i 's$# deb-src$deb-src$' /etc/apt/sources.list && \
|
||||||
apt update && \
|
apt update && \
|
||||||
apt install -y \
|
apt install -y \
|
||||||
@ -55,7 +57,7 @@ RUN sed -i 's$# deb-src$deb-src$' /etc/apt/sources.list && \
|
|||||||
echo "kasm-user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
echo "kasm-user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||||
|
|
||||||
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
|
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
|
||||||
RUN apt install -y nodejs
|
RUN apt install -y nodejs nginx
|
||||||
|
|
||||||
COPY builder/scripts/build-webp /tmp
|
COPY builder/scripts/build-webp /tmp
|
||||||
COPY builder/scripts/build-libjpeg-turbo /tmp
|
COPY builder/scripts/build-libjpeg-turbo /tmp
|
||||||
|
2
kasmweb
2
kasmweb
@ -1 +1 @@
|
|||||||
Subproject commit 5c46b2e13ab1dd7232b28f017fd7e49ca740f5a4
|
Subproject commit 0d8a3c5f07defffe340dd67a1485be5214bec4ee
|
Loading…
x
Reference in New Issue
Block a user