nuber-io / nuber

Virtualization management software
https://www.nuber.io
GNU Affero General Public License v3.0
29 stars 5 forks source link

Web Terminal don't work #29

Open Febtw opened 2 years ago

Febtw commented 2 years ago

New issue for "Web Terminal don't work" problem. The Web Terminal shows nothing but black, and can't type in anything. I checked the browser and got two errors. (I have tried Edge v103, Chrome v103, safari 15; I got the errors on Chrome) DevTools failed to load source map: Could not load content for https://34.125.133.35:3000/cache_js/bootstrap.min.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE DevTools failed to load source map: Could not load content for https://34.125.133.35:3000/js/xterm.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

image

jamielsharief commented 2 years ago

I have not tested on edge, but used with chrome and no problems. you not seem to have no error messages (the map error messages are not the problem) but you are able to communicate with the lxd server , therefore I suspect it is something with either your browser extension or firewall or if not the nodejs server is not running or working properly in the container.

Febtw commented 2 years ago

I use a new installed Chrome, there's no extensions on it.And I have disabled the ufw. But I don't know how to check if the nodejs server is working properly in the container.

jamielsharief commented 2 years ago

Check if there are any errors in the errors log, make sure you restart the nuber-app container at least once ,

If you can check if the server.js is running (its being managed in the background and restarts every minute, so but if you can kill it and start manually, then when you next open a terminal window, you can see the errors which are happening.

$ cd /var/www/websocket && node server.js

You can also test like so

curl -i -N -k -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: localhost" -H "Origin: http://127.0.0.1:9090" http://127.0.0.1:9090

The issue here is the websocket server, or just communicating with that, but if you have any strange setup on your lxd server (ie its not a fresh install), then that could be causing problems, example, if you have configured a firewall etc.

Febtw commented 2 years ago

I use google cloud VM, and I have rebuilt the whole enviroment.

for $ cd /var/www/websocket && node server.js I get

root@nuber-app:~# cd /var/www/websocket && node server.js
Server started port:8080
{ Error: listen EADDRINUSE: address already in use :::8080
    at Server.setupListenHandle [as _listen2] (net.js:1280:14)
    at listenInCluster (net.js:1328:12)
    at Server.listen (net.js:1415:7)
    at new WebSocketServer (/var/www/websocket/node_modules/ws/lib/websocket-server.js:90:20)
    at Object.<anonymous> (/var/www/websocket/server.js:23:16)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
  code: 'EADDRINUSE',
  errno: 'EADDRINUSE',
  syscall: 'listen',
  address: '::',
  port: 8080 }

for curl -i -N -k -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: localhost" -H "Origin: http://127.0.0.1:9090" http://127.0.0.1:9090 I get

root@nuber-app:~# curl -i -N -k -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: localhost" -H "Origin: http://127.0.0.1:9090" http://127.0.0.1:9090
curl: (7) Failed to connect to 127.0.0.1 port 9090: Connection refused
Febtw commented 2 years ago

It seems $ cd /var/www/websocket && node server.js is OK now.

root@nuber-app:/var/www/websocket# cd /var/www/websocket && node server.js
Server started port:8080
> client connected
wss://34.125.133.35:8443/1.0/operations/feb4c736-fe49-48d1-9491-ae3ad3660bb5/websocket?secret=d8c3e54ee1c933842d63dd8c24cb142b6ef94f60ac1228cf8309fcb0447e971f

> connected to LXD
1001 closed connection
> client connected
wss://34.125.133.35:8443/1.0/operations/b34bf45d-e1a6-49c2-8f45-faf777515b3b/websocket?secret=be854631cdc520ffec277acc8dcd246b302552fcd4bf22351bd88c57153479a0

> connected to LXD
1006 closed connection
jamielsharief commented 2 years ago

So its all working now?

jamielsharief commented 2 years ago

Are there any errors in the logs /var/www/logs folder?

Febtw commented 2 years ago

Web Terminal still not work There'are apache-access.log apache-error.log application.log lxd.log in /var/www/logs folder This is /var/www/logs/apache-error.log

[Wed Jun 29 13:55:51.106318 2022] [ssl:warn] [pid 26054] AH01909: nuber-app.lxd:443:0 server certificate does NOT include an ID which matches the server name
[Wed Jun 29 13:55:51.152975 2022] [ssl:warn] [pid 26055] AH01909: nuber-app.lxd:443:0 server certificate does NOT include an ID which matches the server name
[Wed Jun 29 14:02:32.912189 2022] [ssl:warn] [pid 218] AH01909: nuber-app.lxd:443:0 server certificate does NOT include an ID which matches the server name
[Wed Jun 29 14:02:33.121793 2022] [ssl:warn] [pid 254] AH01909: nuber-app.lxd:443:0 server certificate does NOT include an ID which matches the server name
[Wed Jun 29 14:02:39.550224 2022] [proxy:error] [pid 267] (111)Connection refused: AH00957: WS: attempt to connect to 127.0.0.1:8080 (*) failed
[Wed Jun 29 14:02:39.550319 2022] [proxy_wstunnel:error] [pid 267] [client 127.0.0.1:57710] AH02452: failed to make connection to backend: 127.0.0.1
[Wed Jun 29 14:36:40.881260 2022] [ssl:warn] [pid 231] AH01909: nuber-app.lxd:443:0 server certificate does NOT include an ID which matches the server name
[Wed Jun 29 14:36:41.248860 2022] [ssl:warn] [pid 262] AH01909: nuber-app.lxd:443:0 server certificate does NOT include an ID which matches the server name
jamielsharief commented 2 years ago

So basically before it could not connect to the server because it was not running, now its working? Reinstall fixed the problem?

Febtw commented 2 years ago

I restart nuber-app again, and the server.js works

jamielsharief commented 2 years ago

I did say the other day to restart the container first, incase something crashed.

Febtw commented 2 years ago

I re-create the VM, and I restarted nuber once after I installed it

Febtw commented 2 years ago

server.js get the error again

root@nuber-app:~# cd /var/www/websocket && node server.js
Server started port:8080
{ Error: listen EADDRINUSE: address already in use :::8080
    at Server.setupListenHandle [as _listen2] (net.js:1280:14)
    at listenInCluster (net.js:1328:12)
    at Server.listen (net.js:1415:7)
    at new WebSocketServer (/var/www/websocket/node_modules/ws/lib/websocket-server.js:90:20)
    at Object.<anonymous> (/var/www/websocket/server.js:23:16)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
  code: 'EADDRINUSE',
  errno: 'EADDRINUSE',
  syscall: 'listen',
  address: '::',
  port: 8080 }
Febtw commented 2 years ago

But the website still works, I can handle everything except the terminal

jamielsharief commented 2 years ago

Manually running the server is giving that error because its already running (handled by cron jobs). You can disable the cron job temporarily, then run manually, to attempt to see what is going on. Is it possible your VM provider has some firewall blocking traffic to either websockets or port 8080?

Febtw commented 2 years ago

I reinstalled nuber in a new VM yesterday, and got into another error. 500 An Internal Error has Occured image

I studied issue #26, but I was unable to run bin/console db:setup, and couldn't find config/install.json. At the end of the installation, I was informed

Command `db:setup` not found
Command `db:migrate` not found
Command `cache:clear` not found
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN console-server@ No repository field.
npm WARN console-server@ No license field

image

jamielsharief commented 2 years ago

The reason you are getting the 500 is because you are not following the installation instructions.

jamielsharief commented 2 years ago

for example, install.json is not there because you did not install it. You are trying to do it some other way. I setup a VM last month and full tested this and it was working out of the box. Please follow the installation instructions.

https://www.nuber.io/docs/lxd/install/

Febtw commented 2 years ago

This is what I have done during the installation. It works the other day.

apt update
apt upgrade
apt install zfsutils-linux
snap install lxd             ## snap "lxd" is already installed, see 'snap help refresh'
lxd init                          ## all default, the ubuntu 20.04 is installed after I create the VM, so I init lxd with default config
adduser root lxd
bash <(curl -s https://www.nuber.io/install.sh)

I don't create a zpool named lxd, 'cause I don't have free space unformatted. And the default zpool init with lxd seems work fine.

root@instance-3:~# lsmod | grep zfs
zfs                  3756032  7
zunicode              348160  1 zfs
zzstd                 483328  1 zfs
zlua                  155648  1 zfs
zcommon               102400  1 zfs
znvpair                94208  2 zfs,zcommon
zavl                   20480  1 zfs
icp                   315392  1 zfs
spl                   122880  6 zfs,icp,zzstd,znvpair,zcommon,zavl
root@instance-3:~# zpool list
NAME      SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
default  45.5G  1.17G  44.3G        -         -     0%     2%  1.00x    ONLINE  -

I‘m tring to follow the installation on VMware on my local computer But it got stuck image

jamielsharief commented 2 years ago

It looks like you were correct a change to composer (dependency manager) blocked plugins which prevented installation from working properly.

jamielsharief commented 2 years ago

$ lxc operation list $ lxc operation show f7f37f39-783d-48a6-8b5d-0e8779e8b9cd id: f7f37f39-783d-48a6-8b5d-0e8779e8b9cd class: websocket description: Executing command created_at: 2022-07-05T08:34:04.427471543Z updated_at: 2022-07-05T08:34:04.427471543Z status: Failure status_code: 400 resources: containers:

jamielsharief commented 2 years ago

find and kill node process to debug, disabled task to restart

ps -ef | grep node
kill 26809
cd /var/www/websocket && node server.js

> client connected
wss://192.168.1.250:8443/1.0/operations/8cd15ecf-39f3-43ad-be68-a6e229f14c69/websocket?secret=981e667411637de2f9b7f6f487192087dced375c4d22a9095c4463d2de37b810

{ Error: write EPROTO 281473555730448:error:1409442E:SSL routines:ssl3_read_bytes:tlsv1 alert protocol version:../ssl/record/rec_layer_s3.c:1543:SSL alert number 70

    at WriteWrap.afterWrite [as oncomplete] (net.js:789:14) errno: 'EPROTO', code: 'EPROTO', syscall: 'write' }
jamielsharief commented 2 years ago

TODO: this is weird error message, last time websocket was fixed by reinstalling. Since installation failed and i fixed this manually, perhaps a reinstall would work. Come back to this.

Febtw commented 2 years ago

Thanks, the installation is OK now. Its back to the web terminal issue

jamielsharief commented 2 years ago

You were correct it was a change by the dependency manager which messed up the install process. I need to figure out, why nodejs is having the cert problem all of the sudden. You can try installing an older version of node to see if that fixes it, but I cant look it right now , I already done what I can for today

Febtw commented 2 years ago

I think If I log in https://127.0.0.1:3000 under the desktop environment, I don't need to consider the problem "Is it possible your VM provider has some firewall blocking traffic to either websockets or port 8080". And I think the firewall isn't blocking the traffic image

If possible, I can give you the account and password of the VM so that you can test it at any time. You can login with ssh or vnc

jamielsharief commented 2 years ago

No need, I did a new installation and got the same issue , the errors are above. I am thinking it's a problem with a newer version of nodejs. Since that is what causing the problem

Febtw commented 2 years ago

OK, I understand, I’ll try the old version of nodejs

jamielsharief commented 2 years ago

It is possible the EPROTO error is caused by one of the dependency versions which needed to be updated. This is still being investigated.

jamielsharief commented 2 years ago

I have been investigating this all morning, trying to find out what is going on, something has changed somewhere. I have found that LXD have made some changes to the websocket, but i am not sure this is the cause since its a different error.

jamielsharief commented 2 years ago

I want to apologise , i was testing with an older verison of LXD, LXD 5 now uses TLS 1.3 by default, this is also not supported in older versions of nodejs. I am hoping to repackage now.

To fix I had to change the Apache server settings to accept TLS v1.3 and change the NodeJS installation to use v14.

You want to try reinstalling?

Febtw commented 1 year ago

I want to apologise , i was testing with an older verison of LXD, LXD 5 now uses TLS 1.3 by default, this is also not supported in older versions of nodejs. I am hoping to repackage now.

To fix I had to change the Apache server settings to accept TLS v1.3 and change the NodeJS installation to use v14.

You want to try reinstalling?

hi, long time no see. I tried the new Nuber and the Web Terminal has become much better. I can now use it to run some commands, like apt update , apt upgrade, etc. But It seems that its use is time limited. For examples, 1) I open the Web Terminal and do nothing. After about one minute, the terminal can no longer operate. 2) It's OK to run sleep 29, but get stuck when run sleep 30. 3) After staying on the Web Terminal page for about 15 minutes, it will automatically log out. During this period, I draged the scroll bar occasionally.

I want to install this linux panel. It takes a few minutes, so cannot be completed.

I tried the commands above on the local terminal, and they runned well.