📘 This page document how the backend works and what its role is.
The backend is build with Django. Its goal is to serve and API used to read from and write to the database.
Arbitre’s backend is built using Django, and uses ASGI and Daphne for communication. Celery and Celery Beat are used for task queueing with RabbitMQ and scheduling. PostgreSQL is used as the database. Django REST Framework provides API endpoints and supports authentication using mozilla-django-oidc. The OpenAPI specification is served as a Swagger page generated using YASG. The code is formatted using Black.
Production
ASGI is a standard for Python asynchronous web apps and servers to communicate with each other, and positioned as an asynchronous successor to WSGI.
ASGI is required in production for Arbitre as there are many concurrent tasks.
Development
Python code formatter.
Arbitre follows Black’s code style in every Python file.
Development + Production
Task queue service that allows tasks to be run asynchronously.
When a task is added to the queue, it is picked up by a worker and executed. This allows the backend to continue running while the task is being processed.
Celery is used in Arbitre to send tests to run to Camisole, and await for the response.
Development + Production
Scheduler that kicks off off tasks at regular intervals, that are then executed by available worker nodes in the cluster.
Used to re-run tests that remained “pending” for more than five minutes (meaning an error occured while running the test and nothing was returned).
Production
Daphne is a HTTP server designed for ASGI.
It is used on the production server.
Development + Production
Open-source Python web framework based on the MVC architecture (Model, View, Controller).
Models are defined as Python classes and Django acts as a middleware that manages their data in the relational database.
Views generate and return as static html pages using a template system.
Controllers map an URL to a view.
Django is the backbone of the backend.
Development + Production
Turns Django views into API endpoints.
Django REST framework also generates API endpoints based on the models.
It supports authentication to make the API secure.
Development + Production
A lightweight authentication and access management library for integration with OpenID Connect enabled authentication services.
mozilla-django-oidc makes it possible to authenticate to the API using Keycloak.
Development + Production
Open-source relational database management system providing SQL support.
Django’s default database is SQLite. Althought small and convenient, SQLite doesn’t support concurrent operations. The addition of asynchronous and recurring tasks in Arbitre made it mandatory to switch to a more capable database management system.
Development + Production
Message-broker software that takes incoming messages from applications and perform some action on them.
Here, it is used as the queue for Celery.
Development
Tool suite used to create API specifications.
Development
Automatically generates an OpenAPI specification based on the Django models, and serves a Swagger page to navigate the specification.
Table of Contents