CollabVM Server 1.x/Server setup for beginners and CollabVM Server 1.x/Removed Features: Difference between pages

From Computernewb Wiki
(Difference between pages)
Jump to navigation Jump to search
m (1 revision imported)
 
computernewb>CabMobile
(→‎Server: i guess)
 
Line 1: Line 1:
'''CollabVM Server''' is everyone's favorite server that powers [[CollabVM]]. This article covers CollabVM Server 1.
{{UnderConstruction/Choco}}


==Server==
This guide is intended to help get you setup with CollabVM 1.2.11 along with an NGINX server to handle your requests. You may host it publicly or run it privately.
===VM Descriptions===
These instructions are tested '''only''' with Debian 11 and CollabVM 1.2.11. If you vary, you will have to substitute commands for your own. Basic Linux knowledge is '''strongly''' recommended.
Inside <code>src/Database/VMSettings.h</code>, there is a declaration for a string named "Description". However, it appears no code was written for it.


However, by adding [[HTML]] tags after the Display Name of a VM, it is possible to create something like a description. This is frequently used in [[UserVM]]s.
= Installation =
== Basic server requirements ==
* OS: Windows is '''not''' supported (but works). As said, these instructions are tested with Debian 11. Most Linux distributions will work, however.
* CPU: Preferably one which supports hardware virtualization. It is not required, but performance may suffer without it.
* RAM: You will need enough RAM to host your OS, CollabVM and the associated virtual machine. Have at least 2 GB of RAM free.
* Disk: Technically you need only about 50 megabytes of storage to run CollabVM, however you will need space for NGINX and your associated VM. Have atleast 4 GB of free storage, much more (>16GB) if you are hosting full Windows VMs.
* Permissions: You'll likely need root-level access to the server you're using in order to install packages for the system. However, collab-vm-server should '''NEVER''' be run as root! (or administrator privileges, when on Windows)


===Frame rate limiter===
== collab-vm-server setup ==
Before the removal of ODB, there was a commented declaration for "FrameRate" inside <code>src/Database/Config.h</code>.
Do the following under a user with limited privileges (with the exception of sudo commands, if you wish):
# You will need to grab the required libraries and some additional tools for collab-vm-server:
#* <code>sudo apt install -y libboost-dev libboost-system-dev libcairo-dev libvncserver-dev libc-dev libturbojpeg-dev libsqlite3-dev make clang git</code>
# Next, you'll want to clone (download) the collab-vm-server repository: <code>git clone https://github.com/computernewb/collab-vm-server-1.2.git -b release/1.2.11 --recurse-submodules</code>
# Now, change directory: <code>cd collab-vm-server</code>
# Since we will run collab-vm-server under NGINX, we will need to modify two files:
#* Using the editor of your choice, edit the file <code>src/websocketmm/websocket_user.cpp</code> inside the CollabVM source code. Remove the double slashes in the line containing <code>//#define WEBSOCKETMM_SUPPORT_PROXYING</code>.
#* The next file to edit is <code>src/CollabVM.cpp</code>. Here, look for a line containing <code>server_->start("0.0.0.0", port);</code>. Change the <code>0.0.0.0</code> to <code>127.0.0.1</code>
#** What we've done here is make it so CollabVM listens only on localhost. This way, malicious users cannot spoof their IP address by setting headers.
# To compile collab-vm-server, execute this command: <code>make -j$(nproc) JPEG=1</code>
#* If you would not like JPEG support (not recommended!) you can leave out the <code>JPEG=1</code> flag. Do not disable this unless you know what you are doing.
#* Note that this command will also use all of your cores, if you would like to utilize less cores, replace <code>$(nproc)</code> with the amount of cores you'd like to use
The collab-vm-binary is now compiled and ready to be used. It doesn't provide a proper HTTP server though, so it will not run


== Webapp setup ==
==Web App==
===Username colors===
Again, continue doing the following here under a user with limited privileges.
At one point, CollabVM Server 1.x had different username colors which indicated ranks. Red indicated an administrator, blue indicated a developer, and black indicated a registered user. These roles were never finished and mostly don't work properly.
=== Main webapp ===
# Go back 1 directory: <code>cd ..</code>
# Install node.js:
## First, you need curl: <code>sudo apt install -y curl</code>
## Run this command: <code>curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -</code>
## Then install it: <code>sudo apt install -y nodejs</code>
# Get the web app: <code>git clone https://github.com/computernewb/collab-vm-web-app.git</code>
# Change directory into the webapp <code>cd collab-vm-web-app/</code>
# Install the required packages: <code>npm i</code>
# And install gulp globally: <code>sudo npm i -g gulp</code>
# Time to edit another file:
#* Edit <code>src/js/collab-vm/common.js</code>, look for the line containing <code>serverAddress: window.location.host,</code>, change it to <code>serverAddress: window.location.host + '/cvmws',</code>
# Now run <code>gulp</code>, let it build the web app.
=== Admin webapp ===
# Go back 1 directory, once again: <code>cd ..</code>
# Grab the admin webapp: <code>git clone https://github.com/computernewb/collab-vm-admin-web-app.git</code>
# Now change directory into the admin webapp <code>cd collab-vm-admin-web-app/</code>
# Then install the packages, once again: <code>npm i</code>
# We need to modify the same file:
#* Edit <code>src/collab-vm/common.js</code>, this time replacing <code>var serverAddress = window.location.host;</code> with <code>var serverAddress = window.location.host + '/cvmws';</code>
# Now run gulp once again: <code>gulp</code>
=== Constructing your HTTP directory ===
We will be creating the directory in <code>/home/test/collab-vm-www</code>, please substitute the commands as needed.
# First we will create the directory: <code>mkdir /home/test/collab-vm-www/</code>
# Now we will add a file inside:
#* Create the file <code>index.html</code> with the following content: <syntaxhighlight lang="html">
<!DOCTYPE html>
<html>
<head>
<title>...</title>
<meta http-equiv="refresh" content="0; url=/collab-vm/" />
</head>
<body>
</body>
</html>
</syntaxhighlight>
# Next, copy the main webapp into your www directory: <code>cp -r collab-vm-web-app/build /home/test/collab-vm-www/collab-vm</code> (Don't forget the <code>collab-vm/</code>)
# And the admin webapp: <code>cp -r collab-vm-admin-web-app/build /home/test/collab-vm-www/admin</code>
Now you have a working HTTP root for your Collab VM installation. We will be using NGINX in the next step in order to host this directory.


The red "Administrator" rank was officially added back into CollabVM Server version 1.2.9.
== NGINX installation ==

We will be installing and configuring NGINX to host our webapp and proxy connections to the collab-vm-server instance. In this case, we are using port 6004, with collab-vm-server using port 6005 and our root directory being the same as previously (<code>/home/test/collab-vm-www</code>). We are also not accepting IPv6 connections, which may need some additional configuration.
[[File:AdminUser.png]]
# First, install NGINX: <code>sudo apt install nginx -y</code>

# Next, you will want to add an additional site configuration to NGINX.
The blue developer role only exists in the CSS, and no trace of it exists in the server. Presumably, this color would have been used by [[Cosmic Sans]], [[Dartz]], and [[Geodude]].
#* Create the file <code>/etc/nginx/sites-enabled/collab-vm</code>, and insert the following contents inside. If needed, substitute the values as necessary. Root privileges might be required to edit this file. <syntaxhighlight lang="nginx">

server {
[[File:DeveloperUser.png]]
listen 6004; # Listen on port 6004

access_log /var/log/nginx/cvm.log; # Log visitors to this file
There is a reference to a "RegisteredUser" role in the server, so there is some support in the server for it, although there is currently no way to activate it through normal means. It is rather difficult to distinguish a guest user from a normal user although if you look at it very closely, you can tell a user has a darker shade of black than a guest.
root /home/test/collab-vm-www/; # This will be your root www directory

location /cvmws {
This suggests that at some point, guests were meant to have different colors than registered users.
proxy_pass http://127.0.0.1:6005; # This will be the port collab-vm-server will be listening on

proxy_http_version 1.1;
It is worth noting that at one point, accounts were meant to be added into CollabVM Server 1.2, but this was cut and was added into CollabVM Server 2.0 instead.
proxy_set_header Upgrade $http_upgrade;

proxy_set_header Connection "Upgrade";
[[File:RegisteredUser.png]]
proxy_set_header Host $host:$server_port;

proxy_buffering off;
==Admin Panel==
proxy_redirect off;
===Connect to Monitor===
proxy_set_header Sec-WebSocket-Extensions $http_sec_websocket_extensions;
A "Connect to Monitor" button is present in the admin panel but is commented out. This was presumably used in a very early iteration of the Admin Panel as the panel automatically connects to the QEMU Monitor in newer versions.
proxy_set_header Sec-WebSocket-Protocol $http_sec_websocket_protocol;

proxy_set_header Sec-WebSocket-Key $http_sec_websocket_key;
===Disable Change Username===
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Presumably would allow you to prevent username changing on the VM. No code for this function exists in the server.
proxy_connect_timeout 10s;

proxy_read_timeout 36000s;
===Disable Virtual Keyboard===
proxy_temp_file_write_size 16k;
Presumably would allow you to prevent using the virtual Guacamole keyboard. No code for this function exists in the server.
}

location / {
===Restore Periodically===
try_files $uri $uri/ =404;
Alongside "Restore on Shutdown", a feature to restore a VM periodically is present, but commented out in the source code. Code for this feature is also present in the server. It allowed you to automatically restore a VM every x amount of hours and x amount of minutes. This would have a similar function to [[socket.computer]] which restored every 15 minutes. This feature was never finished and does not work correctly.
}

}
===Disable Web Server===
</syntaxhighlight>
This would presumably allow you to disable the internal web server. No code for this function exists in the server.
# Now, enable and start NGINX using these commands:

## <code>sudo systemctl enable nginx</code>
[[Category:Documentation]]
## <code>sudo systemctl start nginx</code>
[[Category:Other Things]]
Now, visit your server's IP address on port 6004. If the IP address were <code>192.168.1.100</code>, then visit http://192.168.1.100:6004/ in your browser. It should load the CollabVM interface with an endless loading spinner.

Revision as of 20:48, 2 October 2021

CollabVM Server is everyone's favorite server that powers CollabVM. This article covers CollabVM Server 1.

Server

VM Descriptions

Inside src/Database/VMSettings.h, there is a declaration for a string named "Description". However, it appears no code was written for it.

However, by adding HTML tags after the Display Name of a VM, it is possible to create something like a description. This is frequently used in UserVMs.

Frame rate limiter

Before the removal of ODB, there was a commented declaration for "FrameRate" inside src/Database/Config.h.

Web App

Username colors

At one point, CollabVM Server 1.x had different username colors which indicated ranks. Red indicated an administrator, blue indicated a developer, and black indicated a registered user. These roles were never finished and mostly don't work properly.

The red "Administrator" rank was officially added back into CollabVM Server version 1.2.9.

The blue developer role only exists in the CSS, and no trace of it exists in the server. Presumably, this color would have been used by Cosmic Sans, Dartz, and Geodude.

There is a reference to a "RegisteredUser" role in the server, so there is some support in the server for it, although there is currently no way to activate it through normal means. It is rather difficult to distinguish a guest user from a normal user although if you look at it very closely, you can tell a user has a darker shade of black than a guest.

This suggests that at some point, guests were meant to have different colors than registered users.

It is worth noting that at one point, accounts were meant to be added into CollabVM Server 1.2, but this was cut and was added into CollabVM Server 2.0 instead.

Admin Panel

Connect to Monitor

A "Connect to Monitor" button is present in the admin panel but is commented out. This was presumably used in a very early iteration of the Admin Panel as the panel automatically connects to the QEMU Monitor in newer versions.

Disable Change Username

Presumably would allow you to prevent username changing on the VM. No code for this function exists in the server.

Disable Virtual Keyboard

Presumably would allow you to prevent using the virtual Guacamole keyboard. No code for this function exists in the server.

Restore Periodically

Alongside "Restore on Shutdown", a feature to restore a VM periodically is present, but commented out in the source code. Code for this feature is also present in the server. It allowed you to automatically restore a VM every x amount of hours and x amount of minutes. This would have a similar function to socket.computer which restored every 15 minutes. This feature was never finished and does not work correctly.

Disable Web Server

This would presumably allow you to disable the internal web server. No code for this function exists in the server.