Skip to content

Commit 10a2b71

Browse files
author
Exploding Labs Bot
committed
Update site from docs source repo
1 parent 3dfc085 commit 10a2b71

File tree

3 files changed

+68
-23
lines changed

3 files changed

+68
-23
lines changed

superstack/assets/extra.css

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,12 @@
3838
}
3939

4040
/* Change header fonts */
41-
h1, h2, h3, h4, h5, h6 {
41+
h1,
42+
h2,
43+
h3,
44+
h4,
45+
h5,
46+
h6 {
4247
font-weight: 700;
4348
font-style: normal;
4449
letter-spacing: -0.5px;
@@ -59,13 +64,17 @@
5964
font-size: 0.9rem;
6065
}
6166

62-
p, ul, ol, pre {
67+
p,
68+
ul,
69+
ol,
70+
pre {
6371
font-size: 17px;
6472
margin-top: 1em;
6573
margin-bottom: 1em;
6674
}
6775

68-
ul, ol {
76+
ul,
77+
ol {
6978
margin-left: 3rem;
7079
padding-left: 3rem;
7180
}
@@ -103,4 +112,3 @@
103112
article {
104113
padding-bottom: 3rem;
105114
}
106-

superstack/bluegreen/index.html

Lines changed: 55 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
<div data-md-component="skip">
7777

7878

79-
<a href="#1-caddy" class="md-skip">
79+
<a href="#1-create-a-docker-network" class="md-skip">
8080
Skip to content
8181
</a>
8282

@@ -444,19 +444,28 @@
444444
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
445445

446446
<li class="md-nav__item">
447-
<a href="#1-caddy" class="md-nav__link">
447+
<a href="#1-create-a-docker-network" class="md-nav__link">
448448
<span class="md-ellipsis">
449-
1. Caddy
449+
1. Create a Docker Network
450450
</span>
451451
</a>
452452

453-
<nav class="md-nav" aria-label="1. Caddy">
453+
</li>
454+
455+
<li class="md-nav__item">
456+
<a href="#2-adjust-caddy" class="md-nav__link">
457+
<span class="md-ellipsis">
458+
2. Adjust Caddy
459+
</span>
460+
</a>
461+
462+
<nav class="md-nav" aria-label="2. Adjust Caddy">
454463
<ul class="md-nav__list">
455464

456465
<li class="md-nav__item">
457-
<a href="#set-the-caddy-container-name-explicitly" class="md-nav__link">
466+
<a href="#name-the-caddy-containers" class="md-nav__link">
458467
<span class="md-ellipsis">
459-
Set the Caddy container name explicitly
468+
Name the Caddy containers
460469
</span>
461470
</a>
462471

@@ -603,19 +612,28 @@
603612
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
604613

605614
<li class="md-nav__item">
606-
<a href="#1-caddy" class="md-nav__link">
615+
<a href="#1-create-a-docker-network" class="md-nav__link">
616+
<span class="md-ellipsis">
617+
1. Create a Docker Network
618+
</span>
619+
</a>
620+
621+
</li>
622+
623+
<li class="md-nav__item">
624+
<a href="#2-adjust-caddy" class="md-nav__link">
607625
<span class="md-ellipsis">
608-
1. Caddy
626+
2. Adjust Caddy
609627
</span>
610628
</a>
611629

612-
<nav class="md-nav" aria-label="1. Caddy">
630+
<nav class="md-nav" aria-label="2. Adjust Caddy">
613631
<ul class="md-nav__list">
614632

615633
<li class="md-nav__item">
616-
<a href="#set-the-caddy-container-name-explicitly" class="md-nav__link">
634+
<a href="#name-the-caddy-containers" class="md-nav__link">
617635
<span class="md-ellipsis">
618-
Set the Caddy container name explicitly
636+
Name the Caddy containers
619637
</span>
620638
</a>
621639

@@ -732,16 +750,35 @@ <h1>Blue/Green Deployments</h1>
732750
deploy to the idle stack, test it, and when ready, swap roles — giving
733751
near-zero downtime and easy rollback.</p>
734752
<p><img alt="Blue/Green" src="../assets/bluegreen.png" /></p>
735-
<h2 id="1-caddy">1. Caddy</h2>
736-
<h3 id="set-the-caddy-container-name-explicitly">Set the Caddy container name explicitly</h3>
737-
<p>This allows us to switch between the two stacks:</p>
753+
<h2 id="1-create-a-docker-network">1. Create a Docker Network</h2>
754+
<p>Blue/Green adds some complexity because where before there was just "the
755+
stack", now you have:</p>
756+
<ol>
757+
<li>A <code>blue</code> stack</li>
758+
<li>A <code>green</code> stack</li>
759+
<li>A front proxy to direct traffic</li>
760+
<li>An external Postgres.</li>
761+
</ol>
762+
<p>Create a network to link them:</p>
763+
<div class="highlight"><pre><span></span><code>docker<span class="w"> </span>network<span class="w"> </span>create<span class="w"> </span>app
764+
</code></pre></div>
765+
<p>And add it to the Compose file:</p>
766+
<div class="highlight"><span class="filename">compose.yaml</span><pre><span></span><code><span class="nt">networks</span><span class="p">:</span>
767+
<span class="w"> </span><span class="nt">default</span><span class="p">:</span>
768+
<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">app</span>
769+
<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>
770+
</code></pre></div>
771+
<h2 id="2-adjust-caddy">2. Adjust Caddy</h2>
772+
<h3 id="name-the-caddy-containers">Name the Caddy containers</h3>
773+
<p>Naming the Caddy containers <code>blue_caddy</code> and <code>green_caddy</code> allows the front
774+
proxy to direct traffic to the correct stacks:</p>
738775
<div class="highlight"><span class="filename">compose.yaml</span><pre><span></span><code><span class="nt">caddy</span><span class="p">:</span>
739776
<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>
740777
</code></pre></div>
741778
<h3 id="remove-exposed-ports">Remove exposed ports</h3>
742-
<p>Remove the <code>caddy</code> service's <code>ports:</code> section in <code>compose.yaml</code>.</p>
743-
<p>We'll no longer expose ports in the stacks, instead a simple "front proxy" will
744-
sit in front of the two stacks, proxying to the active stack.</p>
779+
<p>We'll no longer expose ports in the stacks, instead a front proxy will sit in
780+
front of the two stacks, proxying to them.</p>
781+
<p>So remove the <code>caddy</code> service's <code>ports:</code> section in <code>compose.yaml</code>.</p>
745782
<h3 id="serve-http-only-in-the-stacks">Serve HTTP-only in the stacks</h3>
746783
<p>Set <code>CADDY_SITE_ADDRESS</code> to only <code>:80</code>, removing <code>:443</code> (leaving TLS
747784
termination to the front proxy):</p>
@@ -771,7 +808,7 @@ <h2 id="4-bring-up-two-stacks">4. Bring up two Stacks</h2>
771808
<p>Shell into the server and bring up the idle stack:</p>
772809
<div class="highlight"><pre><span></span><code><span class="nb">cd</span><span class="w"> </span>green
773810
docker<span class="w"> </span>compose<span class="w"> </span>pull
774-
docker<span class="w"> </span>compose<span class="w"> </span>up<span class="w"> </span>-d
811+
<span class="nv">STACK_NAME</span><span class="o">=</span>green<span class="w"> </span>docker<span class="w"> </span>compose<span class="w"> </span>up<span class="w"> </span>-d
775812
</code></pre></div>
776813
<p>Docker will use the directory name <code>green</code> as the project name, creating
777814
different containers, volumes and networks than the <code>blue</code> stack.</p>

0 commit comments

Comments
 (0)