7676 < div data-md-component ="skip ">
7777
7878
79- < a href ="#2-adjust- caddy " class ="md-skip ">
79+ < a href ="#1- caddy-adjustments " class ="md-skip ">
8080 Skip to content
8181 </ a >
8282
444444 < ul class ="md-nav__list " data-md-component ="toc " data-md-scrollfix >
445445
446446 < li class ="md-nav__item ">
447- < a href ="#2-adjust- caddy " class ="md-nav__link ">
447+ < a href ="#1- caddy-adjustments " class ="md-nav__link ">
448448 < span class ="md-ellipsis ">
449- 2. Adjust Caddy
449+ 1. Caddy Adjustments
450450 </ span >
451451 </ a >
452452
453- < nav class ="md-nav " aria-label ="2. Adjust Caddy ">
453+ < nav class ="md-nav " aria-label ="1. Caddy Adjustments ">
454454 < ul class ="md-nav__list ">
455455
456456 < li class ="md-nav__item ">
603603 < ul class ="md-nav__list " data-md-component ="toc " data-md-scrollfix >
604604
605605 < li class ="md-nav__item ">
606- < a href ="#2-adjust- caddy " class ="md-nav__link ">
606+ < a href ="#1- caddy-adjustments " class ="md-nav__link ">
607607 < span class ="md-ellipsis ">
608- 2. Adjust Caddy
608+ 1. Caddy Adjustments
609609 </ span >
610610 </ a >
611611
612- < nav class ="md-nav " aria-label ="2. Adjust Caddy ">
612+ < nav class ="md-nav " aria-label ="1. Caddy Adjustments ">
613613 < ul class ="md-nav__list ">
614614
615615 < li class ="md-nav__item ">
728728
729729 < h1 > Blue/Green Deployments</ h1 >
730730
731- < p > Blue/Green deployment runs two stacks side-by-side: one live, one idle. You
732- deploy to the idle stack, test it, and when ready, swap roles — giving
731+ < blockquote >
732+ < p > This page is a work in progress, I'm working on it - Beau</ p >
733+ </ blockquote >
734+ < p > < em > Blue/Green deployment</ em > runs two stacks side-by-side: one live, one idle. You
735+ deploy to the idle stack, test it, and when ready, swap roles. It gives
733736near-zero downtime and easy rollback.</ p >
734737< p > < img alt ="Blue/Green " src ="../assets/bluegreen.png " /> </ p >
735738< p > Blue/Green adds some complexity because where before there was just "the
@@ -738,42 +741,44 @@ <h1>Blue/Green Deployments</h1>
738741< li > A < code > blue</ code > stack</ li >
739742< li > A < code > green</ code > stack</ li >
740743< li > A proxy to direct traffic</ li >
741- < li > An external Postgres.</ li >
744+ < li > An external Postgres container .</ li >
742745</ ol >
743- < h2 id ="2-adjust- caddy" > 2. Adjust Caddy</ h2 >
746+ < h2 id ="1- caddy-adjustments " > 1. Caddy Adjustments </ h2 >
744747< 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
746- proxy to direct traffic to the correct stacks:</ p >
748+ < p > Naming the Caddy containers < code > blue_caddy</ code > and < code > green_caddy</ code > allows the proxy to
749+ direct traffic to the correct stacks:</ p >
747750< div class ="highlight "> < span class ="filename "> compose.yaml</ span > < pre > < span > </ span > < code > < span class ="nt "> caddy</ span > < span class ="p "> :</ span >
748751< 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 >
749752</ code > </ pre > </ div >
750753< h3 id ="remove-exposed-ports "> Remove exposed ports</ h3 >
751- < p > We'll no longer expose ports in the stacks, instead a proxy will sit in
752- front of the two stacks, proxying to them.</ p >
753- < p > So remove the < code > caddy </ code > service's < code > ports:</ code > section in < code > compose.yaml</ code > .</ p >
754+ < p > We'll no longer expose ports in our stacks. Instead a proxy will sit in front
755+ of the two stacks, proxying to them.</ p >
756+ < p > Remove the Caddy service's < code > ports:</ code > section in < code > compose.yaml</ code > .</ p >
754757< h3 id ="serve-http-only-in-the-stacks "> Serve HTTP-only in the stacks</ h3 >
755- < p > Set < code > CADDY_SITE_ADDRESS</ code > to only < code > :80</ code > , removing < code > :443</ code > ( leaving TLS
756- termination to the proxy) :</ p >
758+ < p > Set < code > CADDY_SITE_ADDRESS</ code > to only < code > :80</ code > , removing < code > :443</ code > , leaving TLS
759+ termination to the proxy:</ p >
757760< div class ="highlight "> < span class ="filename "> compose.yaml</ span > < pre > < span > </ span > < code > < span class ="nt "> caddy</ span > < span class ="p "> :</ span >
758761< span class ="w "> </ span > < span class ="nt "> environment</ span > < span class ="p "> :</ span >
759762< 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 >
760763</ code > </ pre > </ div >
761764< h2 id ="2-postgres "> 2. Postgres</ h2 >
762- < p > It's not advised to run two separate PostgreSQL instances and having them both simultaneously
763- access the same shared volume.</ p >
764- < p > So we need to move Postgres out of the compose file and start it separately.</ p >
765- < p > Create a network:</ p >
766- < div class ="highlight "> < pre > < span > </ span > < code > docker< span class ="w "> </ span > network< span class ="w "> </ span > create< span class ="w "> </ span > shared
765+ < p > In regular SuperStack, Postgres comes up with the stack. But now we're bringing
766+ up two stacks, we can't have two Postgres containers both simultaneously
767+ accessing the same shared volume. We need a single Postgres container, separate
768+ from the stacks.</ p >
769+ < p > Add a profile to the Postgres service:</ p >
770+ < div class ="highlight "> < span class ="filename "> compose.yaml</ span > < pre > < span > </ span > < code > < span class ="nt "> postgres</ span > < span class ="p "> :</ span >
771+ < span class ="w "> </ span > < span class ="nt "> profiles</ span > < span class ="p "> :</ span > < span class ="w "> </ span > < span class ="p p-Indicator "> [</ span > < span class ="s "> "db"</ span > < span class ="p p-Indicator "> ]</ span >
767772</ code > </ pre > </ div >
768- < p > And add it to the Compose file:</ p >
773+ < p > Add it to the Compose file:</ p >
769774< div class ="highlight "> < span class ="filename "> compose.yaml</ span > < pre > < span > </ span > < code > < span class ="nt "> networks</ span > < span class ="p "> :</ span >
770- < span class ="w "> </ span > < span class ="nt "> shared </ span > < span class ="p "> :</ span >
771- < 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 "> shared </ span >
775+ < span class ="w "> </ span > < span class ="nt "> postgres </ span > < span class ="p "> :</ span >
776+ < 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 "> postgres </ span >
772777< 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 >
773778</ code > </ pre > </ div >
774- < p > Then in services that need db access:</ p >
779+ < p > Then in services that need database access (such as PostgREST) :</ p >
775780< div class ="highlight "> < span class ="filename "> compose.yaml</ span > < pre > < span > </ span > < code > < span class ="nt "> networks</ span > < span class ="p "> :</ span >
776- < span class ="w "> </ span > < span class ="p p-Indicator "> -</ span > < span class ="w "> </ span > < span class ="l l-Scalar l-Scalar-Plain "> shared </ span >
781+ < span class ="w "> </ span > < span class ="p p-Indicator "> -</ span > < span class ="w "> </ span > < span class ="l l-Scalar l-Scalar-Plain "> postgres </ span >
777782</ code > </ pre > </ div >
778783< p > Move Postgres out of compose.yaml into a shared-compose.yaml, adding the < code > shared</ code > network:</ p >
779784< h2 id ="3-volumes "> 3. Volumes</ h2 >
0 commit comments