This guide details the required shell commands u need to use. This guide and used templates assume you're running everything from inside the home directory, you can make sure you're there by running this:
cd ~ First step should be a general update:
sudo apt-get update
sudo apt-get -y upgradeInstall Python:
sudo apt-get install python3-pip python3-venvRun these inside the /home directory to setup the virtual environment:
python3 -m venv env --system-site-packagesActivate the virtual environment when installing any python libraries:
source env/bin/activateGit clone the FPF-Backend this only retrieves the deployment branch without any commit history:
git clone --depth 1 -b deployment --single-branch https://github.com/ETCE-LAB/FarmInsight-FPF-Backend.gitAnd install requirements for the django project:
pip install -r FarmInsight-FPF-Backend/django_server/requirements.txt Edit the "FarmInsight-FPF-Backend/django_server/.env.dev" file and set the required variables, using a text editor for example nano:
nano FarmInsight-FPF-Backend/django_server/.env.devEdit the "FarmInsight-FPF-Backend/farminsight-fpf.service" file, replace the with your username:
nano FarmInsight-FPF-Backend/farminsight-fpf.serviceDo the same thing with the "FarmInsight-FPF-Backend/startup.sh" file and make the startup.sh script executable:
nano FarmInsight-FPF-Backend/startup.sh
chmod +x FarmInsight-FPF-Backend/startup.shThen copy it into /etc/systemd/system/ so it is available to start as a system service:
sudo cp FarmInsight-FPF-Backend/farminsight-fpf.service /etc/systemd/system/farminsight-fpf.serviceEnable the service to start at reboot, if you're relying on the other external requirements like the DHT libaries, install these first before doing this step:
sudo systemctl enable farminsight-fpfYou can also manually start it to test
sudo systemctl start farminsight-fpfEdit the startup.sh file to change the port of the fpf server (from our default 8001) or what outside connections it allows.
Now make sure that you have all the sensor types you need in your FarmInsight-FPF-Backend/django_server/fpf_sensor_service/sensors folder and are loading them into the module in the init.py file it is also best to disable any sensors you don't support.
First step is to setup adafruit-blinka (adafruit docs) Restart the system if prompted to and afterwards remember to reactivate the python virtual environment:
sudo apt install --upgrade python3-setuptools
pip3 install --upgrade adafruit-python-shell
wget https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/raspi-blinka.py
sudo -E env PATH=$PATH python3 raspi-blinka.pyNext is to install adafruit CircuitPythons DHT library (adafruit docs):
pip3 install adafruit-circuitpython-dht
sudo apt-get install libgpiod2