new readme

This commit is contained in:
Cayo Puigdefabregas 2023-09-28 08:18:24 +02:00
parent 843324bd17
commit 82bf535915
3 changed files with 87 additions and 14 deletions

68
README.md Normal file
View File

@ -0,0 +1,68 @@
# Devicehub
Devicehub is a distributed IT Asset Management System focused in reusing devices, created under the project [eReuse.org](https://www.ereuse.org)
This README explains how to install and use Devicehub. [The documentation](http://devicehub.ereuse.org) explains the concepts and the API.
Devicehub is built with [Teal](https://github.com/ereuse/teal) and [Flask](http://flask.pocoo.org).
# Installing
Please visit the [Manual Installation](#README_MANUAL_INSTALLATION.md) for understand how you can install locally or deploy in a server.
# Docker
You have a docker compose file for to do a automated deployment. In the next steps we can see as run and use.
1. Download the sources:
```
git clone https://github.com/eReuse/devicehub-teal.git
cd devicehub-teal
```
2. You need decide one dir in your system for share documents between your system and the dockers.
For us only as example we use "/tmp/dhub/" and need create it:
```
mkdir /tmp/dhub
```
3. Copy your snapshots in this directory. If you don't have any snapshots copy one of the example directory.
```
cp examples/snapshot01.json /tmp/dhub
```
4. Modify the file with environment variables in the file .env You can see one example in examples/env
If you don't have one please copy the examples/env file and modify the basic vars
```
cp examples/env.example .env
```
You can use this parameters for default as a test, but you need add values in this three variables:
```
API_DLT
API_DLT_TOKEN
API_RESOLVER
```
5. run the dockers:
```
docker compose up
```
For stop the docker you can use Ctl+c and if you run again "compose up" you maintain the datas and infrastructure.
6. If you want down the volumens and remove the datas, you can use:
```
docker compose down -v
```
7. If you want to enter a shell inside a new container:
```
docker run -it --entrypoint= ${target_docker_image} bash
```
If you want to enter a shell on already running container:
```
docker exec -it ${target_docker_image} bash
```
For to know the valid value for ${target_docker_image} you can use:
```
docker ps
`

View File

@ -1,13 +1,20 @@
# Please fill in these three variables
API_DLT='{ONE_URL}'
API_DLT_TOKEN='{ONE_TOKEN}'
API_RESOLVER='{ONE_URL}'
# Database Variables
DB_USER='dhub' DB_USER='dhub'
DB_PASSWORD='ereuse' DB_PASSWORD='ereuse'
DB_HOST='localhost' DB_HOST='localhost'
DB_DATABASE='devicehub' DB_DATABASE='dpp'
API_DLT='http://$IP_API_DLT' SCHEMA='dbtest'
API_DLT_TOKEN='$TOKEN' DB_SCHEMA='dbtest'
API_RESOLVER='http://$IP_API_RESOLVER'
# TODO this should be guessed by DEVICEHUB_HOST, and avoid hardcode of ID_FEDERATED # TODO this should be guessed by DEVICEHUB_HOST, and avoid hardcode of ID_FEDERATED
ID_FEDERATED='$ID' SERVER_ID_FEDERATED='DH12'
URL_MANUALS='http://$IP_MANUALS' CLIENT_ID_FEDERATED='DH20'
URL_MANUALS='http://localhost:4000'
#SERVER_ID_DEVICEHUB_HOST='http://devicehub-server-id.example.com' #SERVER_ID_DEVICEHUB_HOST='http://devicehub-server-id.example.com'
SERVER_ID_DEVICEHUB_HOST='http://localhost:5000' SERVER_ID_DEVICEHUB_HOST='http://localhost:5000'
@ -17,17 +24,14 @@ SERVER_ID_SERVICE='server_id'
CLIENT_ID_SERVICE='client_id' CLIENT_ID_SERVICE='client_id'
HOST='localhost' HOST='localhost'
SCHEMA='dbtest' EMAIL_DEMO='user@example.com'
DB_SCHEMA='dbtest' PASSWORD_DEMO='1234'
EMAIL_DEMO='user@example.org' JWT_PASS='7KU4ZzsEfe'
PASSWORD_DEMO='changeme' SECRET_KEY='ffa96bac894ccaa070c23dfe18fd900eda2eebcbd5dac8b34db9b54ecec81501'
JWT_PASS='changeme'
SECRET_KEY='changeme'
# important to import snapshots (step 15) # important to import snapshots (step 15)
# rel path starts with ./ # rel path starts with ./
#SNAPSHOTS_PATH='./relpath/to/snapshots' #SNAPSHOTS_PATH='./relpath/to/snapshots'
# full path starts with / # full path starts with /
SNAPSHOTS_PATH='/fullpath/to/snapshots' SNAPSHOTS_PATH='/tmp/dhub_docker/snapshots'

1
examples/snapshot01.json Normal file
View File

@ -0,0 +1 @@
{"closed": true, "components": [{"actions": [], "manufacturer": "Intel Corporation", "model": "82579LM Gigabit Network Connection", "serialNumber": "00:11:11:11:11:00", "speed": 1000.0, "type": "NetworkAdapter", "variant": "04", "wireless": false}, {"actions": [], "manufacturer": "Intel Corporation", "model": "7 Series/C216 Chipset Family High Definition Audio Controller", "serialNumber": null, "type": "SoundCard"}, {"actions": [], "format": "DIMM", "interface": "DDR3", "manufacturer": "Micron", "model": "16KTF51264AZ", "serialNumber": "AAAAAAAA", "size": 4096.0, "speed": 1600.0, "type": "RamModule"}, {"actions": [{"endTime": "2022-10-11T13:45:31.239555+00:00", "severity": "Info", "startTime": "2021-10-11T09:45:19.623967+00:00", "steps": [{"endTime": "2021-10-11T11:05:28.090897+00:00", "severity": "Info", "startTime": "2021-10-11T09:45:19.624163+00:00", "type": "StepZero"}, {"endTime": "2021-10-11T13:45:31.239402+00:00", "severity": "Info", "startTime": "2021-10-11T11:05:28.091255+00:00", "type": "StepRandom"}], "type": "EraseSectors"}, {"assessment": true, "commandTimeout": 30, "currentPendingSectorCount": 0, "elapsed": 60, "length": "Short", "lifetime": 18720, "offlineUncorrectable": 0, "powerCycleCount": 2147, "reallocatedSectorCount": 0, "reportedUncorrectableErrors": 0, "severity": "Info", "status": "Completed without error", "type": "TestDataStorage"}, {"elapsed": 11, "readSpeed": 119.0, "type": "BenchmarkDataStorage", "writeSpeed": 32.7}], "interface": "ATA", "manufacturer": "Seagate", "model": "ST3500418AS", "serialNumber": "AAAAAAAA", "size": 500000.0, "type": "HardDrive", "variant": "CC46"}, {"actions": [{"elapsed": 0, "rate": 25540.36, "type": "BenchmarkProcessor"}, {"elapsed": 8, "rate": 7.6939, "type": "BenchmarkProcessorSysbench"}], "address": 64, "brand": "Core i5", "cores": 4, "generation": 3, "manufacturer": "Intel Corp.", "model": "Intel Core i5-3470 CPU @ 3.20GHz", "serialNumber": null, "speed": 1.6242180000000002, "threads": 4, "type": "Processor"}, {"actions": [], "manufacturer": "Intel Corporation", "memory": null, "model": "Xeon E3-1200 v2/3rd Gen Core processor Graphics Controller", "serialNumber": null, "type": "GraphicCard"}, {"actions": [], "biosDate": "2012-08-07T00:00:00", "firewire": 0, "manufacturer": "LENOVO", "model": "MAHOBAY", "pcmcia": 0, "ramMaxSize": 32, "ramSlots": 4, "serial": 1, "serialNumber": null, "slots": 4, "type": "Motherboard", "usb": 3, "version": "9SKT39AUS"}], "device": {"actions": [{"elapsed": 1, "rate": 0.6507, "type": "BenchmarkRamSysbench"}], "chassis": "Tower", "manufacturer": "LENOVO", "model": "3227A2G", "serialNumber": "AAAAAAAA", "sku": "LENOVO_MT_3227", "type": "Desktop", "version": "ThinkCentre M92P"}, "elapsed": 187302510, "endTime": "2016-11-03T17:17:01.116554+00:00", "software": "Workbench", "type": "Snapshot", "uuid": "ae913de1-e639-476a-ad9b-78eabbe4628b", "version": "11.0b11"}