-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deploy option 'needs_tty' fails with "Pseudo-terminal will not be allocated because stdin is not a terminal." #2231
Comments
If I change deploy.js to send the hostJSON as the first param, then in the deploy bash script replace 'read conf' with 'conf=$1; shift'. This will not open ssh with stdin and the commands will work. |
ping @Unitech I'm a bit lost on this one :| |
Actually you can't use TTY with pm2 deploy since the binary is spawn by a shellscript. |
@vmarchaud I was able to get it to work with the fix I mentioned. I do agree that I shouldn't be using |
I'm writing a new version of the deploying system (here) and i'll be happy if you provide me what you exactly expect from the pre/post hooks ? |
Thanks for following up. I would expect that whatever I put in the string of a hook can be executed as if I put that same string in the shell. I haven't modified my deployment, but when I was writing it, I was able to do everything except what I mentioned in my original comment. I'm very glad you're adding more hooks, it was confusing what ran where before. |
@mozeryansky Actually i'm not just adding hooks, i'm rewriting it from scratch with a pure javascript solution without relying on a shellscript or spawning the ssh binary. I'm interested for feedback on it btw |
@vmarchaud I do see all the additional features, the limited number of hooks was a pain point in the current deployment tool. Personally, and on any project, if I'm using a tool (pm2) and that tool provides other related tools (pm2-deploy) I will almost always use that tool without looking for another (even if others have a million more features). I'm focussing on my project and trying out various deployment takes time away from that. Thank you for making a better tool though, not everyone works like I do. |
@mozeryansky Yeah totally (same for me), but deployerjs will replace pm2-deploy as some point, thats the aim of deployerjs since the start. |
Ok great! |
What I'm attempting to do is run su in a post-deploy. To do this, I know I need a tty which is achieved with -t. I found in the source of deploy that if I include needs_tty then a -t will be used on the ssh commands for deploy. However, when I do this, all the ssh commands output "Pseudo-terminal will not be allocated because stdin is not a terminal."
I believe this is because the deploy command is passed the config string by piping in the string, instead of passing it as an argument.
Environment info
Operating System: OS X 10.11.5
Pm2 version: 1.1.3
Node version: 5.3.0
Shell: bash
Steps to reproduce
Logs
The pm2 log doesn't apply here, so this is from '/tmp/pm2-deploy.log'. From the logs, it looks like everything is operating correctly.
ssh -t username@website.com "cd /home/bob/source && git fetch --all"
ssh -t username@website.com "cd /home/bob/source && git reset --hard origin/master"
ssh -t username@website.com "ln -sfn /home/bob/source /home/bob/current"
ssh -t username@website.com "cd /home/bob/source && echo
git rev-parse --short HEAD
>> /home/bob/.deploys"ssh -t username@website.com "cd /home/bob/current; SHARED="/home/bob/shared" su bob pm2 startOrRestart ecosystem.json --env production 2>&1 | tee -a /tmp/pm2-deploy.log; exit ${PIPESTATUS[0]}"
The text was updated successfully, but these errors were encountered: