interradio
About interradio
InterRadio is a third-party component designed for the open-source community radio software AURA. It facilitates data exchange between AURA and other radio content management systems. InterRadio defines a standardized file format for this data exchange and provides functionality to import content into AURA. Currently, InterRadio does not support data export from AURA. InterRadio operates on an episode-based model, allowing users to selectively exchange episodes from/to a given radio program.
Getting Started
We recommend to set up the project within an isolated environment. The project includes pre-requisites to use either Devbox or Docker. Package management is done with Poetry
Using Devbox for development
Devbox manages dependencies, e.g. Python and NodeJS versions, in an isolated environment.
- Install Devbox locally.
- Run
devbox shell
in the root directory of the project. This installs all needed dependencies and enables them for the shell. You can use direnv to automatically start the devbox shell.
Continue to set up the project according to section "Setting up project"
Using Docker for development
You can also use docker for setting up a development environment.
- Start docker container with
GID=$(id -g) USERID=$(id -u) APP_USER=django docker-compose -f docker-compose.dev.yml up
- Open a bash shell with Docker Compose in the container to execute commands
docker-compose -f docker-compose.dev.yml exec app /bin/bash
Installation
Follow these steps to install InterRadio:
- install poetry
- run
poetry install
- create a
local.py
file underinterradio/settings
if you need specific development settings like db or redis credentials - run
poetry run ./manage.py migrate
to prepare db - run
poetry run pre-commit install
to activate pre-commit hooks - run
poetry run ./manage.py tailwind install
to install Tailwindcss - run
poetry run ./manage.py runserver
to get a dev server - follow the steps listed below for setting up Celery
Celery
This project requires Celery as an asynchronous task worker.
Setting up Celery
- install redis (no configuration required) as local service or docker binding on host port
- install + start redis locally
- add the following to your
local.py
:
CELERY_BROKER_URL = "redis://127.0.0.1:6379/0"
CELERY_RESULT_BACKEND = "redis://127.0.0.1:6379/0"
Using Celery
The Celery daemon has to be started in the background. Attention: it doesn't reload on code change, the daemon has to be restarted in order to reflect on code changes.
- run
poetry run celery -A interradio worker -l info
alongsite the webserver
Tailwindcss
- the main CSS file (
styles.css
) is not committed, it has to be built locally. - run
poetry run ./manage.py tailwind start
for JIT compliation of the CSS - run
poetry run ./manage.py tailwind build
for a one-time build of the CSS
Linting
- this project uses djLint and Ruff for linting and formatting
- linting and formatting is automatically applied through pre-commit hooks
- you can configure exeptions for djLint and ruff in
pyproject.toml
- exeption configuration is listed on the djLint-Website and on the Ruff-Website
Testing
- the functionality of the code can be tested by running
poetry run ./manage.py collectstatic
poetry run ./manage.py test
Connection to AURA
InterRadio is connected to AURA using OpenID Connect (OIDC). We use Steering version cde7192e476db492ebe4df53b5c9e31059393f3f (commit ID).
Configuration of Steering
Steering must be configured as an OIDC provider. InterRadio is registered as an OIDC client, the issued client ID and the secret are required for the configuration of InterRadio:
INTERRADIO_URL="http://localhost:9000" poetry run ./manage.py create_oidc_client interradio confidential -r code -u $INTERRADIO_URL/oidc/callback/ --no-require-consent
Configuration of InterRadio
The following environment variables are then set for InterRadio:
OIDC_CLIENT_ID="<Client-ID>"
OIDC_CLIENT_SECRET="<Client-Secret>"
In a local development setup, InterRadio must be moved to a different port (e.g. 9000
). In a production setup, the
environment variable STEERING_URL="https://aura/steering"
must be set to the steering base URL.