REST API

From veeOp Wiki
Revision as of 16:05, 23 October 2013 by Doug (Talk | contribs)

Jump to: navigation, search

Installing NPM Modules

Install "forever" as a global npm module

sudo npm install forever -g

(If you install it local first, before that, you might have to uninstall both, and then install globally)

Per node-i2c module readme on Raspbian

After installing i2c, you'll need to configure that the modules are available.

sudo vi /etc/modules

And add

i2c-bcm2708
i2c-dev

Then edit

sudo nano /etc/modprobe.d/raspi-blacklist.conf

And comment out the i2c module so it looks like:

# blacklist i2c-bcm2708

Load the kernel module

sudo modprobe i2c-bcm2708

...You may need to reboot at this point.

Check that it's there

pi@raspberrypi ~ $ sudo ls /dev/i2c-* -l
crw------- 1 root root 89, 0 Oct 23 20:03 /dev/i2c-0
crw------- 1 root root 89, 1 Oct 23 20:03 /dev/i2c-1

And make it writeable.

sudo chmod o+rw /dev/i2c*

Setting up syslog

The server process uses node-syslog to get the logging done, which in turn requires some setup on the syslogd on your system. Again note, if you're using a pre-configured distro, this will already be setup for you.

In my example configuration in Pidora, we'll edit our syslog.conf

nano /etc/rsyslog.conf

And we'll add these two lines:

# Save veeOP daemon messages to	veeop.log
local5.*                                                /var/log/veeop.conf

Then restart the daemon with

sudo service syslog restart

You'll probably also want to rotate this log, go and edit instructions for syslog

nano /etc/logrotate.d/veeop

And fill it with:

/var/log/veeop.log {
    missingok
    notifempty
    size 5M
    yearly
    create 0600 root root
}