Unitech / pm2-deploy

Deploy part of PM2
http://pm2.keymetrics.io/docs/usage/deployment/
MIT License
178 stars 71 forks source link

Getting `post-deploy hook failed` error message but no output of any kind #126

Open c0bra opened 7 years ago

c0bra commented 7 years ago

Unfortunately there's no errors or any indication of what's going on. The post hook is a simple bash script that can be run manually as the same user pm2 is connecting with.

Any tips on how to debug?

vmarchaud commented 7 years ago

Care that hooks are run with non-interactive shell so env var that are inside ~/.bashrc or ~/.zshrc arent loaded

c0bra commented 7 years ago

The only environment variable used is NODE_ENV which is set in deploy.config.js.

vmarchaud commented 7 years ago

Are you sure that pm2/node are available with the default env (eg. You didn't hardcoded the path with nvm for example) ? Have you any specific ssh config (ssh subsystem limitation) ?

c0bra commented 7 years ago

Yes the post-deploy hook was working at one point. We're not using nvm.

I did notice that the script has no interpreter shebang. Could that be it? I can try adding it and see what happens.

c0bra commented 7 years ago

Nope, bleh.

dsclassen commented 7 years ago

Any updates on this issue? I'm getting similar useless errors when post-deploy attempts to run.

dsclassen commented 7 years ago

Well I was deploying to our webserver as the apache user. The default login shell was specified as /bin/csh in the /etc/passwd file. I changed it to /usr/bash and now things are working. yay

c0bra commented 7 years ago

@dsclassen I think in our case we were expecting the NODE_ENV set on the project to be available and it wasn't so we had to set it explicitly in the post-deploy hook.