Skip to content

Commit ee71c49

Browse files
committed
Adjust bluegreen doc
1 parent 1436432 commit ee71c49

File tree

1 file changed

+27
-24
lines changed

1 file changed

+27
-24
lines changed

docs/bluegreen.md

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
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
36
near-zero downtime and easy rollback.
47

58
![Blue/Green](assets/bluegreen.png)
@@ -10,14 +13,14 @@ stack", now there is:
1013
1. A `blue` stack
1114
2. A `green` stack
1215
3. 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"
2326
caddy:
@@ -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"
4043
caddy:
@@ -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"
6165
networks:
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"
7074
networks:
71-
- shared
75+
- postgres
7276
```
7377

7478
Move Postgres out of compose.yaml into a shared-compose.yaml, adding the `shared` network:
7579

76-
7780
## 3. Volumes
7881

7982
To share data between the two stacks (uploads, etc.), give volumes explicit

0 commit comments

Comments
 (0)