Upload
jguerrero999
View
28
Download
4
Embed Size (px)
Citation preview
Shubhra Kar | Products & Educationtwitter:@shubhrakar
Build, deploy & scale node
About me
J2EE and SOA architect
Performance architect
Node, mBaaS & APIs
These guys sent me !
Bert Belder
Ben Noordhuis
Node/io Core
RaymondFeng
Ritchie Martori
LoopBack & Express Core
SamRoberts
Miroslav Bajtos
Ryan Graham
For a mature runtime; lets start with Process
Managers
What is a Process Manager
AppApp
App
Secure DeploymentLifecycle ManagerHA, Hot DeploysLog AggregationVertical scalingHooks for monitoring & profilingTraditionally 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.tgzDeployed `../app1-1.0.0.tgz` to `http://prod.foo.com:7777`
$ slc deploy -s apptwo http://prod.foo.com:7777 ../app2-1.0.0.tgzDeployed `../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:7777Service ID: 1Service Name: apponeEnvironment variables: No environment variables definedInstances: Version Agent version Cluster size 4.0.30 1.4.15 4Processes: 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: 2Service Name: apptwoEnvironment variables: No environment variables definedInstances: Version Agent version Cluster size 4.0.30 1.4.15 4Processes: 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 ctlService ID: 1Service Name: my-appEnvironment variables: No environment variables defined Instances: Version Agent version Cluster size 4.1.0 1.5.1 10Processes: 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 MetricsReal-time production monitoring
ProfilerRoot cause
CPU & Memory
API ComposerVisual modeling
StrongLoop Arc
Process Manager
Scale applications
Q2201
5Mesh
Deploy containerize
d
ORM, mBaaS, Realtime