b594022194 | ||
---|---|---|
.github | ||
docker | ||
docs | ||
ereuse_devicehub | ||
examples | ||
scripts | ||
tests | ||
.babelrc.json | ||
.eslintignore | ||
.eslintrc.json | ||
.gitignore | ||
.pre-commit-config.yaml | ||
.prettierrc.json | ||
CHANGELOG.md | ||
CONTRIBUTING.md | ||
Definition-dpp.md | ||
LICENSE.txt | ||
MANIFEST.in | ||
Makefile | ||
README.md | ||
README_MANUAL_INSTALLATION.md | ||
alembic.ini | ||
development-setup.md | ||
docker-compose.yml | ||
licences.txt | ||
package.json | ||
pyproject.toml | ||
requirements-dev.txt | ||
requirements-prod.txt | ||
requirements.in | ||
requirements.txt | ||
setup.cfg | ||
setup.py | ||
tox.ini |
README.md
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.
Devicehub is built with Teal and Flask.
Devicehub relies on the existence of an API_DLT connector verifiable data registry service, where certain 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.
Docker
There is a Docker compose file for an automated deployment. The next steps describe how to run and use it.
- Download the sources:
git clone https://github.com/eReuse/devicehub-teal.git
cd devicehub-teal
- You need to decide on one directory in your system for sharing documents between your system and the dockers. As an example we use "/tmp/dhub/" and need to create it:
mkdir /tmp/dhub
- If you want to initialize your DeviceHub instance with a sample device snapshot you can copy it into that directory.
cp examples/snapshot01.json /tmp/dhub
Otherwise, the device inventory of your DeviceHub instance will be empty and ready to add new devices. To register new devices, the workbench software can be run on a device to generate a hardware snapshot that can be uploaded to your DeviceHub instance.
- Modify the environment variables in the file .env 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 three variables need to be initialized:
API_DLT
API_DLT_TOKEN
API_RESOLVER
These values should come from an already operational API_DLT connector service instance.
- Run the docker containers:
docker compose up
To stop these docker containers you can use Ctl+C, and if you run again "compose up" you'll maintain the data and infrastructure state.
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 whit 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, that can be reached as http://localhost:5000/ and http://localhost:5001/
- 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
- These are the details for use in this implementation:
Devicehub with port 5000 (http://localhost:5000) is the identity provider of OIDC and have user user5000@example.com
Devicehub with port 5001 (http://localhost:5001) is the client identity of OIDC and have user user5001@example.com
You can change these values in the .env file
- 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 that appear on the help page.