Installation
Kelvin relies on several runtime services, so some setup is required before use.
Install System dependenciesβ
apt-get install libsasl2-dev libgraphviz-dev graphviz gcc libxml2-dev libxslt1-dev libffi-dev \
libz-dev curl
Install Python dependenciesβ
Create a Python virtual environment and install Kelvinβs dependencies.
The easiest way of doing that is to use uv,
which manages the dependencies of this project. If you don't have uv,
you can install it using some supported approach, for example:
curl -LsSf https://astral.sh/uv/install.sh | sh
Then, use uv to create a virtual environment and install the necessary dependencies into it:
uv sync
If you have unsupported python version, use uv python install 3.12 with following uv sync --python 3.12
Building the frontendβ
For building the frontend, you'll need npm. Again if you don't have it installed,
follow these official instructions.
cd frontend
npm ci
# Perform a production build:
npm run build
# Perform a development build with live-reload:
npm run dev
The frontend build will store JS and CSS files into web/static.
Prepare environmentβ
Application needs to work with services like postgres, redis, nginx, etc. Therefore, it's required to prepare .env file, that contains
variables used by runtime services. Then modify by your liking.
cp .env.example .env
Preparing the databaseβ
PostgreSQL is required to storage application data. You can either provide it yourself, or use the provided docker-compose.yaml
file (recommended).
Running PostgreSQL with Dockerβ
To start postgres dockerized, docker server is required. If not already installed, use instalation guide,
and then start a PostgreSQL database using docker-compose:
docker compose up db
Note that docker compose will load the DB (and other) configuration options from the .env file, same as Kelvin, so they should match.
Running migrationsβ
Once you have a working connection to the DB, you should run migrations on it:
uv run manage.py migrate
Creating superuserβ
To be able to log in into Kelvin, you firstly need to create superadmin user. Create it by using:
uv run manage.py createsuperuser
Seeding databaseβ
For the ease of use, you can seed some example data into your database by using init_db command. If you want you can specify username to match your created superuser.
Otherwise it will create a user with username: teacher and password admin.
python manage.py init_db [--username <username>]
Running the serverβ
Once you built the frontend, installed Python dependencies and configured the database, you can start a local development server using this command:
uv run manage.py runserver 8000
And then you should be able to find the application on http://localhost:8000.
Optional enhancementsβ
Git pre-commit (prek) hooksβ
To enable hooks with their installation:
uv run prek install
Deploying workersβ
To perform code plagiarism checks or evaluate code submits, you'll also need to deploy Redis and start RQ workers.
You can start Redis using the provided docker-compose.yml file:
docker compose up redis
Note that the Redis instance does not store data persistently.
You also need to compile the Docker images used for evaluation:
cd evaluator/images
uv run build.py
Then you can start a worker with the following command (in kelvin root folder):
uv run manage.py rqworker default evaluator --with-scheduler