Charl
Charl

Reputation: 154

Octopus deployment to same environment and different servers

I have an octopus deployment that needs to go to a load balanced environment But there are small changes in the config between the two servers.

So, in summary:

I already have a web.preprod.config that gets transformed into web.config. Does it mean I need to create more config files, ie. web.server1.preprod.config and web.server2.preprod.config or is there another cleaner way of doing it? It is a whole section that is different so not just an appSetting.

Upvotes: 2

Views: 754

Answers (2)

SteveChapman
SteveChapman

Reputation: 3081

A solution that has worked well in similar scenarios for me in the past (with OctopusDeploy specifically), is to use the web.{environment}.config transforms to get the correct config structure in place, but to use variable substitution and define placeholders in the transform file to keep the run-time environment-specific definitions in Octopus. Quite how you break down the substitution syntax is really dependent on your config, but you can use the machine-scoping features of Octopus variables to control the actual values injected.

This scenario is a good example of where web.config transforms start to blur the edges of configuration management; environment-specific config is really the domain of Octopus (or, more specifically, a centralised configuration store), but the solution proposed here is taking it out of Octopus and back into the source repository, which is one of the problems Octopus is actually designed to solve.

For example; what if you introduced a 3rd node in your pre-prod load balancer? This demands a code change, build, version bump and package, which can be completely avoided given the above.

Upvotes: 1

Daniël van den Berg
Daniël van den Berg

Reputation: 2355

The general approach to problems like this is, indeed, to create a web.server*.preprod.config, or local.config. I'd suggest looking at what exactly is different in the config, and why. Try to find things that you can merge. For instance: If one difference is the difference in drive letter, and your config contains these entries:

C:/a/b/c.txt C:/a/b/d.txt

try splitting those entries into

drive=C drive:/a/b/c.txt

In that case you only have to change drive=C to drive=D to make two entries work.

Upvotes: 1

Related Questions