How can I restart my server in the middle of an Octopus Deploy deployment?

iac
how-to
(Bob Walker) #1

I would like my deployment process and/or runbook install some patches on my server. These patches require a server restart. However, when I restart my server the deployment fails because Octopus Deploy loses connection to the server.

(Bob Walker) #2

If the restart process takes longer than the server timeout then the deployment will fail. The problem is the process is invoking the restart command directly on the server. Once that command is issued then Octopus will wait for the command to finish.

To get around this, we recommend leveraging the hypervisor restart functionality. All cloud platforms, as well as tools such as Hyper-V or VMWare provide a CLI tool to restart a VM.

What you’re process would look like is:

  1. Install patches on specific targets.
  2. On the hypervisor (or using a cloud run a script step) restart the VM(s).

You can see an entire process on our samples instance. In it the process is spinning up a VM. While it is spinning up it installs .NET core, as well as the Azure CLI on the VM. On step 7 the process tells Azure to restart the VM.

This also provides a bit more control over the process. If a server doesn’t come back online after a specific time period then a notification could be sent out. Or a failure could be triggered.

(Tomas Baltusis) #3

That looks fine in if tentacle configured in Push mode, but it won’t work in Pull mode :confused: