SlideShare a Scribd company logo
Shubhra Kar | Products & Education
twitter:@shubhrakar
Build, deploy & scale node
About me
u J2EE and SOA architect
u Performance architect
u Node, mBaaS & APIs
These guys sent me !
Bert
Belder
Ben
Noordhuis
Node/io Core
Raymond
Feng
Ritchie
Martori
LoopBack & Express Core
Sam
Roberts
Miroslav
Bajtos
Ryan
Graham
For a mature runtime; lets
start with Process Managers
What is a Process Manager
  Secure Deployment
  Lifecycle Manager
  HA, Hot Deploys
  Log Aggregation
  Vertical scaling
  Hooks for monitoring &
profiling
  Traditionally Open Source
StrongLoop open source Process Manager
StrongLoop open source Process Manager in Docker
$ curl -ssl https://strong-pm.io/docker.sh | sudo /bin/sh
Dockerized the App for removing flab (trimming)
Node.js
App
Process
Manager
Containers
$ sudo sl-pm-install –driver docker
Orchestrate
Build
Building a node.js app
•  Install:
install dependencies, run custom build steps, and prune
development dependencies. Avoids issues with npm
shrinkwrap
•  Bundle:
modify the package.json and .npmignore configuration
files so dependencies will be packed.
•  Create deployable package, either:
create a deployable .tgz package file.
commit the build onto a Git branch.
Install Dependencies
$ slc build --install
Automates below
•  npm install -- ignore-scripts
Install Node dependencies without running scripts to build
binary add-ons.
•  npm run build
Specify custom build steps such as grunt build or bower in
the package’s scripts.build property
•  npm prune -- production
Remove development only tools
and runs npm rebuild (system addons), npm install (any install
scripts)
Bundling Dependencies
$ slc build --bundle
Automates below
•  configure package.json
•  configure .npmignore, backup is .gitignore
Creating Archive or Pushing to Git
$ slc build –pack
•  uses npm pack
•  creates .tgz outside workspace with version control
$ slc build –commit
•  commits to a deployment branch
•  shows merge changes
$ slc build --onto deploy –install --commit
(deploy branch is default)
Build using StrongLoop Arc
Deploy
Deploy to Process Manager (standalone or dockerized)
$ slc deploy [ [ -s | --service] <service> ] http://
<server>:<port> [ package | branch ]
Example : $ slc deploy http://myserver.myco.com:8701
Multi-App Deploy
$ slc deploy -s appone http://prod.foo.com:7777 ../
app1-1.0.0.tgz
Deployed `../app1-1.0.0.tgz` to `http://prod.foo.com:7777`
$ slc deploy -s apptwo http://prod.foo.com:7777 ../
app2-1.0.0.tgz
Deployed `../app2-1.0.0.tgz` to `http://prod.foo.com:7777`
Multi-App on Process Manager (standalone or dockerized)
$ slc ctl -C http://prod.foo.com:7777
Service ID: 1
Service Name: appone
Environment variables:
No environment variables defined
Instances:
Version Agent version Cluster size
4.0.30 1.4.15 4
Processes:
ID PID WID Listening Ports Tracking objects? CPU profiling?
1.1.22555 22555 0
1.1.22741 22741 5 prod.foo.com:3001
1.1.22748 22748 6 prod.foo.com:3001
1.1.22773 22773 7 prod.foo.com:3001
1.1.22793 22793 8 prod.foo.com:3001
Service ID: 2
Service Name: apptwo
Environment variables:
No environment variables defined
Instances:
Version Agent version Cluster size
4.0.30 1.4.15 4
Processes:
ID PID WID Listening Ports Tracking objects? CPU profiling?
2.1.22984 22984 0
2.1.22985 22985 1 prod.foo.com:3002
2.1.22986 22986 2 prod.foo.com:3002
2.1.22987 22987 3 prod.foo.com:3002
2.1.22988 22988 4 prod.foo.com:3002
Deploy Dockerized Apps
Linux Only
$ sudo sl-pm-install --driver docker
$ slc pm --driver docker
Deploy using StrongLoop Arc to Process Managers
Scale
Vertical Scaling
21
Vertical Clustering
  $ slc ctl set-size my-app 4
  $ slc ctl
Service ID: 1
Service Name: my-app
Environment variables:
No environment variables defined
Instances:
Version Agent version Cluster size
4.1.0 1.5.1 10
Processes:
ID PID WID Listening Ports Tracking objects? CPU profiling?
1.1.50320 50320 0
1.1.50321 50321 1 0.0.0.0:3001
1.1.50322 50322 2 0.0.0.0:3001
1.1.50323 50323 3 0.0.0.0:3001
1.1.50324 50324 4 0.0.0.0:3001
Vertical Clustering at deploy time with Arc
Cluster Control
Horizontal and Vertical Scaling with Process Manager
Horizontal Scaling using Arc
Auto-Configure Nginx
  $ npm install -g strong-nginx-controller
  $ sl-nginx-ctl-install to install as a service
Example
sl-nginx-ctl -x /usr/local/bin/nginx -l http://:8081
Micro services scaling
28
Hyper-scale & Micro-services Deployment
StrongLoop – node.js Development to Production
Build and
Deploy
Automate
Lifecycle
Performance
Metrics
Real-time
production
monitoring
Profiler
Root cause
CPU & Memory
API Composer
Visual modeling
StrongLoop Arc
Process
Manager
Scale
applications"

Q2
2015
Mesh
Deploy 
containerized
ORM, mBaaS, Realtime

More Related Content

Node.js Build, Deploy and Scale Webinar

  • 1. Shubhra Kar | Products & Education twitter:@shubhrakar Build, deploy & scale node
  • 2. About me u J2EE and SOA architect u Performance architect u Node, mBaaS & APIs
  • 3. These guys sent me ! Bert Belder Ben Noordhuis Node/io Core Raymond Feng Ritchie Martori LoopBack & Express Core Sam Roberts Miroslav Bajtos Ryan Graham
  • 4. For a mature runtime; lets start with Process Managers
  • 5. What is a Process Manager   Secure Deployment   Lifecycle Manager   HA, Hot Deploys   Log Aggregation   Vertical scaling   Hooks for monitoring & profiling   Traditionally Open Source
  • 6. StrongLoop open source Process Manager
  • 7. StrongLoop open source Process Manager in Docker $ curl -ssl https://strong-pm.io/docker.sh | sudo /bin/sh
  • 8. Dockerized the App for removing flab (trimming) Node.js App Process Manager Containers $ sudo sl-pm-install –driver docker Orchestrate
  • 10. Building a node.js app •  Install: install dependencies, run custom build steps, and prune development dependencies. Avoids issues with npm shrinkwrap •  Bundle: modify the package.json and .npmignore configuration files so dependencies will be packed. •  Create deployable package, either: create a deployable .tgz package file. commit the build onto a Git branch.
  • 11. Install Dependencies $ slc build --install Automates below •  npm install -- ignore-scripts Install Node dependencies without running scripts to build binary add-ons. •  npm run build Specify custom build steps such as grunt build or bower in the package’s scripts.build property •  npm prune -- production Remove development only tools and runs npm rebuild (system addons), npm install (any install scripts)
  • 12. Bundling Dependencies $ slc build --bundle Automates below •  configure package.json •  configure .npmignore, backup is .gitignore
  • 13. Creating Archive or Pushing to Git $ slc build –pack •  uses npm pack •  creates .tgz outside workspace with version control $ slc build –commit •  commits to a deployment branch •  shows merge changes $ slc build --onto deploy –install --commit (deploy branch is default)
  • 16. Deploy to Process Manager (standalone or dockerized) $ slc deploy [ [ -s | --service] <service> ] http:// <server>:<port> [ package | branch ] Example : $ slc deploy http://myserver.myco.com:8701 Multi-App Deploy $ slc deploy -s appone http://prod.foo.com:7777 ../ app1-1.0.0.tgz Deployed `../app1-1.0.0.tgz` to `http://prod.foo.com:7777` $ slc deploy -s apptwo http://prod.foo.com:7777 ../ app2-1.0.0.tgz Deployed `../app2-1.0.0.tgz` to `http://prod.foo.com:7777`
  • 17. Multi-App on Process Manager (standalone or dockerized) $ slc ctl -C http://prod.foo.com:7777 Service ID: 1 Service Name: appone Environment variables: No environment variables defined Instances: Version Agent version Cluster size 4.0.30 1.4.15 4 Processes: ID PID WID Listening Ports Tracking objects? CPU profiling? 1.1.22555 22555 0 1.1.22741 22741 5 prod.foo.com:3001 1.1.22748 22748 6 prod.foo.com:3001 1.1.22773 22773 7 prod.foo.com:3001 1.1.22793 22793 8 prod.foo.com:3001 Service ID: 2 Service Name: apptwo Environment variables: No environment variables defined Instances: Version Agent version Cluster size 4.0.30 1.4.15 4 Processes: ID PID WID Listening Ports Tracking objects? CPU profiling? 2.1.22984 22984 0 2.1.22985 22985 1 prod.foo.com:3002 2.1.22986 22986 2 prod.foo.com:3002 2.1.22987 22987 3 prod.foo.com:3002 2.1.22988 22988 4 prod.foo.com:3002
  • 18. Deploy Dockerized Apps Linux Only $ sudo sl-pm-install --driver docker $ slc pm --driver docker
  • 19. Deploy using StrongLoop Arc to Process Managers
  • 20. Scale
  • 22. Vertical Clustering   $ slc ctl set-size my-app 4   $ slc ctl Service ID: 1 Service Name: my-app Environment variables: No environment variables defined Instances: Version Agent version Cluster size 4.1.0 1.5.1 10 Processes: ID PID WID Listening Ports Tracking objects? CPU profiling? 1.1.50320 50320 0 1.1.50321 50321 1 0.0.0.0:3001 1.1.50322 50322 2 0.0.0.0:3001 1.1.50323 50323 3 0.0.0.0:3001 1.1.50324 50324 4 0.0.0.0:3001
  • 23. Vertical Clustering at deploy time with Arc
  • 25. Horizontal and Vertical Scaling with Process Manager
  • 27. Auto-Configure Nginx   $ npm install -g strong-nginx-controller   $ sl-nginx-ctl-install to install as a service Example sl-nginx-ctl -x /usr/local/bin/nginx -l http://:8081
  • 30. StrongLoop – node.js Development to Production Build and Deploy Automate Lifecycle Performance Metrics Real-time production monitoring Profiler Root cause CPU & Memory API Composer Visual modeling StrongLoop Arc Process Manager Scale applications" Q2 2015 Mesh Deploy containerized ORM, mBaaS, Realtime