Octopus Powershell Keeps Running React Application

Hello, I am deploying a React application to a single Windows server 2012 machine using Octopus 2018.5.1 and I am attempting to serve the build by using below command.

npm run serve

The command is successful and my application starts running. However, the build task never finishes. It will remain on this task until the deployment is cancelled, and after cancelling, subsequent deployments indicate that the tentacle is busy, and a service restart is required before another deployment can start.

If I execute this command directly on Windows server through Powershell, It opens another tab and starts my application. So, Is it possible to apply the same process in Octopus as well in order to complete the build task.

I am looking for your guidance on solving this issue. Any suggestions are welcome. Thanks!

Hi Atif,

Thanks for getting in touch. Before we discuss some ideas for solving your problem, could you tell me what your npm script - npm run serve, does? Based on your previous message, my guess is that this script just calls node.exe and runs the app. But I just want to be sure :slight_smile:

Thanks,

Phil

Hi Phil,

Thanks for your response. Basically “npm run serve” just runs the below command which I’ve defined under the name serve in package.json

serve": “set PORT=XXXX && serve -s build”

Hi Atif,

Thanks for getting back to me. I think I understand your issue now.

The serve package is designed and primarily used for local development and testing on your workstation. Indeed, even the creators of serve do not recommend it for use in production. From the project’s README:

Once it’s time to push your site to production, we recommend using Vercel.

Now of course they are going to recommend using Vercel, because this is their company’s product and they want you to buy it :slight_smile:. However, because you have you own infrastructure (your Windows Server 2012) and Octopus Deploy, you probably don’t need Vercel.

Running your app anywhere other than your local workstation requires a little more work. Technically, you could continue to use serve, but do so alongside a process manager, like this person did. But again, I would not recommend this because serve is not designed for it.

If your React app has been bundled into static asset files like Create React App does for example, it may be easiest to use Windows’ built in web server, IIS. You can find articles on the web with tutorials that show you how to set this up.

Octopus Deploy also has a built-in step template designed to help you deploy to IIS. The only caveat here would be that you would first need to package your assets into a zip or tarball file and upload that package to a repository (like Octopus’ built in package repository for example).

I hope this helps get you started. Cheers,

Phil

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.