-
Notifications
You must be signed in to change notification settings - Fork 5
Setup Backend
ReefSpy edited this page Apr 7, 2024
·
4 revisions
It is assumed the git repository was cloned to the home directory, so lets start there:
cd ~
create installation directory:
sudo mkdir /usr/local/bin/reefberrypi
copy source files to installation directory:
sudo cp ReefberryPi/controller/* /usr/local/bin/reefberrypi
Create a Python virtual environment, activate it, and install Python dependencies from requirements.txt:
sudo python -m venv /usr/local/bin/reefberrypi/venv
source /usr/local/bin/reefberrypi/venv/bin/activate
sudo python -m pip install -r ReefberryPi/controller/requirements.txt
create an initial config.ini file:
sudo nano /usr/local/bin/reefberrypi/config.ini
Enter the following values, and save (be sure to add the InfluxDB API Token you copied earlier!):
[global]
appuid =
influxdb_host = http://localhost:8086
influxdb_org = reefberrypi
influxdb_token = <<REPLACE_WITH_YOUR_TOKEN>>
mqtt_broker_host = localhost
mysql_host = localhost
mysql_user = pi
mysql_password = reefberry
mysql_database = reefberrypi
mysql_port = 3306
Give ownership of the installation directory to user pi and make the start script executable:
sudo chown -R pi: /usr/local/bin/reefberrypi/
sudo chmod +x /usr/local/bin/reefberrypi/rbp-start.sh
Setup the Reefberry Pi service:
sudo cp /usr/local/bin/reefberrypi/reefberrypi.service /etc/systemd/system/
sudo systemctl enable reefberrypi.service
sudo systemctl start reefberrypi.service