PM2 log output limits
Try this pm2 logs ‘YOUR_PROCESS’ –lines 1000
Try this pm2 logs ‘YOUR_PROCESS’ –lines 1000
Yeah this is a bit of a failing with pm2 IMHO. Only when you have more than one instance (site) running on the server. I use: ss -tnlp | grep “node /” You can then eyeball the pid from pm2 and the port, or in my case you get just a snippet of the directory … Read more
Use pm2 and specify node version using –interpreter flag with node version absolute path: sudo pm2 start app.js –interpreter=/home/ken/.nvm/v4.4.2/bin/node or sudo pm2 start app.js –interpreter=/home/ken/.nvm/v7.4.0/bin/node etc.. If you change the node version wherever I mentioned –interpreter=”***..” the app will run in exact node version. Once you completed the above approach to verify use following command … Read more
You will be able to see currently running docker containers using below command. docker ps Then copy the CONTAINER ID of the running container and execute the following command docker stop <container_id> Please replace with a real value.
The main difference between pm2 and pm2-runtime is pm2-runtime designed for Docker container which keeps an application in the foreground which keep the container running, pm2 is designed for normal usage where you send or run the application in the background. In simple words, the life of the container is the life of CMD or … Read more
I had problems with sudo pm2 start api, but this was since pm2 was already running without sudo privileges, therefor you need to run: pm2 kill sudo pm2 start api This kills the pm2 deamon first, so that it starts in sudo, but then you need sudo for ALL pm2 commands afterwards, like: sudo pm2 … Read more
It actually depends on how your Node application works. If your application is stateless then it is easy to use pm2 cluster mode as it does not require much effort (or no effort) in code changes. But if your application uses local data, sessions or using sockets then it is recommended to use Node.js inbuilt … Read more
The su-exec can be used in alpine. Do add it the package, if not already available, add the following to your Dockerfile RUN apk add –no-cache su-exec Inside your scripts you’d run inside docker you can use the following to become another user: exec su-exec <my-user> <my command> Alternatively, you could add the more familiair … Read more
The error you’re getting is because a bash script (yarn) is being executed with node… Because pm2’s default interpreter is set to node. To run yarn you’ll have to set the interpreter to bash: shell: Try the command below: pm2 start yarn –interpreter bash –name api — start
UPDATE 16 FEB 2020: If it is important to you that PM2 automatically starts up without you logging into the machine (after reboot) please follow my new set of instructions instead of the old ones. New instructions (recommended): Prerequisites (part # 1): First, I have installed NPM in a location which is available to all … Read more