Skip to content

Commit 4e44716

Browse files
kylecarbsammario
andauthored
docs: add high availability (coder#4583)
- Rename `CODER_DERP_SERVER_RELAY_ADDRESS` Co-authored-by: Ammar Bandukwala <ammar@ammar.io>
1 parent fda71da commit 4e44716

File tree

6 files changed

+102
-23
lines changed

6 files changed

+102
-23
lines changed

cli/deployment/flags.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func Flags() *codersdk.DeploymentFlags {
8888
DerpServerRelayAddress: &codersdk.StringFlag{
8989
Name: "DERP Server Relay Address",
9090
Flag: "derp-server-relay-address",
91-
EnvVar: "CODER_DERP_SERVER_RELAY_ADDRESS",
91+
EnvVar: "CODER_DERP_SERVER_RELAY_URL",
9292
Description: "An HTTP address that is accessible by other replicas to relay DERP traffic. Required for high availability.",
9393
Enterprise: true,
9494
},

docs/admin/enterprise.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,32 @@
33
Coder is free to use and includes some features that are only accessible with a paid license.
44
Contact sales@coder.com to obtain a license.
55

6-
These features are available in the enterprise edition:
7-
8-
- [Audit Logging](./audit-logs.md)
9-
- [Browser Only Connections](../networking.md#browser-only-connections)
6+
### User Management
107
- [Groups](./groups.md)
118
- [Template RBAC](./rbac.md)
12-
- [Quotas](./quotas.md)
139
- [SCIM](./auth.md#scim)
1410

15-
And we're releasing these imminently:
11+
### Networking & Deployment
12+
- [High Availability](./high-availability.md)
13+
- [Browser Only Connections](../networking.md#browser-only-connections)
14+
15+
### Other
16+
- [Audit Logging](./audit-logs.md)
17+
- [Quotas](./quotas.md)
18+
19+
### Coming soon
1620

17-
- High Availability
1821
- Multiple Git Provider Authentication
22+
- Max Workspace Auto-Stop
1923

2024
## Adding your license key
2125

22-
### You will need:
26+
### Requirements
2327

2428
- Your license key (contact sales@coder.com if you don't have yours)
2529
- Coder CLI installed
2630

27-
### Steps:
31+
### Instructions
2832

2933
1. Save your license key to disk and make note of the path
3034
2. Open a terminal

docs/admin/high-availability.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# High Availability
2+
3+
High Availability (HA) mode solves for horizontal scalability and automatic failover
4+
within a single region. When in HA mode, Coder continues using a single Postgres
5+
endpoint. [GCP](https://cloud.google.com/sql/docs/postgres/high-availability), [AWS](https://docs.aws.amazon.com/prescriptive-guidance/latest/saas-multitenant-managed-postgresql/availability.html),
6+
and other cloud vendors offer fully-managed HA Postgres services that pair
7+
nicely with Coder.
8+
9+
For Coder to operate correctly, every node must be within 10ms of each other
10+
and Postgres. We make a best-effort attempt to warn the user when inter-coder
11+
latency is too high, but if requests start dropping, this is one metric to investigate.
12+
Note that this latency requirement applies _only_ to coder services. Coder will
13+
operate correctly even with few seconds of latency on
14+
workspace <-> coder and user <-> coder connections.
15+
16+
## Setup
17+
18+
Coder automatically enters HA mode when multiple instances simultaneously connect
19+
to the same Postgres endpoint.
20+
21+
HA brings one configuration variable to set in each Coder
22+
node: `CODER_DERP_SERVER_RELAY_URL`. The HA nodes use these URLs to communicate
23+
with each other. Inter-node communication is only required while using the
24+
embedded relay (default). If you're using [custom relays](../networking.md#custom-relays), Coder ignores `CODER_DERP_SERVER_RELAY_URL` since Postgres is the sole rendezvous for the Coder nodes.
25+
26+
`CODER_DERP_SERVER_RELAY_URL` will never be `CODER_ACCESS_URL` because
27+
`CODER_ACCESS_URL` is a load balancer to all Coder nodes.
28+
29+
Here's an example 3-node network configuration setup:
30+
31+
| Name | `CODER_ADDRESS` | `CODER_DERP_SERVER_RELAY_URL` | `CODER_ACCESS_URL` |
32+
| ------- | --------------- | ----------------------------- | ----------------------- |
33+
| `coder-1` | `*:80` | `http://10.0.0.1:80` | `https://coder.big.corp` |
34+
| `coder-2` | `*:80` | `http://10.0.0.2:80` | `https://coder.big.corp` |
35+
| `coder-3` | `*:80` | `http://10.0.0.3:80` | `https://coder.big.corp` |
36+
37+
38+
## Kubernetes
39+
40+
If you installed Coder via
41+
[our Helm Chart](../install/kubernetes.md#install-coder-with-helm), just
42+
increase `coder.replicaCount` in `values.yaml`.
43+
44+
45+
If you installed Coder into Kubernetes by some other means, insert the relay URL
46+
via the environment like so:
47+
48+
```yaml
49+
env:
50+
- name: POD_IP
51+
valueFrom:
52+
fieldRef:
53+
fieldPath: status.podIP
54+
- name: CODER_DERP_SERVER_RELAY_URL
55+
value: http://$(POD_IP)
56+
```
57+
Then, increase the number of pods.
58+
59+
## Up next
60+
61+
- [Networking](../networking.md)
62+
- [Kubernetes](../install/kubernetes.md)
63+
- [Enterprise](./enterprise.md)

docs/images/icons/hydra.svg

Lines changed: 5 additions & 0 deletions
Loading

docs/manifest.json

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@
2727
"children": [
2828
{
2929
"title": "Install script",
30-
"description": "One-line install script for macOS and Linux.",
30+
"description": "One-line install script for macOS and Linux",
3131
"path": "./install/install.sh.md"
3232
},
3333
{
3434
"title": "System packages",
35-
"description": "System packages for Debian, Ubuntu, Fedora, CentOS, RHEL, SUSE, and Alpine.",
35+
"description": "System packages for Debian, Ubuntu, Fedora, CentOS, RHEL, SUSE, and Alpine",
3636
"path": "./install/packages.md"
3737
},
3838
{
3939
"title": "Kubernetes",
40-
"description": "Install Coder with Kubernetes via Helm.",
40+
"description": "Install Coder with Kubernetes via Helm",
4141
"path": "./install/kubernetes.md"
4242
},
4343
{
@@ -47,12 +47,12 @@
4747
},
4848
{
4949
"title": "Standalone binaries",
50-
"description": "Download binaries for macOS, Windows, and Linux.",
50+
"description": "Download binaries for macOS, Windows, and Linux",
5151
"path": "./install/binary.md"
5252
},
5353
{
5454
"title": "Uninstall",
55-
"description": "Learn how to uninstall Coder.",
55+
"description": "Learn how to uninstall Coder",
5656
"path": "./install/uninstall.md"
5757
}
5858
]
@@ -182,7 +182,7 @@
182182
"children": [
183183
{
184184
"title": "Authentication",
185-
"description": "Learn how to set up authentication using GitHub or OpenID Connect.",
185+
"description": "Learn how to set up authentication using GitHub or OpenID Connect",
186186
"icon_path": "./images/icons/key.svg",
187187
"path": "./admin/auth.md"
188188
},
@@ -208,13 +208,13 @@
208208
},
209209
{
210210
"title": "Configuration",
211-
"description": "Learn how to configure Coder.",
211+
"description": "Learn how to configure Coder",
212212
"path": "./admin/configure.md",
213213
"icon_path": "./images/icons/toggle_on.svg"
214214
},
215215
{
216216
"title": "Upgrading",
217-
"description": "Learn how to upgrade Coder.",
217+
"description": "Learn how to upgrade Coder",
218218
"icon_path": "./images/icons/upgrade.svg",
219219
"path": "./admin/upgrade.md"
220220
},
@@ -226,27 +226,34 @@
226226
},
227227
{
228228
"title": "Audit Logs",
229-
"description": "Learn how to use Audit Logs in your Coder deployment.",
229+
"description": "Learn how to use Audit Logs in your Coder deployment",
230230
"icon_path": "./images/icons/radar.svg",
231231
"path": "./admin/audit-logs.md",
232232
"state": "enterprise"
233233
},
234234
{
235235
"title": "Quotas",
236-
"description": "Learn how to use Workspace Quotas in Coder.",
236+
"description": "Learn how to use Workspace Quotas in Coder",
237237
"icon_path": "./images/icons/dollar.svg",
238238
"path": "./admin/quotas.md",
239239
"state": "enterprise"
240240
},
241+
{
242+
"title": "High Availability",
243+
"description": "Learn how to configure Coder for High Availability",
244+
"icon_path": "./images/icons/hydra.svg",
245+
"path": "./admin/high-availability.md",
246+
"state": "enterprise"
247+
},
241248
{
242249
"title": "Enterprise",
243-
"description": "Learn how to enable Enterprise features.",
250+
"description": "Learn how to enable Enterprise features",
244251
"icon_path": "./images/icons/group.svg",
245252
"path": "./admin/enterprise.md"
246253
},
247254
{
248255
"title": "Telemetry",
249-
"description": "Learn what usage telemetry Coder collects.",
256+
"description": "Learn what usage telemetry Coder collects",
250257
"icon_path": "./images/icons/science.svg",
251258
"path": "./admin/telemetry.md"
252259
}

helm/templates/coder.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ spec:
4040
valueFrom:
4141
fieldRef:
4242
fieldPath: status.podIP
43-
- name: CODER_DERP_SERVER_RELAY_ADDRESS
43+
- name: CODER_DERP_SERVER_RELAY_URL
4444
value: "{{ include "coder.portName" . }}://$(KUBE_POD_IP):{{ include "coder.port" . }}"
4545
{{- include "coder.tlsEnv" . | nindent 12 }}
4646
{{- with .Values.coder.env -}}

0 commit comments

Comments
 (0)