What is the different between using StrongLoop's “slc run” and “node app.js”

前端 未结 6 853
死守一世寂寞
死守一世寂寞 2021-01-06 05:31

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

slc run .
相关标签:
6条回答
  • 2021-01-06 06:09

    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.

    0 讨论(0)
  • 2021-01-06 06:13

    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.

    0 讨论(0)
  • 2021-01-06 06:20

    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.

    0 讨论(0)
  • 2021-01-06 06:25
    slc run
    

    it can be only used for strong loop application

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

    0 讨论(0)
  • 2021-01-06 06:30

    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.

    0 讨论(0)
  • 2021-01-06 06:32

    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

    0 讨论(0)
提交回复
热议问题