SlideShare a Scribd company logo
• CEO & Founder at
• Author of
• Full Stack Javascript developer
• Technologist
My app is ready, now what?
Deploying to production is complex
• Oh noes why my app only use 10% of my server CPUs?
• Oh noes which app is leaking memory?
• Why the server went out of memory?
• Oh noes my app crashed!
• Where are my damn logs?
• How do I organize my micro service app?
• …. …. …. ….
Production application toolbox
with a Built-in load balancer
that Guarantees Uptime
and help you manage your processes
App #1
App #2
App #3
App #4
App #1
App #3 App #4
CL1 CL2
CL3 CL4
Disorganized
application & workflow
Structured
application & workflow
To
Before After
App #1
App #3 App #4
UsabilityCPU
Memory
Log
DeploymentModules
CL1 CL2
CL3 CL4
Ressources
management
and
optimization
Easier
software
management
Extend
capabilities
PM2: Some figures
• 10.000+ stars on GitHub
• 2.000.000+ downloads
• 2500+ commits
• 120+ contributors
• 750+ tests
100+ contributors
Thank you all!!
Installation
Installing PM2
$ npm install pm2 -g
Source code:
https://github.com/Unitech/pm2
Documentation:
http://pm2.keymetrics.io
Setup PM2
No setup required! But…
$ pm2 completion install
Enabling autocompletion:
$ pm2 startup
Respawning PM2 on server boot:
http://pm2.keymetrics.io/docs/usage/quick-start/
Launching apps
Launching a Node.js application
$ pm2 start app.js
Put application in background
Handle logs
Monitor
Auto respawn application
Launching any kind of application
$ pm2 start app.py —interpreter="python3"
$ pm2 start script.sh
Starting a bash script:
Starting a Python app & set interpreter
http://pm2.keymetrics.io/docs/usage/process-management/
Acting on processes
$ pm2 delete <app-name|app-id|'all'>
$ pm2 restart <app-name|app-id|'all'>
Restart:
Delete:
$ pm2 stop <app-name|app-id|'all'>
Stop:
http://pm2.keymetrics.io/docs/usage/process-management/
Cluster mode
Most Node.js application…
Why using the cluster mode?
Intel® Xeon® Processor E5-1410 v2 - 8 cores
Starting an application cluster mode
$ pm2 start app.js -i <instances>
http://pm2.keymetrics.io/docs/usage/cluster-mode/
Managing clustered applications
$ pm2 gracefulReload <app-name|'all'>
$ pm2 reload <app-name|'all'>
Reload without downtime:
Graceful Reload (send signal to process):
$ pm2 scale <app-name> <instances>
Scale up/down process number:
http://pm2.keymetrics.io/docs/usage/cluster-mode/
Inspecting applications
$ pm2 list
Listing processes
$ pm2 monit
Monitoring CPU & Memory
$ pm2 show <app-name|id>
More informations
Inspecting logs
$ pm2 flush
$ pm2 logs [app-name]
Display logs in realtime:
Flushing logs:
$ pm2 reloadLogs
Reloading logs (logrotate):
http://pm2.keymetrics.io/docs/usage/log-management/
Organizing applications
Starting your micro service app…
$ DEBUG=“*” NODE_ENV="production" pm2 start app-1.js —
name “API” -i 8 —watch —max-memory-restart=“300M” — -a 23
$ DEBUG=“app2:*” NODE_ENV=“production" pm2 start
app-2.js —name “WORKER" —watch — -a prod
$ DEBUG=“app3:*” NODE_ENV=“production" pm2 start
app-3.js —name “BDD" —watch — -a malo
UGLY
Solution: JSON declaration
Application 1 (API)
Application 2 (Worker)
Application 3 (Crawler)
ecosystem.json
Using the JSON declaration
$ pm2 restart ecosystem.json
$ pm2 start ecosystem.json
Start:
Restart:
$ pm2 stop <app-name|app-id|'all'>
Stop:
http://pm2.keymetrics.io/docs/usage/application-declaration/
Deployment system
Extending the previous JSONecosystem.json
Production env
Staging env
Multi host
Deployment commands
$ pm2 deploy ecosystem.json production
$ pm2 deploy ecosystem.json production setup
Setup remote server:
Update remote application:
Revert to the n-th deployment:
$ pm2 deploy ecosystem.json production revert [n]
http://pm2.keymetrics.io/docs/usage/deployment/
Modules
What is a module?
An app that extend PM2 capabilities
or
A worker process providing an API
or
A totally independant software
Installing a module
$ pm2 install <module-name>
It gets the module from NPM
then Start it
and Keep it alive forever
http://docs.keymetrics.io/docs/usage/building-module/
Managing modules
$ pm2 uninstall <module-name>
$ pm2 install <module-name>
Install a module:
Uninstall:
$ pm2 set <module-name>:<attr> <value>
Set configuration option:
http://docs.keymetrics.io/docs/usage/building-module/
Some modules
Module #1: pm2-logrotate
$ pm2 install pm2-logrotate
Automatically rotate all logs of applications
managed by pm2
https://github.com/pm2-hive/pm2-logrotate
Module #2: pm2-webshell
$ pm2 install pm2-webshell
Expose a fully capable terminal in your browser
https://github.com/pm2-hive/pm2-webshell
Module #2: pm2-webshell
Termcaps capable
Backed by TTY.js
HTTPS support
Pass/User configurable
Port
Module #x: pm2-technology
Module #x: pm2-technology
Writing your own module
$ pm2 module:generate sample-module
Create a sample module:
Documentation:
Google -> pm2 module system
Official modules repositories:
http://github.com/pm2-hive/
Thank you!
alexandre@keymetrics.io
github.com/Unitech
@strzel_a

More Related Content

What's hot

How to successfully migrate to Bazel from Maven or Gradle - Riga Dev Days
How to successfully migrate to Bazel from Maven or Gradle - Riga Dev DaysHow to successfully migrate to Bazel from Maven or Gradle - Riga Dev Days
How to successfully migrate to Bazel from Maven or Gradle - Riga Dev Days
Natan Silnitsky
 
Node.js Build, Deploy and Scale Webinar
Node.js Build, Deploy and Scale WebinarNode.js Build, Deploy and Scale Webinar
Node.js Build, Deploy and Scale Webinar
jguerrero999
 
Jenkins 101: Getting Started
Jenkins 101: Getting StartedJenkins 101: Getting Started
Jenkins 101: Getting Started
R Geoffrey Avery
 
Genymotion with Jenkins
Genymotion with JenkinsGenymotion with Jenkins
Genymotion with Jenkins
Vishal Nayak
 
Nginx维护手册
Nginx维护手册Nginx维护手册
Nginx维护手册
Lei Yang
 
ДМИТРО БУДИМ «Mobile Automation Infrastructure from scratch» Online QADay 202...
ДМИТРО БУДИМ «Mobile Automation Infrastructure from scratch» Online QADay 202...ДМИТРО БУДИМ «Mobile Automation Infrastructure from scratch» Online QADay 202...
ДМИТРО БУДИМ «Mobile Automation Infrastructure from scratch» Online QADay 202...
QADay
 
Haibu: dev deployment is fast and easy again
Haibu: dev deployment is fast and easy againHaibu: dev deployment is fast and easy again
Haibu: dev deployment is fast and easy again
Frank Rousseau
 
Developer mode on, czyli słów kilka o rbenv, rvm i ruby-ng
Developer mode on, czyli słów kilka o rbenv, rvm i ruby-ng Developer mode on, czyli słów kilka o rbenv, rvm i ruby-ng
Developer mode on, czyli słów kilka o rbenv, rvm i ruby-ng
The Software House
 
Евгений Жарков "React Native: Hurdle Race"
Евгений Жарков "React Native: Hurdle Race"Евгений Жарков "React Native: Hurdle Race"
Евгений Жарков "React Native: Hurdle Race"
Fwdays
 
Hacking Jenkins
Hacking JenkinsHacking Jenkins
Hacking Jenkins
Miro Cupak
 
GitHub Actions for 5 minutes
GitHub Actions for 5 minutesGitHub Actions for 5 minutes
GitHub Actions for 5 minutes
Svetlin Nakov
 
Delivery Pipeline for Windows Machines
Delivery Pipeline for Windows MachinesDelivery Pipeline for Windows Machines
Delivery Pipeline for Windows Machines
Dmitry Buzdin
 
[English][Test Girls] Zero to Hero: Start Test automation with Cypress
[English][Test Girls] Zero to Hero: Start Test automation with Cypress[English][Test Girls] Zero to Hero: Start Test automation with Cypress
[English][Test Girls] Zero to Hero: Start Test automation with Cypress
Test Girls
 
How to Build & Deploy a HelloWorld API function using Java on OpenShift in...
How to Build & Deploy a HelloWorld API function using Java on OpenShift in...How to Build & Deploy a HelloWorld API function using Java on OpenShift in...
How to Build & Deploy a HelloWorld API function using Java on OpenShift in...
Jan Vosecky
 
"Wix Serverless from inside", Mykola Borozdin
"Wix Serverless from inside", Mykola Borozdin"Wix Serverless from inside", Mykola Borozdin
"Wix Serverless from inside", Mykola Borozdin
Fwdays
 
Observability
ObservabilityObservability
Observability
Diego Pacheco
 
Jenkins and rails app - Le Dinh Vu
Jenkins and rails app - Le Dinh VuJenkins and rails app - Le Dinh Vu
Jenkins and rails app - Le Dinh VuFramgia Vietnam
 
Bamboo Hands on training 2016
Bamboo Hands on training 2016Bamboo Hands on training 2016
Bamboo Hands on training 2016
Takahiro Yamaki
 
Rise of the Machines - Automate your Development
Rise of the Machines - Automate your DevelopmentRise of the Machines - Automate your Development
Rise of the Machines - Automate your Development
Sven Peters
 
Selenium Grid & Docker - budowa środowiska do testów przeglądarkowych
Selenium Grid & Docker - budowa środowiska do testów przeglądarkowychSelenium Grid & Docker - budowa środowiska do testów przeglądarkowych
Selenium Grid & Docker - budowa środowiska do testów przeglądarkowych
Łukasz Rosłonek
 

What's hot (20)

How to successfully migrate to Bazel from Maven or Gradle - Riga Dev Days
How to successfully migrate to Bazel from Maven or Gradle - Riga Dev DaysHow to successfully migrate to Bazel from Maven or Gradle - Riga Dev Days
How to successfully migrate to Bazel from Maven or Gradle - Riga Dev Days
 
Node.js Build, Deploy and Scale Webinar
Node.js Build, Deploy and Scale WebinarNode.js Build, Deploy and Scale Webinar
Node.js Build, Deploy and Scale Webinar
 
Jenkins 101: Getting Started
Jenkins 101: Getting StartedJenkins 101: Getting Started
Jenkins 101: Getting Started
 
Genymotion with Jenkins
Genymotion with JenkinsGenymotion with Jenkins
Genymotion with Jenkins
 
Nginx维护手册
Nginx维护手册Nginx维护手册
Nginx维护手册
 
ДМИТРО БУДИМ «Mobile Automation Infrastructure from scratch» Online QADay 202...
ДМИТРО БУДИМ «Mobile Automation Infrastructure from scratch» Online QADay 202...ДМИТРО БУДИМ «Mobile Automation Infrastructure from scratch» Online QADay 202...
ДМИТРО БУДИМ «Mobile Automation Infrastructure from scratch» Online QADay 202...
 
Haibu: dev deployment is fast and easy again
Haibu: dev deployment is fast and easy againHaibu: dev deployment is fast and easy again
Haibu: dev deployment is fast and easy again
 
Developer mode on, czyli słów kilka o rbenv, rvm i ruby-ng
Developer mode on, czyli słów kilka o rbenv, rvm i ruby-ng Developer mode on, czyli słów kilka o rbenv, rvm i ruby-ng
Developer mode on, czyli słów kilka o rbenv, rvm i ruby-ng
 
Евгений Жарков "React Native: Hurdle Race"
Евгений Жарков "React Native: Hurdle Race"Евгений Жарков "React Native: Hurdle Race"
Евгений Жарков "React Native: Hurdle Race"
 
Hacking Jenkins
Hacking JenkinsHacking Jenkins
Hacking Jenkins
 
GitHub Actions for 5 minutes
GitHub Actions for 5 minutesGitHub Actions for 5 minutes
GitHub Actions for 5 minutes
 
Delivery Pipeline for Windows Machines
Delivery Pipeline for Windows MachinesDelivery Pipeline for Windows Machines
Delivery Pipeline for Windows Machines
 
[English][Test Girls] Zero to Hero: Start Test automation with Cypress
[English][Test Girls] Zero to Hero: Start Test automation with Cypress[English][Test Girls] Zero to Hero: Start Test automation with Cypress
[English][Test Girls] Zero to Hero: Start Test automation with Cypress
 
How to Build & Deploy a HelloWorld API function using Java on OpenShift in...
How to Build & Deploy a HelloWorld API function using Java on OpenShift in...How to Build & Deploy a HelloWorld API function using Java on OpenShift in...
How to Build & Deploy a HelloWorld API function using Java on OpenShift in...
 
"Wix Serverless from inside", Mykola Borozdin
"Wix Serverless from inside", Mykola Borozdin"Wix Serverless from inside", Mykola Borozdin
"Wix Serverless from inside", Mykola Borozdin
 
Observability
ObservabilityObservability
Observability
 
Jenkins and rails app - Le Dinh Vu
Jenkins and rails app - Le Dinh VuJenkins and rails app - Le Dinh Vu
Jenkins and rails app - Le Dinh Vu
 
Bamboo Hands on training 2016
Bamboo Hands on training 2016Bamboo Hands on training 2016
Bamboo Hands on training 2016
 
Rise of the Machines - Automate your Development
Rise of the Machines - Automate your DevelopmentRise of the Machines - Automate your Development
Rise of the Machines - Automate your Development
 
Selenium Grid & Docker - budowa środowiska do testów przeglądarkowych
Selenium Grid & Docker - budowa środowiska do testów przeglądarkowychSelenium Grid & Docker - budowa środowiska do testów przeglądarkowych
Selenium Grid & Docker - budowa środowiska do testów przeglądarkowych
 

Similar to Jsconf asia pm2

Alfresco Development Framework Basic
Alfresco Development Framework BasicAlfresco Development Framework Basic
Alfresco Development Framework Basic
Mario Romano
 
Iac d.damyanov 4.pptx
Iac d.damyanov 4.pptxIac d.damyanov 4.pptx
Iac d.damyanov 4.pptx
Dimitar Damyanov
 
Im-A-Hacker-Get-Me-Out-Of-Here-Breaking-Network-Segregation-Using-Esoteric-Co...
Im-A-Hacker-Get-Me-Out-Of-Here-Breaking-Network-Segregation-Using-Esoteric-Co...Im-A-Hacker-Get-Me-Out-Of-Here-Breaking-Network-Segregation-Using-Esoteric-Co...
Im-A-Hacker-Get-Me-Out-Of-Here-Breaking-Network-Segregation-Using-Esoteric-Co...
YuChianWu
 
PAC 2019 virtual Bruno Audoux
PAC 2019 virtual Bruno Audoux PAC 2019 virtual Bruno Audoux
PAC 2019 virtual Bruno Audoux
Neotys
 
Why Kubernetes? Cloud Native and Developer Experience at Zalando - OWL Tech &...
Why Kubernetes? Cloud Native and Developer Experience at Zalando - OWL Tech &...Why Kubernetes? Cloud Native and Developer Experience at Zalando - OWL Tech &...
Why Kubernetes? Cloud Native and Developer Experience at Zalando - OWL Tech &...
Henning Jacobs
 
Docker Monitoring Webinar
Docker Monitoring  WebinarDocker Monitoring  Webinar
Docker Monitoring Webinar
Sematext Group, Inc.
 
6 tips for improving ruby performance
6 tips for improving ruby performance6 tips for improving ruby performance
6 tips for improving ruby performance
Engine Yard
 
How to build streaming data pipelines with Akka Streams, Flink, and Spark usi...
How to build streaming data pipelines with Akka Streams, Flink, and Spark usi...How to build streaming data pipelines with Akka Streams, Flink, and Spark usi...
How to build streaming data pipelines with Akka Streams, Flink, and Spark usi...
Lightbend
 
Angular2 inter3
Angular2 inter3Angular2 inter3
Angular2 inter3
Oswald Campesato
 
IBM Cloud University: Build, Deploy and Scale Node.js Microservices
IBM Cloud University: Build, Deploy and Scale Node.js MicroservicesIBM Cloud University: Build, Deploy and Scale Node.js Microservices
IBM Cloud University: Build, Deploy and Scale Node.js Microservices
Chris Bailey
 
Docker In Bank Unrated
Docker In Bank UnratedDocker In Bank Unrated
Docker In Bank Unrated
Aleksandr Tarasov
 
App engine devfest_mexico_10
App engine devfest_mexico_10App engine devfest_mexico_10
App engine devfest_mexico_10Chris Schalk
 
CI/CD and TDD in deploying kamailio
CI/CD and TDD in deploying kamailioCI/CD and TDD in deploying kamailio
CI/CD and TDD in deploying kamailio
Aleksandar Sosic
 
What is going on - Application diagnostics on Azure - TechDays Finland
What is going on - Application diagnostics on Azure - TechDays FinlandWhat is going on - Application diagnostics on Azure - TechDays Finland
What is going on - Application diagnostics on Azure - TechDays Finland
Maarten Balliauw
 
PyCon AU 2012 - Debugging Live Python Web Applications
PyCon AU 2012 - Debugging Live Python Web ApplicationsPyCon AU 2012 - Debugging Live Python Web Applications
PyCon AU 2012 - Debugging Live Python Web Applications
Graham Dumpleton
 
Running MongoDB Enterprise on Kubernetes
Running MongoDB Enterprise on KubernetesRunning MongoDB Enterprise on Kubernetes
Running MongoDB Enterprise on Kubernetes
Ariel Jatib
 
IBM Monitoring and Diagnostic Tools - GCMV 2.8
IBM Monitoring and Diagnostic Tools - GCMV 2.8IBM Monitoring and Diagnostic Tools - GCMV 2.8
IBM Monitoring and Diagnostic Tools - GCMV 2.8
Chris Bailey
 
Docker based Architecture by Denys Serdiuk
Docker based Architecture by Denys SerdiukDocker based Architecture by Denys Serdiuk
Docker based Architecture by Denys Serdiuk
Lohika_Odessa_TechTalks
 
OpenStack API's and WSGI
OpenStack API's and WSGIOpenStack API's and WSGI
OpenStack API's and WSGI
Mike Pittaro
 

Similar to Jsconf asia pm2 (20)

Alfresco Development Framework Basic
Alfresco Development Framework BasicAlfresco Development Framework Basic
Alfresco Development Framework Basic
 
Iac d.damyanov 4.pptx
Iac d.damyanov 4.pptxIac d.damyanov 4.pptx
Iac d.damyanov 4.pptx
 
Im-A-Hacker-Get-Me-Out-Of-Here-Breaking-Network-Segregation-Using-Esoteric-Co...
Im-A-Hacker-Get-Me-Out-Of-Here-Breaking-Network-Segregation-Using-Esoteric-Co...Im-A-Hacker-Get-Me-Out-Of-Here-Breaking-Network-Segregation-Using-Esoteric-Co...
Im-A-Hacker-Get-Me-Out-Of-Here-Breaking-Network-Segregation-Using-Esoteric-Co...
 
PAC 2019 virtual Bruno Audoux
PAC 2019 virtual Bruno Audoux PAC 2019 virtual Bruno Audoux
PAC 2019 virtual Bruno Audoux
 
Cloud APIs Overview Tucker
Cloud APIs Overview   TuckerCloud APIs Overview   Tucker
Cloud APIs Overview Tucker
 
Why Kubernetes? Cloud Native and Developer Experience at Zalando - OWL Tech &...
Why Kubernetes? Cloud Native and Developer Experience at Zalando - OWL Tech &...Why Kubernetes? Cloud Native and Developer Experience at Zalando - OWL Tech &...
Why Kubernetes? Cloud Native and Developer Experience at Zalando - OWL Tech &...
 
Docker Monitoring Webinar
Docker Monitoring  WebinarDocker Monitoring  Webinar
Docker Monitoring Webinar
 
6 tips for improving ruby performance
6 tips for improving ruby performance6 tips for improving ruby performance
6 tips for improving ruby performance
 
How to build streaming data pipelines with Akka Streams, Flink, and Spark usi...
How to build streaming data pipelines with Akka Streams, Flink, and Spark usi...How to build streaming data pipelines with Akka Streams, Flink, and Spark usi...
How to build streaming data pipelines with Akka Streams, Flink, and Spark usi...
 
Angular2 inter3
Angular2 inter3Angular2 inter3
Angular2 inter3
 
IBM Cloud University: Build, Deploy and Scale Node.js Microservices
IBM Cloud University: Build, Deploy and Scale Node.js MicroservicesIBM Cloud University: Build, Deploy and Scale Node.js Microservices
IBM Cloud University: Build, Deploy and Scale Node.js Microservices
 
Docker In Bank Unrated
Docker In Bank UnratedDocker In Bank Unrated
Docker In Bank Unrated
 
App engine devfest_mexico_10
App engine devfest_mexico_10App engine devfest_mexico_10
App engine devfest_mexico_10
 
CI/CD and TDD in deploying kamailio
CI/CD and TDD in deploying kamailioCI/CD and TDD in deploying kamailio
CI/CD and TDD in deploying kamailio
 
What is going on - Application diagnostics on Azure - TechDays Finland
What is going on - Application diagnostics on Azure - TechDays FinlandWhat is going on - Application diagnostics on Azure - TechDays Finland
What is going on - Application diagnostics on Azure - TechDays Finland
 
PyCon AU 2012 - Debugging Live Python Web Applications
PyCon AU 2012 - Debugging Live Python Web ApplicationsPyCon AU 2012 - Debugging Live Python Web Applications
PyCon AU 2012 - Debugging Live Python Web Applications
 
Running MongoDB Enterprise on Kubernetes
Running MongoDB Enterprise on KubernetesRunning MongoDB Enterprise on Kubernetes
Running MongoDB Enterprise on Kubernetes
 
IBM Monitoring and Diagnostic Tools - GCMV 2.8
IBM Monitoring and Diagnostic Tools - GCMV 2.8IBM Monitoring and Diagnostic Tools - GCMV 2.8
IBM Monitoring and Diagnostic Tools - GCMV 2.8
 
Docker based Architecture by Denys Serdiuk
Docker based Architecture by Denys SerdiukDocker based Architecture by Denys Serdiuk
Docker based Architecture by Denys Serdiuk
 
OpenStack API's and WSGI
OpenStack API's and WSGIOpenStack API's and WSGI
OpenStack API's and WSGI
 

Recently uploaded

Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
AmarGB2
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
ongomchris
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
SupreethSP4
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
BrazilAccount1
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 

Recently uploaded (20)

Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 

Jsconf asia pm2

  • 1.
  • 2. • CEO & Founder at • Author of • Full Stack Javascript developer • Technologist
  • 3. My app is ready, now what?
  • 4. Deploying to production is complex • Oh noes why my app only use 10% of my server CPUs? • Oh noes which app is leaking memory? • Why the server went out of memory? • Oh noes my app crashed! • Where are my damn logs? • How do I organize my micro service app? • …. …. …. ….
  • 5.
  • 6. Production application toolbox with a Built-in load balancer that Guarantees Uptime and help you manage your processes
  • 7. App #1 App #2 App #3 App #4 App #1 App #3 App #4 CL1 CL2 CL3 CL4 Disorganized application & workflow Structured application & workflow To Before After
  • 8. App #1 App #3 App #4 UsabilityCPU Memory Log DeploymentModules CL1 CL2 CL3 CL4 Ressources management and optimization Easier software management Extend capabilities
  • 9. PM2: Some figures • 10.000+ stars on GitHub • 2.000.000+ downloads • 2500+ commits • 120+ contributors • 750+ tests
  • 11.
  • 13. Installing PM2 $ npm install pm2 -g Source code: https://github.com/Unitech/pm2 Documentation: http://pm2.keymetrics.io
  • 14. Setup PM2 No setup required! But… $ pm2 completion install Enabling autocompletion: $ pm2 startup Respawning PM2 on server boot: http://pm2.keymetrics.io/docs/usage/quick-start/
  • 16. Launching a Node.js application $ pm2 start app.js Put application in background Handle logs Monitor Auto respawn application
  • 17. Launching any kind of application $ pm2 start app.py —interpreter="python3" $ pm2 start script.sh Starting a bash script: Starting a Python app & set interpreter http://pm2.keymetrics.io/docs/usage/process-management/
  • 18. Acting on processes $ pm2 delete <app-name|app-id|'all'> $ pm2 restart <app-name|app-id|'all'> Restart: Delete: $ pm2 stop <app-name|app-id|'all'> Stop: http://pm2.keymetrics.io/docs/usage/process-management/
  • 21. Why using the cluster mode? Intel® Xeon® Processor E5-1410 v2 - 8 cores
  • 22. Starting an application cluster mode $ pm2 start app.js -i <instances> http://pm2.keymetrics.io/docs/usage/cluster-mode/
  • 23. Managing clustered applications $ pm2 gracefulReload <app-name|'all'> $ pm2 reload <app-name|'all'> Reload without downtime: Graceful Reload (send signal to process): $ pm2 scale <app-name> <instances> Scale up/down process number: http://pm2.keymetrics.io/docs/usage/cluster-mode/
  • 25. $ pm2 list Listing processes
  • 26. $ pm2 monit Monitoring CPU & Memory
  • 27. $ pm2 show <app-name|id> More informations
  • 28. Inspecting logs $ pm2 flush $ pm2 logs [app-name] Display logs in realtime: Flushing logs: $ pm2 reloadLogs Reloading logs (logrotate): http://pm2.keymetrics.io/docs/usage/log-management/
  • 30. Starting your micro service app… $ DEBUG=“*” NODE_ENV="production" pm2 start app-1.js — name “API” -i 8 —watch —max-memory-restart=“300M” — -a 23 $ DEBUG=“app2:*” NODE_ENV=“production" pm2 start app-2.js —name “WORKER" —watch — -a prod $ DEBUG=“app3:*” NODE_ENV=“production" pm2 start app-3.js —name “BDD" —watch — -a malo
  • 31. UGLY
  • 32. Solution: JSON declaration Application 1 (API) Application 2 (Worker) Application 3 (Crawler) ecosystem.json
  • 33. Using the JSON declaration $ pm2 restart ecosystem.json $ pm2 start ecosystem.json Start: Restart: $ pm2 stop <app-name|app-id|'all'> Stop: http://pm2.keymetrics.io/docs/usage/application-declaration/
  • 35. Extending the previous JSONecosystem.json Production env Staging env Multi host
  • 36. Deployment commands $ pm2 deploy ecosystem.json production $ pm2 deploy ecosystem.json production setup Setup remote server: Update remote application: Revert to the n-th deployment: $ pm2 deploy ecosystem.json production revert [n] http://pm2.keymetrics.io/docs/usage/deployment/
  • 38. What is a module? An app that extend PM2 capabilities or A worker process providing an API or A totally independant software
  • 39. Installing a module $ pm2 install <module-name> It gets the module from NPM then Start it and Keep it alive forever http://docs.keymetrics.io/docs/usage/building-module/
  • 40. Managing modules $ pm2 uninstall <module-name> $ pm2 install <module-name> Install a module: Uninstall: $ pm2 set <module-name>:<attr> <value> Set configuration option: http://docs.keymetrics.io/docs/usage/building-module/
  • 42. Module #1: pm2-logrotate $ pm2 install pm2-logrotate Automatically rotate all logs of applications managed by pm2 https://github.com/pm2-hive/pm2-logrotate
  • 43. Module #2: pm2-webshell $ pm2 install pm2-webshell Expose a fully capable terminal in your browser https://github.com/pm2-hive/pm2-webshell
  • 44. Module #2: pm2-webshell Termcaps capable Backed by TTY.js HTTPS support Pass/User configurable Port
  • 47. Writing your own module $ pm2 module:generate sample-module Create a sample module: Documentation: Google -> pm2 module system Official modules repositories: http://github.com/pm2-hive/