Pre/post deploy script feature request

Hi, I am looking at using Octopus to deploy to our environments and everything looks pretty good so far.

When we do our pushes into load balanced sites, our current process is to take a server out of LB, deploy code, repeat for 1/2 the machines (so we’re not down to one server taking all the load). Then, once half are deployed to, we switch the inactive ones to live and cycle through the remaining servers that haven’t been deployed to. Nothing too out of the ordinary.

What would make octopus more useful in this scenario is to be able to run a pre/post deploy script around each server in the environment. Any chance this type of thing could make it in?

Hi Chris,

Thanks for the feedback. This is actually something I’ve wanted to do for a while.

As a “step” for your project, instead of just deploying a package, you’ll be able to choose to just run an arbitrary PowerShell script. The script could be run on the Octopus machine, or on a selected set of machines.

Until that’s available, you could cheat by just creating a PowerShell script called “Deploy.ps1”, and packaging it into an empty NuGet package. You could then deploy that package to a machine, and during deployment the script would be run. Your build steps would be something like:

  1. Deploy package “RemoveFromLB” to machines A and B
  2. Deploy package “Website” to machines A and B
  3. Deploy package “AddToLB” to machines A and B
  4. Deploy package “RemoveFromLB” to machines C and D
  5. Deploy package “Website” to machines C and D
  6. Deploy package “AddToLB” to machines C and D

Hope that helps,

Paul