|
513 | 513 | </li> |
514 | 514 |
|
515 | 515 | <li class="md-nav__item"> |
516 | | - <a href="#5-add-a-front-proxy" class="md-nav__link"> |
| 516 | + <a href="#5-add-a-proxy" class="md-nav__link"> |
517 | 517 | <span class="md-ellipsis"> |
518 | | - 5. Add a Front Proxy |
| 518 | + 5. Add a Proxy |
519 | 519 | </span> |
520 | 520 | </a> |
521 | 521 |
|
|
672 | 672 | </li> |
673 | 673 |
|
674 | 674 | <li class="md-nav__item"> |
675 | | - <a href="#5-add-a-front-proxy" class="md-nav__link"> |
| 675 | + <a href="#5-add-a-proxy" class="md-nav__link"> |
676 | 676 | <span class="md-ellipsis"> |
677 | | - 5. Add a Front Proxy |
| 677 | + 5. Add a Proxy |
678 | 678 | </span> |
679 | 679 | </a> |
680 | 680 |
|
@@ -737,23 +737,23 @@ <h1>Blue/Green Deployments</h1> |
737 | 737 | <ol> |
738 | 738 | <li>A <code>blue</code> stack</li> |
739 | 739 | <li>A <code>green</code> stack</li> |
740 | | -<li>A front proxy to direct traffic</li> |
| 740 | +<li>A proxy to direct traffic</li> |
741 | 741 | <li>An external Postgres.</li> |
742 | 742 | </ol> |
743 | 743 | <h2 id="2-adjust-caddy">2. Adjust Caddy</h2> |
744 | 744 | <h3 id="name-the-caddy-containers">Name the Caddy containers</h3> |
745 | | -<p>Naming the Caddy containers <code>blue_caddy</code> and <code>green_caddy</code> allows the front |
| 745 | +<p>Naming the Caddy containers <code>blue_caddy</code> and <code>green_caddy</code> allows the |
746 | 746 | proxy to direct traffic to the correct stacks:</p> |
747 | 747 | <div class="highlight"><span class="filename">compose.yaml</span><pre><span></span><code><span class="nt">caddy</span><span class="p">:</span> |
748 | 748 | <span class="w"> </span><span class="nt">container_name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">${STACK_NAME}_caddy</span> |
749 | 749 | </code></pre></div> |
750 | 750 | <h3 id="remove-exposed-ports">Remove exposed ports</h3> |
751 | | -<p>We'll no longer expose ports in the stacks, instead a front proxy will sit in |
| 751 | +<p>We'll no longer expose ports in the stacks, instead a proxy will sit in |
752 | 752 | front of the two stacks, proxying to them.</p> |
753 | 753 | <p>So remove the <code>caddy</code> service's <code>ports:</code> section in <code>compose.yaml</code>.</p> |
754 | 754 | <h3 id="serve-http-only-in-the-stacks">Serve HTTP-only in the stacks</h3> |
755 | 755 | <p>Set <code>CADDY_SITE_ADDRESS</code> to only <code>:80</code>, removing <code>:443</code> (leaving TLS |
756 | | -termination to the front proxy):</p> |
| 756 | +termination to the proxy):</p> |
757 | 757 | <div class="highlight"><span class="filename">compose.yaml</span><pre><span></span><code><span class="nt">caddy</span><span class="p">:</span> |
758 | 758 | <span class="w"> </span><span class="nt">environment</span><span class="p">:</span> |
759 | 759 | <span class="w"> </span><span class="nt">CADDY_SITE_ADDRESS</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">:80</span> |
@@ -798,8 +798,8 @@ <h2 id="4-bring-up-two-stacks">4. Bring up two Stacks</h2> |
798 | 798 | </code></pre></div> |
799 | 799 | <p>Docker will use the directory name <code>green</code> as the project name, creating |
800 | 800 | different containers, volumes and networks than the <code>blue</code> stack.</p> |
801 | | -<h2 id="5-add-a-front-proxy">5. Add a Front Proxy</h2> |
802 | | -<p>The <em>front proxy</em> is a single container that binds ports <code>80</code> and <code>443</code> on the |
| 801 | +<h2 id="5-add-a-proxy">5. Add a Proxy</h2> |
| 802 | +<p>The proxy is a single container that binds ports <code>80</code> and <code>443</code> on the |
803 | 803 | server and routes requests into either the Blue or Green stack.</p> |
804 | 804 | <p>On the server, create a simple <code>Caddyfile</code>:</p> |
805 | 805 | <div class="highlight"><span class="filename">caddy/Caddyfile</span><pre><span></span><code>api.myapp.com { |
@@ -828,7 +828,7 @@ <h2 id="flip-traffic">Flip traffic</h2> |
828 | 828 | reverse_proxy green_caddy:80 |
829 | 829 | } |
830 | 830 | </code></pre></div> |
831 | | -<p>Reload the front proxy's config:</p> |
| 831 | +<p>Reload the proxy's config:</p> |
832 | 832 | <div class="highlight"><pre><span></span><code>docker<span class="w"> </span><span class="nb">exec</span><span class="w"> </span>front-proxy<span class="w"> </span>caddy<span class="w"> </span>reload |
833 | 833 | </code></pre></div> |
834 | 834 | <p>Cutover is instant. Green is now live, and Blue is the idle stack.</p> |
|
0 commit comments