WPA FREE 0.5.1 Instalation

From wwwelab
Jump to navigation Jump to search

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 :
{
  admin_key = "elab1";
  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 :
{
  admin_key = "elab1";
  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

Download the Zip file containing the code

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

Unzip the downloaded file into the new directory.

  • 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.

Download the database and put it into the project root:


wget https://github.com/e-lab-FREE/FREE_Web/releases/latest/download/db_template_0_5_0.sqlite3 -O db.sqlite3

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

  • wp-admin - superuser account with access to admin interface
  • wp-guest - guest account

Both users have a temporary123 password.

This password should be changed through admin interface.

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>.


Copy of pendulum infomation

Raspberry Pi Proxy

Due to changes on the API and the database you will need to make a upgrade to this version of the Proxy.

Installation of source code

Create a new folder for the new version of Proxy (compateble to the Version of the FREE server).

  • For example mkdir Proxy_050

Download the Zip file containing the code

wget https://github.com/e-lab-FREE/RPi_Proxy/releases/latest/download/RPi_Proxy_0_5_0.zip 

Unzip the downloaded file into the new directory.

  • For example unzip RPi_Proxy_0_5_0.zip -d Proxy_050/

Enter the directory conantaining the code.

  • For example cd Proxy_050/

After that, install the dependent package:

For the Proxy:

sudo apt install python3
sudo apt install python3-pip
pip3 install pyserial

And for streaming the video:

sudo apt-get install gstreamer1.0-tools
sudo apt-get install gstreamer1.0-plugins-good
sudo apt-get install gstreamer1.0-plugins-bad
sudo apt-get install gstreamer1.0-plugins-ugly
sudo apt-get install gstreamer1.0-plugins-base

Configuration

Proxy execution

Copy of pendulum infomation