retspen/webvirtcloud

Quick Install overrides nginx upstream wssocketiod port?

Closed this issue · 3 comments

When running the Quick Install script the wssocketiod default port gets overridden with the websocket port number and I am wondering if this is expected:

upstream wsnovncd {
      server 127.0.0.1:6080;
}
upstream wssocketiod {
      server 127.0.0.1:6080;
}

System (debian 12, bookworm):
Linux XXXX 6.1.0-13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.55-1 (2023-09-29) x86_64 GNU/Linux

File: /etc/nginx/conf.d/webvirtcloud.conf

server { listen 80;

server_name localhost;
#access_log /var/log/nginx/webvirtcloud-access_log;

location /static/ {
    root /srv/webvirtcloud;
    expires max;
}

location / {
    proxy_pass http://127.0.0.1:8000;
    proxy_set_header X-Real-IP $remote_addr;
    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 1800;
    proxy_read_timeout 1800;
    proxy_send_timeout 1800;
    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";
}
location /socket.io/ {
    proxy_pass http://wssocketiod;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
}

}

upstream wsnovncd {
server 127.0.0.1:6080;
}
upstream wssocketiod {
server 127.0.0.1:6080;
}

Installation log details ...

WEBVIRTCLOUD

Welcome to Webvirtcloud Installer for RHEL&Alternatives, Fedora, Debian and Ubuntu!

The installer has detected Debian version 12 codename bookworm.
Q. Do you want to configure fqdn for Nginx? (y/n) n
Q. NOVNC service port number?(Default: 6080)
Setting novnc service port 6080

Q. NOVNC public port number for reverse proxy(e.g: 80 or 443)?(Default: 6080) 80
Setting novnc public port 80

Q. NOVNC host listen ip?(Default: 0.0.0.0)
Setting novnc host ip 0.0.0.0

  • Updating installed packages./
  • Installing OS requirements.
  • Installing git
  • Installing virtualenv
  • python3-virtualenv already installed
  • python3-dev already installed
  • Installing python3-lxml
  • Installing libvirt-dev
  • zlib1g-dev already installed
  • Installing libxslt1-dev
  • Installing libsasl2-dev
  • Installing libldap2-dev
  • nginx already installed
  • Installing supervisor
  • libsasl2-modules already installed
  • gcc already installed
  • pkg-config already installed
  • Installing python3-guestfs
  • Installing uuid
  • Setting up hosts file.
  • Creating webvirtcloud user.
  • Cloning webvirtcloud from github to the web directory.
  • Configuring settings.py file.
  • Secret for Django generated: %5215%km226j4zzaa_$3lry*zq9t3yv$qy#!)o_!ma+6i761%g
  • Activate virtual environment.
    created virtual environment CPython3.11.2.final.0-64 in 467ms
    creator CPython3Posix(dest=/srv/webvirtcloud/venv, clear=False, no_vcs_ignore=False, global=False)
    seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/root/.local/share/virtualenv)
    added seed packages: pip==23.0.1, setuptools==66.1.1, wheel==0.38.4
    activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
  • Install App's Python requirements.
    Requirement already satisfied: pip in ./venv/lib/python3.11/site-packages (23.0.1)
    Collecting pip
    Downloading pip-23.3.1-py3-none-any.whl (2.1 MB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 10.2 MB/s eta 0:00:00
    Installing collected packages: pip
    Attempting uninstall: pip
    Found existing installation: pip 23.0.1
    Uninstalling pip-23.0.1:
    Successfully uninstalled pip-23.0.1
    Successfully installed pip-23.3.1
  • Django Migrate.
    Migrations for 'accounts':
    accounts/migrations/0006_alter_userattributes_id_alter_userinstance_id_and_more.py
    • Alter field id on userattributes
    • Alter field id on userinstance
    • Alter field id on usersshkey
      Migrations for 'appsettings':
      appsettings/migrations/0009_alter_appsettings_id.py
    • Alter field id on appsettings
      Migrations for 'computes':
      computes/migrations/0004_alter_compute_id.py
    • Alter field id on compute
      Migrations for 'instances':
      instances/migrations/0012_alter_flavor_id_alter_instance_id.py
    • Alter field id on flavor
    • Alter field id on instance
      Migrations for 'logs':
      logs/migrations/0004_alter_logs_id.py
    • Alter field id on logs
      Operations to perform:
      Apply all migrations: accounts, admin, appsettings, auth, computes, contenttypes, instances, interfaces, logs, networks, otp_totp, sessions, storages
      Running migrations:
      Applying accounts.0006_alter_userattributes_id_alter_userinstance_id_and_more... OK
      Applying appsettings.0009_alter_appsettings_id... OK
      Applying computes.0004_alter_compute_id... OK
      Applying instances.0012_alter_flavor_id_alter_instance_id... OK
      Applying logs.0004_alter_logs_id... OK
      ! SHOW_PROFILE_EDIT_PASSWORD is found inside settings.py
  • Applying permission can_change_password for all users
    ! Warning!!! Setting to True for all users
    ! Don`t forget to remove the option from settings.py
  • Django Collect Static

0 static files copied to '/srv/webvirtcloud/static', 70 unmodified.

  • Configuring Nginx.

    • Copying Nginx configuration
  • Configuring Supervisor.

    • Copying supervisor configuration
  • Setting Supervisor to start on boot and restart.

  • Setting Nginx to start on boot and starting Nginx.

    Open http://localhost to login to webvirtcloud.

  • Cleaning up...

  • Finished!

Default port should be 6081 for upstream wssocketiod.
Default port should be 6080 for upstream wsnovncd.
We should check installation script, if it is different than…

Ok, than I think the issue is related to this line:

sed -i "s|\\(server 127.0.0.1:\\).*|\\1$novncd_port_escape;|" "$nginxfile"

If I understand it correctly, it replaces everything that matches "server 127.0.0.1:" which applies to both upstream servers listed below:

upstream wsnovncd {
server 127.0.0.1:6080;
}
upstream wssocketiod {
server 127.0.0.1:6081;
}

Pull request #618 has been merged