keymetrics / docker-pm2

🐳 Official Docker Image for PM2 runtime
https://hub.docker.com/r/keymetrics/pm2
MIT License
476 stars 60 forks source link

Ignore watch not working #78

Open gloffreda opened 4 years ago

gloffreda commented 4 years ago

Hi there,

Just setting up a docker environment with the following config:

ecossystem:

module.exports = {
  apps : [{
    name: 'server',
    script: '/app/server.js',
     "error_file": "/dev/stderr",
     "out_file": "/dev/stdout",

    // Options reference: https://pm2.io/doc/en/runtime/reference/ecosystem-file/
    // args: '',
    instances: '1',
    autorestart: true,
    watch: true,
    ignore_watch:["node_modules","*.git","*.log","log","tmp"],
    "watch_options": {
      "followSymlinks": false
    },    
    max_memory_restart: '1G',
    env: {
      NODE_ENV: 'development'
    },
    env_production: {
      NODE_ENV: 'production'
    }
  }],
};

Dockerfile:

FROM keymetrics/pm2:latest
CMD [ "pm2-runtime", "start", "/app/ecosystem.config.js" ]

Errors:

Error: watch /app/node_modules/yargs/package.json ENOSPC
14/02/2020 13:18:47PM2        |     at _errnoException (util.js:999:13)
14/02/2020 13:18:47PM2        |     at FSWatcher.start (fs.js:1397:19)
14/02/2020 13:18:47PM2        |     at Object.fs.watch (fs.js:1423:11)
14/02/2020 13:18:47PM2        |     at createFsWatchInstance (/usr/local/lib/node_modules/pm2/node_modules/chokidar/lib/nodefs-handler.js:37:15)
14/02/2020 13:18:47PM2        |     at setFsWatchListener (/usr/local/lib/node_modules/pm2/node_modules/chokidar/lib/nodefs-handler.js:80:15)
14/02/2020 13:18:47PM2        |     at FSWatcher.NodeFsHandler._watchWithNodeFs (/usr/local/lib/node_modules/pm2/node_modules/chokidar/lib/nodefs-handler.js:228:14)
14/02/2020 13:18:47PM2        |     at FSWatcher.NodeFsHandler._handleFile (/usr/local/lib/node_modules/pm2/node_modules/chokidar/lib/nodefs-handler.js:255:21)
14/02/2020 13:18:47PM2        |     at FSWatcher.<anonymous> (/usr/local/lib/node_modules/pm2/node_modules/chokidar/lib/nodefs-handler.js:473:21)
14/02/2020 13:18:47PM2        |     at FSReqWrap.oncomplete (fs.js:167:5)
14/02/2020 13:18:47PM2        | Error: watch /app/node_modules/yargs/yargs.js ENOSPC
14/02/2020 13:18:47PM2        |     at _errnoException (util.js:999:13)
14/02/2020 13:18:47PM2        |     at FSWatcher.start (fs.js:1397:19)
14/02/2020 13:18:47PM2        |     at Object.fs.watch (fs.js:1423:11)
14/02/2020 13:18:47PM2        |     at createFsWatchInstance (/usr/local/lib/node_modules/pm2/node_modules/chokidar/lib/nodefs-handler.js:37:15)
14/02/2020 13:18:47PM2        |     at setFsWatchListener (/usr/local/lib/node_modules/pm2/node_modules/chokidar/lib/nodefs-handler.js:80:15)
14/02/2020 13:18:47PM2        |     at FSWatcher.NodeFsHandler._watchWithNodeFs (/usr/local/lib/node_modules/pm2/node_modules/chokidar/lib/nodefs-handler.js:228:14)
14/02/2020 13:18:47PM2        |     at FSWatcher.NodeFsHandler._handleFile (/usr/local/lib/node_modules/pm2/node_modules/chokidar/lib/nodefs-handler.js:255:21)
14/02/2020 13:18:47PM2        |     at FSWatcher.<anonymous> (/usr/local/lib/node_modules/pm2/node_modules/chokidar/lib/nodefs-handler.js:473:21)
14/02/2020 13:18:47PM2        |     at FSReqWrap.oncomplete (fs.js:167:5)
14/02/2020 13:18:47PM2        | Change detected on path proc/14/map_files/55e2aeb61000-55e2b0808000 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path proc/14/map_files/55e2b0a08000-55e2b0a88000 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path proc/14/map_files/55e2b0a88000-55e2b0aa2000 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path proc/14/map_files/7f5b1621f000-7f5b1642f000 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path proc/14/map_files/7f5b1642f000-7f5b16430000 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path proc/14/map_files/7f5b16430000-7f5b16431000 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path proc/14/map_files/7f5b16431000-7f5b16771000 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path proc/14/map_files/7f5b16771000-7f5b1677f000 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path proc/14/map_files/7f5b1677f000-7f5b16780000 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path proc/14/map_files/7f5b16783000-7f5b1680c000 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path proc/14/map_files/7f5b16a07000-7f5b16a08000 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path proc/14/map_files/7f5b16a0b000-7f5b16a0c000 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path proc/14/map_files/7f5b16a0c000-7f5b16a0d000 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path root/.pm2/pm2.log for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path dev/pts/0 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path dev/console for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path proc/1/map_files/55ab9c2af000-55ab9df56000 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path proc/1/map_files/55ab9e156000-55ab9e1d6000 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path proc/1/map_files/55ab9e1d6000-55ab9e1f0000 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path proc/1/map_files/7f2940d78000-7f2940f88000 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path proc/1/map_files/7f2940f88000-7f2940f89000 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path proc/1/map_files/7f2940f89000-7f2940f8a000 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path proc/1/map_files/7f2940f8a000-7f29412ca000 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path proc/1/map_files/7f29412ca000-7f29412d8000 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path proc/1/map_files/7f29412d8000-7f29412d9000 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path proc/1/map_files/7f29412dc000-7f2941365000 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path proc/1/map_files/7f2941560000-7f2941561000 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path proc/1/map_files/7f2941564000-7f2941565000 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path proc/1/map_files/7f2941565000-7f2941566000 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path root/.pm2/pm2.log for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path dev/pts/0 for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | Change detected on path dev/console for app server - restarting
14/02/2020 13:18:47PM2        | [Watch] PM2 is being killed, stopping restart procedure...
14/02/2020 13:18:47PM2        | [Watch] Stop watching server
14/02/2020 13:18:47PM2        | ===============================================================================
14/02/2020 13:18:47PM2        | --- Stopping PM2 --------------------------------------------------------------
14/02/2020 13:18:47PM2        | Time                 : Fri Feb 14 2020 16:18:47 GMT+0000 (UTC)
14/02/2020 13:18:47PM2        | ===============================================================================
14/02/2020 13:18:47PM2        | RPC closed
14/02/2020 13:26:10PM2        | Change detected on path bin/ash for app server - restarting
14/02/2020 13:26:10PM2        | Stopping app:server id:0
14/02/2020 13:26:10PM2        | Proc is not defined anymore or is being killed
14/02/2020 13:26:10PM2        | App name:server id:0 disconnected
14/02/2020 13:26:10PM2        | App [server] with id [0] and pid [24], exited with code [0] via signal [SIGINT]
14/02/2020 13:26:10PM2        | pid=24 msg=process killed
14/02/2020 13:26:10PM2        | Starting execution sequence in -cluster mode- for app name:server id:0
14/02/2020 13:26:11PM2        | App name:server id:0 online
14/02/2020 13:26:11PM2        | Change detected on path proc/1/cwd for app server - restarting
14/02/2020 13:26:11PM2        | Stopping app:server id:0
14/02/2020 13:26:11PM2        | App name:server id:0 disconnected
14/02/2020 13:26:11PM2        | App [server] with id [0] and pid [35], exited with code [0] via signal [SIGINT]
14/02/2020 13:26:11PM2        | pid=35 msg=process killed
14/02/2020 13:26:11PM2        | Starting execution sequence in -cluster mode- for app name:server id:0
14/02/2020 13:26:12PM2        | App name:server id:0 online
14/02/2020 13:26:12PM2        | Change detected on path sys/block/nvme0n1 for app server - restarting
14/02/2020 13:26:12PM2        | Stopping app:server id:0
14/02/2020 13:26:120 application online, exiting
14/02/2020 13:26:12Exiting PM2
14/02/2020 13:26:12PM2        | App name:server id:0 disconnected
14/02/2020 13:26:12PM2        | App [server] with id [0] and pid [46], exited with code [0] via signal [SIGINT]
14/02/2020 13:26:12PM2        | [Watch] Stop watching server
14/02/2020 13:26:12PM2        | Stopping app:server id:0
14/02/2020 13:26:12PM2        | app=server id=0 does not have a pid
14/02/2020 13:26:12PM2        | pid=46 msg=process killed
14/02/2020 13:26:12PM2        | [RestartProcessId] PM2 is being killed, stopping restart procedure...
14/02/2020 13:26:12PM2        | Trace: Error: [RestartProcessId] PM2 is being killed, stopping restart procedure...
14/02/2020 13:26:12PM2        |     at Object.God.logAndGenerateError (/usr/local/lib/node_modules/pm2/lib/God/Methods.js:41:12)
14/02/2020 13:26:12PM2        |     at /usr/local/lib/node_modules/pm2/lib/God/ActionMethods.js:386:25
14/02/2020 13:26:12PM2        |     at /usr/local/lib/node_modules/pm2/lib/God/ActionMethods.js:312:14
14/02/2020 13:26:12PM2        |     at Timeout.<anonymous> (/usr/local/lib/node_modules/pm2/lib/God/Methods.js:168:16)
14/02/2020 13:26:12PM2        |     at ontimeout (timers.js:466:11)
14/02/2020 13:26:12PM2        |     at tryOnTimeout (timers.js:304:5)
14/02/2020 13:26:12PM2        |     at Timer.listOnTimeout (timers.js:264:5)
14/02/2020 13:26:12PM2        |     at Object.God.logAndGenerateError (/usr/local/lib/node_modules/pm2/lib/God/Methods.js:36:15)
14/02/2020 13:26:12PM2        |     at /usr/local/lib/node_modules/pm2/lib/God/ActionMethods.js:424:30
14/02/2020 13:26:12PM2        |     at /usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:473:16
14/02/2020 13:26:12PM2        |     at iterateeCallback (/usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:976:17)
14/02/2020 13:26:12PM2        |     at /usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:958:16
14/02/2020 13:26:12PM2        |     at /usr/local/lib/node_modules/pm2/lib/God/ActionMethods.js:386:18
14/02/2020 13:26:12PM2        |     at /usr/local/lib/node_modules/pm2/lib/God/ActionMethods.js:312:14
14/02/2020 13:26:12PM2        |     at Timeout.<anonymous> (/usr/local/lib/node_modules/pm2/lib/God/Methods.js:168:16)
14/02/2020 13:26:12PM2        |     at ontimeout (timers.js:466:11)
14/02/2020 13:26:12PM2        |     at tryOnTimeout (timers.js:304:5)
14/02/2020 13:26:12PM2        | ===============================================================================
14/02/2020 13:26:12PM2        | --- Stopping PM2 --------------------------------------------------------------
14/02/2020 13:26:12PM2        | Time                 : Fri Feb 14 2020 16:26:12 GMT+0000 (UTC)
14/02/2020 13:26:12PM2        | ===============================================================================

node_modules shouldn't be on watch sight.

Any tip how overcome it ?

Thanks