Adding Tentacles during deployment

I’ve been working on a deployment process that can deploy an entire environment to Azure. The application consists of two virtual machines for backend worker processes. The process currently runs as:

  • Create Azure Environment using Azure Resource Templates
  • Run PowerShell process to call the Octopus Rest API to add the tentacle to the machine with “Role1”
  • Run the NuGet deploy to the push the application to “Role1”, run a PowerShell post deploy.

The issue is that when I get to step 3 it doesn’t find any servers in the “Role1” role. If I run the deploy again it finds them. Is there a way to do this, if not what would be the best way to dynamically get the machine?

Hi Dan,
I would split this into 2 different projects, the first will create the environment and deploy the tentacles, then use the Rest API to call a second project which will deploy the application.
Hope this helps

Regards,
Nir

Hi Dan,

Currently, the machines are evaluated only at the beginning of a deployment. You can’t add machines during a deployment.

As Nir suggested, the neatest solution is probably to divide your project into two: an infrastructure-provisioning project and a deployment project.

Better support for this scenario is certainly on our road-map!

I hope this helps,
Michael

@Michael

I just ran into this issue when dynamically spinning up EC2 instances. I’ll proceed as suggested by splitting the project, but you mentioned that this is on your road-map. How far down the road is this feature?

Thanks!

-Tim

Hi Tim,

Version 3.4 of Octopus Deploy included our Elastic and Transient Environments feature-set, which supports scenarios such as this. In particular, see the Immutable Infrastructure section.

I hope that helps. If you have any queries, you know where to find us!

Hi Michael,

Wonderful! Works perfectly!

The only hiccup was that I needed to include the new “Health check” step (as per Deploying to transient targets), then select the option to “Include new deployment targets in the deployment”.

Thanks!

-Tim

Oh no! This was working perfectly in OD 3.4.14, but I just upgraded to 3.4.15 and when I click the final “Deploy release” button, I get this error (quoted below and image attached).

There was a problem with your request.
There must be at least one enabled healthy machine to deploy to in the environment
Once you have corrected these problems you can try again.
If the problem is related to a variable you will need to update the variables for this release or recreate the release for the changes to take effect.
If the problem is related to the deployment process you will need to create a new release for the changes to take effect.

I simply don’t have any machines at all when I kick off a deploy. As I’ve mentioned in another post:

I’m spinning up brand new machines in environments from nothing, during this process the VM’s auto install and register the Machines/Tentacles and Roles are added to the Machines (with the intention of deploying packages to them in subsequent steps of the same deployment).

Can we please override this error somehow, as I said it was working perfect for me in 3.4.14.

Many thanks!

-Tim

ODError.jpg

Ignore me - I had to rebuild the Deployment Process due to an unrelated problem with the server, and I neglected to add other roles to the Process.

All I needed to do to fix this was to add any role to any step (in my case a “Run on Octopus Server” step).

Oh, and I needed to make sure a “placeholder” (unused) machine was in the Environment I am deploying to.

-Tim

Hi Tim,

I’m glad to hear you resolved it.

There are two possible approaches to the “no machines” problem:

The first is the approach you have taken; create a “dummy” machine in the environment. We find Cloud Regions are handy for this (as you don’t require a physical machine).

The second (and this is only applicable if you are using the two-project approach discussed at the beginning of this thread) is to create a trigger (as described in this document), and create a Release Override (as in your scenario there won’t be a machine present in the environment to determine which release to use).

Happy Deployments!