/studio

Primary LanguagePythonMIT LicenseMIT

Kolibri Studio

codecov

Check out our beta site!

Kolibri Studio is a web application designed to deliver educational materials to Kolibri. It supports:

  • 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.

Getting started

Get the code

Tip: Register your SSH keys on GitHub to avoid having to repeatedly enter your password.

Install and run services

Studio requires some background services to be running:

  • Minio
  • Postgres
  • Redis

The instructions below show how to set up the services using Docker. This works for many people, but not everyone. If docker is giving you issues, you can also manually install the services either on your host machine or in a virtual machine (for example, using Vagrant with Virtualbox or VMWare).

First, install Docker.

Next, run

make dcservicesup

This will take a while the first time it's run, and might need to be restarted a couple times if it errors out initially.

To confirm that the services are running, run docker ps, and you should see three containers, for example:

> docker ps
CONTAINER ID        IMAGE                             COMMAND                  CREATED             STATUS              PORTS                    NAMES
e09c5c203b93        redis:4.0.9                       "docker-entrypoint.s…"   51 seconds ago      Up 49 seconds       0.0.0.0:6379->6379/tcp   studio_vue-refactor_redis_1
6164371efb6b        minio/minio                       "minio server /data"     51 seconds ago      Up 49 seconds       0.0.0.0:9000->9000/tcp   studio_vue-refactor_minio_1
c86bbfa3a59e        postgres:9.6                      "docker-entrypoint.s…"   51 seconds ago      Up 49 seconds       0.0.0.0:5432->5432/tcp   studio_vue-refactor_postgres_1

To shut down the services, run

make dcservicesdown

Pipenv and Python dependencies

To develop on Kolibri, you'll need:

Managing Python installations can be quite tricky. We highly recommend using package managers like Homebrew <http://brew.sh/>__ on Mac or apt on Debian for this. Never modify your system's built-in version of Python

Then set up:

# Create virtual environment
pipenv shell

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

# Set up pre-commit hooks
pre-commit install

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

Yarn and 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 --network-timeout 1000000

The network-timeout helps avoid a timeout issue with the Material Icons dependency.

Initial setup

To set up the database, run:

yarn run devsetup

Running the development server

In one tab, start celery using:

make prodceleryworkers

In another tab, start Django and the webpack build using:

yarn run devserver:hot  # with Vue hot module reloading
# or
yarn run devserver  # without hot module reloading

This will take a few mins to build the frontend. When it's done, you can log in with a@a.com password a at http://localhost:8080/accounts/login/

Additional tools

Running tests

You can run tests using the following command:

yarn run test

View more testing tips

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 as described above. This will ensure that linting is automatically run on staged changes before every commit.