Noderunner Noderunner is a Node.js server app that runs scripts every second, minute, hour or overnight, each group in its own folder. Sun, 04 Jan 2015 19:04:36 GMT Sun, 04 Jan 2015 19:04:36 GMT en-us Fargo v1.68 davewiner dave.winer.12 Why I needed Noderunner <p>I have lots of little scripts scattered across my servers whose only job is to keep to things in sync.<img style="float: right; margin-left: 25px; margin-bottom: 15px;" src=""></p> <h4>An example</h4> <p>For example, I edit <a href="">Scripting News</a> in <a href="">Fargo</a>, but serve it on S3.</p> <p>S3 is necessary for Scripting, because so many people subscribe to the <a href="">RSS feed</a>, it's the most practical way to scale it. Let S3 handle the traffic. They have to do it for everyone else too. <i class="fa fa-smile-o"></i></p> <p>So I need a little bit of glue that's watching a folder and when something new shows up copies it to S3. </p> <h4>20 years of glue</h4> <p>I've been doing this for 20 years! So there's lots of little crap floating around. And I'm always creating new stuff that needs to be glued together. I didn't want to deploy the new stuff on various Frontier servers I still run (have to or else the content goes away), I want to do it all in Node.js, and run on Unix, from this point on. So <a href="">Noderunner</a> is where I write the little cheesy bits of glue I need to keep things going as I develop more stuff to glue together next month. </p> <h4>Another example</h4> <p>I have a <a href="">NYT river</a> that flows items into the <a href="">@NYT</a> twitter account. That connection done by a little bridging script that runs once a minute.</p> <h4>Why Dropbox is cool for this</h4> <p>Keeping it all in the filesystem makes it easy to do an audit, and also means I have a wide variety of choices of tools to use to edit these scripts now and in the future. Hooking it all up via Dropbox means I can edit stuff no matter where I am. I could even edit server code on my iPhone because they have a Dropbox that runs there too.</p> <h4>Noderunner is duct tape</h4> <p>You live to write elegant software where everything flows naturally.</p> <p>Unfortunately it doesn't always work out that way. Or history takes us in a different direction. For those situations you need places to organize your little hacks that glue things together. For that, a script organizer like <a href="">Noderunner</a> is really nice to have.</p> <p>"It's even worse than it appears!"</p> Sat, 03 Jan 2015 18:46:34 GMT Noderunner v0.57 <p>Two major changes in this release of <a href="">Noderunner</a>, thanks to a <a href="">suggestion</a> by Marco Fabbri on the mail list.</p> <h4>folderPath</h4> <p>If you specify a noderunnerFolderPath environment variable, Noderunner will store its and and run scripts from that folder. </p> <p><code>export folderPath=/home/bull/mydata/</code></p> <p>If you don't specify it, the functionality is as before, the data and scripts are expected to be in the same folder as noderunner.js. </p> <p>You may want to create the folder running the app and put prefs.json in the prefs folder. I needed to do this because I have Noderunner responding to HTTP requests on a port other than the default, port 80.</p> <h4>Line-endings</h4> <p>I changed the line-endings in noderunner.js and the sample scripts to be Unix style, a single \n character.</p> <h4>Re Marco's other comments</h4> <p>The "web" folder was part of a feature that was removed while Noderunner was in development. It became another snack, which should be the next one released. I felt it needed to be separate, keeping with the "do one thing well" philosophy. The project was drifting, and I needed to refocus it.</p> <p>Re using <a href="">eval</a>, there are tradeoffs to all script-running approaches. I stuck with eval over the other options, because it offered the simplicity and power I was looking for. I <i>want</i> user scripts to be able to access the routines and data of Noderunner. I want to add more built-in verbs, and work on it as I worked on the <a href="">verb set</a> of Frontier. </p> <p>I know that the <a href="">vm package</a> allows you to provide a sandbox for scripts to run in. But I don't want to have to think about this too much, Noderunner is important, but it's not everything. And maybe at some point its functionality will be absorbed into something designed on a grander scale.</p> <p>Noderunner is designed to be a nice utility for an individual programmer, or a small team. You don't need to protect the environment any more than you would for other code you write. If you wanted to offer this as a service to random people, you would most definitely need to sandbox the scripts. But that's now how I'm expecting to use this.</p> <p>The other items on Marco's list are great, you can tell that I'm new to working in this environment. I developed in Unix in the 1970s. My whole philosophy of development was formed by this experience. But I spent the 80s, 90s and 00s working in Mac and Windows. A lot of new Unix culture formed in that period, and I forgot stuff I used to know. Thank you for your patience! <i class="fa fa-smile-o"></i></p> Tue, 30 Dec 2014 17:39:43 GMT