User Tools

Site Tools


projects:bewaesserung:installation

Installation

Fr. 26.03.2021

Zur Installation der Webseite auf einem USB-Stick gehe ich wie folgt vor:
Ich folge der Installationsanleitung aus dem Readme: https://gitlab.com/BorisFlit/bewaesserung-ip
Als erstes installiere ich Ubuntu 20.04 LTS: https://releases.ubuntu.com/20.04/
11:31
Ich downloade das Desktop image for 64-bit PC (AMD64) computers ( standard download) und speichere es auf meinem Rechner
I download and execute Rufus https://rufus.ie/

Ich stimme zu

11:45
Ich reboote einen der PCs im fablab mit dem USB-stick
12:00 Beim Start drücke is F12 und wähle UEFI-Boot –> Ubuntu
Unable to find a medium container a live file system
Attempt interactive reboot from a URL? no
“USB-Device” wäre die richtige Option gewesen (statt UEFI)…Ubuntu bootet jetzt
12:09
doch nicht…bekomme wieder den selben Fehler:

Habe mehrere verschiedene USB-ports probiert, immer dasselbe
13:04
Habe das ganze nochmal auf einem anderen USB-stick gemacht…jetzt funktioniert es. Mußte das deutsche Keyboard layout installieren um mich bei gitlab anmelden zu können (@ funktioniert schwierig auf EN/DE)

$ sudo apt update
$ sudo apt install python3
  python3 is already the newest version (3.8.2-0ubuntu2).
$ python3 -V
  Python 3.8.5
$ sudo apt install python3-venv
  E: Package 'python3-venv' has no installation candidate
$ sudo apt-get upgrade
  (dauert ne Weile 15:55-16:24)
  update-initramfs is disabled since running on read-only media
  E: Package 'python3-venv' has no installation candidate

Googeling for possible solutions: https://stackoverflow.com/questions/62314556/how-to-install-virtualenv-on-ubuntu-20-04-gcp-instance
https://community.home-assistant.io/t/package-it-missed-in-installation-in-python-virtual-environment/48788
… habe einiges versucht:

sudo apt install python3-venv
 10  sudo apt install python3.8-venv
 11  sudo apt install python3.4-venv
 12  apt cache search venv
 13  apt-cache search venv
 14  sudo apt install python3-venv
 15  sudo apt install python3.9-venv
 16  sudo apt install python3.8-venv
 17  sudo apt install python3.7-venv
 18  sudo apt install python3.6-venv
 19  sudo apt install python3.5-venv
 20  sudo apt install python3.10-venv
 21  sudo apt-get install python3-venv
 23  sudo apt-get update
 24  sudo apt-get install python3-venv
 25  sudo apt-get install python-virtualenv
 26  sudo apt-get install python3-virtualenv
 27  sudo apt-get install python3.8-venv
 30  sudo apt-get update
 31  sudo apt-get upgrade
 32  sudo apt-get install python3-virtualenv
 33  sudo apt-get install python3-venv
 34  sudo apt-get install python3
 35  sudo apt-get install python3-pip
 36  sudo apt-get update
 37  sudo apt-get upgrade
 38  sudo apt-get install python3-venv

immer noch nichts…

Mo. 29.03.2021

Habe Ubuntu auf dem Rechner PC Fablab 4 installiert.
Python version ist: Python 3.8.5
jetzt funktioniert

sudo apt install python3-venv  \\

ohne Fehlermeldung.

sudo apt install python3-pip\\
sudo apt-get install git-all
git version
 --> git version 2.25.1
cd Documents/
mkdir FME
cd FME
mkdir IP15_Bewaesserung
cd IP15_Bewaesserung
git clone https://gitlab.com/BorisFlit/bewaesserung-ip.git

Bei der Passworabfrage gebe ich meine G-mail Adresse und mein gitlab Passwort ein.

cd bewaesserung-ip
source bin/activate
 --> (django-vue) fablab@fablab-OptiPlex-7010:~/Documents/FME/IP15_Bewaesserung/bewaesserung-ip$
WARNING: The script sqlformat is installed in '/home/fablab/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The script django-admin is installed in '/home/fablab/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The scripts isort and isort-identify-imports are installed in '/home/fablab/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The script netatmo is installed in '/home/fablab/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The scripts epylint, pylint, pyreverse and symilar are installed in '/home/fablab/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

ansonsten alles OK.

python3 manage.py migrate
Username (leave blank to use 'fablab'): 
Email address: meier.ferdinand@gmail.com
Password: "fabadmin password"
Password (again): 
Superuser created successfully.

cd frontend/
npm install
Command 'npm' not found, but can be installed with:
sudo apt install npm
added 2012 packages from 1471 contributors and audited 2017 packages in 51.965s
98 packages are looking for funding
run `npm fund` for details
found 1 low severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details

npm run serve
cable cross sections
DONE  Compiled successfully in 9375ms   
App running at:
Local:   http://localhost:8080/ 
Network: http://192.168.1.70:8080/

installed gimp and inkscape

open a new window:

Activate the virtual environment:

source bin/activate

starte django webserver:

python3 manage.py runserver localhost:8000

jetzt kann die Seite localhost:8000 im Browser geöffnet werden:

Installiere Visual Studio Code:

sudo snap install --classic code

Habe in netatmofetch.py den usernamen und passwort eingetragen. Beim ausführen von /graphspage/netatmo_db_import/netatmo_first_import.sh bekomme ich die folgende Meldung:

./netatmo_first_import.sh 
Timestamp Datei erzeugt und auf 0 gesetzt.
error invalid_grant https://api.netatmo.com/oauth2/token
None
Traceback (most recent call last):
  File "csv_to_database.py", line 72, in <module>
    with open(csv_file_path, 'r', encoding='UTF-8') as file:
FileNotFoundError: [Errno 2] No such file or directory: 'netatmo_station.csv'

Habe jetzt den richtigen login für netatmo von Prof.Nebe und habe ihn in netatmofetch.py eingetragen.
Wenn ich jetzt netatmo_first_import.sh ausführe:

./netatmo_first_import.sh

bekomme ich folgende Meldung:

Timestamp Datei erzeugt und auf 0 gesetzt.
[]
Traceback (most recent call last):
  File "csv_to_database.py", line 72, in <module>
    with open(csv_file_path, 'r', encoding='UTF-8') as file:
FileNotFoundError: [Errno 2] No such file or directory: 'netatmo_station.csv'

Ich habe die Datei netatmo_station.csv mit

touch netatmo_station.csv 

erzeugt.
Jetzt bekomme ich

Timestamp Datei erzeugt und auf 0 gesetzt.
[]
Einträge werden in die Datenbank übertragen...

0 Einträge Übertragen

Bin noch einmal zurück in IP15_Bewaesserung/bewaesserung-ip um das virtual environment zu starten:

~/Documents/FME/IP15_Bewaesserung/bewaesserung-ip$ source bin/activate
(django-vue) fablab@fablab-OptiPlex-7010:~/Documents/FME/IP15_Bewaesserung/bewaesserung-ip$ cd graphspage/netatmo_db_import/
(django-vue) fablab@fablab-OptiPlex-7010:~/Documents/FME/IP15_Bewaesserung/bewaesserung-ip/graphspage/netatmo_db_import$ python3 csv_to_database.py -h
usage: csv_to_database.py [-h] [-i] [-gt] [-w]
optional arguments:
  -h, --help            show this help message and exit
  -i, --init            Bei Erstbenutzung bitte als erstes ausführen (oder wenn der Timestamp auf 0 gesetzt werden soll
  -gt, --get-timestamp  Holt den neusten Timestamp
  -w, --write           Writes the CSV data to the table

Habe den cronjob gestartet:

python3 manage.py crontab add
no crontab for fablab
  adding cronjob: (73bb14f920c56753f62140cb4e1eee0b) -> ('*/15 * * * *', 'djangovue.cron.myjob')

sensordata.py ausgeführt

python3 sensordata.py 
Trying to connect to: eu.thethings.network:8883
Connected with result code: 0
Subscribed to topic: +/devices/+/up

Mi. 31.03.2021

Der chronjob scheint zu laufen:

Schreibe Daten in die Datenbank...
Daten erfolgreich in die Datenbank Geschrieben!
TOPIC: hsrw_iotlab_lse01/devices/lse01_n007/up
PAYLOAD: {'app_id': 'hsrw_iotlab_lse01', 'dev_id': 'lse01_n007', 'hardware_serial': 'A84041B2A18264AC', 'port': 2, 'counter': 9495, 'payload_raw': 'DR0AAAQjBussiAE=', 'payload_fields': {'battery_voltage': {'comment': 'LSE01 battery voltage', 'unit': 'V', 'value': 3.357}, 'extra_temperature_sensor': {'comment': 'Temperature from an extra DS18B20. Not connected by default.', 'unit': '°C', 'value': '0.00'}, 'soil_sensor': {'electrical_conductivity': {'comment': 'Soil electrical conductivity (EC)', 'unit': 'uS/cm', 'value': 11400}, 'moisture': {'comment': 'Volumetric soil water content', 'unit': '%vol', 'value': '10.59'}, 'temperature': {'comment': 'Soil temperature', 'unit': '°C', 'value': '17.71'}}, 'type': 'LSE01'}, 'metadata': {'time': '2021-03-31T11:27:09.90232232Z', 'frequency': 867.1, 'modulation': 'LORA', 'data_rate': 'SF7BW125', 'airtime': 61696000, 'coding_rate': '4/5', 'gateways': [{'gtw_id': 'eui-b827ebfffeeb09b2', 'timestamp': 2172751227, 'time': '2021-03-31T11:27:09.881996Z', 'channel': 3, 'rssi': -39, 'snr': 10.2, 'rf_chain': 0}]}}

Unter http://localhost:8080/ ist jetzt auch der login screen sichtbar.
Leider habe ich das Passwort nicht.

Habe mit

python3 manage.py createsuperuser

einen superuser erstellt.
Jetzt klappt der Login:


projects/bewaesserung/installation.txt · Last modified: 2021/03/31 12:09 by ferdi