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