Files
directus/ecosystem.config.cjs
Rijk van Zanten cde4dc6c78 Run Directus in PM2 Cluster mode in Docker Image (#18998)
* Send ready state to pm2

* Run with pm2

* Add ecosystem config

* Fix cjs naming

* Add start command

* Increase kill timeout retry

* Set PM2 config through environment variables

* Add changeset

* Add config options for pm2

* Add additional config options

* Add more wordssssssssss

* Update Dockerfile

Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>

* Update ecosystem.config.cjs

Co-authored-by: Wryn (yage) Wagner <yage@yage.io>

* Default to undefined instead of empty string

* Update docs to match safer defaults

---------

Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
Co-authored-by: Wryn (yage) Wagner <yage@yage.io>
2023-10-25 15:34:26 -04:00

29 lines
780 B
JavaScript

/**
* pm2 ecosystem options
* See https://pm2.keymetrics.io/docs/usage/application-declaration/
*
* Attributes down below are in order of the above linked documentation
*/
module.exports = [
{
// General
name: 'directus',
script: 'cli.js',
args: ['start'],
// General
instances: process.env.PM2_INSTANCES ?? '1',
exec_mode: process.env.PM2_EXEC_MODE ?? 'cluster',
max_memory_restart: process.env.PM2_MAX_MEMORY_RESTART,
// Control flow
min_uptime: process.env.PM2_MIN_UPTIME,
listen_timeout: process.env.PM2_LISTEN_TIMEOUT,
kill_timeout: process.env.PM2_KILL_TIMEOUT,
wait_ready: true,
max_restarts: process.env.PM2_MAX_RESTARTS,
restart_delay: process.env.PM2_RESTART_DELAY ?? 0,
autorestart: process.env.PM2_AUTO_RESTART ?? false,
},
];