Skip to content

Commit 705d93d

Browse files
committed
Adjust advanced doc
1 parent 1f1dd8a commit 705d93d

File tree

1 file changed

+31
-18
lines changed

1 file changed

+31
-18
lines changed

docs/advanced.md

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ While this is simple, it has some trade-offs:
88
- No way to test a new version while another is live (blue/green)
99
- No quick rollback once upgraded
1010

11-
When your app is ready for production, you can enable a **traffic-router** in
12-
to eliminate downtime, enable blue/green testing and easy rollbacks.
11+
When your app is ready for production, you can enable a traffic router to
12+
eliminate these issues.
1313

1414
## 🧭 How It Works
1515

@@ -27,14 +27,14 @@ flowchart TD
2727
NextApp["Next App"]
2828
```
2929

30-
In standard mode, the app exposes ports directly. In advanced mode, the **proxy
31-
owns the ports**, and apps connect to it internally over Docker networks.
30+
Normally the app exposes ports directly, but in this advanced mode, the **proxy
31+
owns the ports**, and apps connect to its Docker network.
3232

3333
## 🔄 Deployment Flow
3434

35-
1. Stop exposing ports in the app project — only the proxy will listen on `:80`
36-
and `:443`.
3735
1. Enable the proxy project (included in the repository).
36+
1. Stop exposing ports in the app — only the proxy will listen on `:80` and
37+
`:443`.
3838
1. For each deployment, bring up a new app stack (e.g. `app/<commit>`),
3939
connected to the proxy’s network.
4040
1. Test the new app while the current one remains live.
@@ -45,18 +45,20 @@ owns the ports**, and apps connect to it internally over Docker networks.
4545

4646
A `proxy` project already exists in your SuperStack project.
4747

48-
> For consistent environments, use the proxy in all environments including
48+
> For consistent environments, use the proxy in all environments, including
4949
> development.
5050
51-
Start it:
51+
Start the proxy:
5252

5353
```sh
54+
cd proxy
5455
docker compose up -d
5556
```
5657

5758
## ⚙️ 2. Adjust the Application
5859

59-
Remove the app's exposed ports and connect it to the proxy's network:
60+
**Remove the `ports:` section from the app,** and connect it to the proxy's
61+
network by adding these lines:
6062

6163
```yaml title="app/compose.yaml" hl_lines="5-11 13-15"
6264
services:
@@ -76,23 +78,25 @@ networks:
7678
external: true
7779
```
7880
81+
You should also remove the `ports:` and `CADDY_SITE_ADDRESS` in
82+
`app/compose.override.yaml`.
83+
7984
What's Changed?
8085

8186
1. Exposed ports were removed.
8287
1. `CADDY_SITE_ADDRESS` now listens internally on port `:80`.
8388
1. The app joins the proxy's network so traffic can be routed to it.
84-
1. A container alias (`_caddy`) lets the proxy target this service reliably.
85-
86-
You can also remove the `CADDY_SITE_ADDRESS` override in
87-
`compose.override.yaml`.
89+
1. A container alias (`_caddy`) allows the proxy to target this service
90+
reliably.
8891

8992
Recreate the app's Caddy container:
9093

9194
```sh
95+
cd app
9296
docker compose up -d --force-recreate caddy
9397
```
9498

95-
Commit these changes – your app is now "proxy-ready".
99+
Commit these changes – your app is now proxy-ready.
96100

97101
## 🚀 3. Deploying
98102

@@ -111,8 +115,8 @@ app/
111115
.env
112116
```
113117
114-
Before deploying, build and push your own proxy image by adding an image name
115-
to the Compose file:
118+
Before deploying, build and push your own proxy image by adding an `image:`
119+
line to the Compose file:
116120
117121
```yaml title="proxy/compose.yaml" hl_lines="5"
118122
services:
@@ -143,12 +147,18 @@ scp proxy/compose.yaml app-backend:proxy/
143147

144148
Start the proxy:
145149

150+
```sh
146151
docker compose up -d
152+
```
147153

148154
## 🆕 4. Deploy the New App Stack
149155

150156
Deploy your app into a new directory (e.g. `b/`):
151157

158+
```sh
159+
mkdir app/b
160+
```
161+
152162
```sh
153163
scp compose.yaml yourserver:app/b/
154164
```
@@ -160,10 +170,11 @@ cd app/b
160170
docker compose up -d
161171
```
162172

163-
Optionally, verify it's healthy before switching traffic:
173+
Optionally, verify the new app is healthy before switching traffic:
164174

165175
```sh
166-
docker compose exec -T caddy curl -fsS http://caddy:80/healthz
176+
$ docker compose exec -T caddy curl -fsS http://caddy:80/healthz
177+
OK
167178
```
168179

169180
## 🔁 5. Flip Traffic
@@ -178,6 +189,8 @@ Traffic now points to the new stack.
178189

179190
## ⚡ GitHub Actions Example
180191

192+
Use this Github Actions Workflow to automate deployments.
193+
181194
<details>
182195
<summary>Show full workflow</summary>
183196

0 commit comments

Comments
 (0)