| title | Configuring a pi to run Ronny for 12urenloop |
|---|
-
Download and copy the raspbian lite .img file to an sd card
-
Mount the root partition and edit
/etc/hostnameto the desired hostname -
Mount the boot partition and create a file named
ssh(touch ssh) to enable ssh for one time -
Insert the sd card and boot the pi
-
Ssh into the pi and run
sudo raspi-config- Change the password to
zeusisdemax - Enable ssh
- Enable wait for network at boot
- Set timezone to
Europe/Brussels - Expand the filesystem
- Quit (don't reboot)
- Change the password to
-
Edit
/etc/systemd/timesyncd.conf- Change
#NTP=toNTP=ntp.ugent.be
- Change
-
Run
sudo systemctl enable systemd-time-wait-sync.serviceto allow waiting for the NTP server -
Reboot the pi
-
Install git and pip on the pi
-
Run
sudo -i && cd / && git clone https://github.com/12urenloop/Ronny-the-station-chef.git && cd Ronny-the-station-chef && pip install -r requirements.txtdownload Ronny and install the requirements -
Create
/etc/systemd/system/ronny.service,/etc/systemd/system/station.service,/usr/local/bin/ronny, and/usr/local/bin/station -
In
/etc/systemd/system/ronny.servicepaste[Unit] Description=Ronny, collects detections into a database Requires=network.target Requires=time-sync.target After=network.target After=time-sync.target [Service] Type=simple Restart=always User=root ExecStart=ronny [Install] WantedBy=multi-user.target
In
/usr/local/bin/ronnypaste#!/bin/bash cd /Ronny-the-station-chef /usr/bin/env python ronny.py
In
/etc/systemd/system/station.servicepaste[Unit] Description=Station, serves detections from the database Requires=network.target Requires=time-sync.target After=network.target After=time-sync.target [Service] Type=simple Restart=always User=root ExecStart=station [Install] WantedBy=multi-user.target
In
/usr/local/bin/stationpaste#!/bin/bash cd /Ronny-the-station-chef uvicorn station:app --host 0.0.0.0 --reload
Then enable the executables with
sudo chmod +x /usr/local/bin/ronny && sudo chmod +x /usr/local/bin/stationand enable the services withsudo systemctl enable ronny.service && sudo systemctl enable station.service -
Restart the pi or run
sudo systemctl start ronny && sudo systemctl start stationto start the services