Skip to content

Commit eff08d7

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

File tree

4 files changed

+75
-39
lines changed

4 files changed

+75
-39
lines changed

superstack/bluegreen/index.html

Lines changed: 62 additions & 21 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-adjustments-to-the-compose-file" class="md-skip">
79+
<a href="#1-adjust-the-compose-file" class="md-skip">
8080
Skip to content
8181
</a>
8282

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

446446
<li class="md-nav__item">
447-
<a href="#1-adjustments-to-the-compose-file" class="md-nav__link">
447+
<a href="#1-adjust-the-compose-file" class="md-nav__link">
448448
<span class="md-ellipsis">
449-
1. Adjustments to the Compose file
449+
1. Adjust the Compose file
450450
</span>
451451
</a>
452452

@@ -462,12 +462,27 @@
462462
</li>
463463

464464
<li class="md-nav__item">
465-
<a href="#4-deploying" class="md-nav__link">
465+
<a href="#3-deployingupgrading" class="md-nav__link">
466466
<span class="md-ellipsis">
467-
4. Deploying
467+
3. Deploying/Upgrading
468+
</span>
469+
</a>
470+
471+
<nav class="md-nav" aria-label="3. Deploying/Upgrading">
472+
<ul class="md-nav__list">
473+
474+
<li class="md-nav__item">
475+
<a href="#flip-traffic" class="md-nav__link">
476+
<span class="md-ellipsis">
477+
Flip traffic
468478
</span>
469479
</a>
470480

481+
</li>
482+
483+
</ul>
484+
</nav>
485+
471486
</li>
472487

473488
</ul>
@@ -525,9 +540,9 @@
525540
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
526541

527542
<li class="md-nav__item">
528-
<a href="#1-adjustments-to-the-compose-file" class="md-nav__link">
543+
<a href="#1-adjust-the-compose-file" class="md-nav__link">
529544
<span class="md-ellipsis">
530-
1. Adjustments to the Compose file
545+
1. Adjust the Compose file
531546
</span>
532547
</a>
533548

@@ -543,12 +558,27 @@
543558
</li>
544559

545560
<li class="md-nav__item">
546-
<a href="#4-deploying" class="md-nav__link">
561+
<a href="#3-deployingupgrading" class="md-nav__link">
547562
<span class="md-ellipsis">
548-
4. Deploying
563+
3. Deploying/Upgrading
564+
</span>
565+
</a>
566+
567+
<nav class="md-nav" aria-label="3. Deploying/Upgrading">
568+
<ul class="md-nav__list">
569+
570+
<li class="md-nav__item">
571+
<a href="#flip-traffic" class="md-nav__link">
572+
<span class="md-ellipsis">
573+
Flip traffic
549574
</span>
550575
</a>
551576

577+
</li>
578+
579+
</ul>
580+
</nav>
581+
552582
</li>
553583

554584
</ul>
@@ -576,9 +606,9 @@ <h1>Blue/Green Deployments</h1>
576606
deploy to the idle stack, test it, and when ready, swap roles — giving
577607
near-zero downtime and easy rollback.</p>
578608
<p><img alt="Blue/Green" src="../assets/bluegreen.png" /></p>
579-
<h2 id="1-adjustments-to-the-compose-file">1. Adjustments to the Compose file</h2>
580-
<p>Remove the exposed ports by removing the Caddy <code>ports:</code> section in
581-
<code>compose.yaml</code>.</p>
609+
<h2 id="1-adjust-the-compose-file">1. Adjust the Compose file</h2>
610+
<p>Remove the Caddy <code>ports:</code> section in <code>compose.yaml</code>. Instead of exposing ports
611+
in the stacks, a "front proxy" will expose ports and proxy to the active stack.</p>
582612
<p>Set <code>CADDY_SITE_ADDRESS</code> to only <code>:80</code> (leaving TLS termination to the front
583613
proxy):</p>
584614
<div class="highlight"><span class="filename">compose.yaml</span><pre><span></span><code><span class="nt">caddy</span><span class="p">:</span>
@@ -594,8 +624,8 @@ <h2 id="1-adjustments-to-the-compose-file">1. Adjustments to the Compose file</h
594624
<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>
595625
</code></pre></div>
596626
<h2 id="2-add-a-front-proxy">2. Add a Front Proxy</h2>
597-
<p>The front proxy is a single container that binds <code>:80</code> and <code>:443</code> on the server
598-
and routes requests into either the Blue or Green stack.</p>
627+
<p>The <em>front proxy</em> is a single container that binds ports <code>80</code> and <code>443</code> on the
628+
server and routes requests into either the Blue or Green stack.</p>
599629
<p>On the server, create a simple <code>Caddyfile</code>:</p>
600630
<div class="highlight"><span class="filename">Caddyfile</span><pre><span></span><code>api.myapp.com {
601631
reverse_proxy blue_caddy:80
@@ -623,12 +653,23 @@ <h2 id="2-add-a-front-proxy">2. Add a Front Proxy</h2>
623653
<span class="w"> </span>--network<span class="w"> </span>green_default<span class="w"> </span><span class="se">\</span>
624654
<span class="w"> </span>caddy:2
625655
</code></pre></div>
626-
<h2 id="4-deploying">4. Deploying</h2>
627-
<p>Update the idle stack:</p>
628-
<div class="highlight"><pre><span></span><code>docker<span class="w"> </span>compose<span class="w"> </span>pull
629-
docker<span class="w"> </span>compose<span class="w"> </span>-p<span class="w"> </span>green<span class="w"> </span>up<span class="w"> </span>-d
656+
<h2 id="3-deployingupgrading">3. Deploying/Upgrading</h2>
657+
<p>Deploying is the same as <a href="../deploying/">before</a>, but now we're deploying the
658+
<em>idle stack</em>. For this example, <code>green</code> is idle so that's the one we're
659+
deploying.</p>
660+
<p>Create <code>blue</code> and <code>green</code> directories on the server and deploy <code>compose.yaml</code>
661+
into the idle stack's directory:</p>
662+
<div class="highlight"><pre><span></span><code>scp<span class="w"> </span>compose.yaml<span class="w"> </span>youruser@yourserver:green/compose.yaml
663+
</code></pre></div>
664+
<p>Shell into the server and bring up the idle stack:</p>
665+
<div class="highlight"><pre><span></span><code><span class="nb">cd</span><span class="w"> </span>green
666+
docker<span class="w"> </span>compose<span class="w"> </span>pull
667+
docker<span class="w"> </span>compose<span class="w"> </span>up<span class="w"> </span>-d
630668
</code></pre></div>
631-
<p>Edit the front proxy's config to flip traffic:</p>
669+
<p>Docker will use the directory name <code>green</code> as the project name, creating
670+
different containers, volumes and networks than the <code>blue</code> stack.</p>
671+
<h3 id="flip-traffic">Flip traffic</h3>
672+
<p>Point traffic to the <code>green</code> stack, and make <code>blue</code> idle:</p>
632673
<div class="highlight"><span class="filename">Caddyfile</span><pre><span></span><code>api.myapp.com {
633674
reverse_proxy green_caddy:80
634675
}
@@ -637,11 +678,11 @@ <h2 id="4-deploying">4. Deploying</h2>
637678
reverse_proxy blue_caddy:80
638679
}
639680
</code></pre></div>
640-
<p>Restart Caddy:</p>
681+
<p>Reload the front proxy's config:</p>
641682
<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
642683
</code></pre></div>
643684
<p>Cutover is instant. Green is now live, and Blue is the idle stack.</p>
644-
<p>And rollback is simple: flip the <code>Caddyfile</code> back and <code>caddy reload</code>.</p>
685+
<p>And rollback is simple: flip the <code>Caddyfile</code> back and <code>caddy reload</code> again.</p>
645686

646687

647688

superstack/deploying/index.html

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -606,36 +606,33 @@ <h2 id="1-prepare-your-images">✅ 1. Prepare your Images</h2>
606606
<div class="highlight"><span class="filename">compose.yaml</span><pre><span></span><code><span class="nt">caddy</span><span class="p">:</span>
607607
<span class="w"> </span><span class="nt">build</span><span class="p">:</span>
608608
<span class="w"> </span><span class="nt">context</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">./caddy</span>
609-
<span class="w"> </span><span class="nt">image</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">ghcr.io/youruser/yourapp-caddy</span>
609+
<span class="w"> </span><span class="nt">image</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">ghcr.io/youruser/yourapp-caddy:0.1.0</span>
610610

611611
<span class="nt">postgres</span><span class="p">:</span>
612612
<span class="w"> </span><span class="nt">build</span><span class="p">:</span>
613613
<span class="w"> </span><span class="nt">context</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">./postgres</span>
614-
<span class="w"> </span><span class="nt">image</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">ghcr.io/youruser/yourapp-postgres</span>
614+
<span class="w"> </span><span class="nt">image</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">ghcr.io/youruser/yourapp-postgres:0.1.0</span>
615615
</code></pre></div>
616616
<h2 id="2-build-and-push-your-images">🛠️ 2. Build and Push your Images</h2>
617617
<p>Build your images locally and push to your registry:</p>
618618
<div class="highlight"><pre><span></span><code>docker<span class="w"> </span>compose<span class="w"> </span>build
619619
docker<span class="w"> </span>compose<span class="w"> </span>push
620620
</code></pre></div>
621621
<h2 id="3-deploy-the-compose-file">📦 3. Deploy the Compose File</h2>
622-
<p>Copy <code>compose.yaml</code> to your server:</p>
622+
<p>Copy <code>compose.yaml</code> to the server:</p>
623623
<div class="highlight"><pre><span></span><code>scp<span class="w"> </span>compose.yaml<span class="w"> </span>youruser@yourserver:
624624
</code></pre></div>
625625
<h2 id="4-launch-your-stack">🚀 4. Launch your Stack</h2>
626-
<p>SSH into your server and bring up the stack.</p>
627-
<p>For production, avoid using <code>.env</code> files. Instead, set secrets directly:</p>
628-
<div class="highlight"><span class="filename">.env</span><pre><span></span><code><span class="nv">JWT_SECRET</span><span class="o">=</span>your-secret<span class="w"> </span><span class="se">\</span>
629-
<span class="nv">CADDY_PORT</span><span class="o">=</span><span class="m">80</span><span class="w"> </span><span class="se">\</span>
630-
<span class="nv">PG_USER</span><span class="o">=</span>admin<span class="w"> </span><span class="se">\</span>
631-
<span class="nv">PG_PASS</span><span class="o">=</span>supersecret<span class="w"> </span><span class="se">\</span>
632-
<span class="nv">POSTGREST_AUTHENTICATOR_PASS</span><span class="o">=</span>supersecret<span class="w"> </span><span class="se">\</span>
626+
<p>SSH into your server and bring up the stack:</p>
627+
<div class="highlight"><pre><span></span><code>docker<span class="w"> </span>compose<span class="w"> </span>pull
633628
docker<span class="w"> </span>compose<span class="w"> </span>up<span class="w"> </span>-d
634629
</code></pre></div>
635-
<blockquote>
636-
<p>💡 Avoid leaking secrets by disabling shell history.</p>
637-
</blockquote>
638-
<p>Alternatively, use environment injection in your CI/CD.</p>
630+
<p>Docker compose needs secrets, so you have a few options:</p>
631+
<ol>
632+
<li>Write secrets to a <code>.env</code> file in plain-text (be sure to <code>chmod 600 .env</code>).</li>
633+
<li>Set env vars in the docker compose command</li>
634+
<li>Alternatively, use environment injection in your CI/CD.</li>
635+
</ol>
639636
<hr />
640637
<p>That’s it — your backend is live.</p>
641638
<p>If this is the first time bringing up your stack, the migrations will run

superstack/gettingstarted/index.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -705,9 +705,7 @@ <h2 id="2-configure-environment-variables">2. Configure Environment Variables</h
705705
environment or application (you may bring up multiple).</li>
706706
</ul>
707707
<blockquote>
708-
<p>⚠️ The .env file is for development only. Never store real secrets in version
709-
control or production. Use CI/CD environment variables or a secrets manager
710-
instead.</p>
708+
<p>⚠️ Never store secrets in version control.</p>
711709
</blockquote>
712710
<h2 id="3-start-the-stack">3. Start the Stack</h2>
713711
<div class="highlight"><pre><span></span><code>docker<span class="w"> </span>compose<span class="w"> </span>up<span class="w"> </span>-d

0 commit comments

Comments
 (0)