Unitech / Unitech/pm2

Watch not reloading the app in docker

Open
#4,902 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

What's going wrong?

When using pm2 on docker, with the watch option, changing a file does not trigger a restart of the application

How could we reproduce this issue?

  • Create a simple webapp with nodejs
  • Dockerize it with pm2 and use --watch,--ignore-watch='node_modules' arguments
  • Enter the container and change a file

Supporting information

--- PM2 report ----------------------------------------------------------------
Date                 : Fri Oct 30 2020 09:28:56 GMT+0000 (Coordinated Universal Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 4.5.0
node version         : 12.19.0
node path            : not found
argv                 : /usr/local/bin/node,/usr/local/bin/pm2-runtime,server.js,--watch,--ignore-watch='node_modules'
argv0                : node
user                 : undefined
uid                  : 0
gid                  : 0
uptime               : 5min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 4.5.0
node version         : 12.19.0
node path            : /usr/local/bin/pm2
argv                 : /usr/local/bin/node,/usr/local/bin/pm2,report
argv0                : node
user                 : undefined
uid                  : 0
gid                  : 0
===============================================================================
--- System info --------------------------------------------
arch                 : x64
platform             : linux
type                 : Linux
cpus                 : Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz
cpus nb              : 4
freemem              : 3457523712
totalmem             : 6582960128
home                 : /root
===============================================================================
--- PM2 list -----------------------------------------------
┌─────┬───────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐       
│ id  │ name      │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │       
├─────┼───────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤       
│ 0   │ server    │ default     │ 1.0.0   │ fork    │ 62       │ 3m     │ 1    │ online    │ 0%       │ 44.9mb   │ root     │ enabled  │       
└─────┴───────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘       
===============================================================================
--- Daemon logs --------------------------------------------

btw the single restart was manually triggered

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with a Node.js webapp in Docker using pm2-runtime server.js --watch --ignore-watch='node_modules', then change a file inside the container and observe whether the app restarts. Investigate the PM2 watch behavior in this Docker setup; done means file changes trigger an automatic restart while node_modules remains ignored.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, nodejs
Domain
cli, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.