Skip to content
This repository was archived by the owner on Aug 18, 2025. It is now read-only.

Commit 5b0a917

Browse files
authored
feat(cdr): Docs for remote postgresql C4D (#818)
1 parent 7da3386 commit 5b0a917

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

setup/docker.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,45 @@ For example:
9191
docker run --rm -it -p 7080:7080 -v /var/run/docker.sock:/var/run/docker.sock -v ~/.coder:/var/run/coder -e DEVURL_HOST="*.mycompany.com" codercom/coder:1.27.0
9292
```
9393

94+
## Use an external PostgreSQL database
95+
96+
If you'd like to use an external database, you must:
97+
98+
1. Disable the embedded database by setting the `DB_EMBEDDED` environment
99+
variable (see the next code snippet for an example)
100+
1. Provide the connection information to the external PostgreSQL database:
101+
102+
```console
103+
docker run --rm -it -p 7080:7080 \
104+
-v /var/run/docker.sock:/var/run/docker.sock \
105+
-v ~/.coder:/var/run/coder \
106+
# Disable using the embedded DB
107+
-e DB_EMBEDDED="" \
108+
# Change these values to match those for your database
109+
-e DB_HOST=127.0.0.1 \
110+
-e DB_PORT=5432 \
111+
-e DB_USER=postgres \
112+
-e DB_PASSWORD="" \
113+
-e DB_NAME=postgres \
114+
-e DB_SSL_MODE=disable \
115+
codercom/coder:1.27.0
116+
```
117+
118+
Coder supports client TLS certificates using `DB_SSL_MODE=verify-full`. Ensure
119+
that you mount the certs into the container (and add the flag
120+
`-v <local_certs>:/certs`). Then, specify the certificate path using environment
121+
variables:
122+
123+
<!-- markdownlint-disable -->
124+
125+
| **Flag/environment variable** | **Description** |
126+
| --------------------------------- | -------------------------------------------- |
127+
| `-e DB_CERT=/certs/client.crt` | The path to the client cert signed by the CA |
128+
| `-e DB_KEY=/certs/client.key` | The path to the client secret |
129+
| `-e DB_ROOT_CERT=/certs/myCA.crt` | The path to the trusted CA cert |
130+
131+
<!-- markdownlint-enable -->
132+
94133
## Admin password
95134

96135
If you want to set (or reset) your admin password, use the
@@ -108,7 +147,6 @@ For organizations, we recommend one Docker host per team of 5-10 developers.
108147

109148
Currently, Coder for Docker does not support:
110149

111-
- External PostgreSQL databases
112150
- The use of your own TLS certificates. If you'd like to use TLS with Coder for
113151
Docker, you'll need to run Coder behind a reverse proxy (e.g., Caddy or NGINX)
114152
and terminate TLS at that point. See

0 commit comments

Comments
 (0)