@@ -41,42 +41,7 @@ flowchart TD
4141
4242Ok, we need to make some changes to the repository.
4343
44- ## 1. Adjust the Application
45-
46- Remove the app's exposed ports, and connect to the proxy's network:
47-
48- ``` yaml title="app/compose.yaml" hl_lines="5-11 13-15"
49- services :
50- caddy :
51- build :
52- context : ./caddy
53- environment :
54- CADDY_SITE_ADDRESS : " :80"
55- networks :
56- default :
57- proxy_default :
58- aliases :
59- - ${COMPOSE_PROJECT_NAME}_caddy
60-
61- networks :
62- proxy_default :
63- external : true
64- ` ` `
65-
66- What's changed?
67-
68- 1. The exposed ports were removed.
69- 1. Caddy's site address has changed to ` :80` (The application layer no longer
70- handles TLS).
71- 1. We connect to the proxy's network, so the proxy can direct traffic to the
72- app.
73- 1. A container alias was added. This alias allows the proxy to target this
74- container, while still allowing Docker to manage the container name.
75-
76- The `CADDY_SITE_ADDRESS` environment variable can be removed from the override
77- file.
78-
79- # # 2. Start a new `proxy` project
44+ ## 1. Create a new ` proxy ` project
8045
8146From the root of the repository, create a new ` proxy ` project:
8247
@@ -137,15 +102,53 @@ FROM caddy:2
137102COPY Caddyfile /etc/caddy/Caddyfile
138103```
139104
140- # # Start the services
141-
142- Start the proxy first, then the app which connects to its network.
105+ Start the proxy service:
143106
144107``` yaml
145- cd proxy && docker compose up -d
146- cd ../app && docker compose up -d
108+ docker compose up -d
109+ ```
110+
111+ ## 2. Adjust the Application
112+
113+ Remove the app's exposed ports, and connect to the proxy's network:
114+
115+ ``` yaml title="app/compose.yaml" hl_lines="5-11 13-15"
116+ services :
117+ caddy :
118+ build :
119+ context : ./caddy
120+ environment :
121+ CADDY_SITE_ADDRESS : " :80"
122+ networks :
123+ default :
124+ proxy_default :
125+ aliases :
126+ - ${COMPOSE_PROJECT_NAME}_caddy
127+
128+ networks :
129+ proxy_default :
130+ external : true
131+ ` ` `
132+
133+ What's changed?
134+
135+ 1. The exposed ports were removed.
136+ 1. Caddy's site address has changed to ` :80` (The application layer no longer
137+ handles TLS).
138+ 1. We connect to the proxy's network, so the proxy can direct traffic to the
139+ app.
140+ 1. A container alias was added. This alias allows the proxy to target this
141+ container, while still allowing Docker to manage the container name.
142+
143+ The `CADDY_SITE_ADDRESS` environment variable can be removed from the override
144+ file.
145+
146+ ` ` ` sh
147+ docker compose up -d app
147148` ` `
148149
150+ Commit these changes.
151+
149152# # Deploying
150153
151154```
0 commit comments