Skip to content

umeshprasadk/studio

 
 

Repository files navigation

Kolibri Studio

codecov

Check out our beta site!

Kolibri Studio is a web application designed to deliver educational materials to Kolibri. Kolibri Studio supports the following workflows:

  • Organizing and publishing content channels in the format suitable for import from Kolibri.

  • Curating content and remixing of existing channels into custom channels aligned to various educational standards, country curricula, and special needs.

  • Creating learning pathways and assessments.

  • Uploading new content through the web interface or programatically using ricecooker-powered content import scripts.

Kolibri Studio uses Django for the backend and is transitioning from Backbone.js to Vue.js for the frontend.

Developer Instructions

Follow the instructions below to setup your dev environment and get started. (Note: docs/docker_setup has instructions for setting up your environment using docker, but this is currently a work in progress.)

0. Get the code

  • Fork the studio repo to create a copy of the studio repository under your own github username.

    cd <project directory>
    git clone git@github.com:<yourusername>/studio.git
  • The folder <project directory>/studio now contains the latest Studio code.

  • For more information on using git, please check out docs/git_setup

1. Install software prerequisites

You need the following software installed on your machine to run Studio:

You can also use nodeenv (which is included as a python development dependency below) or nvm to install Node.js 10.x if you need to maintain multiple versions of node:

Ubuntu or Debian You can install all the necessary packages using these commands (you may need to add sudo if you receive Permission Denied errors:

# Install minio
wget https://dl.minio.io/server/minio/release/linux-amd64/minio -O /usr/local/bin/minio
chmod +x /usr/local/bin/minio

# Install node PPA
curl -sL https://deb.nodesource.com/setup_10.x | bash -

# Install packages
apt-get install -y  python python-pip python-dev python-tk \
    postgresql-server-dev-all postgresql-contrib postgresql-client postgresql \
    ffmpeg nodejs libmagickwand-dev nginx redis-server wkhtmltopdf

Mac OS X You can install the corresponding packages using Homebrew:

brew install  postgresql@9.6 redis node ffmpeg imagemagick@6 gs
brew install minio/stable/minio
brew link --force postgresql@9.6
brew link --force imagemagick@6

Windows Windows is no longer supported due to incompatibilities with some of the required packages.

2. Set up python dependencies through pipenv

If you haven't installed pipenv,

pip install -U pipenv

Then set up:

# Create virtual environment
pipenv shell

# Ensure your environment matches the one specified in Pipfile.lock
pipenv sync --dev

Exit the virtual environment by running exit. Reactivate it by running pipenv shell again.

3. Set up pre-commit hooks

We use pre-commit to help ensure consistent, clean code. The pip package should already be installed from a prior setup step, but you need to install the git hooks using this command.

pre-commit install

Note: you may need to run pip install pre-commit if you see pre-commit command not found

4. Install javascript dependencies

As described above, Kolibri Studio has dependencies that rely on Node.js version 10.x. You'll also need yarn installed.

All the javascript dependencies are listed in package.json. To install them run the following yarn command:

yarn install

This may take a long time.

If you encounter a ESOCKETTIMEDOUT error related to material-design-icons, you can increase your timeout by setting network-timeout 600000 inside ~/.yarnrc.

5. Set up the database and start redis

Install postgres if you don't have it already. If you're using a package manager, you need to make sure you install the following packages: postgresql, postgresql-contrib, and postgresql-server-dev-all which will be required to build psycopg2 python driver.

Make sure postgres is running:

service postgresql start
# alternatively: pg_ctl -D /usr/local/var/postgresql@9.6 start

Start the client with:

sudo su postgres  # switch to the postgres account
psql  # mac: psql postgres

Create a database user with username learningequality and password kolibri:

CREATE USER learningequality with NOSUPERUSER INHERIT NOCREATEROLE CREATEDB LOGIN NOREPLICATION NOBYPASSRLS PASSWORD 'kolibri';

Create a database called kolibri-studio:

CREATE DATABASE "kolibri-studio" WITH TEMPLATE = template0 ENCODING = "UTF8" OWNER = "learningequality";

Press Ctrl+D to exit the psql client. Finally

exit  # leave the postgres account

To start redis on Linux-based systems, run the following command

service redis-server start

On Mac, it will be started as part of the yarn run services command (detailed below).

6. Run all database migrations and load constants

These commands setup the necessary tables and contents in the database.

In one terminal, run all external services:

yarn run services

In another terminal, run devsetup to create all the necessary tables and buckets:

yarn run devsetup

When this completes, close the second tab and kill the services.

7. Start the dev server

You're all set up now, and ready to start the Studio local development server:

On Macs only run this in another terminal first:

yarn run services

Start the server:

yarn run devserver

Once you see the following output in your terminal, the server is ready:

Starting development server at http://0.0.0.0:8080/
Quit the server with CONTROL-C.

You should be able to login at http://127.0.0.1:8080 using email a@a.com, password a.

Note: If you are using a Linux environment, you may need to increase the amount of listeners to allow the watch command to automatically rebuild static assets when you edit them. Please see here for instructions on how to do so.

Running tests

You can run tests using the following command:

yarn run test

For more testing tips, please check out docs/running_tests.

Profiling and local production testing

If you want to test the performance of your changes, you can start up a local server with settings closer to a production environment like so:

yarn run localprodserver

Once the local production server is running, you can also use Locust to test your changes under scenarios of high demand like so:

cd deploy/chaos/loadtest
make timed_run
make stop_slaves  # mac: killall python

Linting

Front-end linting is run using:

yarn run lint-all

Some linting errors can be fixed automatically by running:

yarn run lint-all:fix

Make sure you've set up pre-commit hooks by following the instructions here. This will ensure that linting is automatically run on staged changes before every commit.

About

Content curation tools for Kolibri

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 40.4%
  • JavaScript 27.5%
  • HTML 19.9%
  • CSS 7.0%
  • Vue 4.4%
  • Shell 0.3%
  • Other 0.5%