Deploying Multiple NodeJS Servers on DigitalOcean Managed by PM2, Without an ecosystem.config.js file

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • Puts Debuggerer

    Ruby library for improved puts debugging, automatically displaying bonus useful information such as source line number and source code.

  • a) Create various folders, on DO named w.r.t how you'd like PM2 to identify these servers; i.e. if you've got 3 servers to deploy on a single droplet, you'd say; e.g plutonium_server, neptunium_server, promethium_server b) clone your repo into each folder: git clone https://github.com... c) cd into the repo; sudo nano package.json d) in your start script, enter: "pm2 start " e.g: "pm2 start ./backend/dist/index.js" ensure your package.json file has got an engines object; (recommended for deployment) e.g engines: { "node": "18.1.0", "yarn": "1.22.18" } e) save the file by saying; ctrl + x then shift + y then enter f) install your project dependencies; yarn install g) copy your environment variables; create the environment variable file as you have it locally e.g: cd backend/src/config && sudo nano .env h) copy and paste the contents of the local env-file into the newly server .env file you can call the env file whatever name you perceive; but as programmed locally. Just ensure the extension is appended. Repeat step e. i) spin the server: yarn start j) rename the server: pm2 restart 0 --name plutonium_server k) you can now run pm2 logs or pm2 list for monitoring l) subsequently, all you need do next time is: pm2 start plutonium_server, pm2 stop plutonium_server etc m) replicate this procedure; to deploy other instances.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts