Skip to content

Commit 2082ad9

Browse files
committed
Adjust bluegreen doc
1 parent 1389be1 commit 2082ad9

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

docs/bluegreen.md

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,22 @@ volumes:
3535
name: user-data
3636
```
3737
38-
## 2. Start two Stacks
39-
40-
On the server, bring up two stacks, `blue` and `green`:
41-
42-
```sh
43-
docker compose -p blue up -d
44-
docker compose -p green up -d
45-
```
46-
47-
## 3. Front Proxy
38+
## 2. Front Proxy
4839
4940
The front proxy is a single Caddy container that binds `:80` and `:443` on the
5041
server and routes requests into either the Blue or Green stack.
5142

5243
On the server, create a simple `Caddyfile`:
5344

5445
```caddyfile title="Caddyfile"
55-
api.myapp.com reverse_proxy blue_caddy:80
46+
api.myapp.com {
47+
reverse_proxy blue_caddy:80
48+
}
5649
5750
# Optionally point a second hostname to the idle stack for testing
58-
next.myapp.com reverse_proxy blue_caddy:80
51+
next.myapp.com {
52+
reverse_proxy green_caddy:80
53+
}
5954
```
6055

6156
The front proxy manages TLS, so give it a persistent volume for certificates:
@@ -64,6 +59,13 @@ The front proxy manages TLS, so give it a persistent volume for certificates:
6459
docker volume create caddy_data
6560
```
6661

62+
Create networks for the two stacks:
63+
64+
```sh
65+
docker network create blue_default
66+
docker network create green_default
67+
```
68+
6769
Start the proxy and attach it to both networks:
6870

6971
```sh
@@ -89,8 +91,13 @@ docker compose -p green up -d
8991
Edit the front proxy's config to flip traffic:
9092

9193
```caddyfile title="Caddyfile"
92-
api.myapp.com reverse_proxy green_caddy:80
93-
next.myapp.com reverse_proxy blue_caddy:80
94+
api.myapp.com {
95+
reverse_proxy green_caddy:80
96+
}
97+
98+
next.myapp.com {
99+
reverse_proxy blue_caddy:80
100+
}
94101
```
95102

96103
Restart Caddy:

0 commit comments

Comments
 (0)