Skip to content

Commit affc31a

Browse files
author
Exploding Labs Bot
committed
Update site from docs source repo
1 parent cec02c2 commit affc31a

File tree

3 files changed

+124
-24
lines changed

3 files changed

+124
-24
lines changed

superstack/bluegreen/index.html

Lines changed: 121 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -450,25 +450,67 @@
450450
</span>
451451
</a>
452452

453+
<nav class="md-nav" aria-label="1. Adjust the Compose file">
454+
<ul class="md-nav__list">
455+
456+
<li class="md-nav__item">
457+
<a href="#remove-exposed-ports" class="md-nav__link">
458+
<span class="md-ellipsis">
459+
Remove exposed ports
460+
</span>
461+
</a>
462+
463+
</li>
464+
465+
<li class="md-nav__item">
466+
<a href="#serve-http-only-in-the-stacks" class="md-nav__link">
467+
<span class="md-ellipsis">
468+
Serve http-only in the stacks
469+
</span>
470+
</a>
471+
472+
</li>
473+
474+
<li class="md-nav__item">
475+
<a href="#share-volumes-between-the-stacks" class="md-nav__link">
476+
<span class="md-ellipsis">
477+
Share volumes between the stacks
478+
</span>
479+
</a>
480+
481+
</li>
482+
483+
<li class="md-nav__item">
484+
<a href="#make-the-networks-external" class="md-nav__link">
485+
<span class="md-ellipsis">
486+
Make the networks external
487+
</span>
488+
</a>
489+
490+
</li>
491+
492+
</ul>
493+
</nav>
494+
453495
</li>
454496

455497
<li class="md-nav__item">
456-
<a href="#2-add-a-front-proxy" class="md-nav__link">
498+
<a href="#3-add-a-front-proxy" class="md-nav__link">
457499
<span class="md-ellipsis">
458-
2. Add a Front Proxy
500+
3. Add a Front Proxy
459501
</span>
460502
</a>
461503

462504
</li>
463505

464506
<li class="md-nav__item">
465-
<a href="#3-deployingupgrading" class="md-nav__link">
507+
<a href="#4-deployingupgrading" class="md-nav__link">
466508
<span class="md-ellipsis">
467-
3. Deploying/Upgrading
509+
4. Deploying/Upgrading
468510
</span>
469511
</a>
470512

471-
<nav class="md-nav" aria-label="3. Deploying/Upgrading">
513+
<nav class="md-nav" aria-label="4. Deploying/Upgrading">
472514
<ul class="md-nav__list">
473515

474516
<li class="md-nav__item">
@@ -555,25 +597,67 @@
555597
</span>
556598
</a>
557599

600+
<nav class="md-nav" aria-label="1. Adjust the Compose file">
601+
<ul class="md-nav__list">
602+
603+
<li class="md-nav__item">
604+
<a href="#remove-exposed-ports" class="md-nav__link">
605+
<span class="md-ellipsis">
606+
Remove exposed ports
607+
</span>
608+
</a>
609+
610+
</li>
611+
612+
<li class="md-nav__item">
613+
<a href="#serve-http-only-in-the-stacks" class="md-nav__link">
614+
<span class="md-ellipsis">
615+
Serve http-only in the stacks
616+
</span>
617+
</a>
618+
619+
</li>
620+
621+
<li class="md-nav__item">
622+
<a href="#share-volumes-between-the-stacks" class="md-nav__link">
623+
<span class="md-ellipsis">
624+
Share volumes between the stacks
625+
</span>
626+
</a>
627+
628+
</li>
629+
630+
<li class="md-nav__item">
631+
<a href="#make-the-networks-external" class="md-nav__link">
632+
<span class="md-ellipsis">
633+
Make the networks external
634+
</span>
635+
</a>
636+
637+
</li>
638+
639+
</ul>
640+
</nav>
641+
558642
</li>
559643

560644
<li class="md-nav__item">
561-
<a href="#2-add-a-front-proxy" class="md-nav__link">
645+
<a href="#3-add-a-front-proxy" class="md-nav__link">
562646
<span class="md-ellipsis">
563-
2. Add a Front Proxy
647+
3. Add a Front Proxy
564648
</span>
565649
</a>
566650

567651
</li>
568652

569653
<li class="md-nav__item">
570-
<a href="#3-deployingupgrading" class="md-nav__link">
654+
<a href="#4-deployingupgrading" class="md-nav__link">
571655
<span class="md-ellipsis">
572-
3. Deploying/Upgrading
656+
4. Deploying/Upgrading
573657
</span>
574658
</a>
575659

576-
<nav class="md-nav" aria-label="3. Deploying/Upgrading">
660+
<nav class="md-nav" aria-label="4. Deploying/Upgrading">
577661
<ul class="md-nav__list">
578662

579663
<li class="md-nav__item">
@@ -625,15 +709,18 @@ <h1>Blue/Green Deployments</h1>
625709
near-zero downtime and easy rollback.</p>
626710
<p><img alt="Blue/Green" src="../assets/bluegreen.png" /></p>
627711
<h2 id="1-adjust-the-compose-file">1. Adjust the Compose file</h2>
628-
<p>Remove the Caddy <code>ports:</code> section in <code>compose.yaml</code>. We'll no longer expose
629-
ports in the stacks – instead a simple "front proxy" will expose ports and
630-
proxy to the active stack.</p>
712+
<h3 id="remove-exposed-ports">Remove exposed ports</h3>
713+
<p>We'll no longer expose ports in the stacks, instead a simple "front proxy" will
714+
sit in front of the two stacks, exposing ports and proxying to the active
715+
stack. So remove the Caddy service's <code>ports:</code> section in <code>compose.yaml</code>.</p>
716+
<h3 id="serve-http-only-in-the-stacks">Serve http-only in the stacks</h3>
631717
<p>Set <code>CADDY_SITE_ADDRESS</code> to only <code>:80</code> (leaving TLS termination to the front
632718
proxy):</p>
633719
<div class="highlight"><span class="filename">compose.yaml</span><pre><span></span><code><span class="nt">caddy</span><span class="p">:</span>
634720
<span class="w"> </span><span class="nt">environment</span><span class="p">:</span>
635721
<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>
636722
</code></pre></div>
723+
<h3 id="share-volumes-between-the-stacks">Share volumes between the stacks</h3>
637724
<p>To share data between the two stacks (database, uploads, etc.), give volumes
638725
explicit names:</p>
639726
<div class="highlight"><span class="filename">compose.yaml</span><pre><span></span><code><span class="nt">volumes</span><span class="p">:</span>
@@ -642,7 +729,24 @@ <h2 id="1-adjust-the-compose-file">1. Adjust the Compose file</h2>
642729
<span class="w"> </span><span class="nt">user_data</span><span class="p">:</span>
643730
<span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">user-data</span>
644731
</code></pre></div>
645-
<h2 id="2-add-a-front-proxy">2. Add a Front Proxy</h2>
732+
<h3 id="make-the-networks-external">Make the networks external</h3>
733+
<p>The front proxy needs to connect to both <code>blue_default</code> and <code>green_default</code>
734+
networks. This makes it easier to start the front proxy regardless of whether
735+
the stacks are up:</p>
736+
<div class="highlight"><span class="filename">compose.yaml</span><pre><span></span><code><span class="nt">networks</span><span class="p">:</span>
737+
<span class="w"> </span><span class="nt">default</span><span class="p">:</span>
738+
<span class="w"> </span><span class="nt">external</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">true</span>
739+
</code></pre></div>
740+
<p>In the override file, don't use external networks:</p>
741+
<div class="highlight"><span class="filename">compose.override.yaml</span><pre><span></span><code><span class="nt">networks</span><span class="p">:</span>
742+
<span class="w"> </span><span class="nt">default</span><span class="p">:</span>
743+
<span class="w"> </span><span class="nt">external</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">false</span>
744+
</code></pre></div>
745+
<p>Shell into the server and manually create the two networks:</p>
746+
<div class="highlight"><pre><span></span><code>docker<span class="w"> </span>network<span class="w"> </span>create<span class="w"> </span>blue_default
747+
docker<span class="w"> </span>network<span class="w"> </span>create<span class="w"> </span>green_default
748+
</code></pre></div>
749+
<h2 id="3-add-a-front-proxy">3. Add a Front Proxy</h2>
646750
<p>The <em>front proxy</em> is a single container that binds ports <code>80</code> and <code>443</code> on the
647751
server and routes requests into either the Blue or Green stack.</p>
648752
<p>On the server, create a simple <code>Caddyfile</code>:</p>
@@ -654,11 +758,7 @@ <h2 id="2-add-a-front-proxy">2. Add a Front Proxy</h2>
654758
<p>The front proxy manages TLS, so give it a persistent volume for certificates:</p>
655759
<div class="highlight"><pre><span></span><code>docker<span class="w"> </span>volume<span class="w"> </span>create<span class="w"> </span>caddy_data
656760
</code></pre></div>
657-
<p>Create networks for the two stacks:</p>
658-
<div class="highlight"><pre><span></span><code>docker<span class="w"> </span>network<span class="w"> </span>create<span class="w"> </span>blue_default
659-
docker<span class="w"> </span>network<span class="w"> </span>create<span class="w"> </span>green_default
660-
</code></pre></div>
661-
<p>Start the proxy and attach it to both networks:</p>
761+
<p>Start the proxy, attaching it to both networks:</p>
662762
<div class="highlight"><pre><span></span><code>docker<span class="w"> </span>run<span class="w"> </span>-d<span class="w"> </span><span class="se">\</span>
663763
<span class="w"> </span>--name<span class="w"> </span>front-proxy<span class="w"> </span><span class="se">\</span>
664764
<span class="w"> </span>-p<span class="w"> </span><span class="m">80</span>:80<span class="w"> </span>-p<span class="w"> </span><span class="m">443</span>:443<span class="w"> </span><span class="se">\</span>
@@ -668,11 +768,11 @@ <h2 id="2-add-a-front-proxy">2. Add a Front Proxy</h2>
668768
<span class="w"> </span>--network<span class="w"> </span>green_default<span class="w"> </span><span class="se">\</span>
669769
<span class="w"> </span>caddy:2
670770
</code></pre></div>
671-
<h2 id="3-deployingupgrading">3. Deploying/Upgrading</h2>
771+
<h2 id="4-deployingupgrading">4. Deploying/Upgrading</h2>
672772
<p>Deploying is the same as <a href="../deploying/">before</a>, but now we're deploying the
673773
<em>idle stack</em>. For this example, <code>green</code> is idle so that's the one we're
674774
deploying.</p>
675-
<p>Create <code>blue</code> and <code>green</code> directories on the server and deploy <code>compose.yaml</code>
775+
<p>Create <code>blue</code> and <code>green</code> directories on the server and copy <code>compose.yaml</code>
676776
into the idle stack's directory:</p>
677777
<div class="highlight"><pre><span></span><code>scp<span class="w"> </span>compose.yaml<span class="w"> </span>youruser@yourserver:green/compose.yaml
678778
</code></pre></div>

superstack/deploying/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,10 +655,10 @@ <h2 id="3-deploy-the-compose-file">📦 3. Deploy the Compose File</h2>
655655
<h3 id="4-set-secrets">4. Set Secrets</h3>
656656
<p>The stack needs your secrets (passwords, keys, etc.). There are a few options:</p>
657657
<ol>
658-
<li>Write secrets to a <code>.env</code> file on the server (convenient but not secure).</li>
658+
<li>Put secrets in a <code>.env</code> file on the server (convenient but less secure).</li>
659659
<li>Set environment variables in the the <code>docker compose</code> command, being sure to
660660
disable shell history (inconvenient).</li>
661-
<li>Use environment injection in your CI/CD. (Recommended)</li>
661+
<li>Use environment injection in your CI/CD.</li>
662662
</ol>
663663
<h2 id="5-launch-your-stack">🚀 5. Launch your Stack</h2>
664664
<p>SSH into your server and bring up the stack:</p>

0 commit comments

Comments
 (0)