# Janus Server

## Update

If the janus server is already running with the FREE 0.3.0 version it is only necessary to guarantee that the admin secret is defined.

Edit the janus.plugin.streaming.jcfg file in the /var/snap/janus-gateway/common/etc ​ directory and guarantee that the admin_key is defined:

general :
{
rtp_port_range = "6000-7000";
};


## Installation

To install the Janus stream server you will need to run the following commands on your Debian 11 machine:

sudo apt install snap​

sudo apt install snapd

sudo snap install janus-gateway​


### Configuration

The configuration of janus is done editing a file in the /var/snap/janus-gateway/common/etc​ directory

Edit the janus.plugin.streaming.jcfg file

Define an administration secret​ by uncommenting the line 104) or the one that contains the admin_key string= and changing the string to a suitable value.

Define the possible ports that Janus will use to ​receive the video stream from the pendulum by uncomment line 106​) or the one containing the string rtp_port_range= and define the available ports (for example to 6000-7000​).

Delete the sample pre-configure endpoints by deleting all lines from line 124.

Restart Janus by running the command:

sudo snap restart janus-gateway​


### Example of janus configuration

After the configuration of a newly installed Janus Server the janus.plugin.streaming.jcfg should only containg the following

general :
{
rtp_port_range = "6000-7000";
};


# FREE Server

Due to changes on the database it is ot possible to reuse the FREE 0.3.50 database, as such it is necessary to install this new version on a new directory and after installation copy the pendulums information from one version to the other

## Installation of source code

Create a new folder for the new version of FREE.

• For example mkdir wpa_free_050

wget https://github.com/e-lab-FREE/FREE_Web/releases/latest/download/FREE_Web_0_5_0.zip


• For example unzip FREE_Web_0_5_0.zip -d wpa_free_050/

Enter the directory conantaining the code.

• For example cd wpa_free_050/

Create a new python virtual environment, it should be called free-env:

virtualenv -p python3 free-env


Activate the virtual environment:

source free-env/bin/activate


You should now see a prefix of (free-env) in your command line.

After that, install the dependent packages:

pip install -r REQUIREMENTS.txt


## Installation of new database

Since the data model was change it is necessary to download and install a new empty database.

This database is configured with two users and the WPA pendulum apparatus types and protocols.

This database contains a Pendulum experiment, as well as two example user accounts.

• wp-guest - guest account

Both users have a temporary123 password.

## Configuration

The application is configured using environment variables.

You can set them using the /freeweb/.env file.

There is a .env-template file in the ~freeweb folder, that can be renamed to .env  :

mv freeweb/.env-template freeweb/.env


It is necessary to define correct values for the following variables. Some of these vaues can be copied frm the previous version .env file.

• PROJECT_NAME, PROJECT_ACRONYMUM, SITE_NAME - Texts that will appear in the page header
• TIME_ZONE - Time zone setting for tha app in TZ database name from https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List.
• FREE_PRODUCTION - set to on to enable production mode (disables sensitive error messages etc.)
• FREE_REVERSE_PROXY - set to on to be able to run the FREE behind a reverse proxy
• FREE_SECRET - String used in hashing function. Set either to a random string of your choice, or generate one here: https://djecrety.ir
• FREE_ALLOWED_HOSTS - comma separated list of domain names/addresses; only requests to these hosts will be processed by the application. This is necessary to prevent HTTP Host header attacks.
• JANUS_SERVER_ADDRESS, JANUS_STREAM_KEY - Configuration of Janus video streaming server.

## FREE server execution

to start the FREE server run the following command:

daphne freeweb.asgi:application
`

By default, the webserver will be available at port 8000. To change the port, pass -p <portnumber> parameter to the daphne command. You can also force binding to specific addres by -b <address>.