简体   繁体   English

使代码船部署进入数字海洋工作

[英]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. 现在,我花了3天的时间尝试使这种看似简单的废话工作。

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) 我需要它:-在CI服务器上安装npm(works)-运行测试(works)-生成有角度的前端(works)-通过rsync(works)将代码运送到服务器-ssh到服务器(works)--和npm install(我认为是因为npm警告而死了)--重新启动pm2进程(此操作不起作用,因为没有优雅的方式来表示启动或重新启动)

At the deploy step, I have this script in the codeship UI 在部署步骤中,我在代码导航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: 然后postDeploy.sh脚本是这样的:

#!/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. 不幸的是,项目中存在一些漏洞,这些漏洞深处核心模块内部,我无法修复,因此在这种情况下,我需要npm保持安静。

Then there's the PM2 thing which is slightly annoying. 然后是PM2,这有点令人讨厌。 I need to issue a stop command, but if the service is not running it will fail, so again I need to swallow errors. 我需要发出一个stop命令,但是如果服务未运行,它将失败,因此再次需要吞下错误。 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... 如果Google索引的有用文章中有80%没有在您的网站上导致网页死机,那么@codeship也会令人惊讶。

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. 为什么您会遇到这些意外的行为,并且有太多可能的场景,并且通过ssh调试会话实时运行构建很可能会触底。

Please see our documentation section for troubleshooting password prompts for ssh debug sessions . 请参阅我们的文档部分,以对ssh调试会话的密码提示进行故障排除

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. 如果ssh调试会话无法解决您的问题,请通过您的构建URL通过support@codeship.com与我们联系,我们将进行仔细研究。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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