`pm2 startup` does not take into account authbind nor `pm2` alias
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 43.3k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
In the docs we suggest to users to add the following line to their non-root user's ~/.bashrc file.
alias pm2='authbind --deep pm2'
However this ONLY works for when pm2 is started as this user in this session.
Upon calling pm2 save, the following output occurs:
user@ubuntu:~$ pm2 save
[PM2] Saving current process list...
[PM2] Successfully saved in /home/user/.pm2/dump.pm2
This is OK actually, the problem is the next step:
user@ubuntu-2gb-nyc3-01:~$ pm2 startup
[PM2] Init System found: upstart
[PM2] You have to run this command as root. Execute the following command:
sudo env PATH=$PATH:/home/user/.nvm/versions/node/v8.3.0/bin /home/user/.config/yarn/global/node_modules/pm2/bin/pm2 startup upstart -u user --hp /home/user
Note that the pm2 command here does not utilize authbind.
Therefore when you run that command as root, and then run sudo reboot to reboot the server, the ONLY way your apps will run again properly is if you manually log in as user and run:
authbind --deep pm2 update
I think that we should detect if the user is using authbind and then insert that in the copy/paste snippet or fix the startup command?
This issue is related to the comment here https://github.com/Unitech/PM2/issues/1038#issuecomment-211459999.
Perhaps allow the user to pass a flag --authbind to pm2 startup command? And then take that into consideration here https://github.com/Unitech/pm2/blob/43b6000171a28e09cc25467e1b46fcd7f7ac7a08/lib/API/Startup.js#L281?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read lib/API/Startup.js around line 281 and reproduce the documented pm2 save and pm2 startup commands using the authbind alias. Determine how startup output should account for authbind or an --authbind option, with completion shown by a generated command that preserves app startup after reboot.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100