node.js build, deploy and scale webinar
TRANSCRIPT
These guys sent me !
Bert Belder
Ben Noordhuis
Node/io Core
Raymond Feng
Ritchie Martori
LoopBack & Express Core
Sam Roberts
Miroslav Bajtos
Ryan Graham
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 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
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)
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
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
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
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