Add * new * DestinationBinding for the site to the package using MSDeploy

I am using an intermediate model with MSDeploy to deploy several of our sites in a web farm. Sites are configured in IIS only in intermediate blocks, and then MSDeploy is used to create target web servers from scratch.

The intermediate block uses its own bindings (i.e. there are no header entries, different IP addresses / ports and host headers) for sites that will live. When I deploy them, I first have an xml file used to prepare a parameterized package (using the -declareParamFile switch), which declares the parameters as follows:

 <parameters> <parameter name="site1"> <parameterEntry kind="DestinationBinding" scope="Site1" match=":17000:" /> </parameter> </parameters> 

So, in the XML above, you can see that the phased site is hosted on port 17000, since the match attribute is set to match the binding that has this value.

When I then deploy to each live site, I use different XML parameters that set the correct host and IP header for this machine β€” I apply this using the -setParamFile switch. Here is an example of one of them.

 <parameters> <setParameter name="site1" value="[ip_addr]:[port]:[host_header]"/> </parameters> 

So, since the initial parameter is declared in accordance with one of the known bindings - I can replace this binding with the fact that I really want it to be on every live server.

Now I want to expand the site and add new bindings to it, which include the various TLDs that we have, i.e. site.com, site.co.uk, site. ca, etc., are all connected by the same IP address and port.

Reasons for this:

  • We have a new site that we want to deploy, which will require a different host name, but we do not want to specify its own IP address (ending with IP addresses here!), But at the same time it uses the IP address of the existing site on the servers already It has.
  • This means adding specific hostname bindings to a site that already exists, instead of responding to any hostname.
  • Currently, we have four domain names indicating the existing load balance based on the site (.com, .us, .ca, .com.au). At the moment, this works because the web server does not care about the host header, but when the new site goes to the same IP address, it will be, and other domain names will no longer work.

The problem is that I don’t think there is any way to add such information. I tried adding a few setParameter elements to the second XML, but that just leads to overwrite the binding multiple times, with the last one being the final winner.

One solution is for me to add "placeholder" bindings for each of the sites in the intermediate field that represent the target external bindings for each domain name, port, etc .; and then I modify two parameter files to replace these bindings with real ones.

But for me it seems completely wrong - it will be a simulation of the intermediate box in accordance with a live deployment; it should be the other way around.

Is it possible to actually add site bindings to MSDeploy (if so, how?) Or does it support replacement only?

+4
source share
1 answer

After many voices, it seems that there is no way to add new bindings using the DestinationBinding operation with msdeploy.

What would be possible is to attach a script to execute after deployment, which adds bindings each time using appcmd.

So, initial synchronization via msdeploy will remove these bindings (because they are not on the intermediate server), but the appcmd script will then add them again.

This is actually not an ideal solution, as another script needs to be updated.

+3
source

Source: https://habr.com/ru/post/1301574/


All Articles