Giter Club home page Giter Club logo

session-local's Introduction

Session

Real-time video streaming paltform developet mainly using Nginx server components with added nginx-rtmp module.

Platform consists of Ingest service, CDN (Content Delivery Network) service, Ingest and CDN Proxy.

Content in received through the Ingest proxy service, implemented using Haproxy tcp proxy and load balancer. This component will keep track of active Ingest service instances and balance the incoming traffic accordingly using leastconn alghoritm.

Ingest service receives the content forwarded by the Ingest proxy, does secret streaming key validation (considering passed credentials in the form of the cookies) by contacting the auth service. If valid, received content is trancoded in three different qualities (size and maximum allowed bitrate) using ffmpeg and h.264 compression format (libx264 implementation) and forwarded towards the CDN proxy.

CDN proxy is a simple implementation of Nginx server component which receives content using rtmp protocol and forwards it towards all active instances of CDN service again using ffmpeg.

CDN service receives content sent from the CDN proxy, does content fragmentation so it can be shared using HLS protocol, generates cryptographic keys and master .m3u8 playlist containing all possible bitrate/quality information necessary for successfull use of Variable bitrate techique.

The rest of the services, not directly involved in video streaming (Stream registry, Authentication service and CDN Manager service) are developet in the form of simple HTTP Rest api's using Python.

The frontend is developed using React web development library. Using Frontend app, clients can create account using email and password, generate unique secret streaming key required for video streaming, update info (title and category) for existing stream, browse other live streams using search bar or provided category switcher, watch some of the live streams, chat with other viewers and follow choosen stream so it will stay on the front page is the followed streamer is live.

For the purpose of platform architecture abstarction, all of the http requests towards the backend services should be sent towards the single Gateway proxy service which will then rout them accordingly. This service is also implemented using Nginx http server.

As an authentication and authorization service, Supertokens auth platform is used.

Manual

All of the services are expected to be run inside the docker containers. For this purpose docker-compose.yaml and appropriate dockerfiles are created (under the dockerfiles directory).
For convinient starting of the necessary services up.sh bash script, located at the project root can be used (after the docker compose build commant has been run in order to pull or build necessary docker images). This script will start all the necessary backend services including:

  • two instances of ingest service
  • ingest proxy instance
  • cdn proxy instance
  • two cdn instance
  • gateway instance
  • container hosting react web app.

Together will all of the services, bridge type docker network will be created. Since credentials are shared in the form of cookies, inside the http requests, platfrom's services (including frontend web app) have to be accessed using session.com domain name. This can be achieved by editing /etc/hosts configuration file (on linux systems) by adding mapping 'localhost session.com'. Other mappings necessary for paltform's functioning are ip addresses for each cdn service instance. Finally /etc/hosts file should look like this:

172.23.1.20	eu-0-cdn.session.com  
172.23.1.21	na-0-cdn.session.com  
172.23.1.22	as-0-cdn.session.com  
127.0.0.1	session.com  
127.0.0.1	localhost

Other scripts for easier services management are located under project_root/utils.

session-local's People

Contributors

saltypretzel303 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.