pm2 has multiple copies of an executable in its list - pm2

Here is the output of pm2 ls
Why are there multiple keys_server's and how can they be removed?
P.s. If anyone knows why the vertical bars are not being rendered properly feel free to pitch in

Looks like pm2 delete <id> works. After doing
pm2 delete 0
pm2 delete 2
The list is:

Related

pm2 proper path for ecosystem.config.js

I would like to instruct pm2 to always read the global ecosystem.config.js in:
C:\ProgramData\pm2\ecosystem.config.js or
C:\ProgramData\pm2\my-pm2-apps.config.js
by a simplified name/command - meaning: If I go to the terminal as Administrator, and to a random folder e.g: C:\temp\ (but NOT C:\ProgramData\pm2) and I type
pm2 start my-pm2-apps
pm2 stop my-pm2-apps
etc.
it will do the same as:
pm2 start C:\ProgramData\pm2\ecosystem.config.js
pm2 stop C:\ProgramData\pm2\ecosystem.config.js
or
pm2 start C:\ProgramData\pm2\my-pm2-apps.config.js
pm2 stop C:\ProgramData\pm2\my-pm2-apps.config.js
etc.
At this time I see it done by a separate PowerShell script that is added to the Windows PATH env.var., but is there a more direct way with pm2 itself?

Relation of dump.pm2 and ecosystem.json

i'm using pm2-windows-service to start PM2 as service.
I don't understand the relationship between dump.pm2 and ecosystem.json. It looks like they are all the pm2 boot config that will be used. But which would take precedence if both in dump.pm2 and ecosystem.json were defined?
Please tell me the answer . Thanks you.
ecosystem.json will have a higher priority than dump.pm2.
When there is no ecosystem.json file it will use dump.pm2 file. dump.pm2 will be generated when running the command : pm2 save.
It is more convenient to use the ecosystem.json because we just need to change the settings in the ecosystem.json. If we use dump.pm2, we need to run the app again (pm2 start ...) and then update the dump file with the command : pm2 save

How can I disable timestamps on PM2?

I wanted to use see timestamps on my log output from pm2, so I stopped the process and started it again with:
pm2 start www --log-date-format "MM/DD HH:mm"
Which successfully gave me timestamps. I now want to turn them off, but restarting doesn't work.
You have to delete the process from PM2 with pm2 delete www and then add it back with pm2 start www.

I can't find the process id

I have PM2 on a GoDaddy Ubuntu cloud server. pm2 list shows as follows:
Is the fourth column the process id? Every one seems to be 0. Is there something wrong with my installation?
The 4th column is the number of restarts. It's supposed to show a little icon, like this:
The reason its not showing the process id column is because your terminal window is too narrow. Try extending it and running pm2 list again. I believe this responsive list view is a recently added feature.
Once your terminal is wide enough, it should look like this:
as you can see the process id (pid) is now shown.
check your error log maybe can get something useful tips, and check have you turn on "watch" options? if you turn on the "watch" options, pm2 will be restart when the file had changed, so you need to add the log files in "ignore_watch" options, or pm2 will be always restart loop because the log file always has changed

metadata.json not found when pushing to openShift git

I am trying to push a second version of my app (nodeJS + MongoDB) into my OpenShift account. It worked the first time, but now it fails with this error:
Erics-MacBook-Air:rippleRating ericg$ git push openShift master
Counting objects: 129, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (129/129), done.
Writing objects: 100% (129/129), 28.09 KiB | 0 bytes/s, done.
Total 129 (delta 94), reused 0 (delta 0)
remote: Stopping NodeJS cartridge
remote: Mon Apr 13 2015 07:53:08 GMT-0400 (EDT): Stopping application 'ripplerating' ...
remote: Mon Apr 13 2015 07:53:09 GMT-0400 (EDT): Stopped Node application 'ripplerating'
remote: Stopping MongoDB cartridge
remote: No such file or directory - /var/lib/openshift/xxxxxxxxxxxxxxxxf8000090/app-deployments/2015-04-13_07-53-10.382/metadata.json
To ssh://xxxxxxxxxxxxxxxxf8000090#ripplerating-<domain>.rhcloud.com/~/git/ripplerating.git/
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'ssh://xxxxxxxxxxxxxxxxf8000090#ripplerating-<domain>.rhcloud.com/~/git/ripplerating.git/'
If I rhc ssh to my app, I don't see the directory 2015-04-13_07-53-19.382, I have only app-files, current and by-id (app-files has the metadata.json).
BTW what would be a good place to add some files (secret.json) that I don't want to put in the git repo and can be used by the nodeJS app?
Thanks!
I recently came across this problem myself and wanted to share how I came to a solution.
To start, my /app-deployments directory contained the following:
by-id current redis-cli
Using ls -l reveals that current is actually a soft link to the currently running build.
current -> 2015-07-10_22-45-22.964
However, using the command file current also revealed that:
current: broken symbolic link to `2015-07-12_22-45-22.964'
That seemed strange, but it was consistent with the fact that there was no folder in the /app-deployments directory named with the most recent build's timestamp (2015-07-10_22-45-22.964). I removed current and attempted to push. Same result as the OP however, missing folder or directory for the new build with metadata.json inside.
After poking around in by-id and redis-cli, I found that redis-cli contained it's own metadata.json file with a lot of null values in it (both 'git_sha1' and 'id' were null). I played with the git_sha1 field to match both my previous and new commits, but nothing changed. The other folder, by-id, had a soft link in it as well which pointed to the redis-cli folder.
At this point I had backed up everything I wanted and I attempted to force a refresh to defaults of the /app-deployments directory by deleting everything in it and pushing. Surprisingly, it worked! Now my /app-deployments directory looks like this:
2015-07-10_22-45-22.964 by-id current
which is what I normally expect to see in there. Hopefully this will be helpful to someone!
As a side note, I later decided to enable openshift's support for multiple rollback versions, which you can read about here. It allows you to specify how many rollbacks you want to keep, which could be very valuable in another situation like this.
I finally got to the bottom of this one. I had created a folder under app-deployments, and that upsets the auto deployment logic in OpenShift. The current folder was deleted under app-deployments and I have to recreate it and put a metadata.json copy in it. Once I have done that I was able to deploy again using git push. I am gessing that if you have some secret data that cannot be kept in the git repo, they have to reside under app-root/data although this won't work for a scalable app... which in this case I am not sure where should I put those sensible data...
My answer is basically the one provided by #Will.R but shorter:
The problem comes from the fact that:
* app-deployments/current is a broken symbolic link to the most recent build.
If you want to fix this problem:
* Delete everything inside /app-deployments
* Push again
* :)
* Problem fixed.