Question

I'm working through the StrongLoop's getting started instructions and created my sample app. Whilst the instructions tell me to use:

slc run .

to start my application, I noticed I can equally run my application with:

node app.js

and get the same result. Obviously by using the second approach I can integrated my StrongLoop application with tools such as forever.

So my question is, what extra benefits does slc run offer? Does it have functionalities such auto restart etc?

Was it helpful?

Solution

You can do more with slc than node app.js.

slc is a command line tool for StrongLoop, which has more features. If you just want to run the app, it doesn't matter much, but if you want to do more, you can.

Here's the documentation: http://docs.strongloop.com/display/SLC/StrongLoop+Controller

It doesn't have much features for development (such as auto restart and such), but it will help with managing servers and what not.

OTHER TIPS

My favorite feature is scaling a node app using slc.

You can do "slc run . size 2". This will spin up 1 master and 1 worker process which is part of a single cluster. Now if my workload increases, and resources are low, which I know using strongOps monitoring (slc strongops) and I want to scale the app without having to stop the app and re-engineer, I can just do the following:

"slc clusterctl size 4". This will spin up 2 more worker processes and automatically attach them to the same application cluster at run-time. The master will auto distribute the workload now to the new processes.

This is built on top of node cluster module. But there is much more to it. Used cluster-store to store shared cluster state objects too.

Another feature is "slc debug". Launches Node Inspector and brings the application code in runtime context and helps me in debugging, load source maps and iterate through test runs.

Based on the latest release at the moment (v2.1.1), the main immediate benefit of running slc run instead of node app.js is you get a REPL at the same time (lib/run-reple.js#L150L24). Looks like all you have to do is have main set properly in package.json, since it uses Module._load().

If you run slc run app.js you get no benefit as far as I can tell: lib/commands/run.js#30.

Yay open source! https://github.com/strongloop/strong-cli

One of my favorite features is 'slc debug app.js' which brings up node-inspector for debugging . its nice CLI sugar. But of course you can totally run node and configure this manually.

I created a Linux init.d Daemon script which you can use to run your app with slc as service: https://gist.github.com/gurdotan/23311a236fc65dc212da

Might be useful to some of you.

slc run

it can be only used for strong loop application

while node . or node [fileName] can be used to execute any Nodejs file

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top