I am struggling with under which accounts I should be running the daemon and how to add applications.
I currently have it under root.
PM2 v4.2.3: God Daemon (/root/.pm2)
But when I run my bash script to add another application, I am logged in as brad with sudo permissions. So it then wants to start another daemon as
PM2 v4.2.3: God Daemon (/brad/.pm2)
and add the application to the brad instance, not the root one.
I am not sure just how to structure this. Ultimately the goal is to have a php webpage run the bash script to add the application. The nginx web server and php-frm run as www-data user. So am I supposed to run the God Daemon as that user as well and give www-data sudo permissions? I am worried about security here. I would appreciate any help on this as I think it is pretty important on getting it right. I am using ubuntu 18.4