Configuration

PM2

Configuration for PM2, the process manager for Directus.
Environment Variables
Environment variables are configurable for Directus Business Cloud and Enterprise Cloud projects via our Customer Success team. You can also set environment variables in self-hosted projects.

For more information on what these options do, refer directly to the pm2 documentation.

VariableDescriptionDefault
PM2_INSTANCES1Number of app instance to be launched.1
PM2_EXEC_MODEOne of fork, cluster.'cluster'
PM2_MAX_MEMORY_RESTARTApp will be restarted if it exceeds the amount of memory specified.
PM2_MIN_UPTIMEMin uptime of the app to be considered started.
PM2_LISTEN_TIMEOUTTime in ms before forcing a reload if app not listening.
PM2_KILL_TIMEOUTTime in milliseconds before sending a final SIGKILL.
PM2_MAX_RESTARTSNumber of failed restarts before the process is killed.
PM2_RESTART_DELAYTime to wait before restarting a crashed app.0
PM2_AUTO_RESTARTAutomatically restart Directus if it crashes unexpectedly.false
PM2_LOG_ERROR_FILEError file path.$HOME/.pm2/logs/<app name>-error-<pid>.log
PM2_LOG_OUT_FILEOutput file path.$HOME/.pm2/logs/<app name>-out-<pid>.log

1 Redis is required in case of multiple instances.

These environment variables only exist when you're using the official Docker Container, or are using the provided ecosystem.config.cjs file with pm2 directly.