Skip to content

Latest commit

 

History

History
193 lines (141 loc) · 4.74 KB

manual.adoc

File metadata and controls

193 lines (141 loc) · 4.74 KB

HallCam: Technical Handbook

HallCam is a video monitoring solution for buildings and places.

Standard Installation von Ubuntu Server in Deutsch, Version: Ubuntu 20.04 LTS

Kontrolliere die Konfiguration und Funktion der NTP Synchronisierung:

$ timedatectl
# [...]
System clock synchronized: yes
              NTP service: active

$ timedatectl timesync-status
# [...]
$ pwd
/home/carsten
$ git clone https://github.com/carstenfuchs/hallcam.git HallCam
Cloning into 'HallCam'...
$ sudo apt install python3-venv
$ cd ~
$ mkdir .virtualenvs
$ python3 -m venv ~/.virtualenvs/HallCam-web
$ ln -s .virtualenvs/HallCam-web/bin/activate activate_HallCam_web
$ . activate_HallCam_web
$ cd HallCam/web/
$ pip install wheel
$ pip install -r requirements.txt

Can these steps be modernized? See Python Best Practices for a New Project in 2021.

$ cp HallCam/localconfig.example HallCam/localconfig.py
$ nano HallCam/localconfig.py

An diesem Punkt sollte HallCam bereits über die Management Shell funktionieren:

$ ./manage.py shell
Python 3.8.10 (default, Sep 28 2021, 16:10:42)
>>> from Core.models import Camera
>>> for c in Camera.objects.all():
...     print(c)
>>> quit()

There is no patchday.py script for the HallCam at this time. However, we need to create the directory that ./manage.py collectstatic collects into and from which the webserver serves the static files. We also need the directory into which the webserver can save the uploaded media (pictures) from the cameras.

$ sudo mkdir /var/www/HallCam-static
$ sudo chown carsten:carsten /var/www/HallCam-static/

$ sudo mkdir /var/www/HallCam-media
$ sudo chown carsten:carsten /var/www/HallCam-media/

$ # ./patchday.py
$ ./manage.py collectstatic --no-input

Überprüfe einige wichtige Dateien und passe sie ggf. an:

$ cat /etc/hostname
l-lori-01

$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 l-lori-01.rofu.de l-lori-01

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Beginne die Installation:

$ sudo apt install apache2 libapache2-mod-wsgi-py3

Kann direkt danach im Browser http://localhost/ oder z.B. http://l-lori-01/ aufrufen („It works!“).

Füge nun die Konfigurationsdateien /etc/apache2/sites-available/hallcam[-ssl].conf hinzu. Diese Dateien sind der wichtigste Bestandteil der Apache-Konfiguration:

$ sudo cp HallCam/etc_apache2_sites-available_hallcam.conf /etc/apache2/sites-available/hallcam.conf
$ sudo a2dissite 000-default.conf
$ sudo a2enmod headers  # mod_headers wird in hallcam.conf benötigt
$ sudo a2ensite hallcam.conf

Abschluss der Apache-Konfiguration:

# Starte den Apache Server neu, um alle der o.g. Änderungen aktiv werden zu lassen.
$ sudo systemctl restart apache2

Browsing to http://localhost/ shows the home page of the HallCam project!

$ sudo cp hallcam-web.service /etc/systemd/system
# Customize user and paths settings:
$ sudo nano /etc/systemd/system/hallcam-web.service
$ sudo systemctl daemon-reload
$ sudo systemctl enable hallcam-web.service
Created symlink /etc/systemd/system/multi-user.target.wants/hallcam.service → /etc/systemd/system/hallcam.service.

$ sudo systemctl status
$ journalctl -u hallcam-web
$ systemctl list-dependencies multi-user.targe
$ systemctl list-dependencies hallcam-web