UserVM Handbook/Windows: Difference between revisions

no edit summary
No edit summary
net stop collabvm
}}
 
== Setting up reverse proxying ==
'''This is REQUIRED for UserVM as, for technical reasons, only TLS-equipped WebSockets can be accepted'''
 
We strongly recommend you proxy your UserVM behind Nginx, to provide additional security and allow things like TLS. It also makes your VM look a lot cleaner, allowing people to access it on your main HTTP(s) port and on a subdirectory, like <code>https://example.com/collab-vm/</code> rather than <code>http://example.com:6004</code>. Here's a brief tutorial of how to set that up on the Nginx side.
 
This assumes you're setting up a Nginx site from scratch. If not, you can skip most of this and just add the relevant config snippets to your configuration.
 
First, you'll need to acquire a domain. You can also get free subdomains from https://freedns.afraid.org. Make sure your domain or subdomain is pointed to your IP address and ports are open.
 
Next, install nginx:
 
{{code|lang=batch|
choco install nginx
}}
 
Then, you'll want to save [https://computernewb.com/~elijah/wsproxy_params wsproxy_params] to your Nginx directory, which enables WebSocket proxying.
 
{{code|lang=batch|
cd C:\tools\nginx*
curl https://computernewb.com/~elijah/wsproxy_params -o wsproxy_params
}}
 
If you use Cloudflare reverse proxying, make SURE to open this file and uncomment the indicated line.
 
Create a directory to store site configurations:
 
{{code|lang=batch|
mkdir sites
}}
 
Open up <code>conf\nginx.conf</code> and add the following to the bottom of your <code>http { ... }</code> block:
 
{{code|lang=nginx|<nowiki>
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
include ../sites/*.conf;
</nowiki>}}
 
Now, create a configuration for your nginx site that includes a proxy statement for your VM.
 
'''C:\tools\nginx-[version]\sites\example.com.conf'''
{{code|lang=nginx|<nowiki>
server {
server_name example.com;
listen 80;
index index.html;
# You can change this to the absolute path of your site's webroot, or leave it if you don't have a site other than CollabVM
root html;
 
location /collab-vm/vm1 {
include ../wsproxy_params;
proxy_pass http://127.0.0.1:6004/;
}
}
</nowiki>}}
 
The last step is to set up SSL (if you use Cloudflare reverse proxying you can skip this as Cloudflare will handle SSL for you). Install win-acme:
 
{{code|lang=batch|
choco install win-acme
refreshenv
}}
 
Create a directory for the SSL certs:
 
{{code|lang=batch|
mkdir ssl
}}
 
Grab the certs. Example command:
 
{{code|lang=batch|<nowiki>
wacs --host example.com (REPLACE WITH YOUR DOMAIN) --webroot html (REPLACE WITH YOUR WEBROOT IF YOU CHANGED IT) --validation filesystem --source manual --store pemfiles --pemfilespath ssl --accepttos
</nowiki>}}
 
Install the certs to your nginx conf:
 
'''C:\tools\nginx-[version]\sites\example.com.conf'''
{{code|lang=nginx|<nowiki>
server {
server_name example.com;
listen 80;
listen 443 ssl;
ssl_certificate ../ssl/example.com-chain.pem;
ssl_certificate_key ../ssl/example.com-key.pem;
}
</nowiki>}}
 
Finally, restart nginx to apply the config
 
{{code|lang=batch|
net stop nginx
net start nginx
}}
 
If all went well, your VM is now available at <code>wss://example.com/collab-vm/vm1</code>
 
== Permanently host the webapp ==
If you want to host the webapp on your website, you can build it as follows:
{{code|
cd C:\collabvm\collab-vm-1.2-webapp
yarn build
}}
Then, copy the contents of the <code>dist</code> directory to your website. For example, if your webroot is at <code>/var/www/example.com</code>, and you want your webapp at example.com/collab-vm/:
{{code|
xcopy /S /Y dist C:\path\to\your\webroot\collab-vm\
}}
The webapp should now be accessible at your website.
== Logging in as an admin (or mod) ==
Logging in is very simple. Just join the VM, and double click your username. Enter your admin or mod password into the prompt, and you should be authenticated and able to use staff actions.
== Getting your UserVM on the roster ==
Now you can have your UserVM put on the roster! Join our [https://discord.gg/a4kqb4mGyX Discord], and create a post in #support with the <code>uservm roster update</code> tag, including your VM's WebSocket URL. You can ping me (@elijahr.dev) if you'd like.