Skip to content

Instantly share code, notes, and snippets.

@wurmr
Last active November 27, 2020 16:50
Show Gist options
  • Save wurmr/5ce012f897c905da356b0143ebe2ad1a to your computer and use it in GitHub Desktop.
Save wurmr/5ce012f897c905da356b0143ebe2ad1a to your computer and use it in GitHub Desktop.
Pool Monitor Install on Pi Zero

Installation Steps for Pi Zero W

Install Node

Node 10.x is the latest version of node that works on the arm6 of the Pi Zero

Get the latest distrobution here https://nodejs.org/dist/latest-v10.x/ and run commands like below:

$ wget https://nodejs.org/dist/latest-v10.x/node-v10.23.0-linux-armv6l.tar.xz
$ tar xvf node-v10.23.0-linux-armv6l.tar.xz
$ sudo cp -r node-v10.23.0-linux-armv6l/* /usr/local/

Check the install

$ node -v
$ npm -v

Setup the applications

Clone the repository

$ git clone git@github.com:wurmr/pool-monitor.git

Build Monitor application

$ cd pool-monitor/monitor
$ npm ci
$ npm run build

Create service

General documanation can be found here.

Create a service script /etc/systemd/system/pool-monitor.service

[Unit]
Description=Pool Monitor
After=network.target

[Service]
ExecStart=/usr/bin/npm start
WorkingDirectory=/home/pi/pool-monitor/monitor
StandardOutput=inherit
StandardError=inherit
Restart=always
User=pi

[Install]
WantedBy=multi-user.target

Start and Enable the service

$ sudo systemctl start pool-monitor
$ sudo systemctl enable pool-monitor

Install nginx

Reference documation here

$ sudo apt update
$ sudo apt install nginx
$ sudo /etc/init.d/nginx start

Build Web interface

$ cd pool-monitor/web
$ npm ci
$ npm run build

Copy the output to nginx

$ sudo cp -r build/* /var/www/html

Add Proxy Pass for api to nginx

$ sudo nano /etc/nginx/sites-enabled/default

Add a new location section to the file directly below the default / location

        location /api {
                proxy_pass http://localhost:4000;
        }

Restart nginx

$ sudo /etc/init.d/nginx restart

Test it all

Open a web browser to your pool pi port 80 and see if it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment