Guides

Installation by platform

Raspberry Pi

Prerequisites


# Chromium
sudo apt-get update
sudo apt-get install chromium-browser --yes

# Disabling screen saver
sudo cat > /usr/bin/screensaver_off.sh <<END
#!/bin/bash
sleep 10 &&
sudo xset s 0 0
sudo xset s off
exit 0
END

sudo chmod +x /usr/bin/screensaver_off.sh

# /!\ Must be run with user which start x server, usually pi
cat > ~/.config/autostart/screensaver_off.desktop <<END
[Desktop Entry]
Type=Application
Exec=/usr/bin/screensaver_off.sh
Hidden=false
X-MATE-Autostart-enabled=true
Name[fr_FR]=screensaver_off
Name=screensaver_off
Comment[fr_FR]=
  Comment=
END
      

Install Monitoror


# Download binary file and make it executable
sudo mkdir /opt/monitoror
sudo curl -s -o /opt/monitoror/monitoror https://github.com/monitoror/monitoror/releases/latest/download/monitoror-linux-arm
sudo chmod +x /opt/monitoror/monitoror

# Create backend configuration file
# Setup default UI config with MO_CONFIG
touch /opt/monitoror/.env
      

Tip: To run monitoror with another user, change binary owner.

Starting Monitoror

Manually

# Starting backend
/opt/monitoror/monitoror

# Starting UI
chromium-browser --kiosk --password-store=basic --disable-infobars \
  --app=http://localhost:8080/
      
Automatically

# Backend startup with systemd
sudo cat > /lib/systemd/system/monitoror.service <<END
[Unit]
Description=Monitoror
After=multi-user.target

[Service]
Type=idle
ExecStart=/opt/monitoror/monitoror
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=monitoror

[Install]
WantedBy=multi-user.target
END

sudo systemctl enable monitoror.service
sudo systemctl start monitoror.service

# rsyslog configuration
sudo cat > /etc/rsyslog.d/99-monitoror.conf <<END
if \$programname == 'monitoror' then /var/log/monitoror/monitoror.log
& stop
END

sudo mkdir /var/log/monitoror/
sudo touch /var/log/monitoror/monitoror.log
sudo chown syslog:adm /var/log/monitoror/monitoror.log

sudo service rsyslog restart

# UI startup with autostart
# /!\ Must be run with user which start x server, usually pi
cat > ~/.config/autostart/chromium-browser.desktop <<END
  [Desktop Entry]
  Type=Application
  Exec=chromium-browser --kiosk --password-store=basic --disable-infobars --app=http://localhost:8080/
  Hidden=false
  X-MATE-Autostart-enabled=true
  Name[fr_FR]=chromium-browse
  Name=chromium-browser
  Comment[fr_FR]=
    Comment=
  END
      

Development

This section is for development purposes only.
Those tools are not necessary to run Monitoror from binaries.

Requirements

  • Go v1.14+
  • Nodejs v10+
  • Yarn v1.7+

Install Go tools

Execute these commands either:

  • outside of Monitoror project
  • or use go mod tidy after them

# Generating mock for backend
go get -u github.com/Willyham/mockery/.../

# Test utilities
go get -u gotest.tools/gotestsum

# Embed UI dist into go binary
go get -u github.com/GeertJohan/go.rice/rice
      

See golangci-lint installation guide to install linter.

Run project

Start project

# Core
make install
make run
      

# UI
cd ui
yarn
yarn serve
      
Build project

cd ui
yarn
yarn run build
cd ..
make install
make build
      
Run tests and lint

make test
make lint
      
List all the available targets

make help