Setup from Scratch¶
Manual Setup installs each component individually to maximize control and configurability. All components can be installed into a single machine, provided the machine has an FQDN, and is strong enough to meet the requirements. Please make sure the certificate for the domain includes not only the domain itself, but all its belonging subdomains as well. You may ensure it by using a wildcard like “*.mydomain.com” when procuring the certificate.
Setting Up Purpie¶
Requirements¶
Getting Started¶
git clone https://github.com/doganbros/purpie # Clone Repository
cd purpie
Install dependencies with
yarn install
Set Environment Variables Into .env File¶
You may configure the environment by making a copy of the boilerplate provided. The functionality of each environment variable is documented within the .env.example
file.
cp .env.example .env # Then make changes to the boilerplate provided
Variable |
Example |
Explanation |
---|---|---|
NODE_ENV |
development |
The environment your application runs in. |
SERVER_PORT |
8000 |
The port the backend server is running on. |
PORT |
3000 |
The port the frontend serves from. |
HOST |
purpie.io |
Host address for backend and frontend. |
PURPIE_API_KEY |
YOUR_API_KEY |
Key for access API directly with PURPIE_API_SECRET |
PURPIE_API_SECRET |
YOUR_API_SECRET |
Secret for access API directly with PURPIE_API_KEY |
RTMP_INGRESS_URL |
ingress.yourrtmp.com |
The RTMP server Purpie pushes your streams to. |
RTMP_EGRESS_URL |
egress.yourrtmp.com |
The RTMP server Purpie pulls steams from to display. |
Creating Postgres Database¶
Please follow the steps below to get a development Postgres server running. The easiest way to use docker. If you have running Postgres database server you can skip these steps and simply create an Purpie database.
Make sure you have docker installed on your computer. If you do not have docker already on your computer, Go to this link, choose your platform and click download. Follow the simple steps to get docker installed on your computer.
Open your terminal (command prompt or preferably powershell on windows).
Enter the command
docker run --name purpie-dev -e POSTGRES_PASSWORD=$YOUR_POSTGRES_PASSWORD -p 5432:5432 -d postgres
. Postgres docker image will be downloaded and Postgres Docker container with the name purpie-dev will up and serve from port 5432 after this command.Run
docker exec -it purpie-dev psql -U postgres
to connect your Postgres database.Inside the docker container, run
CREATE DATABASE 'purpie';
to create your Purpie database.Run
\q
to quit from Psql and Docker container.Remember to update
DB_USER
,DB_PASSWORD
,DB_DATABASE
andDB_HOST
.env variables to your database user name, database password database name, and database host respectively.
Running Purpie¶
yarn server:start:dev # Runs backend side in dev mode
yarn start:server # Runs backend in production
yarn start:web # Runs frontend side
You may refer to this sample NGINX config to set up your Purpie web server.
Setting up Jitsi¶
Installing Jitsi with JWT support¶
Purpie mmakes use of Jitsi for video streaming and live meeting purposes. It requires a Jitsi installation with JWT token support. You can refer to this document by us to install Jitsi. Remember to update the .env
variable by setting JWT_APP_ID
’s value to YOUR_APP_ID
, JITSI_SECRET
to YOUR_SECRET
and JITSI_DOMAIN
to the domain where you set up jitsi.
Installing Purpie Jitsi Module¶
This module is a React Module that applies on top of Jitsi to provide visual and functional differentiations. To avoid issues regarding version mismatch, start with the customized Jitsi repo below;
git clone https://github.com/doganbros/purpie-jitsi-meet.git
cd purpie-jitsi-meet
The module is included in the package.json file within the repository. Therefore, you are able to simply follow the promtps as shown;
npm install
export WEBPACK_DEV_SERVER_PROXY_TARGET=https://yourdomain.com
make
At this point, your customized Jitsi is built and ready to serve. Make sure to edit the NGINX configuration accordingly to make use of your new directory.
Integrating Jitsi with Purpie¶
This .lua module for Jitsi Meet manages the integration between purpie and Jitsi. It enables Jitsi to send reports to Purpie. To enable it, follow the instructions below.
cp ./external/prosody-modules/mod_purpie.lua /usr/share/jitsi-meet/prosody-plugins
Configuring Prosody¶
Edit your prosody configuration at
/etc/prosody/conf.d/your.domain.com.cfg.lua
, and add the following lines.
purpieApiKey = "yourAPIkey";
purpieApiSecret = "yourAPIsecret";
purpieAPIBaseUrl = "https://your.baseAPI.url";
In the same file, add purpie to the list of enabled modules of the conference component like below;
Component "conference.meet.doganbros.com" "muc"
restrict_room_creation = true
storage = "memory"
modules_enabled = {
"muc_meeting_id";
"muc_domain_mapper";
"polls";
"purpie";
"token_verification";
}
admins = { "focus@auth.meet.doganbros.com" }
muc_room_locking = false
muc_room_default_public_jids = true
Installing Jibri¶
To install Jibri you can follow this tutorial.
Customizing the Finalize Script¶
Find the following in your
/etc/jitsi/jibri/jibri.conf
file, and replace path with/srv/finalize/purpie-finalize.sh
jibri {
recording {
finalize-script = <path>
}
}
Copy the included finalize.sh file to your finalize script directory. This .sh file runs upon the completion of recording, and both uploads the recorded file to an S3 bucket, and manages Jibri’s integration with Purpie.
cp {./external/jibri/purpie-finalize.conf, purpie-finalize.sh} /srv/finalize
Edit
/srv/finalize/purpie-finalize.conf
accordingly, and restart Jibri.
Setting up the Ingress RTMP servers¶
For Purpie, you will need at least one ingress server, and as many additional egress servers as you need for ease of autoscalability. To install NGINX rtmp server, you can follow the guide in this page. Remember to update the RTMP_INGRESS_URL
and RTMP_EGRESS_URL
.env variables to your ingress and egress server url respectively.
Integrating the RTMP server with Purpie¶
Head into the RTMP server, and use the following to copy the required scripts.
sample-nginx.conf
contains a working example for an RTMP server, who calls uponpurpie.sh
in its workflow.purpie.sh
is the script that maintains the integration between the RTMP server and Purpie.purpie-sh.conf
contains customizable variables for the script.
mkdir /home/purpie
cp {./external/rtmp/purpie.sh, ./external/rtmp/purpie-sh.conf} /home/purpie
cp ./external/rtmp/sample-nginx.conf /etc/nginx
Navigate to
/home/purpie
and edit the contents ofpurpie-sh.conf
accordingly. Then restart nginx.
systemctl restart nginx