0%

Book Description

Node.js is used by many companies for building performant backend services without sacrificing developer efficiency. Thanks to its approachable API and familiar syntax, Node.js is loved by engineers and used by startups and Fortune 500s alike. Backed by the world's largest package repository, its enterprise foothold is only expected to grow.

In this hands-on guide, author Thomas Hunter II proves that Node.js is just as capable as traditional enterprise platforms for building services that are observable, scalable, and resilient. Intermediate to advanced Node.js developers will find themselves integrating application code with a breadth of tooling from each layer of a modern service stack.

  • Learn why running redundant copies of the same Node.js service is necessary
  • Know which protocol to choose, depending on the situation
  • Fine-tune your application containers for use in production
  • Track down errors in a distributed setting to determine which service is at fault
  • Simplify app code and increase performance by offloading work to a reverse proxy
  • Build dashboards to monitor service health and throughput
  • Find out why so many different tools are required when operating in an enterprise environment

Table of Contents

  1. Preface
    1. Target Audience
    2. Goals
    3. Conventions Used in This Book
    4. Using Code Examples
    5. O’Reilly Online Learning
    6. How to Contact Us
    7. Acknowledgments
  2. 1. Why Distributed?
    1. Single-Threaded Nature of JavaScript
    2. Quick Node.js Overview
    3. Sample Applications
  3. 2. Protocols
    1. Request and Response with HTTP
      1. HTTP Payloads
      2. HTTP Semantics
      3. HTTP Compression
      4. HTTPS / TLS
      5. JSON over HTTP
      6. The Dangers of Serializing POJOs
    2. API Facade with GraphQL
      1. GraphQL Schema
      2. Queries and Responses
      3. GraphQL Producer
      4. GraphQL Consumer
    3. RPC with gRPC
      1. Protocol Buffers
      2. gRPC Producer
      3. gRPC Consumer
  4. 3. Scaling
    1. The Cluster Module
      1. A Simple Example
      2. Request Dispatching
      3. Cluster Shortcomings
    2. Reverse proxies with HAProxy
      1. Introduction to HAProxy
      2. Load Balancing and Health Checks
      3. Compression
      4. TLS Termination
      5. Rate Limiting and Back Pressure
    3. SLA and Load Testing
      1. Introduction to Autocannon
      2. Running a Baseline Load Test
      3. Reverse Proxy Concerns
      4. Protocol Concerns
      5. Formulating an SLA
  5. 4. Observability
    1. Environments
    2. Logging with ELK
      1. Running ELK via Docker
      2. Transmitting Logs from Node.js
      3. Creating a Kibana Dashboard
      4. Running Ad-Hoc Queries
    3. Metrics with Graphite, StatsD, and Grafana
      1. Running via Docker
      2. Transmitting Metrics from Node.js
      3. Creating a Grafana Dashboard
      4. Node.js Health Indicators
    4. Distributed Request Tracing with Zipkin
      1. How Does Zipkin Work?
      2. Running Zipkin via Docker
      3. Transmitting Traces from Node.js
      4. Visualizing a Request Tree
      5. Visualizing Microservice Dependencies
    5. Health Checks
      1. Building a Health Check
      2. Testing the Health Check
    6. Alerting with Cabot
      1. Create a Twilio Trial Account
      2. Running Cabot via Docker
      3. Creating a Health Check
  6. 5. Containers
    1. Introduction to Docker
    2. Containerizing a Node.js Service
      1. Dependency Stage
      2. Release Stage
      3. From Image to Container
      4. Rebuilding and Versioning an Image
    3. Basic Orchestration with Docker Compose
      1. Composing Node.js Services
    4. Internal Docker Registry
      1. Running the Docker Registry
      2. Pushing and Pulling to the Registry
      3. Running a Docker Registry UI
  7. 6. Deployments
    1. Build Pipeline with Travis CI
      1. Creating a Basic Project
      2. Configuring Travis CI
      3. Testing a Pull Request
    2. Automated Testing
      1. Unit Tests
      2. Integration Tests
      3. Code Coverage Enforcement
    3. Deploying to Heroku
      1. Create a Heroku App
      2. Configure Travis CI
      3. Deploy your Application
    4. Modules, Packages, and SemVer
      1. Node.js Modules
      2. SemVer (Semantic Versioning)
      3. npm Packages and the npm CLI
    5. Internal npm Registry
      1. Installing Verdaccio
      2. Configuring npm to use Verdaccio
      3. Publishing to Verdaccio
18.218.138.170