0

I am setting continuous integration using Jenkins server for my Node.js application. For deployment I am using a powershell script and for that I have installed powershell plug-in. The script will need to perform the following tasks in the order.

# 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

I have no problem executing Step2. My question is about Step1 and Step3.

  1. Should I execute maintenance.js remotely from the build server? Is this even possible? ( Assume I have installed node.js on the build server)

  2. Should I have one more PowerShell script on the web server which executes maintenance.js locally? So basically deployment script (from build server) will execute remote PowerShell script (which is on web server) and that remote PowerShell script will execute maintenance.js locally. In this scenario I don't have to install Node.js on the build server.

What is recommended?

2 Answers 2

0

People generally use ssh to execute commands remotely. I think you want to execute a command from your build server on your production / staging server.

see linux execute command remotely

this is simple where the remote box is a linux box.

If your remote is a Windows box then you can still run an ssh server on it but its more painful to setup. you might try Bitvise SSH Client.

Once your ssh client is setup correctly you should be able to execute remote commands from your build server.

Sign up to request clarification or add additional context in comments.

1 Comment

Build server and web server both are windows server
0

I have used Jenkins SSH Plugin for deployment in my remote staging/production servers.I would recommend to execute your 'maintenance.js' in web server machine instead of your build server.You can just trigger 'maintenance.js' execution in staging/production servers from build server using ssh.I believe the execution of 'maintenance.js' remotely from the build server is hard to achieve.

2 Comments

Will SSH Plugin execute powershell in windows server?
any help on how to do this on windows machine?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.