Month: November 2014

A couple of weeks ago, I started running River4 on my Synology DS412+ NAS device. At the moment I’m generating just one river, which you can see on river.jakesavin.com.

Since I needed River4 to run all the time, and I didn’t want to have to kick it off by hand every time the NAS boots up, I decided to write an init.d script to make River4 start automatically.

If you have a Synology NAS or other Linux-based machine that uses init.d to start daemon processes, you can use or adapt my script to run River4 on your machine.

How to

  1. Install node.js and River4 on your machine.
    • I installed River4 under /opt/share/river4/ since that’s where optional software usually goes on Synology systems, but yours can be wherever you want.
  2. Follow Dave’s instructions here in order to set up River4 with your data, and test that it’s working.
  3. Download the init.d shell script.
  4. Unzip, and copy the script to  /opt/etc/init.d/S58river4 on your NAS/server.
  5. Make the script executable on your NAS/server with:  chmod 755 S58river4
  6. Edit the variables near the top of the script to correspond to the correct paths on your local system.
    • If you’re using a Synology NAS, and the SynoCommunity release of node.js, then the only paths you should need to change are RIVER4_EXEC and RIVER4_FSPATH, which are the path to river4.js and your web-accessible data folder (river4data in Dave’s instructions).
  7. Run River4 using  /opt/etc/init.d/S58river4 start

At this point, River4 should be running.

If your firewall is enabled and want access to the dashboard, you’ll need to add a firewall rule to allow incoming TCP traffic on port 1337. I recommend you only do this for your local network, and not for the Internet at large, since River4 doesn’t currently require authentication.

Once your firewall has been configured, you should be able to access the dashboard via:

http://myserver:1337/dashboard

Notes

The script assumes you’re going to be generating your river of news using the local filesystem, per Dave’s instructions for using River4 with file system storage. I haven’t used it with S3 yet, but you should be able to simply comment out the line in my script that says export fspath, and get the S3 behavior.

There is no watcher, so if River4 crashes or is killed, or if node itself exits, then you’ll need to restart River4 manually. (It should restart automatically if you reboot your NAS.)

Questions, Problems, Caveats

I did this on my own, and it is likely to break in the future if River4 changes substantially. I can’t make any guarantees about support or updates.

If you have problems, for now please post a comment on this post, and I’ll do what I can to help.

Please don’t bug Dave. 😉

Source code

Here’s the source code of the init.d script. (The downloadable version also contains instructions at the top of the file.)

Uncategorized