简体   繁体   中英

Getting codeship deployments to digital ocean working

Oh god why is this so hard. I've now spent 3 days trying to get this seemingly simple crap to work.

I need it to: - npm install on CI server (works) - run tests (works) - build angular frontend (works) - ship code to server via rsync (works) - ssh into server (works) - - and npm install (doesn't work. dies because of npm warnings, I think) - - restart pm2 process (doesn't work as there's no elegant way to say start or restart)

At the deploy step, I have this script in the codeship UI

rsync -avz --exclude 'node_modules' ~/clone/
root@xxx.xxx.xxx.xxx:/root/my-project/
ssh root@xxx.xxx.xxx.xxx cd /root/my-project && bash ./postDeploy.sh

Then the postDeploy.sh script is this:

#!/bin/sh
export PATH=$PATH:/usr/local/bin
npm install --silent &> /dev/null
/usr/local/bin/pm2 stop --silent keystone &> /dev/null
/usr/local/bin/pm2 start keystone.js 2> /dev/null

I'm trying to swallow errors with this trick. &> /dev/null

There are a few vulnerabilities in the project that are unfortunately deep inside a core module and not fixable by me so I need npm to just be quiet in this case.

Then there's the PM2 thing which is slightly annoying. I need to issue a stop command, but if the service is not running it will fail, so again I need to swallow errors. The start command is probably fine.

I think maybe what's happening now is that because I swallow all output codeship's script runner assumes it fails?

I have tried to use the half-baked debug tool, but it magically asks me for a password when I try to login in... Eh?

Also @codeship it would be amazing if 80% of the helpful articles that google has indexed didn't lead to dead pages on your site...

I have tried to use the half-baked debug tool, but it magically asks me for a password when I try to login in... Eh?

I'd say this was a correct instinct. There are too many possible scenarios for why you're coming across these unintended behaviors and nothing short of running the build live with a ssh debug session will likely get to the bottom of that.

Please see our documentation section for troubleshooting password prompts for ssh debug sessions .

If an ssh debug session doesn't solve your situation, then please reach out to us at support@codeship.com with your build url and we'll take a closer look.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM