From c0f707854a267c6f449e7f845d80684007709400 Mon Sep 17 00:00:00 2001 From: catborise Date: Fri, 26 Jun 2020 16:31:41 +0300 Subject: [PATCH 1/2] wsproxy patch --- Dockerfile | 27 +- README.md | 6 + conf/nginx/webvirtcloud.conf | 12 + console/templates/console-spice-full.html | 16 +- console/templates/console-spice-lite.html | 20 +- console/templates/console-vnc-full.html | 480 +++++++++++----------- console/templates/console-vnc-lite.html | 5 +- console/views.py | 3 +- static/js/spice-html5/spice.css | 2 - webvirtcloud/settings.py.template | 5 +- 10 files changed, 295 insertions(+), 281 deletions(-) diff --git a/Dockerfile b/Dockerfile index b04b9d5..0349fac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,28 @@ -FROM phusion/baseimage:0.11 +FROM phusion/baseimage:18.04-1.0.0 + +EXPOSE 80 +EXPOSE 6080 + +# Use baseimage-docker's init system. +CMD ["/sbin/my_init"] + RUN echo 'APT::Get::Clean=always;' >> /etc/apt/apt.conf.d/99AutomaticClean RUN apt-get update -qqy RUN DEBIAN_FRONTEND=noninteractive apt-get -qyy install \ -o APT::Install-Suggests=false \ - git python3-virtualenv python3-dev python3-lxml virtualenv libvirt-dev zlib1g-dev nginx libsasl2-modules + git \ + python3-virtualenv \ + python3-dev \ + python3-lxml \ + virtualenv \ + libvirt-dev \ + zlib1g-dev \ + nginx \ + libsasl2-modules + +RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ADD . /srv/webvirtcloud RUN chown -R www-data:www-data /srv/webvirtcloud @@ -39,11 +56,7 @@ ADD conf/runit/nginx-log-forwarder /etc/service/nginx-log-forwarder/run ADD conf/runit/novncd.sh /etc/service/novnc/run ADD conf/runit/webvirtcloud.sh /etc/service/webvirtcloud/run -EXPOSE 80 -EXPOSE 6080 - # Define mountable directories. #VOLUME [] -# Use baseimage-docker's init system. -CMD ["/sbin/my_init"] +WORKDIR /srv/webvirtcloud diff --git a/README.md b/README.md index 6f40feb..2e7581f 100644 --- a/README.md +++ b/README.md @@ -300,6 +300,12 @@ datasource: metadata_urls: [ "http://webvirtcloud.domain.com/datasource" ] ``` +### Reverse-Proxy +Edit WS_PUBLIC_PORT at settings.py file to expose redirect to 80. Default: 6080 +``` +WS_PUBLIC_PORT = 80 +``` + ### How To Update ```bash # Go to Installation Directory diff --git a/conf/nginx/webvirtcloud.conf b/conf/nginx/webvirtcloud.conf index 70b8e0e..d4420b6 100644 --- a/conf/nginx/webvirtcloud.conf +++ b/conf/nginx/webvirtcloud.conf @@ -15,9 +15,21 @@ server { proxy_set_header X-Forwarded-for $proxy_add_x_forwarded_for; proxy_set_header Host $host:$server_port; proxy_set_header X-Forwarded-Proto $remote_addr; + proxy_set_header X-Forwarded-Ssl off; proxy_connect_timeout 600; proxy_read_timeout 600; proxy_send_timeout 600; client_max_body_size 1024M; } + + location /novncd/ { + proxy_pass http://wsnovncd; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + } } + +upstream wsnovncd { + server 127.0.0.1:6080; +} \ No newline at end of file diff --git a/console/templates/console-spice-full.html b/console/templates/console-spice-full.html index 501fbc3..d9a7f89 100644 --- a/console/templates/console-spice-full.html +++ b/console/templates/console-spice-full.html @@ -31,17 +31,8 @@ - - + + - + + + - - - - - - - - - + + + + + + + + {% endblock %} {% block content %} -
-
-
{% trans 'noVNC encountered an error' %}:
-
-
-
+
+
+
{% trans 'noVNC encountered an error' %}:
+
+
+
- -
+ +
-
-
+
+
+
+
-
+
-

no
VNC

+

no
VNC

+ id="noVNC_view_drag_button" class="noVNC_button noVNC_hidden" title="Move/Drag Viewport" />
+ id="noVNC_mouse_button0" class="noVNC_button" title="Active Mouse Button" /> + id="noVNC_mouse_button1" class="noVNC_button" title="Active Mouse Button" /> + id="noVNC_mouse_button2" class="noVNC_button" title="Active Mouse Button" /> + id="noVNC_mouse_button4" class="noVNC_button" title="Active Mouse Button" /> + id="noVNC_keyboard_button" class="noVNC_button" value="Keyboard" title="Show Keyboard" />
+ id="noVNC_toggle_extra_keys_button" class="noVNC_button" title="Show Extra Keys" />
-
- - - - - - -
+
+ + + + + + +
+ id="noVNC_power_button" class="noVNC_button" title="Shutdown/Reboot..." />
-
-
- Power +
+
+ Power +
+ + +
- - - -
+ id="noVNC_clipboard_button" class="noVNC_button" title="Clipboard" />
-
-
- Clipboard +
+
+ Clipboard +
+ +
+
- -
- -
+ id="noVNC_fullscreen_button" class="noVNC_button noVNC_hidden" title="Fullscreen" /> + id="noVNC_settings_button" class="noVNC_button" title="Settings" />
-
-
    -
  • - Settings -
  • -
  • - -
  • -
  • - -
  • -

  • -
  • - -
  • -
  • - - -
  • -

  • -
  • -
    Advanced
    -
      -
    • - - -
    • -
    • -
      WebSocket
      -
        +
        +
          +
        • + Settings +
        • +
        • + +
        • +
        • + +
        • +
        • +
          +
        • +
        • + +
        • +
        • + + +
        • +
        • +
          +
        • +
        • +
          Advanced
          +
          +
          • - -
          • -
          • - - + +
          • - - +
            WebSocket
            +
            +
              +
            • + +
            • +
            • + + +
            • +
            • + + +
            • +
            • + + + +
            • +
            +
          • - - +
          • -
          -
        • -

        • -
        • - - -
        • -
        • - - -
        • -

        • -
        • - -
        • -

        • - -
        • - -
        • -
        - -
      -
      +
    • + + +
    • +
    • + + +
    • +
    • +
      +
    • +
    • + +
    • +
    • +
      +
    • + +
    • + +
    • +
    +
    +
  • +
+
+ id="noVNC_disconnect_button" class="noVNC_button" title="Disconnect" /> -
-
- -
- -
- - -
- - -
-
- -
-
Connect
-
- -
-
-
    -
  • - - -
  • -
  • - -
  • -
-
-
+
- -
-
-
+
+ + +
+ + +
+
+ +
+
Connect
+
+
+
+ + +
+
+
+
    +
  • + + +
  • +
  • + +
  • +
+
+
+
+ + +
+
+
-
-
+
+
- -
- +
+ - -
+ +
- + {% endblock %} \ No newline at end of file diff --git a/console/templates/console-vnc-lite.html b/console/templates/console-vnc-lite.html index 3fd7db2..e3cad63 100755 --- a/console/templates/console-vnc-lite.html +++ b/console/templates/console-vnc-lite.html @@ -3,7 +3,6 @@ {% load staticfiles %} {% block head %} -