Closed alexsegura closed 7 years ago
Hello,
You are right, it's not that easy.
The problem is the role is always deleting all the apps, even when nothing has changed.
For example if pm2_apps
is empty, and apps have been started by another mean (for example via pm2 deploy
), when you provision the server everything gets deleted.
What about restarting apps only when the list has changed?
I also need to understand why the build fails.
Hi, I did a little work on this role:
New variables:
* `pm2_cmds` run pm2 commands before managing apps
* `pm2_cmds_default_env` default env to use for commands
* `pm2_apps_default_env` default env to use for apps
* `pm2_apps_default_cmd` default cmd to use for apps
Check out README on the develop branch.
One note: startOrRestart
expects pm2 config json file and doesn't work on apps directly.
You think this would solve it?
This is great, it stays backwards compatible 👍
It works, for the moment I just added pm2_cmds: []
and all my problems are gone 🎉
THX for the support!
Hi, thanks for the PR. The reason I delete all running apps at the beginning is that I was a bit lazy on managing apps. This means, that with your changes you don't stop / delete apps that are no longer in your config file... It's been a while since I used this role or pm2. Do you know if there's something like docker's
--remove-orphans
?