diff --git a/.github/workflows/build-image-novnc.yaml b/.github/workflows/build-image-novnc.yaml new file mode 100644 index 0000000..0021e97 --- /dev/null +++ b/.github/workflows/build-image-novnc.yaml @@ -0,0 +1,56 @@ +--- +name: build-image-novnc + +on: + push: + branches: + - main + tags: + - "v*" + paths: + - "images/showroom-novnc/**" + +permissions: + packages: write + +concurrency: + group: build + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + + - name: set datetime + run: | + echo "datetime=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV + + - name: Build image + id: build-image + uses: redhat-actions/buildah-build@v2 + with: + image: showroom-novnc + tags: latest ${{ github.ref_name }} + context: images/showroom-novnc/ + containerfiles: | + ./images/showroom-novnc/Containerfile + build-args: | + CREATED_AT=${{ env.datetime }} + GITHUB_SHA=${{ github.sha }} + + - name: push image to ghcr.io + id: push-to-ghcr + uses: redhat-actions/push-to-registry@v2 + with: + image: ${{ steps.build-image.outputs.image }} + tags: ${{ steps.build-image.outputs.tags }} + registry: ghcr.io/rhpds + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + + - name: Print image url + run: echo "Image pushed to ${{ steps.push-to-ghcr.outputs.registry-paths }}" diff --git a/README.adoc b/README.adoc index ac989f7..b7c1fae 100644 --- a/README.adoc +++ b/README.adoc @@ -92,6 +92,19 @@ helm install myshowroom myrhpds/showroom --set deployer.domain=apps.shared-410.o NOTE: The above creates the namespace `showroom-test` where the helm release exists, AND creates the namespace `showroom-test2` there the actual application is deployed. +==== Deploy noVNC + +For deploying showroom with noVNC, you need to have a host with a VNC server configured and running. + +. Using Helm +---- +helm install +... +--set novnc.setup=true \ +--set novnc.vncServer=my.host.local:5900 \ +--set novnc.password=secret123 +---- + == Hosting Helm Repo with on \https://rhpds.github.io/ === Prereqs diff --git a/charts/showroom-single-pod/files/index.html b/charts/showroom-single-pod/files/index.html index e64022c..7b0564e 100644 --- a/charts/showroom-single-pod/files/index.html +++ b/charts/showroom-single-pod/files/index.html @@ -27,6 +27,9 @@ {{- end }} {{- if eq .Values.ocpconsole.setup "true" }} +{{- end }} +{{- if eq .Values.novnc.setup "true" }} + {{- end }} {{- if eq .Values.terminal.setup "true" }} @@ -48,6 +51,11 @@
+{{- end }} +{{- if eq .Values.novnc.setup "true" }} +
+ +
{{- end }} {{- end }} diff --git a/charts/showroom-single-pod/templates/deployment.yaml b/charts/showroom-single-pod/templates/deployment.yaml index 5621caf..2dfb2a4 100644 --- a/charts/showroom-single-pod/templates/deployment.yaml +++ b/charts/showroom-single-pod/templates/deployment.yaml @@ -150,6 +150,22 @@ spec: {{- toYaml .Values.wetty.resources | nindent 10 }} {{- end }} +{{- if eq .Values.novnc.setup "true" }} + - name: novnc + image: {{ .Values.novnc.image }} + imagePullPolicy: IfNotPresent + args: + - websockify + - --web=/www + - 127.0.0.1:{{ .Values.novnc.port }} + - "{{ .Values.novnc.vncServer }}" + ports: + - containerPort: {{ .Values.novnc.port }} + protocol: TCP + resources: + {{- toYaml .Values.novnc.resources | nindent 10 }} +{{- end }} + volumes: - name: showroom emptyDir: {} diff --git a/charts/showroom-single-pod/templates/proxy/configmap-nginx-config.yaml b/charts/showroom-single-pod/templates/proxy/configmap-nginx-config.yaml index 4eb6ee4..8cfa86b 100644 --- a/charts/showroom-single-pod/templates/proxy/configmap-nginx-config.yaml +++ b/charts/showroom-single-pod/templates/proxy/configmap-nginx-config.yaml @@ -91,5 +91,29 @@ data: proxy_set_header X-Forwarded-Proto $scheme; } {{- end }} + +{{- if eq .Values.novnc.setup "true" }} + location ^~ /novnc { + proxy_pass http://127.0.0.1:{{ .Values.novnc.port }}; + + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $host; + proxy_set_header X-NginX-Proxy true; + } + + location ^~ /websockify { + proxy_pass http://127.0.0.1:{{ .Values.novnc.port }}/websockify; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_read_timeout 43200000; + + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $host; + proxy_set_header X-NginX-Proxy true; + } +{{- end }} } } diff --git a/charts/showroom-single-pod/values.yaml b/charts/showroom-single-pod/values.yaml index 9c851de..d05b0b2 100644 --- a/charts/showroom-single-pod/values.yaml +++ b/charts/showroom-single-pod/values.yaml @@ -84,3 +84,16 @@ codeserver: # To be fully implemented ocpconsole: setup: "false" + +novnc: + setup: "false" + image: ghcr.io/rhpds/showroom-novnc:latest + port: 6080 + vncServer: 127.0.0.1:5900 + password: password + resources: + limits: + memory: 256Mi + requests: + cpu: 500m + memory: 256Mi diff --git a/images/showroom-novnc/Containerfile b/images/showroom-novnc/Containerfile new file mode 100644 index 0000000..19dd26e --- /dev/null +++ b/images/showroom-novnc/Containerfile @@ -0,0 +1,20 @@ +FROM registry.access.redhat.com/ubi9:9.2-722 + +ARG CREATED_AT=none +ARG GITHUB_SHA=none + +LABEL org.opencontainers.image.created="$CREATED_AT" +LABEL org.opencontainers.image.revision="$GITHUB_SHA" + +RUN curl -L https://github.com/novnc/websockify/archive/refs/tags/v0.11.0.tar.gz \ + --output websockify.tar.gz && \ + tar xzf websockify.tar.gz && \ + cd /websockify-0.11.0 && python3 setup.py install + +RUN curl -L https://github.com/novnc/noVNC/archive/refs/tags/v1.4.0.tar.gz \ + --output noVNC.tar.gz && \ + mkdir -p /www/novnc && \ + tar xzf noVNC.tar.gz --strip-components 1 -C /www/novnc + +# +CMD ["websockify"]