1- Blue/Green deployment runs two stacks side-by-side: one live, one idle. You
2- deploy to the idle stack, test it, and when ready, swap roles — giving
1+ > ![ NOTE]
2+ > This page is a work in progress, I'm working on it - Beau
3+
4+ _ Blue/Green deployment_ runs two stacks side-by-side: one live, one idle. You
5+ deploy to the idle stack, test it, and when ready, swap roles. It gives
36near-zero downtime and easy rollback.
47
58![ Blue/Green] ( assets/bluegreen.png )
@@ -10,14 +13,14 @@ stack", now there is:
10131 . A ` blue ` stack
11142 . A ` green ` stack
12153 . A proxy to direct traffic
13- 4 . An external Postgres.
16+ 4 . An external Postgres container .
1417
15- ## 2. Adjust Caddy
18+ ## 1. Caddy Adjustments
1619
1720### Name the Caddy containers
1821
19- Naming the Caddy containers ` blue_caddy ` and ` green_caddy ` allows the
20- proxy to direct traffic to the correct stacks:
22+ Naming the Caddy containers ` blue_caddy ` and ` green_caddy ` allows the proxy to
23+ direct traffic to the correct stacks:
2124
2225``` yaml title="compose.yaml"
2326caddy :
@@ -26,15 +29,15 @@ caddy:
2629
2730### Remove exposed ports
2831
29- We'll no longer expose ports in the stacks, instead a proxy will sit in
30- front of the two stacks, proxying to them.
32+ We'll no longer expose ports in our stacks. Instead a proxy will sit in front
33+ of the two stacks, proxying to them.
3134
32- So remove the ` caddy` service's `ports:` section in `compose.yaml`.
35+ Remove the Caddy service's ` ports:` section in `compose.yaml`.
3336
3437# ## Serve HTTP-only in the stacks
3538
36- Set `CADDY_SITE_ADDRESS` to only `:80`, removing `:443` ( leaving TLS
37- termination to the proxy) :
39+ Set `CADDY_SITE_ADDRESS` to only `:80`, removing `:443`, leaving TLS
40+ termination to the proxy :
3841
3942` ` ` yaml title="compose.yaml"
4043caddy:
@@ -44,36 +47,36 @@ caddy:
4447
4548# # 2. Postgres
4649
47- It's not advised to run two separate PostgreSQL instances and having them both simultaneously
48- access the same shared volume.
49-
50- So we need to move Postgres out of the compose file and start it separately .
50+ In regular SuperStack, Postgres comes up with the stack. But now we're bringing
51+ up two stacks, we can't have two Postgres containers both simultaneously
52+ accessing the same shared volume. We need a single Postgres container, separate
53+ from the stacks .
5154
52- Create a network :
55+ Add a profile to the Postgres service :
5356
54- ` ` ` sh
55- docker network create shared
57+ ` ` ` yaml title="compose.yaml"
58+ postgres:
59+ profiles: ["db"]
5660` ` `
5761
58- And add it to the Compose file :
62+ Add it to the Compose file :
5963
6064` ` ` yaml title="compose.yaml"
6165networks:
62- shared :
63- name: shared
66+ postgres :
67+ name: postgres
6468 external: true
6569` ` `
6670
67- Then in services that need db access :
71+ Then in services that need database access (such as PostgREST) :
6872
6973` ` ` yaml title="compose.yaml"
7074networks:
71- - shared
75+ - postgres
7276` ` `
7377
7478Move Postgres out of compose.yaml into a shared-compose.yaml, adding the `shared` network :
7579
76-
7780# # 3. Volumes
7881
7982To share data between the two stacks (uploads, etc.), give volumes explicit
0 commit comments