Setting up a web farm for Blue-Green deployRSS

4 replies

Last post Jan 13, 2021 08:27 AM by samwu

‹ Previous Thread|Next Thread ›
  • Setting up a web farm for Blue-Green deploy

    Jan 11, 2021 08:57 PM|CyberFranck|LINK

    It seems extremely complicated to make URL Rewrite to work so i am trying asking here in hope to find better tutorial or explaination for my custom case scenario. First I have a windows server 2016 brand new with IIS 10.0. I do believe URL Rewrite is broken on that system and i have already retried a couple time reloading the original snapshot of what HyperVM and each time i install and try a basic rewrite rule it fails.

    A basic test is to do a simple redirect. I created a host redirect like this.

    127.0.0.1 test.useless.com

    Then i tried a custom config in the IIS root to redirect that to google.

    <rule name="something" stopProcessing="false">
        <match url="(.*)" />
        <conditions>
            <add input="{HTTP_HOST}" pattern="*/test.useless.com/*" />
        </conditions>
        <action type="Redirect" url="http://www.google.ca/" redirectType="Permanent" />
    </rule>

    This should redirect simply to google.ca. Tested the pattern and it works but the redirect rule does not work at all and i cannot find any logging in the IIS logs.

    So knowing this simple rewrite rule does not work it explain why more complex Blue-Green deploy farm fails to work if i cannot even get such simple redirect to work.

    What is the final goal :

    The final goal is i have 4 DNS name given by my IT and i need to have a Blue-Green for each. The trick is one of them is the main domain and the other a sub domains.

    So i have the DNS names with ports i will use right now :

    Site1.MySite.com Port Blue 8820, Green 8821

    Site2.MySite.com Port Blue 8830, Green 8831

    Site3.MySite.com Port Blue 8840, Green 8841

    MySite.com Port Blue 8810, Green 8811

    I created 8 website (2 per site 1 blue 1 green) in IIS root which all are bind to all ip but have a specified port

    So website called "Site1.MySite.com.blue" bind all ip port 8820 and so on for each site

    To make things work i created host file entry for the farm computers so they redirect inside so i added for example :

    127.0.0.1 Site1.MySite.com.blue

    127.0.0.1 Site1.MySite.com.green

    and did so for all the other sites i have as well. Then I created 4 farms

    Site1, Site2, Site3, MainSite

    Each one i added 2 server using the same name as the host file and same in the hostname and put the correct port for each of them. Then i enabled the url rewrite and click apply which should make the correct rule by default (which it is not obviously, i couldn't be that easy).

    Now what do i have to do to make it work properly ? I cannot browse the Site1.MySite.com it just show a "page cannot display". how to i get the rules to do the following :

    Site1.MySite.com -> go to Site1 farm -> reroute to -> Site1.MySite.com.blue:8820 or Site1.MySite.com.green:8821

    Site2.MySite.com -> go to Site2 farm -> reroute to -> Site2.MySite.com.blue:8830 or Site2.MySite.com.green:8831

    Site3.MySite.com -> go to Site3 farm -> reroute to -> Site3.MySite.com.blue:8840 or Site3.MySite.com.green:8841

    MySite.com -> go to MainSite farm -> reroute to -> MySite.com.blue:8810 or MySite.com.green:8811

  • Re: Setting up a web farm for Blue-Green deploy

    Jan 11, 2021 11:31 PM|lextm|LINK

    CyberFranck

    This should redirect simply to google.ca. Tested the pattern and it works but the redirect rule does not work at all and i cannot find any logging in the IIS logs.

    No, it shouldn't, as you served wrong input for the condition. Mistake 1 in https://blog.lextudio.com/the-very-common-mistakes-when-using-iis-url-rewrite-module-a2ab7e4fee59 

    Lex Li
    Affordable IIS Consulting Services at https://support.lextudio.com/services/consulting.html
    ---------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Setting up a web farm for Blue-Green deploy

    Jan 12, 2021 06:10 AM|samwu|LINK

    Hi CyberFranck,

    CyberFranck

    Then i tried a custom config in the IIS root to redirect that to google.

    CyberFranck

    <add input="{HTTP_HOST}" pattern="*/test.useless.com/*" />

    The reason why your rule does not work is because your parameter is wrong,  you can try this parameter: ^test.useless.com$.

    <add input="{HTTP_HOST}" pattern="^test.useless.com$" />

    For how to troubleshoot url rewrite you can refer to this link: using-failed-request-tracing.

    CyberFranck

    I cannot browse the Site1.MySite.com it just show a "page cannot display"

    Can you post more information about this error?  and Do you want to redirect Site1.MySite.com to Site1.MySite.com.blue:8820 or Site1.MySite.com.green:8821?

    Best regards,

    Sam

    .NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
  • Re: Setting up a web farm for Blue-Green deploy

    Jan 12, 2021 01:08 PM|CyberFranck|LINK

    changed the pattern and i doesn't work either.

    For the error it's just a basic "page not found" it's generated by the browser.

    Site1.MySite.com need to redirect to the farm which should redirect automagically to Site1.MySite.com.blue:8820 or Site1.MySite.com.green:8821 depending on the round robin balancer.

  • Re: Setting up a web farm for Blue-Green deploy

    Jan 13, 2021 08:27 AM|samwu|LINK

    Hi CyberFranck,

    CyberFranck

    changed the pattern and i doesn't work either.

    It works fine on my side, this is my rule:

    <rule name="test4" enabled="false" stopProcessing="true">
        <match url="^(.*)$" />
           <conditions>
               <add input="{HTTP_HOST}" pattern="^test.useless.com$" />
           </conditions>
        <action type="Redirect" url="http://www.google.ca/" />
    </rule>

    CyberFranck

    Site1.MySite.com need to redirect to the farm which should redirect automagically to Site1.MySite.com.blue:8820

    <rule name="test5" enabled="true" stopProcessing="true">
       <match url="^(.*)$" />
           <conditions>
             <add input="{HTTP_HOST}" pattern="^Site1.MySite.com$" />
           </conditions>
       <action type="Redirect" url="http://Site1.MySite.com.blue:8820" />
    </rule>

    Best regards,

    Sam

    .NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
‹ Previous Thread|Next Thread ›