Compare commits

..

12 commits

Author SHA1 Message Date
pedro 57f9e28466 up_snapshots: simplify and clarify errors
specially, do not halt in case of errors, just print them in logs
2024-11-12 14:37:55 +01:00
pedro fc849f0360 recover old up_snapshot functionality
- We don't need the if settings.DEBUG anymore, we have a logger
configuration that when DEBUG is there, a trace is always generated
- restore old error message that is shorter and clearer than the new one
2024-11-12 14:31:46 +01:00
Thomas Nahuel Rusiecki 7c4602722f added success messages 2024-11-11 14:57:20 -03:00
Thomas Nahuel Rusiecki 7c3044f82f catching pandas exception 2024-11-11 14:49:17 -03:00
Thomas Nahuel Rusiecki 43cee8fd05 changed form validation onto field 2024-11-11 14:47:44 -03:00
Thomas Nahuel Rusiecki 3729994b5f grammar fix and todo added 2024-11-11 14:12:26 -03:00
Thomas Nahuel Rusiecki 5709f8ed76 upload form now displays error messages once 2024-11-11 04:28:41 -03:00
Thomas Nahuel Rusiecki b752a8750e better error messages 2024-11-11 04:06:22 -03:00
Thomas Nahuel Rusiecki a0a22e7840 minor fix in mac parsing 2024-11-11 03:41:08 -03:00
Thomas Nahuel Rusiecki 53000725c7 fixed mac not recovered properly 2024-11-09 16:52:26 -03:00
Thomas Nahuel Rusiecki 1330a231ef better error handling and logging 2024-11-09 16:46:01 -03:00
Thomas Nahuel Rusiecki b37617421e check for values on websnapshot 2024-11-09 16:30:49 -03:00
2 changed files with 11 additions and 114 deletions

121
README.md
View file

@ -1,123 +1,20 @@
# Device Hub # INSTALACIÓN:
DeviceHub is an IT Asset Management System focused on reusing devices, created under the [eReuse.org](https://www.ereuse.org) project. La instalación es muy estándar
## Overview
DeviceHub aims to:
- Provide a common IT Asset Management platform for donors, receivers, and IT professionals.
- Automatically collect, analyze, and share device metadata while ensuring privacy and traceability.
- Integrate with existing IT Asset Management Systems.
- Operate in a decentralized manner.
DeviceHub primarily works with three types of objects:
1. **Devices**: Including computers, smartphones, and their components.
2. **Events**: Actions performed on devices (e.g., Repair, Allocate).
3. **Accounts**: Users who perform events on devices.
## Installation
Assuming a host with debian stable
### Quickstart
For a quick start with dummy data in localhost, DeviceHub can be run directly with docker. To do so, from the root of the project run:
```bash
./docker-reset.sh
``` ```
Note that everytime you perform the `docker-reset.sh` script, all data is lost.
Also there is a demo running in http://demo.ereuse.org/. The token for accessing the instance will be always: `token=5018dd65-9abd-4a62-8896-80f34ac66150`, but the instance will be reset every day at 4 am.
For production needs, review and change .env file properly
## Running from baremetal
### Prerequisites
- Python 3.10
- pip
- virtualenv
Specially when developing, is quite convenient to run DeviceHub from a virtual environment. To start with this deployment, create a virtual environment to isolate our project dependencies:
```bash
python -m venv env python -m venv env
source env/bin/activate source env/bin/actevate
pip install -r requirements.txt python install -r requirements.txt
``` ```
### System Dependencies ## IMPORTANT EXTERNAL DEPENDENCIES
#### Xapian Para arrancarlo es necesario tener el paquete `xapian-bindings` en tu ordenador. No se instala mediante `pip`, así que depende de cada [sistema operativo](https://xapian.org/download).
Now, install the xapian dependencies (xapian library and python bindings) Luego solo necesitas:
```bash
sudo apt-get install python3-xapian libxapian-dev
``` ```
./manage.py migrate
Allow the virtual environment to use system-installed packages: ./manage.py runserver
```bash
export PYTHONPATH="${PYTHONPATH}:/usr/lib/python3/dist-packages"
``` ```
#### Environment Variables
Now, configure the environment variables. For this, we will expand a `.env` file. You can use the following content as an example:
```source
STATIC_ROOT=/tmp/static/
MEDIA_ROOT=/tmp/media/
ALLOWED_HOSTS=localhost,localhost:8000,127.0.0.1,
DOMAIN=localhost
DEBUG=True
```
Now, expand the environment variables:
```bash
source .env
```
### Migrations
Now, apply migrations
```bash
python manage.py makemigrations
python manage.py migrate
```
Also, we can add some dummy data into the database to play along:
```bash
python manage.py add_institution Pangea
python manage.py add_user Pangea user@example.org 1234
python manage.py up_snapshots example/snapshots/ user@example.org
```
### Run DeviceHub
Finally, we can run the DeviceHub service by running:
```bash
python manage.py runserver
```
### Clean up
To clean up the deployment and start fresh, just delete Django's database:
```bash
rm db/*
```
## License
DeviceHub is released under the [GNU Affero General Public License v3.0](LICENSE).

View file

@ -13,9 +13,9 @@ class CustomFormatter(logging.Formatter):
if record.levelname == "ERROR": if record.levelname == "ERROR":
color = RED color = RED
elif record.levelname == "WARNING": elif record.levelname == "WARNING":
color = YELLOW
elif record.levelname in ["INFO", "DEBUG"]:
color = PURPLE color = PURPLE
elif record.levelname in ["INFO", "DEBUG"]:
color = YELLOW
else: else:
color = RESET color = RESET