Best Flask open-source libraries and packages

Lecture2Gether

A tool for synchronized online streaming
Updated 1 year ago

Logo

Lecture2Gether

Watch online lectures together!

View Demo · Report Bug · Request Feature · Send a Pull Request

About The Project

Lecture2Gether makes it possible to watch online lectures with friends by pasting a link to a Lecture2Go Video, a YouTube Video, Google Drive Video or a simple .mp4 link. The video streams are synchronized to partially restore the social aspect of campus life.

Flask CI    Node.js CI    Kubernetes configuration

Screenshots

Screenshot Frontpage Screenshot Player

Install

Using docker (or podman)

You can either build the image from source or use one of the provided versions from our Docker Hub Repository.

# for building from source
docker build -t lecture2gether .
docker run -p 8000:8000 lecture2gether

# for running from docker hub
docker run -p 8000:8000 thenerdful8/lecture2gether

This will start the whole application stack and expose it at http://localhost:8000/.

Full Development Environment

For development we recommend building a dev container (defined in default Dockerfile) and mounting your local sources into it.

This can be done by simply executing the dev_up.sh script. Any arguments appended to this script are passed to the container runtime so if you want to define environment variables you should use a -e NAME=VALUE flag. By default the script uses docker as a container runtime but you can choose a different one (like podman) by exporting the environment variable CONTAINER_RUNTIME before executing the script.

Install single Backend

The backend runs on a redis database. Run the redis docker docker run -it -p 6379:6379 redis:buster or install manually by following this guide. Set the environment-variables 'REDIS_HOST', 'REDIS_PORT', 'REDIS_DB', 'REDIS_PASSWORD' accordingly.

#Clone the repository
git clone https://github.com/TheNerdful8/Lecture2Gether

#Go to the backend folder
cd Lecture2Gether/lecture2gether_flask/

#Get Poetry
pip3 install poetry --user

#install the dependencies
poetry install --no-root

#start the server manually
poetry run python app.py

Install single Frontend

Install npm on your machine

#Clone the repository
git clone https://github.com/TheNerdful8/Lecture2Gether

#Go to the frontend folder
cd Lecture2Gether/lecture2gether-vue/

#Install required npm dependencies
npm install

#Run the application with
npm run serve

Configuration

How to configure

The application is configured at two places:

  1. Environment variables for the backend
  2. A settings.json file for the frontend

Defaults defined in the source code were chosen to work in a development environment. The Container Image uses different defaults for the frontend which make more sense in a production environment (defined in docker/settings.json).

Detailed Configuration possibilities

The server can be configured via the following environment variables

Name Default Value Description
SECRET_KEY codenames Change this in production
REDIS_HOST localhost Hostname of the redis database which should be used
REDIS_PORT 6379 Port on which redis listens on the redis-host
REDIS_DB 0 Which database on the redis server should be used
REDIS_PASSWORD empty Password to authenticate at the redis server
CLEANUP_INTERVAL 900 Interval (in seconds) of searching for abandoned rooms
CLEANUP_ROOM_EXPIRE_TIME 3600 Time (in seconds) until an empty room gets abandoned
CLEANUP_MAX_ROOM_LIFE_TIME 86400 Time (in seconds) until an active room gets abandoned
LOGLEVEL INFO Configures the python logging loglevel
GOOGLE_YOUTUBE_API_KEY empty Google YouTube Data v3 API-key, used to extract meta data from YouTube videos
GOOGLE_DRIVE_API_KEY_BACKEND empty Google Drive API key, used to access meta data in the backend
GOOGLE_DRIVE_API_KEY_FRONTEND empty Google Drive API key, used to access Google Drive files in the frontend (see warning [1])
SENTRY_DSN empty Sentry connection DSN
SENTRY_ENV default Sentry environment

[1] This key is publicly readable, restrict its usage to the used website (e.g. https://lecture2gether.eu) and Google Drive in the Google API console.

The frontend is configured via a settings.js file which should be reachable on a request to /settings.js from the running browser application. This Javascript file must register the variable window.L2GO_SETTINGS which must be an object defining the below described properties. It can be mounted into our provided container under /app/config/settings.js.

The frontend settings object is defined as follows:

{
    "apiRoot": <string>,        // Under which url the server is reachable for http api calls
    "socketioHost": <string>,   // Under which host the socket.io endpoint is served.
                                // Can be an empty string which results in the same as where the frontend is deployed
    "environment": <string>,    // Determines the sentry environment
    "sentry_dsn": <string>      // Sentry connection DSN
                                // Can be an empty string which disables sentry reporting
}

Statistics

The backend publishes statistical data (No. sessions, No. joined/left rooms, server infos, ...) in the Prometheus format to /metrics. This can be scraped by a Prometheus server and displayed in e.g. Grafana.

Built With

License

Distributed under the MIT License. See LICENSE for more information.