/substra-backend

Backend of the Substra platform

Primary LanguagePythonApache License 2.0Apache-2.0

Substra-Backend Python Helm Docker Cloud Build Status

Backend of the Substra platform

Running a development instance

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:

Django management

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.

Execute unit tests

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.

Accessing the app

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/

Compatibility

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

Companion repositories

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

License

This project is developed under the Apache License, Version 2.0 (Apache-2.0), located in the LICENSE file.