From ee1dd74793371fd3d16c6d8a29fa70b940d52c1b Mon Sep 17 00:00:00 2001 From: Shlomo Zalman Heigh Date: Sun, 7 Dec 2025 18:23:17 -0500 Subject: [PATCH 1/2] Add GitHub Actions workflow for building frontend --- .github/workflows/build-frontend.yml | 30 ++++++++++++++++++++++++++++ .github/workflows/build-image.yml | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build-frontend.yml diff --git a/.github/workflows/build-frontend.yml b/.github/workflows/build-frontend.yml new file mode 100644 index 0000000..d2c7ade --- /dev/null +++ b/.github/workflows/build-frontend.yml @@ -0,0 +1,30 @@ +--- +name: Build Frontend +on: [push, pull_request, workflow_dispatch] + +jobs: + build-frontend: + runs-on: ubuntu-latest + steps: + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: 12 + + - name: Checkout Project Repository + uses: actions/checkout@v2 + with: + repository: ${{ github.repository }} + path: repository + + - name: Build React frontend + run: | + cd repository/naturewatch_camera_server/static/client + npm i -y + npm run build + + - name: Archive build folder + uses: actions/upload-artifact@v4 + with: + name: build + path: repository/naturewatch_camera_server/static/client/build diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index c801410..5781554 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -1,6 +1,6 @@ --- name: Build Image -on: [push, pull_request, workflow_dispatch] +on: [workflow_dispatch] jobs: build: From 1640162fbf94244e0841675de6e22b6b4d956e5b Mon Sep 17 00:00:00 2001 From: Shlomo Zalman Heigh Date: Sun, 7 Dec 2025 19:15:56 -0500 Subject: [PATCH 2/2] Add installation instructions for existing RPi --- README.md | 1 + README_RASPBIAN_INSTALL.md | 64 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 README_RASPBIAN_INSTALL.md diff --git a/README.md b/README.md index fd8c63a..81dc8a5 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ These updates now should make it easier for community members to adapt and updat 1. Either clone the repository and build software locally, fork the repository and run the Github Actions build, or download the latest commit build. 2. Uncompress the built zip file and burn this to an SD card. We recommend using [Raspberry Pi Imager](https://www.raspberrypi.com/software/) for this. +3. Alternatively, flash the latest Raspberry Pi OS (Lite) image to an SD card and then follow the steps in [README_RASPBIAN_INSTALL.md](README_RASPBIAN_INSTALL.md) to install the software manually. ## Configuring the wifi setup diff --git a/README_RASPBIAN_INSTALL.md b/README_RASPBIAN_INSTALL.md new file mode 100644 index 0000000..4dc0fda --- /dev/null +++ b/README_RASPBIAN_INSTALL.md @@ -0,0 +1,64 @@ +# Installing on Raspbian / Raspberry Pi OS Lite + +On a fresh install of Raspberry Pi OS Lite (formerly Raspbian Lite), you can +install the Naturewatch Camera Server software by following these steps. One +advantage to using this method is that you can take advantage of the latest +Raspberry Pi OS updates and features, and you can customize the installation in +Raspberry Pi Imager before flashing the SD card (for example, enabling SSH on +first boot). + +## On your Raspberry Pi + +### Update and install necessary packages: + +```bash +sudo apt-get update +sudo apt-get upgrade -y +sudo apt-get install -y coreutils p7zip-full qemu-user-static python3-git python3-picamera2 git python3-pip python3-libcamera libcap-dev ffmpeg python3-flask python3-numpy python3-opencv python3-kms++ +``` + +### Clone the Naturewatch Camera Server repository + +```bash +cd /home/pi +git clone https://github.com/interactionresearchstudio/NaturewatchCameraServer-CommunityDevelopmentEdition.git NaturewatchCameraServer +``` + +### Copy the frontend build files + +Run `build_node_app.sh` on your main machine and copy the `build` folder to the +Pi, to `/home/pi/NaturewatchCameraServer/naturewatch_camera_server/static/client/build`. Or you can +download the build folder from a GH workflow run. Once you have the build folder +in place, continue here: + +### Set up the Python virtual environment and install dependencies + +```bash +cd /home/pi/NaturewatchCameraServer +python -m venv --system-site-packages /home/pi/NaturewatchCameraServer/.venv +/home/pi/NaturewatchCameraServer/.venv/bin/pip install -r requirements.txt +``` + +### Set up the service + +Uncomment the commented lines to enable WiFi hotspot. + +```bash +cd /home/pi/NaturewatchCameraServer +export DIR=$(pwd) +TEMPLATES="${DIR}/helpers" +sed -e "s|\${path}|/home/pi|g" "${TEMPLATES}/python.naturewatch.service" > "./python.naturewatch.service" +# sed -e "s|\${path}|/home/pi|g" "${TEMPLATES}/wifisetup.service" > "./wifisetup.service" +sudo cp python.naturewatch.service "/etc/systemd/system/" +sudo chmod 644 /etc/systemd/system/python.naturewatch.service +# sudo chmod 644 /etc/systemd/system/wifisetup.service +sudo systemctl daemon-reload +sudo systemctl enable python.naturewatch.service +# sudo systemctl enable wifisetup.service +sudo systemctl start python.naturewatch.service +# systemctl start wifisetup.service +(sudo crontab -l 2>/dev/null; echo "# Start watchdog script at boot time") | sudo crontab - +(sudo crontab -l 2>/dev/null; echo "@reboot ${TEMPLATES}/watchdog.sh > /dev/null 2>&1") | sudo crontab - + +sudo systemctl status python.naturewatch.service +```