Deploy package once using 1 random server in environment

I’ve created a database deployment package with a role of “sql-server” and have added the role to each server in the environment.

Given the way it currently stands, it will run the package on each server in that environment.
I only want it to run once during the deployment but don’t really care which server is selected.
I would rather not restrict the role on the servers as servers may come/go or be down thus failing the deployment.

Thoughts?

Hi @DaveE

Thanks for getting in touch!

One way to accomplish this would be to configure a second instance of Tentacle on each server, however rather than configuring them on your Octopus Server as Tentacles, have them configured as Workers. You can then combine these workers into a Worker Pool, which allows us to get where we want to go.

Once you have you workers you can configure a script step (with an associated package) which will Run once on a worker in the worker pool you have setup (in my example I’ve created a pool called Database)

When executed Octopus Server will then pick any given Worker from that pool to run the script step (which can then execute the package), and will only execute it once.

Quick aside: depending on how many servers you have to configure it may be worth looking into the register-worker command, which could could run via a script step on all of your targets to configure them as workers.

I hope that helps, happy to answer any questions that you might have.

Regards,
Alex

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