Getting Started

After recording is done with Jibri, you may want upload those recordings to an external service for storage. In this particular post, we’re going to learn how we can integrate external storage with AWS S3 bucket in to Jibri as storage.

Prerequistes

The following are required before following this tutorial

  • You have a working Jitsi Installation.
  • You have configured Jibri to work with your Jitsi Installation.
  • You have an AWS S3 Bucket setup.

Quick Start

Assuming our config.json looks like the one below

{
  "recording_directory": "/home/jibri",
  "finalize_recording_script_path": "/home/jibri/finalize_recording.sh",
  "xmpp_environments": [
    {
      "name": "prod environment",
      "xmpp_server_hosts": ["jitsimeet.easyjitsi.com"],
      "xmpp_domain": "jitsi.easyjitsi.com",
      "control_login": {
        "domain": "auth.jitsimeet.easyjitsi.com",
        "username": "jibri",
        "password": "jibriauthpass"
      },
      "control_muc": {
        "domain": "internal.auth.jitsimeet.easyjitsi.com",
        "room_name": "JibriBrewery",
        "nickname": "jibri-nickname-instance"
      },
      "call_login": {
        "domain": "recorder.easyjitsi.com",
        "username": "recorder",
        "password": "jibrirecorderpass"
      },
      "room_jid_domain_string_to_strip_from_start": "conference.",
      "usage_timeout": "0"
    }
  ]
}

Log into your Jibri Server using ssh

ssh root@192.168.100.1 -t "cd /home/jibri;bash"

Populate the finalize script file with the content below

Replace the variables below with the right parameters

# AWS credentials
AWS_ACCESS_KEY=yourawsaccesskey
AWS_SECRET_KEY=youawssecretkey
AWS_DEFAULT_REGION=yourawsregion
S3_BUCKET_NAME=nameofawss3bucket

RECORDINGS_DIR=$1

echo "Uploading the recording to S3"

# Get the folder name
RECORDINGS=`ls $RECORDINGS_DIR/*.mp4`
RECORDINGS=`basename $RECORDINGS`
FOLDER_NAME=$(echo $RECORDINGS | tr "_" "\n")

for name in $FOLDER_NAME
do
FOLDER_NAME=$name
break
done



upload(){

echo "Uploading..."
# Set credentials for aws cli
aws configure set aws_access_key_id $AWS_ACCESS_KEY
aws configure set aws_secret_access_key $AWS_SECRET_KEY
aws configure set default.region $AWS_DEFAULT_REGION

# Upload to S3
aws s3 sync $RECORDINGS_DIR s3://$S3_BUCKET_NAME/recordings/$FOLDER_NAME/

# Get the instance ID and terminate the EC2 instance
die() { status=$1; shift; echo "FATAL: $*"; exit $status; }
INSTANCE_ID="`wget -q -O - http://169.254.169.254/latest/meta-data/instance-id || die \"wget instance-id has failed: $?\"`"

aws ec2 terminate-instances --instance-ids $INSTANCE_ID


}


upload
Author

Write A Comment