keymetrics / pm2-logrotate

Automatically rotate all applications logs managed by PM2
1.25k stars 138 forks source link

Docker pm2-logrotate stuck #107

Open smasilamani-cfins opened 6 years ago

smasilamani-cfins commented 6 years ago

Hi

I am running nodejs in a docker containter with pm2 and starting today I see that whenever I run the build, it stuck at below line forever. Please advise.

image

Our docker file:

FROM collinestes/docker-node-oracle:latest

RUN npm install pm2 -g

# Create app directory
RUN mkdir -p /usr/app/test/src

# Install app dependencies
COPY ./package.json /usr/app/test/
COPY ./tsconfig.json /usr/app/test/
WORKDIR /usr/app/test
RUN npm install

# Move source files to the containter
COPY ./src/ /usr/app/test/src/
WORKDIR /usr/app/test/src/

#Fix the permiossion for all the files in the container.
RUN chmod 744 -R /usr/app/test/src/*

RUN pm2 install pm2-logrotate

RUN pm2 set pm2-logrotate:compress true

RUN pm2 set pm2-logrotate:retain 2

RUN pm2 install typescript

ARG NODE=production
ENV NODE_ENV ${NODE}
ENV APP_ENV dev

EXPOSE 443
#CMD [ "npm", "start" ]
CMD [ "pm2-docker", "start", "pm2.json" ]
smasilamani-cfins commented 6 years ago

I have no issue if I use pm2@2.10.4.

patrickcze commented 6 years ago

Also having this exact issue with PM2 3.0.1

[PM2] Spawning PM2 daemon with pm2_home=/home/ec2-user/.pm2
[PM2] PM2 Successfully daemonized
[PM2][Module] Installing module pm2-logrotate
[PM2][Module] Calling [NPM] to install pm2-logrotate ...
+ pm2-logrotate@2.6.0
added 320 packages in 6.481s
[PM2][Module] Module downloaded
[PM2][WARN] Applications pm2-logrotate not running, starting...
[PM2] App [pm2-logrotate] launched (1 instances)
== pm2-logrotate ==
┌────────────────┬─────────────────────┐
│ key            │ value               │
├────────────────┼─────────────────────┤
│ max_size       │ 10M                 │
│ retain         │ 30                  │
│ compress       │ false               │
│ dateFormat     │ YYYY-MM-DD_HH-mm-ss │
│ workerInterval │ 30                  │
│ rotateInterval │ 0 0 * * *           │
│ rotateModule   │ true                │
└────────────────┴─────────────────────┘
[PM2][Module] Module successfully installed and launched
[PM2][Module] Edit configuration via: `pm2 conf`
doubliez commented 6 years ago

Having the same issue with version 3.0.1 and 3.0.0 of pm2. Reverting to 2.x fixes the issue.

matheuslin commented 6 years ago

Hi, I got the very same issue. I've followed your suggestions, used pm2@2.10.0 and it worked!

wazho commented 5 years ago

It's perfect work with pm2@3.2.2.

Maybe this issue is solved?


Edit:

Also tried docker image keymetrics/pm2:10-alpine and keymetrics/pm2:8-alpine, both are perfect works.