literakl / mezinamiridici

Traffic forum
htttps://www.mezinamiridici.cz
MIT License
4 stars 4 forks source link

Create PM2 configuration for all scripts #174

Closed literakl closed 2 years ago

literakl commented 3 years ago

There are many jobs backend/src/jobs and main app. Create configs that can be fine tuned and easier maintained than CLI. Set easy to remember names, e.g. backend.

literakl commented 3 years ago

See the docs: https://pm2.keymetrics.io/docs/usage/application-declaration/#yaml-format

Main app + all scripts need a configuration. I do not want to specify that in CLI.

literakl commented 3 years ago

the port must be configurable:

app.listen(3000, () => logger.info('Server started'));

LabN36 commented 3 years ago

pm2 is configured on backend. there is a file named ecosystem.config.js under backend directory.

  1. we can change port numberin this directory
  2. along with api server there are 2 more scripts are running(CalculateUserRanks & ParseAccidents)

Note: CreateSitemap script is not configured as of now, this script will reside on www

literakl commented 3 years ago

PM2 interfers with log4js-node library so no logs are created.

pm2: true in logging config helps but I need to ensure that it works in a cluster mode with more processes.

https://log4js-node.github.io/log4js-node/clustering.html has more information