我正在为我的Node.js应用程序设置使用Jenkins服务器的持续集成。对于部署,我使用了一个powershell脚本,并为此安装了powershell插件。脚本将需要按照顺序执行以下任务。
# Step1
# Stop all the currently running services on web server. For that I am trying to
# execute maintenance.js remotely from the build server under node
node \\SharedWebServerFolder\Utilities\maintenance.js stopServices
# Step2
# Copies all the resources to server at \\SharedServerWebFolder
# Step3
# Start the services
node \\SharedWebServerFolder\Utilities\maintenance.js startServices执行Step2没有问题。我的问题是关于Step1和Step3的。
maintenance.js吗?这有可能吗?(假设我已经在构建服务器上安装了node.js )maintenance.js脚本吗?因此,基本上部署脚本(来自构建服务器)将执行远程PowerShell脚本(它位于web服务器上),远程PowerShell脚本将在本地执行maintenance.js。在这个场景中,我不需要在构建服务器上安装Node.js。推荐什么?
发布于 2016-03-08 10:29:32
人们通常使用ssh远程执行命令。我认为您希望在生产/暂存服务器上从构建服务器执行一个命令。
请参阅linux execute command remotely
在远程盒是linux盒的情况下,这很简单。
如果您的遥控器是Windows框,那么您仍然可以在其上运行ssh服务器,但设置起来更痛苦。您可以尝试一下Bitvise客户端。
一旦您的ssh客户端设置正确,您应该能够从您的构建服务器执行远程命令。
发布于 2016-03-08 10:55:31
我使用Jenkins SSH插件在我的远程分阶段/生产服务器中进行部署,我建议在web服务器机器上执行“maintenance.js”,而不是在构建服务器上执行“maintenance.js”,这样就可以在使用ssh.I从生成服务器进行“maintenance.js”执行时触发“maintenance.js”执行,我认为从构建服务器远程执行“maintenance.js”是很困难的。
https://stackoverflow.com/questions/35859622
复制相似问题