You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create directory 'liberry' anywhere on your filesystem. This directory will be referred to as LIBERRY_HOME henceforth. Set the env variable LIBERRY_HOME to this directory.
Create directories 'pi' and 'central' within it
Create directories 'code', 'content', 'output' in both 'pi' and 'central' directories
Create directories 'pi' and 'central' within the 'output' directories created in the last step
Clone the 'platform' repository in the 'code' directory in both 'pi' and 'central' directories
Setup instructions
sudo apt-get install node
sudo npm install -g pm2
pm2 install pm2-logrotate
sudo apt-get install node-vows
sudo npm install -g sequelize-cli
sudo apt-get install sqlite3
cd /home//liberry/code
npm install
Create database 'liberry' in your MySQL instance
Update the password for 'root' user in the env.js file
sudo apt-get install mysql-client-5.5
Running instructions
cd into $LIBERRY_HOME/pi/code or $LIBERRY_HOME/central/code depending upon which server you want to run
Set the env variables
'export LIBERRY_ROOT=$LIBERRY_HOME/pi' or 'export LIBERRY_ROOT=$LIBERRY_HOME/central'
'export MODE=pi' or 'export MODE=central'
sequelize db:migrate
pm2 start app.js
Tech stack
Node.js based backend
Hapi.js as the web framework on top of Node.js
PM2 as the process manager to run, monitor, log
SQLite3 as the Database for the Pi server
MySQL as the Database for the Central server
Sequelize as the ORM and Migration framework
Vows.js as the testing framework
Travis CI for automated testing
Database tables
user - Represents both the end user and the admin. The difference between end user and admin is the 'role' field.
category - Represents the category and content would belong to. Just a way to categorize the content.
module - Represents a course containing many videos/texts/games. Belongs to a particular category.
content - Represents the actual content that the end user would consume. It holds the path to the actual file on the filesystem.
playlist - Represents a sequence of content to be played.
playlist_content - Used to define the content that a playlist contains along with the order in which the content should be played.
device - Represents a Raspberry Pi device
location - Represents a location(school, village, etc) where a Rapsberry Pi is installed
app -Represents a frontend app that is deployed on the Pi
activity - Captures the action of a user watching a content
Central User Features
User can register to the app using /register endpoint and providing necessary details
User needs to access all other endpoints by providing the username:password with base64 encoding (Basic Auth)
There is no session maintained. All requests need to carry the Authentication header
User can access the /me endpoint to get his details
Central Admin Features
Admin can access /me endpoint to get his details
Admin needs to be created directly in the DB. There is no way to register someone as Admin
Admin can upload the user.sql table to /syncdb url to insert the data into central DB
Admin can hit /download endpoint to dump the DB tables and pull new code of platform-pi in the liberry directory
/download does not actually download the data to the pendrive. That has to be done separately
Admin can create new devices, locations, categories, modules, content, playlist, etc
Pi User Features
User can register to the app using /register endpoint and providing necessary details
User needs to access all other endpoints by providing the username:password with base64 encoding (Basic Auth)
There is no session maintained. All requests need to carry the Authentication header
User can access the /me endpoint to get his details
CRUD endpoints available for all content related tables. Only Admin can do write operations though
Pi Admin Features
Admin can access /me endpoint to get his details
Admin needs to be created directly in the DB. There is no way to register someone as Admin
Admin can download the dump of 'user' table using /download?path=/path/to/liberry/directory/on/pendrive endpoint
Admin can upload new content and code using /upload?path=/path/to/liberry/directory/on/pendrive endpoint
Admin can sync all the content related tables using /syncdb?path=/path/to/liberry/directory/on/pendrive endpoint
Admin can restart the server using endpoint /restart
Liberry directory content on central server
'database.sqlite' file which is the actual database
'code' directory containing the latest codebase of platform
'content' directory containing all the content files
'output/central' directory containing the dump created by accessing /download endpoint
Liberry directory content on pi server
'database.sqlite' file which is the actual database
'code' directory containing the latest codebase of platform
'content' directory containing all the content files
'output/pi' directory containing the dump created by accessing /download endpoint
Liberry directory content on the pendrive
'code' directory containing the latest codebase of platform
'content' directory containing all the content files
'output/central' directory containing the dump created by accessing /download endpoint on the central server.
'output/pi' directory in which the pi server will dump it's own database tables. The files will have naming convention mac_table.sql