mrjackwills / leafcast_pi

leafcast plant camera backend

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Leafcast - pi client rust

The pi client for Leafcast, powered by staticPi.com

Built in Rust
See typescript branch for original, now not maintained, TypeScript version

See the frontend website source here

Required Hardware

  1. Raspberry pi - designed for, tested, and fully working, on a Raspberry pi zero w 2
  2. Pi camera, such as camera module

Required services

  1. staticPi - the simple and secure messaging service

Required software

  1. libcamera-still - should be pre-installed in recent Pi OS version
  2. libwebp - should be pre-installed in recent Pi OS version

Download

See releases

download (aarch64 one liner)

wget https://www.github.com/mrjackwills/leafcast_pi/releases/latest/download/leafcast_linux_aarch64.tar.gz &&
tar xzvf leafcast_linux_aarch64.tar.gz leafcast

Run step

a) sudo ./leafcast -i create and install systemd service file, to automatically run on boot

or

b) ./leafcast run in current session

Suggested directories and file

directory reason
~/leafcast/logs Log files
~/leafcast/photos photo storage
~/leafcast/.env environmental variables
/ramdrive/ip.addr ip address
# addition to /etc/fstab
ramdrive /ramdrive tmpfs defaults,noatime,size=128K     0       0

suggested crontab

@reboot ip addr show wlan0 | grep -Po 'inet \K[\d.]+' > /ramdrive/ip.addr
*/5 * * * * ip addr show wlan0 | grep -Po 'inet \K[\d.]+' > /ramdrive/ip.addr

ip address gets updated every 5 minutes, so write to a ramdrive rather than causing repetitive, eventually damaging, writes to the pi's SD card

Build step

Raspberry pi 64bit pi (pi zero 2 w, pi 4)

requires docker & cross-rs

  1. cross build --target aarch64-unknown-linux-musl --release or cross build --target aarch64-unknown-linux-gnu --release

Tests

Testing is a work in progress

cargo test -- --test-threads=1

About

leafcast plant camera backend

License:MIT License


Languages

Language:Rust 93.0%Language:Shell 6.5%Language:Dockerfile 0.5%