Deploying Node.js
eBook - ePub

Deploying Node.js

Sandro Pasquali

Partager le livre
  1. 274 pages
  2. English
  3. ePUB (adapté aux mobiles)
  4. Disponible sur iOS et Android
eBook - ePub

Deploying Node.js

Sandro Pasquali

DĂ©tails du livre
Aperçu du livre
Table des matiĂšres
Citations

À propos de ce livre

If you are an intermediate or advanced developer deploying your Node.js applications, then this book is for you. If you have already built a Node application or module and want to take your knowledge to the next level, this book will help you find your way.

Foire aux questions

Comment puis-je résilier mon abonnement ?
Il vous suffit de vous rendre dans la section compte dans paramĂštres et de cliquer sur « RĂ©silier l’abonnement ». C’est aussi simple que cela ! Une fois que vous aurez rĂ©siliĂ© votre abonnement, il restera actif pour le reste de la pĂ©riode pour laquelle vous avez payĂ©. DĂ©couvrez-en plus ici.
Puis-je / comment puis-je télécharger des livres ?
Pour le moment, tous nos livres en format ePub adaptĂ©s aux mobiles peuvent ĂȘtre tĂ©lĂ©chargĂ©s via l’application. La plupart de nos PDF sont Ă©galement disponibles en tĂ©lĂ©chargement et les autres seront tĂ©lĂ©chargeables trĂšs prochainement. DĂ©couvrez-en plus ici.
Quelle est la différence entre les formules tarifaires ?
Les deux abonnements vous donnent un accĂšs complet Ă  la bibliothĂšque et Ă  toutes les fonctionnalitĂ©s de Perlego. Les seules diffĂ©rences sont les tarifs ainsi que la pĂ©riode d’abonnement : avec l’abonnement annuel, vous Ă©conomiserez environ 30 % par rapport Ă  12 mois d’abonnement mensuel.
Qu’est-ce que Perlego ?
Nous sommes un service d’abonnement Ă  des ouvrages universitaires en ligne, oĂč vous pouvez accĂ©der Ă  toute une bibliothĂšque pour un prix infĂ©rieur Ă  celui d’un seul livre par mois. Avec plus d’un million de livres sur plus de 1 000 sujets, nous avons ce qu’il vous faut ! DĂ©couvrez-en plus ici.
Prenez-vous en charge la synthÚse vocale ?
Recherchez le symbole Écouter sur votre prochain livre pour voir si vous pouvez l’écouter. L’outil Écouter lit le texte Ă  haute voix pour vous, en surlignant le passage qui est en cours de lecture. Vous pouvez le mettre sur pause, l’accĂ©lĂ©rer ou le ralentir. DĂ©couvrez-en plus ici.
Est-ce que Deploying Node.js est un PDF/ePUB en ligne ?
Oui, vous pouvez accĂ©der Ă  Deploying Node.js par Sandro Pasquali en format PDF et/ou ePUB ainsi qu’à d’autres livres populaires dans Informatique et Informatique client-serveur. Nous disposons de plus d’un million d’ouvrages Ă  dĂ©couvrir dans notre catalogue.

Informations

Année
2015
ISBN
9781783981403

Deploying Node.js


Table of Contents

Deploying Node.js
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Appreciating Node
Understanding Node's unique design
Concurrency
Parallelism and threads
Concurrency and processes
Events
The event loop
The implications of Node's design on system architects
Building large systems out of small systems
Streams
Using full-stack JavaScript to maximum effect
Hot code
Browserify
Summary
2. Installing and Virtualizing Node Servers
Getting a basic Node server up and running
Hello world
Making HTTP requests
Proxying and tunneling
HTTPS, TLS (SSL), and securing your server
Creating a self-signed certificate for development
Installing a real SSL certificate
Installing applications on Heroku
Add-ons
Git
Managing configuration variables
Managing your deployment
Installing applications on OpenShift
Installing a Node application and MongoDB
Deploying your app
Using Docker to create lightweight virtual containers
First, some Unix
Getting started with Docker
Creating a Dockerfile
Building and running a Docker image
Summary
3. Scaling Node
Scaling vertically across multiple cores
spawn(command, [arguments], [options])
fork(modulePath, [arguments], [options])
exec(command, [options], callback)
execFile
Communicating with your child process
child.connected
child.stdin
child.stdout
child.stderr
child.pid
child.kill([signal])
child.disconnect()
child.send(message, [sendHandle])
The cluster module
cluster.isMaster
cluster.isWorker
cluster.worker
cluster.workers
cluster.setupMaster([settings])
cluster.fork([env])
cluster.disconnect([callback])
cluster events
worker.id
worker.process
worker.suicide
worker.send(message, [sendHandle])
worker.kill([signal])
worker.disconnect()
Scaling horizontally across different machines
Using Nginx
Deploying an Nginx load balancer on DigitalOcean
Installing and configuring Nginx
Load balancing with Node
Using node-http-proxy
Using message queues
Using Node's UDP Module
Summary
4. Managing Memory and Space
Dealing with large crowds
Microservices
Redis pub/sub
Microservices with Seneca
Reducing memory usage
Use streams, not buffers
Understanding prototypes
Memory-efficient data structures with Redis
Using bitwise operations to analyze user actions over time
Setting, getting, and counting bits
Bitmasks and filtering results
Using HyperLogLog to count unique anonymous visitors
Taming V8 and optimizing performance
Optimizing JavaScript
Numbers and tracing optimization/de-optimization
Objects and arrays
Functions
Caching strategies
Using Redis as a cache
Deploying CloudFlare as a CDN
Managing sessions
JSON Web Token authentication and sessions
Summary
5. Monitoring Applications
Dealing with failure
The 'domain' module
Catching process errors
Logging
Logging with UDP
Logging with Morgan
Modifying behavior in changing environments
Node REPL
Remotely monitoring and managing Node processes
Profiling processes
Using third-party monitoring tools
PM2
Monitoring
Nodetime
Using New Relic for monitoring
Summary
6. Building and Testing
Building with Gulp, Browserify, and Handlebars
Using Gulp
Erecting a build scaffold
Running and testing your build
Using Node's native testing tools
The Node debugger
The 'assert' module
Testing with Mocha, Chai, Sinon, and npm
Mocha
Chai
Sinon
Spies
Stubs
Mocks
Automated browser testing with PhantomJS and CasperJS
Headless testing with PhantomJS
Navigation scenarios with CasperJS
Summary
7. Deploying and Maintaining
Using GitHub webhooks
Enabling webhooks
Implementing a build/deploy system using webhooks
Synchronizing local and deployed builds
Developing locally with Vagrant
Provisioning with Ansible
Integrating, delivering, and deploying
Continuous integration
Continuous delivery
Continuous deployment
Building and deploying with Jenkins
Deploying to Heroku
Package maintenance
Understanding Semver
Managing packages with npm
Designing a dependency tree
Summary
Index

Deploying Node.js

Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: July 2015
Production reference: 1170715
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78398-140-3
www.packtpub.com

Credits

Author
Sandro Pasquali
Reviewers
Benjamin Bahrenburg
Nikola BreĆŸnjak
FĂ©lix Saparelli
Jim Schubert
Commissioning Editor
Edward Gordon
Acquisition Editor
Meeta Rajani
Content Development Editor
Rohit Kumar Singh
Technical Editor
Humera Shaikh
Copy Editor
Sarang Chari
Project Coordinator
Mary Alex
Proofreader
Safis Editing
Indexer
Mariammal Chettiyar
Production Coordinator
Conidon Miranda
Cover Work
Conidon Miranda

About the Author

Sandro Pasquali, in 1997, formed Simple.com, a technology company that sold the world's first JavaScript-based application development framework and was awarded several patents for deployment and advertising technologies that anticipated the future of Internet-based software. Node represents, for him, the natural next step in the inexorable march toward the day when JavaScript powers nearly every level of software development.
Sandro has led the design of enterprise-grade applications for some of the largest companies in the world, including Nintendo, Major League Baseball, Bang and Olufsen, LimeWire, AppNexus, Conde Nast, and others. He has displayed interactive media exhibits during the Venice Biennial, won design awards, built knowledge management tools for research institutes and schools, and started...

Table des matiĂšres