Skip to content

hannesdatta/pulse

 
 

Repository files navigation

Pulse - An Open Source Online Learning Platform

Pulse is a new (open source) online learning platform, developed to support open education classes taught by dr. Hannes Datta at Tilburg University.

The platform is still under development.

Interested in collaborating? Be in touch via email.

Features

  • Interactive to-do list management
  • Discussions centered around the course's learning goals
  • Reports on student progress for instructors and students

Running Pulse

Login to server

Pulse runs on a virtual server in the cloud.

  1. Modify permissions of .pem credentials file: chmod 400 credentials.pem
  2. Log on to the remote computer: ssh -i ec2.pem ubuntu@ec2-XX-XX-XX-XXX.compute-1.amazonaws.com

Use the screen -r command to check whether any software is already running. You can access the particular screen using screen -r <SCREENNUMBER>. Exiting is also possible (without closing the session), using CTRL+A, and D.

Setup new virtual environment

Setup virtual environment to make sure all packages are installed properly.

python3.8 -m venv pulse-env
source pulse-env/bin/activate
python3 -m pip install -r requirements.txt

Directory structure

pulse
├── Dockerfile
├── Pipfile
├── README.md
├── api
│   ├── courses.py
│   ├── database.py
│   ├── db.json
│   ├── events_comments.db
│   ├── main.py
│   ├── name.py
│   └── nohup.out
├── docker-compose-old.yml
├── docker-compose.yml
├── myapp
│   └── wsgi.py
├── myproject.ini
├── myproject.log
├── nohup.out
├── project
│   ├── __init__.py
│   ├── app.py
│   ├── auth.py
│   ├── auth0.py
│   ├── db.sqlite
│   ├── emailtool.py
│   ├── main.py
│   ├── models.py
│   ├── static
│   │   └── logo.png
│   ├── templates
│   │   ├── 404.html
│   │   ├── base.html
│   │   ├── base2.html
│   │   ├── base_bare.html
│   │   ├── categories.html
│   │   ├── comments.html
│   │   ├── courses.html
│   │   ├── courses2.html
│   │   ├── index.html
│   │   ├── login.html
│   │   ├── modules.html
│   │   ├── profile.html
│   │   ├── signup.html
│   │   ├── todo.html
│   │   ├── todo2.html
│   │   └── update.html
│   └── uwsgi.ini
├── requirements.txt
└── wsgi.py

Starting the apps

Pulse consists of two modules: the frontend (programmed in Flask), and the backend (programmed with FastAPI).

Frontend (Flask)

The frontend, by default, runs on port 80.

export TSH_email=SECRET_EMAIL_ADRESS_FOR_MAILSERVER (check own computer, printenv)
root@ip-XXX:/home/ubuntu/pulse# ../myenv/bin/uwsgi --ini /home/ubuntu/pulse/myproject.ini
../myenv/bin/uwsgi --ini /home/ubuntu/pulse/myproject.ini

Other options are by not relying on the python environment myenv, using:

uwsgi --http-socket :80 --plugin python3 --module wsgi:app --virtualenv /home/ubuntu/myenv --chdir /home/ubuntu/pulse/

Yet another way is to start up the Flask development server, rather than UWSGI.

export FLASK_APP=project
export FLASK_DEBUG=1
flask run --port 5000

Backend (FastAPI)

The API, by default, runs on port 8000, on an internal server that can only be reached from within the virtual machine. Add --host 0.0.0.0 to make available the API to other systems.

cd api
sudo uvicorn main:app --reload --host 0.0.0.0

The app ideally should run via gunicorn for some proper load balancing in the future.

gunicorn main:app -w 1 -k uvicorn.workers.UvicornWorker &

Things to remember when starting a new semester

Remember to wipe the events database, ideally via the sqlite3 command on the VM.

  • sqlite3
  • .open events_comments.db

Then, delete the events and logs tables for particular timestamps (say, before the beginning of the course).

That's it!

Things to remember when starting out "fresh"

Remember to create the database tables!

import requests
requests.get('API-IP:8000/create')
requests.get('API-IP:8000/create_comments')

Acknowledgements

The platform has been inspired and built upon the fantastic open source contributions of others.

About

Pulse - A new learning platform for open education classes taught by Hannes Datta.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 70.5%
  • HTML 27.7%
  • R 1.7%
  • Dockerfile 0.1%