Home

Awesome

The signaling Server for LiveLab

ChangeLog

[12.09.2020] automating local/production server switching

[05.18.2020] Running Locally

Instruction

This is the repo for the signaling server of LiveLab.

To self-host or to run this signaling server locally, you need to clone this repo, and operate it as follows:

Update the content and file name for the .env-sample file

First, change the filename from .env-sample to .env, either manually or by running in your terminal $ mv .env_example .env

Then, inside the .env file, fill in your

Update the file name for the certs_example folder

Next step, change the folder name of certs_example to certs, either manually or by running $ mv .certs_example .certsin your terminal

Obtain public SSL certificates to allow secure connections

Secure your self-hosted server with public SSL certificates generated by free certificate authorities (CA) such as LetsEncrypt ( which points you to certbot )

Following the instructions provided and you will obtain two certificate files, fullchain.pem and privkey.pem.

Move the two files to be under the certs folder and replace the empty placeholder files fullchain.pem and privkey.pem

Generate locally-trusted SSL certificates

Secure your local signaling server with locally-trusted SSL certificates by using mkcert.

mkcert is a simple tool for making locally-trusted development certificates. It requires no configuration.)

After installing mkcert, create a new local CA at the local server directory:

$ mkcert -install

Request the local CA at your localhost:

$ mkcert localhost

Running the commands above generates two certificate files, localhost.pem and localhost-key.pem.

Move the two files to be under the certs folder and replace the empty placeholder files localhost-key.pem and localhost.pem

Warning: the four newly generated .pem files grant complete power to intercept secure requests from your machine. So store them safely and never share them.

To Run the signaling server

After preparing all the files required above, you should install all the required dependencies by running

npm install

next step, you could either run the signaling server locally or host it on a webServer.

to run the signaling server locally:

*if you have specified a port number in .env file

npm run local

*or you can use the command line to specify a port number (e.g: 1000)

PORT=1000 npm run local

Now you can access your local server at https://localhost:{port you've selected} e.g. https://localhost:1000

to host the signaling server on a webServer:

npm start or PORT=[*the number at your choice] npm run local

Now you can access your webServer and visit the signaling server at

https://yourwebsite.com:{port you've selected} e.g. https://yourwebsite.com:1000