Backend of the Substra platform
For the local installation of substra-backend (and companions), please refer to the setup documentation.
With hlf-k8s already running and requirements fulfilled, this should boils down to:
skaffold dev
This will spawn several pods in two different namespaces to simulate several organizations: 'org-1' and 'org-2'. Each organization will have:
- Postgres database
- RabbitMQ message broker
- Docker registry
- Kaniko cache warmer
- Celery beat
- 2 celery workers (a worker executing tasks and a scheduler restarting hanging tasks)
- an operator pattern to add accounts
- the API backend
- the events backend converting events from the chaincode into celery tasks
To get access to the Django management tool, spawn a shell in the running container:
kubectl -n org-1 exec -i -t $(kubectl -n org-1 get pods -l=app.kubernetes.io/name=substra-backend-server -o name) -c substra-backend -- /bin/bash
This will also gives you access to the celery CLI. You can issue celery inspect active_queues
to examine consumed queues.
Make sure you have the requirements installed:
pip install -r backend/requirements.txt
Then launch unit tests:
make test
A coverage report can be obtained with:
make coverage
Should you prefer an HTML report, you can use coverage html
from the backend
directory.
On deployment, several user accounts are created (for ./values/backend-org-1.yaml and ./values/backend-org-2.yaml).
The sample credentials for org1 are:
- user:
node-1
- pass:
p@$swr0d44
Provided you have correctly setup your network configuration, you can use them to access the exposed API at http://substra-backend.node-1.com/
Make sure you deploy this backend with a compatible ecosystem (chaincode, hlf-k8s, etc). Always refer to the compatibility table.
The recommended way to run a specific version (0.1.6) of substra-backend is to execute:
SUBSTRA_BACKEND_VERSION=0.1.6
git checkout $SUBSTRA_BACKEND_VERSION
skaffold deploy --images substrafoundation/substra-backend:$SUBSTRA_BACKEND_VERSION
The Substra platform is built from several components (see the architecture documentation for a comprehensive overview):
- hlf-k8s is the implementation of Hyperledger Fabric on which this backend rely
- substra-chaincode is the chaincode powering the Fabric network
- substra-frontend is the frontend consuming the API exposed by the backend
- substra-tests is the Substra end to end test suite
This project is developed under the Apache License, Version 2.0 (Apache-2.0), located in the LICENSE file.