🌍 NodeJS · subject

NodeJS Deployment Syllabus

Every chapter and topic of Deployment examined in NodeJS — 2 chapters, 6 topics, plus 50 flashcards written against it.

2Chapters
6Topics
0Sub-topics
~5hEst. first pass
8%Of NodeJS
50Flashcards

Deployment syllabus — full chapter and topic list

Expand any chapter to see its topics and sub-topics. This is the whole examinable outline for Deployment in NodeJS, not a summary of it.

  1. Deployment Strategies

    3 topics
    • PM2
    • Docker
    • CI/CD Pipelines
  2. Cloud Providers

    3 topics
    • AWS
    • Heroku
    • Google Cloud Platform

Deployment flashcards for NodeJS

24 of 50 cards from the Deployment deck — real questions with worked answers.

  1. What is PM2 in the Node.js ecosystem?

    PM2 is a production process manager for Node.js applications with a built-in load balancer. It keeps apps alive forever, reloads them without downtime, and manages logging, monitoring, and clustering.

  2. Which PM2 command starts an app and keeps it running under the process manager?

    pm2 start app.js (optionally with --name, --watch, or -i for instances). This launches the app as a managed, auto-restarting process.

  3. How does PM2 cluster mode scale a Node.js app across CPU cores?

    pm2 start app.js -i max (or a number) forks N worker processes using Node's cluster module, load-balancing incoming connections across cores. Optimal N is typically the number of CPU cores.

  4. What is the difference between pm2 restart and pm2 reload?

    restart kills and restarts the process (causes brief downtime). reload does a zero-downtime rolling restart in cluster mode, starting new workers before killing old ones.

  5. How do you make PM2-managed apps survive a server reboot?

    Run pm2 startup (generates and installs an init script) then pm2 save (snapshots the current process list to be resurrected on boot).

  6. What file does PM2 use for declarative multi-app configuration?

    An ecosystem file, typically ecosystem.config.js, defining an apps array with settings like name, script, instances, exec_mode, env, and watch.

  7. Which PM2 command shows a live dashboard of CPU, memory, and logs?

    pm2 monit gives a real-time terminal dashboard; pm2 logs streams aggregated logs; pm2 list shows a status table.

  8. What does PM2's max_memory_restart option do?

    It automatically restarts a process when its memory usage exceeds a threshold (e.g. max_memory_restart: '300M'), guarding against memory leaks.

  9. What is a Docker image versus a Docker container?

    An image is a read-only template (layered filesystem plus metadata) built from a Dockerfile. A container is a running, writable instance of an image with its own isolated process, network, and filesystem namespace.

  10. What is a Dockerfile?

    A text file of sequential instructions (FROM, RUN, COPY, CMD, etc.) that Docker reads to build an image. Each instruction generally creates a new cached layer.

  11. What is the purpose of the FROM instruction in a Dockerfile?

    FROM sets the base image the build starts from (e.g. FROM node:20-alpine). It must be the first non-comment instruction and defines the initial filesystem and OS layer.

  12. What is the difference between the CMD and ENTRYPOINT instructions?

    ENTRYPOINT defines the fixed executable that always runs; CMD provides default arguments (or the default command) that are easily overridden at runtime. Combined, ENTRYPOINT is the command and CMD supplies its default args.

  13. What is a multi-stage Docker build and why use it?

    A Dockerfile with multiple FROM stages where build artifacts are copied from a heavy build stage into a slim final stage. It produces smaller, more secure production images by excluding build tools and dev dependencies.

  14. What is the difference between COPY and ADD in a Dockerfile?

    COPY simply copies local files/directories into the image. ADD does the same but additionally can auto-extract local tar archives and fetch remote URLs. Best practice: prefer COPY unless you need ADD's extra features.

  15. What is the difference between a Docker volume and a bind mount?

    A volume is Docker-managed storage stored in Docker's area and decoupled from the host path structure. A bind mount maps a specific host directory into the container. Volumes are preferred for portability and backups; bind mounts for live source during development.

  16. What does the EXPOSE instruction actually do in Docker?

    EXPOSE documents which port the container listens on; it does NOT publish the port. You must still map it at runtime with docker run -p hostPort:containerPort.

  17. What is the role of a .dockerignore file?

    It lists files/directories excluded from the build context sent to the Docker daemon (e.g. node_modules, .git). This speeds builds, shrinks context, and avoids leaking secrets into images.

  18. How does Docker layer caching affect build order for a Node.js app?

    Copy package.json and package-lock.json and run npm install BEFORE copying source code. Because layers cache until an input changes, dependencies are only reinstalled when the manifest changes, not on every code edit.

  19. What is Docker Compose used for?

    Docker Compose defines and runs multi-container applications via a YAML file (compose.yaml). docker compose up starts all defined services, networks, and volumes together with one command.

  20. What is CI/CD?

    CI (Continuous Integration) is the practice of frequently merging code and automatically building/testing it. CD (Continuous Delivery/Deployment) automatically prepares and releases those validated changes to staging or production.

  21. What is the difference between Continuous Delivery and Continuous Deployment?

    In Continuous Delivery every change is automatically built, tested, and made release-ready, but the final push to production is a manual approval. In Continuous Deployment that final step is also automated, so every passing change ships to production without human intervention.

  22. What are the typical stages of a CI/CD pipeline?

    Source (trigger on commit/PR) → Build (compile/package) → Test (unit, integration, lint) → Release/Artifact → Deploy (staging/production) → optional Monitor. Each stage gates the next.

  23. What is a build artifact in a CI/CD pipeline?

    A deployable output produced by the build stage (e.g. a Docker image, a zipped bundle, or a compiled binary) that is stored and passed to later deploy stages to ensure the exact same tested code is released.

  24. What triggers a CI pipeline run in GitHub Actions?

    Events defined under the on: key, such as push, pull_request, schedule (cron), or workflow_dispatch (manual). Workflows are YAML files stored in .github/workflows/.

See more Deployment flashcards →

Planning Deployment for NodeJS

Deployment is about 8% of the NodeJS syllabus by topic count — 6 of 72 topics, spread over 2 chapters. At roughly 45 minutes per topic plus 12 minutes per sub-topic, a first pass runs to about 5 hours.

Work top-down: read the chapter, then tick topics off individually rather than marking the whole chapter done. Sub-topics are where silent gaps hide.

Deployment (NodeJS) FAQ

What is in the NodeJS Deployment syllabus?

Deployment is split into 2 chapters — Deployment Strategies and Cloud Providers, containing 6 topics and 0 sub-topics in total.

How many chapters are there in Deployment for NodeJS?

2 chapters. Deployment accounts for about 8% of the topics in the whole NodeJS syllabus (6 of 72).

How long should I spend on Deployment for NodeJS?

Budget around 5 hours for a first pass through Deployment — about 45 minutes per topic plus 12 minutes per sub-topic across its 6 topics. Add revision cycles on top.

Are there flashcards for NodeJS Deployment?

Yes — a 50-card Deployment deck. Sample cards are printed on this page, and the full deck is free in the Examius app with spaced repetition scheduling.