/temperature_monitor

Django project for monitoring 1-wire temperature sensors

Primary LanguagePython

Setup

  1. Create web-site directory: mkdir /temperature_site.
  2. Create static directory: mkdir /temperature_site/static.
  3. Set-up camera-image directory.
    1. Create the directory mkdir /temperature_site/camera_images.
    2. Create data-acquisition user: sudo useradd -r -s /bin/false data_acquisition.
    3. Change group: sudo chgrp data_acquisition /temperature_site/camera_images.
    4. Set group permissions: sudo chmod g=rxw /temperature_site/camera_images.
  4. Clone temperature monitor repo: cd /temperature_site & git clone https://github.com/SkyToGround/temperature_monitor.git.
  5. Install Python 3 and required libraries (listed in requirements.txt).
  6. Install Postgres
  7. Log on to Postgres: sudo su postgres and psql.
  8. Create django user: CREATE USER django WITH PASSWORD xxxxx;.
  9. Create the django database: CREATE DATABASE yyyyyyy;.
  10. Populate the database with the django tables.
    1. First, set the correct database settings in the django settings file.
    2. Then run the following Python command: cd /temperature_site/temperature_monitor & python3 manage.py migrate.
  11. Create Grafana user: CREATE USER grafana WITH PASSWORD zzzzzzz;.
  12. Grant read permission to Grafana relevant tables.
    1. Connect to the database: \connect yyyyyyy.
    2. Give permission: GRANT SELECT ON temperature_sensors_temperatures TO grafana;
    3. Give permission: GRANT SELECT ON temperature_sensors_temperaturesensor TO grafana;.
  13. Install owfs.
  14. Copy owfs systemd unit to the correct directory: cd /temperature_site/temperature_monitor/systemctl-services & sudo cp owfs.service /lib/systemd/system/
  15. Copy systemd units to the correct directory: cd /temperature_site/temperature_monitor/systemctl-services & sudo cp image_acquisition.service /etc/systemd/system/ & sudo cp temperature_acquisition.service /etc/systemd/system/.
  16. Start the services: systemctl start image_acquisition & systemctl start temperature_acquisition.
  17. Install apache2 and and mod-wsgi apt-get install apache2 libapache2-mod-wsgi-py3.
  18. Copy the file sparup_config.conf to /etc/apache2/sites-available/.
  19. Enable site config by running: a2ensite sparup_config.