This guide will walk you through setting up Kolibri Studio for local development using Windows Subsystem for Linux (WSL). We will cover everything from installing WSL and a Linux distribution to configuring your environment and running the necessary commands.
- Install WSL and Ubuntu
- Update and Upgrade Packages
- Install Prerequisites
- Install System Dependencies and Services
- Set Up the Database
- Configure .bashrc
- Set Up Python Virtual Environment
- Install Frontend Dependencies
- Run the Services
- Initialize Studio
- Run the Development Server
- Access Kolibri Studio
-
Enable WSL: Open PowerShell as Administrator and run the following command to enable WSL:
wsl --install
This command will install WSL and the default Linux distribution (Ubuntu). If you need to install a specific version of Ubuntu, you can follow the instructions on the official WSL installation guide.
-
Set Up Your Linux Username and Password: After the installation is complete, you will be prompted to set up your Linux username and password.
-
Set WSL Version to 2:
wsl --set-default-version 2
Open your WSL terminal and update the package lists:
sudo apt update
sudo apt upgrade -y
Fork the repo and clone it by running the following command:
git clone https://github.com/$USERNAME/studio.git
Replace $USERNAME
with your GitHub username.
For detailed instructions on installing and configuring Volta, pyenv, and pyenv-virtualenv, please see the Prerequisites section in our Local Development with host guide.
Studio requires some background services to be running:
- Minio - a local S3 storage emulation
- PostgreSQL - a relational database
- Redis - a fast key/value store useful for caching
Install the necessary system dependencies and services:
sudo apt-get update
sudo apt-get install -y python-tk postgresql-server-dev-all postgresql-contrib postgresql-client postgresql-12 ffmpeg libmagickwand-dev redis-server wkhtmltopdf
Download and install MinIO:
wget https://dl.minio.io/server/minio/release/linux-amd64/minio -O bin/minio
sudo chmod +x ~/bin/minio
Make sure PostgreSQL is running:
sudo service postgresql start
Start the client with:
sudo su postgres
psql
Run the following SQL commands:
CREATE USER learningequality WITH NOSUPERUSER INHERIT NOCREATEROLE CREATEDB LOGIN NOREPLICATION NOBYPASSRLS PASSWORD 'kolibri';
CREATE DATABASE "kolibri-studio" WITH TEMPLATE = template0 ENCODING = "UTF8" OWNER = "learningequality";
Exit the PostgreSQL client:
\q
exit
For complete instructions on installing Python 3.10.13, creating and activating the virtual environment, and installing Studio’s Python dependencies, please refer to the Build Your Python Virtual Environment section in our Local Development with host guide.
The packages postgresql-12
, postgresql-contrib
, and postgresql-server-dev-all
are required to build the psycopg2
Python driver.
For guidance on installing Node 16.X, Yarn, and all required frontend dependencies, running the services, initializing Studio, and running the development server , please refer to the Install Frontend Dependencies section in our Local Development with host guide.
Either of the above commands will take a few minutes to build the frontend. When it's done, you can sign in with the account created by the yarn run devsetup
command:
- URL: http://localhost:8080/accounts/login/
- Username:
[email protected]
- Password:
a
Once you have completed the setup of Kolibri Studio in your WSL environment using the terminal, you can use Visual Studio Code (VS Code) to open the project and start contributing to the codebase. Here’s how you can do it:
- Download and Install VS Code:
- Download VS Code from the official website.
- Install it on your Windows machine.
- Open VS Code.
- Go to the Extensions View:
- Click on the Extensions icon in the Activity Bar on the side of the window or press
Ctrl+Shift+X
.
- Click on the Extensions icon in the Activity Bar on the side of the window or press
- Search for "Remote - WSL":
- Install the extension by Microsoft.
- Open the Command Palette:
- Press
Ctrl+Shift+P
to open the Command Palette.
- Press
- Select "Remote-WSL: New Window":
- This will open a new VS Code window connected to your WSL environment.
- In the WSL-connected VS Code Window:
- Use the File Explorer to open your
~/studio
directory. - You can do this by selecting
File > Open Folder
and navigating to~/studio
.
- Use the File Explorer to open your
Now that you have your project open in VS Code, you can run the same commands you used in the terminal to activate the environment and start the services:
-
Open the Integrated Terminal in VS Code:
- You can open the terminal by selecting
Terminal > New Terminal
from the menu or by pressing `Ctrl+``.
- You can open the terminal by selecting
-
Activate the Python Virtual Environment:
pyenv activate studio-py3.10
-
Run the Services:
yarn run services
-
Initialize the Studio:
yarn run devsetup
-
Start the Development Server:
yarn run devserver:hot
By following these steps, you can set up a productive development environment in VS Code with WSL and start contributing to the Kolibri Studio codebase.