486486</ li >
487487
488488 < li class ="md-nav__item ">
489- < a href ="#postgres " class ="md-nav__link ">
489+ < a href ="#2- postgres " class ="md-nav__link ">
490490 < span class ="md-ellipsis ">
491- Postgres
491+ 2. Postgres
492492 </ span >
493493 </ a >
494494
495- < nav class ="md-nav " aria-label ="Postgres ">
496- < ul class ="md-nav__list ">
497-
498- < li class ="md-nav__item ">
499- < a href ="#share-volumes-between-the-stacks " class ="md-nav__link ">
495+ </ li >
496+
497+ < li class ="md-nav__item ">
498+ < a href ="#3-volumes " class ="md-nav__link ">
500499 < span class ="md-ellipsis ">
501- Share volumes between the stacks
500+ 3. Volumes
502501 </ span >
503502 </ a >
504503
505- </ li >
506-
507- </ ul >
508- </ nav >
509-
510504</ li >
511505
512506 < li class ="md-nav__item ">
513- < a href ="#3 -bring-up-two-stacks " class ="md-nav__link ">
507+ < a href ="#4 -bring-up-two-stacks " class ="md-nav__link ">
514508 < span class ="md-ellipsis ">
515- 3 . Bring up two Stacks
509+ 4 . Bring up two Stacks
516510 </ span >
517511 </ a >
518512
519513</ li >
520514
521515 < li class ="md-nav__item ">
522- < a href ="#3 -add-a-front-proxy " class ="md-nav__link ">
516+ < a href ="#5 -add-a-front-proxy " class ="md-nav__link ">
523517 < span class ="md-ellipsis ">
524- 3 . Add a Front Proxy
518+ 5 . Add a Front Proxy
525519 </ span >
526520 </ a >
527521
528522</ li >
529523
530524 < li class ="md-nav__item ">
531- < a href ="#4 -upgrading " class ="md-nav__link ">
525+ < a href ="#6 -upgrading " class ="md-nav__link ">
532526 < span class ="md-ellipsis ">
533- 4 . Upgrading
527+ 6 . Upgrading
534528 </ span >
535529 </ a >
536530
651645</ li >
652646
653647 < li class ="md-nav__item ">
654- < a href ="#postgres " class ="md-nav__link ">
648+ < a href ="#2- postgres " class ="md-nav__link ">
655649 < span class ="md-ellipsis ">
656- Postgres
650+ 2. Postgres
657651 </ span >
658652 </ a >
659653
660- < nav class ="md-nav " aria-label ="Postgres ">
661- < ul class ="md-nav__list ">
662-
663- < li class ="md-nav__item ">
664- < a href ="#share-volumes-between-the-stacks " class ="md-nav__link ">
654+ </ li >
655+
656+ < li class ="md-nav__item ">
657+ < a href ="#3-volumes " class ="md-nav__link ">
665658 < span class ="md-ellipsis ">
666- Share volumes between the stacks
659+ 3. Volumes
667660 </ span >
668661 </ a >
669662
670- </ li >
671-
672- </ ul >
673- </ nav >
674-
675663</ li >
676664
677665 < li class ="md-nav__item ">
678- < a href ="#3 -bring-up-two-stacks " class ="md-nav__link ">
666+ < a href ="#4 -bring-up-two-stacks " class ="md-nav__link ">
679667 < span class ="md-ellipsis ">
680- 3 . Bring up two Stacks
668+ 4 . Bring up two Stacks
681669 </ span >
682670 </ a >
683671
684672</ li >
685673
686674 < li class ="md-nav__item ">
687- < a href ="#3 -add-a-front-proxy " class ="md-nav__link ">
675+ < a href ="#5 -add-a-front-proxy " class ="md-nav__link ">
688676 < span class ="md-ellipsis ">
689- 3 . Add a Front Proxy
677+ 5 . Add a Front Proxy
690678 </ span >
691679 </ a >
692680
693681</ li >
694682
695683 < li class ="md-nav__item ">
696- < a href ="#4 -upgrading " class ="md-nav__link ">
684+ < a href ="#6 -upgrading " class ="md-nav__link ">
697685 < span class ="md-ellipsis ">
698- 4 . Upgrading
686+ 6 . Upgrading
699687 </ span >
700688 </ a >
701689
@@ -761,19 +749,19 @@ <h3 id="set-the-caddy-container-name-explicitly">Set the Caddy container name ex
761749< div class ="highlight "> < span class ="filename "> compose.yaml</ span > < pre > < span > </ span > < code > < span class ="nt "> caddy</ span > < span class ="p "> :</ span >
762750< 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 >
763751</ code > </ pre > </ div >
764- < h2 id ="postgres "> Postgres</ h2 >
752+ < h2 id ="2- postgres "> 2. Postgres</ h2 >
765753< p > Running two separate PostgreSQL instances and having them both simultaneously
766754access the same data directory within that shared volume is not recommended and
767755can lead to data corruption.</ p >
768756< p > So we need to move Postgres out of the compose file and start it separately.</ p >
769- < h3 id ="share -volumes-between-the-stacks " > Share volumes between the stacks </ h3 >
757+ < h2 id ="3 -volumes" > 3. Volumes </ h2 >
770758< p > To share data between the two stacks (uploads, etc.), give volumes explicit
771759names:</ p >
772760< div class ="highlight "> < span class ="filename "> compose.yaml</ span > < pre > < span > </ span > < code > < span class ="nt "> volumes</ span > < span class ="p "> :</ span >
773761< span class ="w "> </ span > < span class ="nt "> user_data</ span > < span class ="p "> :</ span >
774762< 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 >
775763</ code > </ pre > </ div >
776- < h2 id ="3 -bring-up-two-stacks "> 3 . Bring up two Stacks</ h2 >
764+ < h2 id ="4 -bring-up-two-stacks "> 4 . Bring up two Stacks</ h2 >
777765< p > Deploying is the same as < a href ="../deploying/ "> before</ a > , but now we're deploying the
778766< em > idle stack</ em > . For this example, < code > green</ code > is idle so that's the one we're
779767deploying.</ p >
@@ -788,7 +776,7 @@ <h2 id="3-bring-up-two-stacks">3. Bring up two Stacks</h2>
788776</ code > </ pre > </ div >
789777< p > Docker will use the directory name < code > green</ code > as the project name, creating
790778different containers, volumes and networks than the < code > blue</ code > stack.</ p >
791- < h2 id ="3 -add-a-front-proxy "> 3 . Add a Front Proxy</ h2 >
779+ < h2 id ="5 -add-a-front-proxy "> 5 . Add a Front Proxy</ h2 >
792780< p > The < em > front proxy</ em > is a single container that binds ports < code > 80</ code > and < code > 443</ code > on the
793781server and routes requests into either the Blue or Green stack.</ p >
794782< p > On the server, create a simple < code > Caddyfile</ code > :</ p >
@@ -811,7 +799,7 @@ <h2 id="3-add-a-front-proxy">3. Add a Front Proxy</h2>
811799< span class ="w "> </ span > --network< span class ="w "> </ span > green_default< span class ="w "> </ span > < span class ="se "> \</ span >
812800< span class ="w "> </ span > caddy:2
813801</ code > </ pre > </ div >
814- < h2 id ="4 -upgrading "> 4 . Upgrading</ h2 >
802+ < h2 id ="6 -upgrading "> 6 . Upgrading</ h2 >
815803< h2 id ="flip-traffic "> Flip traffic</ h2 >
816804< p > Point traffic to the < code > green</ code > stack:</ p >
817805< div class ="highlight "> < span class ="filename "> Caddyfile</ span > < pre > < span > </ span > < code > api.myapp.com {
0 commit comments