Skip to content

Latest commit

 

History

History
66 lines (56 loc) · 3.07 KB

README.md

File metadata and controls

66 lines (56 loc) · 3.07 KB

Vör Image Client

A light-weight node.js client(server) installed in Raspberry PI 1 or 2

  • connects to backend using websockets
  • takes a picture frequently

Requirements

Local setup

  1. Start vor-backend
  2. Install dependencies:npm install
  3. Start server and watch changes: npm run start
  4. App will run in port 9000

Other commands

  • To lint ESlint: npm run eslint
  • To run tests: npm run test
  • To run tests continuously: npm run test-watch

Deploying to Raspberry PI

  1. Install Raspian version ^8 to Raspberry PI
  2. SSH to Raspberry PI Raspberry PI support
  3. Install node.js ^5.0.0 more info
  4. Run: sudo apt-get update to update package manager
  5. Run: sudo apt-get install fswebcam to install fswebcam more info
  6. Run: cd /var and run: sudo git clone https://github.com/futurice/vor.git to clone this repo
  7. Run: cd /var/vor/vor-image-client and run: sudo npm install --unsafe-perm --production
  8. Run cd and add /var/vor.env file with content:
SOCKET_SERVER=<vor-backend server>
LISTEN_TYPE=<socket message type to listen>
LISTEN_ID=<socket message id to listen>
SEND_TYPE=<the type property of message to be sent>
SEND_ID=<the id property of message to be sent>
UPDATE_TIME=<how frequently the client will send an image in milliseconds>
NODE_PATH=/var/vor/vor-image-client/
NODE_ENV=production
  1. Add /etc/systemd/system/vor.service file with content:
[Unit]
Description=vor-image-client

[Service]
ExecStart=/usr/local/bin/node --harmony_destructuring --harmony_modules --harmony_array_includes /var/vor/vor-image-client/app/index.js
EnvironmentFile=-/var/vor.env
WorkingDirectory=/var/vor/vor-image-client

[Install]
WantedBy=multi-user.target
  1. Run: sudo systemctl start vor.service to start service. Notice! when ever you edit vor.service file:
    1. run: sudo systemctl daemon-reload to ensure updated file is used.
    2. run: sudo systemctl restart vor.service to restart service.
  2. Run: sudo systemctl enable vor.service to enable service for reboot.
  3. Run sudo systemctl status vor.serviceto view the process output.

EXTRA: More about system services