TODO merge with devicehub | devicehub adapted to trustchain oc1 orchestral (dpp branch)
This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
Find a file
Cayo Puigdefabregas 8b4f4b2c6e fix host
2024-04-02 22:03:50 +02:00
.github Run selenium only on reviews 2022-09-29 12:11:10 +02:00
docker docker refactor 2024-02-16 11:02:18 +01:00
docs clean 2022-11-24 12:21:42 +01:00
ereuse_devicehub fix host 2024-04-02 22:03:50 +02:00
examples docker refactor 2024-02-16 11:02:18 +01:00
scripts drop pdb 2023-04-28 12:11:09 +02:00
tests fix test 2023-06-16 13:04:37 +02:00
.babelrc.json use babel to support old browsers 2022-05-09 11:07:57 +02:00
.eslintignore ESLint ignore builded JS files 2022-05-11 19:07:52 +02:00
.eslintrc.json eslint avoid class limit 2022-05-13 21:29:29 +02:00
.gitignore add optional dpp_module and snapshots 2023-09-29 10:51:48 +02:00
.pre-commit-config.yaml Add pip-compile pre-commit hook 2022-09-29 12:22:22 +02:00
.prettierrc.json add prettier rule 2022-04-20 11:55:15 +02:00
alembic.ini Update README 2020-05-15 20:14:00 +02:00
CHANGELOG.md update changelog 2023-06-14 10:43:52 +02:00
CONTRIBUTING.md Manage dependencies using pip-tools 2022-09-29 12:11:10 +02:00
Definition-dpp.md Update Definition-dpp.md 2023-07-19 11:34:58 +02:00
development-setup.md Remove duplicated setup steps 2022-04-12 12:32:20 +02:00
docker-compose.yml add optional dpp_module and snapshots 2023-09-29 10:51:48 +02:00
docker-compose_devicehub-dpp.yml docker refactor 2024-02-16 11:02:18 +01:00
docker-compose_devicehub.yml docker: remove unneeded env var 2023-10-24 09:14:18 +02:00
launcher.sh docker refactor 2024-02-16 11:02:18 +01:00
licences.txt fixing bug of 2 users with the same device and launch one live 2021-01-08 10:46:34 +01:00
LICENSE.txt Add GPLV3 License 2019-06-09 08:48:09 +02:00
Makefile docker refactor 2024-02-16 11:02:18 +01:00
MANIFEST.in Better installation; add example_app 2018-07-07 18:51:15 +02:00
package.json Fix build-js pre-commit hook 2022-09-29 12:04:05 +02:00
pyproject.toml up target-version 2023-06-02 09:54:43 +02:00
README.md update readme 2024-02-20 15:59:20 +01:00
README_MANUAL_INSTALLATION.md update READMES 2024-02-16 20:18:17 +01:00
requirements-dev.txt Move selenium to requirements-dev.txt 2022-07-15 12:03:06 +02:00
requirements-prod.txt Move sentry & blinker to requirements-prod.txt 2022-07-15 11:59:06 +02:00
requirements.in fix teal import inm did resource 2023-05-24 10:25:04 +02:00
requirements.txt fix teal import inm did resource 2023-05-24 10:25:04 +02:00
setup.cfg Enhance testing config 2018-09-16 15:56:20 +02:00
setup.py correct versions of dependencies 2023-03-27 10:22:08 +02:00
tox.ini Add pre-commit hook to run black, flake8 & isort 2022-02-10 14:05:26 +01:00

Devicehub

Devicehub is a distributed IT Asset Management System focused on reusing digital devices, created under the eReuse.org initiative.

This README explains how to install and use Devicehub. The documentation explains the concepts, usage and the API it provides.

Devicehub is built with Teal and Flask.

Devicehub relies on the existence of an API_DLT connector verifiable data registry service, where specific operations are recorded to keep an external track record (ledger).

Installing

Please visit the Manual Installation instructions to understand the detailed steps to install it locally or deploy it on a server. However, we recommend the following Docker deployment process.

Docker

There is a Docker compose file for an automated deployment. Two instances of DeviceHub will be deployed. The following steps describe how to run and use it.

  1. Download the sources:
  git clone https://github.com/eReuse/devicehub-teal.git -b oidc4vp
  cd devicehub-teal
  1. If you want to initialise one of DeviceHub instances (running on port 5000) with sample device snapshots, copy it/them into that directory. e.g.
  cp snapshot01.json examples/snapshots/

Otherwise, the device inventory of your DeviceHub instance will be empty and ready to add new devices. For that (no snapshot import), you need to change the var to 'n' in the .env file

  IMPORT_SNAPSHOTS='n'

To register new devices, the workbench software can be run on a device to generate its hardware snapshot that can be uploaded to one of the two DeviceHub instance.

  1. Setup the environment variables in the .env file. You can find one example in examples/env.example. If you don't have any, you can copy that example and modify the basic vars
  cp examples/env.example .env

You can use these parameters as default for a local test, but default values may not be suitable for an internet-exposed service for security reasons. However, these six variables need to be initialised:

  API_DLT
  API_DLT_TOKEN
  API_RESOLVER
  ABAC_TOKEN
  ABAC_USER
  ABAC_URL
  SERVER_ID_FEDERATED
  CLIENT_ID_FEDERATED

The first six values should come from an already operational API_DLT connector service instance.

For the last two values check manual install step 9 for more details.

  1. Build and run the docker containers:
  ./launcher.sh

To stop these docker containers, you can use Ctl+C. You'll maintain the data and infrastructure state if you run "compose up" again.

On the terminal screen, you can follow the installation steps. If there are any problems, error messages will appear here. The appearance of several warnings is normal and can be ignored.

If the last line you see one text like this, exited with code:

  devicehub-teal-devicehub-id-client-1 exited with code 1

means the installation failed.

If the deployment was end-to-end successful (two running Devicehub instances successfully connected to the DLT backend selected in the .env file), you can see this text in the last lines:

  devicehub-teal-devicehub-id-client-1  |  * Running on http://172.28.0.2:5000/ (Press CTRL+C to quit)
  devicehub-teal-devicehub-id-server-1  |  * Running on all addresses.
  devicehub-teal-devicehub-id-server-1  |    WARNING: This is a development server. Do not use it in a production deployment.
  devicehub-teal-devicehub-id-server-1  |  * Running on http://172.28.0.5:5000/ (Press CTRL+C to quit)

That means the two Devicehub instances are running in their containers, which can be reached as http://localhost:5000/ and http://localhost:5001/

Once the DeviceHub instances are running, you might want to register a user binding to the DLT with the following commands (here, it assumes you want to execute it on devicehub-id-client, you might also want to do it in devicehub-id-server). Change the variables accordingly

  FILE=my_users_devicehub.json
  DOCKER_SERVICE=devicehub-id-server
  docker compose cp /path/to/${FILE} ${DOCKER_SERVICE}:/tmp/
  docker compose exec ${DOCKER_SERVICE} flask dlt_register_user /tmp/${FILE}

my_users_devicehub.json is a custom file which is similar to the one provided in examples/users_devicehub.json

  1. To shut down the services and remove the corresponding data, you can use:
  docker compose down -v

If you want to enter a shell inside a new instance of the container:

  docker run -it --entrypoint= ${target_docker_image} bash

If you want to enter a shell on an already running container:

  docker exec -it ${target_docker_image} bash

To know the valid value for ${target_docker_image} you can use:

  docker ps
  1. These are the details for use in this implementation:

Devicehub with URL (http://localhost:5000) is the identity provider of OIDC and have a user defined in .env file with SERVER_ID_EMAIL_DEMO var.

Devicehub with URL (http://localhost:5001) is the client identity of OIDC and have a user defined in .env file with SERVER_ID_EMAIL_DEMO var.

You can change these values in the .env file

  1. If you want to use Workbench for these DeviceHub instances, you need to go to
  http://localhost:5001/workbench/

with the demo user and then download the settings and ISO files. Follow the instructions on the help page.