- connects to backend using websockets
- takes a picture frequently
- Node.js 5.0.0 node.js homepage
- command line camera app, uses ImageSnap in development and fswebcam in production. These can be changed in configs.
- Start vor-backend
- Install dependencies:
npm install
- Start server and watch changes:
npm run start
- App will run in port 9000
- To lint ESlint:
npm run eslint
- To run tests:
npm run test
- To run tests continuously:
npm run test-watch
- Install Raspian version ^8 to Raspberry PI
- SSH to Raspberry PI Raspberry PI support
- Install node.js ^5.0.0 more info
- use https://nodejs.org/dist/v5.0.0/node-v5.0.0-linux-armv6l.tar.gz for Raspberry PI 1
- use https://nodejs.org/dist/v5.0.0/node-v5.0.0-linux-armv7l.tar.gz for Raspberry PI 2
- Run:
sudo apt-get update
to update package manager - Run:
sudo apt-get install fswebcam
to install fswebcam more info - Run:
cd /var
and run:sudo git clone https://github.com/futurice/vor.git
to clone this repo - Run:
cd /var/vor/vor-image-client
and run:sudo npm install --unsafe-perm --production
- 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
- 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
- Run:
sudo systemctl start vor.service
to start service. Notice! when ever you edit vor.service file:- run:
sudo systemctl daemon-reload
to ensure updated file is used. - run:
sudo systemctl restart vor.service
to restart service.
- run:
- Run:
sudo systemctl enable vor.service
to enable service for reboot. - Run
sudo systemctl status vor.service
to view the process output.
EXTRA: More about system services