Skip to content

Commit 9930664

Browse files
authored
docs: update caddy reverse proxy example (#6228)
Update caddy reverse proxy example to use `CODER_HTTP_ADDRESS` instead of deprecated `CODER_ADDRESS` This resolved #5449
1 parent 22cc6a3 commit 9930664

File tree

2 files changed

+30
-9
lines changed

2 files changed

+30
-9
lines changed

examples/web-server/caddy/README.md

+29-8
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,23 @@ This is an example configuration of how to use Coder with [caddy](https://caddys
4040

4141
1. If you haven't already, [install Coder](https://coder.com/docs/coder-oss/latest/install)
4242

43-
1. Install [Caddy Server](https://caddyserver.com/docs/install)
43+
2. Install [Caddy Server](https://caddyserver.com/docs/install)
4444

45-
1. Copy our sample [Caddyfile](./Caddyfile) and change the following values:
45+
3. Copy our sample [Caddyfile](./Caddyfile) and change the following values:
4646

4747
> If you're installed Caddy as a system package, update the default Caddyfile with `vim /etc/caddy/Caddyfile`
4848
4949
- `email@example.com`: Email to request certificates from LetsEncrypt/ZeroSSL (does not have to be Coder admin email)
5050
- `coder.example.com`: Domain name you're using for Coder.
5151
- `*.coder.example.com`: Domain name for wildcard apps, commonly used for [dashboard port forwarding](https://coder.com/docs/coder-oss/latest/networking/port-forwarding#dashboard). This is optional and can be removed.
52-
- `localhost:3000`: Address Coder is running on. Modify this if you changed `CODER_ADDRESS` in the Coder configuration.
52+
- `localhost:3000`: Address Coder is running on. Modify this if you changed `CODER_HTTP_ADDRESS` in the Coder configuration.
5353

54-
1. [Configure Coder](https://coder.com/docs/coder-oss/latest/admin/configure) and change the following values:
54+
4. [Configure Coder](https://coder.com/docs/coder-oss/latest/admin/configure) and change the following values:
5555

5656
- `CODER_ACCESS_URL`: root domain (e.g. `https://coder.example.com`)
5757
- `CODER_WILDCARD_ACCESS_URL`: wildcard domain (e.g. `*.example.com`).
5858

59-
1. Start the Caddy server:
59+
5. Start the Caddy server:
6060

6161
If you're [keeping Caddy running](https://caddyserver.com/docs/running) via a system service:
6262

@@ -70,7 +70,7 @@ This is an example configuration of how to use Coder with [caddy](https://caddys
7070
caddy run
7171
```
7272

73-
1. Optionally, use [ufw](https://wiki.ubuntu.com/UncomplicatedFirewall) or another firewall to disable external traffic outside of Caddy.
73+
6. Optionally, use [ufw](https://wiki.ubuntu.com/UncomplicatedFirewall) or another firewall to disable external traffic outside of Caddy.
7474

7575
```console
7676
# Check status of UncomplicatedFirewall
@@ -90,7 +90,7 @@ This is an example configuration of how to use Coder with [caddy](https://caddys
9090
sudo ufw enable
9191
```
9292

93-
1. Navigate to your Coder URL! A TLS certificate should be auto-generated on your first visit.
93+
7. Navigate to your Coder URL! A TLS certificate should be auto-generated on your first visit.
9494

9595
## Generating wildcard certificates
9696

@@ -104,7 +104,9 @@ For production deployments, we recommend configuring Caddy to generate a wildcar
104104

105105
- Standalone: [Download a custom Caddy build](https://caddyserver.com/download) with the module for your DNS provider. If you're using Debian/Ubuntu, you [can configure the Caddy package](https://caddyserver.com/docs/build#package-support-files-for-custom-builds-for-debianubunturaspbian) to use the new build.
106106

107-
1. Edit your `Caddyfile` and add the necessary credentials/API tokens to solve the DNS challenge for wildcard certificates.
107+
2. Edit your `Caddyfile` and add the necessary credentials/API tokens to solve the DNS challenge for wildcard certificates.
108+
109+
For example, for AWS Route53:
108110

109111
```diff
110112
tls {
@@ -125,3 +127,22 @@ For production deployments, we recommend configuring Caddy to generate a wildcar
125127
```
126128

127129
> Configuration reference from [caddy-dns/route53](https://github.com/caddy-dns/route53).
130+
131+
And for CloudFlare:
132+
133+
Generate a [token](https://dash.cloudflare.com/profile/api-tokens) with the following permissions:
134+
135+
- Zone:Zone:Edit
136+
137+
```diff
138+
tls {
139+
- on_demand
140+
issuer acme {
141+
email email@example.com
142+
}
143+
144+
+ dns cloudflare CLOUDFLARE_API_TOKEN
145+
}
146+
```
147+
148+
> Configuration reference from [caddy-dns/cloudflare](https://github.com/caddy-dns/cloudflare).

examples/web-server/caddy/docker-compose.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ services:
44
image: ghcr.io/coder/coder:${CODER_VERSION:-latest}
55
environment:
66
CODER_PG_CONNECTION_URL: "postgresql://${POSTGRES_USER:-username}:${POSTGRES_PASSWORD:-password}@database/${POSTGRES_DB:-coder}?sslmode=disable"
7-
CODER_ADDRESS: "0.0.0.0:7080"
7+
CODER_HTTP_ADDRESS: "0.0.0.0:7080"
88
# You'll need to set CODER_ACCESS_URL to an IP or domain
99
# that workspaces can reach. This cannot be localhost
1010
# or 127.0.0.1 for non-Docker templates!

0 commit comments

Comments
 (0)