I m using a staging model with MSDeploy to deploy a couple of our sites to a web farm. The sites are configured in IIS on the staging boxes only, and then MSDeploy is used to build the target web servers from scratch.
The staging box uses its own bindings (ie no header entries, different IPs/ports and no host headers) for the sites that will be live. When I deploy them I first have an xml file used to prepare a parameterised package (using the -declareParamFile
switch) which declares parameters as follows:
<parameters>
<parameter name="site1">
<parameterEntry kind="DestinationBinding" scope="Site1" match=":17000:" />
</parameter>
</parameters>
So in the above XML you can see that the staged site is hosted on port 17000 as the match
attribute is set to match a binding that has that value.
When I then deploy to each live site, I use a different parameters XML that specifies the correct host header and IP for that machine - I apply this using the -setParamFile switch. Here s an example of one of them.
<parameters>
<setParameter name="site1" value="[ip_addr]:[port]:[host_header]"/>
</parameters>
So, because the original parameter is declared to match one of the known bindings - I can replace that binding with what I actually want it to be on each live server.
What I want to do now is to deploy the site and add new destination bindings to it that incorporate the different TLDs that we have - i.e. site.com, site.co.uk, site.ca etc, all bound on the same IP address and port.
The reasons for wanting to do this are:
- We have a new site that we want to deploy that will need a different hostname, but we don t want to give it it s own IP address (running out of IPs here!) but have it share the IP that an existing site on the servers already has.
- This means adding specific hostname bindings to the site that s already on there, instead of having it respond to any hostname.
- We have four domain names currently pointing to the existing site s load balanced IP(.com, .us, .ca, .com.au). At the moment it works because the web server doesn t care about the host header - but when the new site goes on the same IP, it will, and the other domain names will no longer work.
The problem is I don t think there appears to be any way of adding such information. I ve tried adding multiple setParameter
elements in the second XML, but that simply has the effect of repeatedly overwriting the binding, with the last one as the eventual winner.
One solution is for me to add placeholder bindings for each of the sites on the staging box, which represent the target external bindings for each domain name, port etc; and then I modify the two parameters files to replace those bindings with the real ones.
But to me this feels completely wrong - that would be modelling the staging box to suit the live deployment; it should be the other way around.
Is it possible to actually add site bindings with MSDeploy (if so, how?), or does it only support replacement?