Skip to content

docs: add high availability #4583

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/deployment/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func Flags() *codersdk.DeploymentFlags {
DerpServerRelayAddress: &codersdk.StringFlag{
Name: "DERP Server Relay Address",
Flag: "derp-server-relay-address",
EnvVar: "CODER_DERP_SERVER_RELAY_ADDRESS",
EnvVar: "CODER_DERP_SERVER_RELAY_URL",
Description: "An HTTP address that is accessible by other replicas to relay DERP traffic. Required for high availability.",
Enterprise: true,
},
Expand Down
22 changes: 13 additions & 9 deletions docs/admin/enterprise.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,32 @@
Coder is free to use and includes some features that are only accessible with a paid license.
Contact sales@coder.com to obtain a license.

These features are available in the enterprise edition:

- [Audit Logging](./audit-logs.md)
- [Browser Only Connections](../networking.md#browser-only-connections)
### User Management
- [Groups](./groups.md)
- [Template RBAC](./rbac.md)
- [Quotas](./quotas.md)
- [SCIM](./auth.md#scim)

And we're releasing these imminently:
### Networking & Deployment
- [High Availability](./high-availability.md)
- [Browser Only Connections](../networking.md#browser-only-connections)

### Other
- [Audit Logging](./audit-logs.md)
- [Quotas](./quotas.md)

### Coming soon

- High Availability
- Multiple Git Provider Authentication
- Max Workspace Auto-Stop

## Adding your license key

### You will need:
### Requirements

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

### Steps:
### Instructions

1. Save your license key to disk and make note of the path
2. Open a terminal
Expand Down
63 changes: 63 additions & 0 deletions docs/admin/high-availability.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# High Availability

High Availability (HA) mode solves for horizontal scalability and automatic failover
within a single region. When in HA mode, Coder continues using a single Postgres
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),
and other cloud vendors offer fully-managed HA Postgres services that pair
nicely with Coder.

For Coder to operate correctly, every node must be within 10ms of each other
and Postgres. We make a best-effort attempt to warn the user when inter-coder
latency is too high, but if requests start dropping, this is one metric to investigate.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we surface the database latency, should we document the endpoint/dashboard to check this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should do that once the Admin Settings page is in. cc @kylecarbs

Note that this latency requirement applies _only_ to coder services. Coder will
operate correctly even with few seconds of latency on
workspace <-> coder and user <-> coder connections.

## Setup

Coder automatically enters HA mode when multiple instances simultaneously connect
to the same Postgres endpoint.

HA brings one configuration variable to set in each Coder
node: `CODER_DERP_SERVER_RELAY_URL`. The HA nodes use these URLs to communicate
with each other. Inter-node communication is only required while using the
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.

`CODER_DERP_SERVER_RELAY_URL` will never be `CODER_ACCESS_URL` because
`CODER_ACCESS_URL` is a load balancer to all Coder nodes.

Here's an example 3-node network configuration setup:

| Name | `CODER_ADDRESS` | `CODER_DERP_SERVER_RELAY_URL` | `CODER_ACCESS_URL` |
| ------- | --------------- | ----------------------------- | ----------------------- |
| `coder-1` | `*:80` | `http://10.0.0.1:80` | `https://coder.big.corp` |
| `coder-2` | `*:80` | `http://10.0.0.2:80` | `https://coder.big.corp` |
| `coder-3` | `*:80` | `http://10.0.0.3:80` | `https://coder.big.corp` |


## Kubernetes

If you installed Coder via
[our Helm Chart](../install/kubernetes.md#install-coder-with-helm), just
increase `coder.replicaCount` in `values.yaml`.


If you installed Coder into Kubernetes by some other means, insert the relay URL
via the environment like so:

```yaml
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: CODER_DERP_SERVER_RELAY_URL
value: http://$(POD_IP)
```
Then, increase the number of pods.

## Up next

- [Networking](../networking.md)
- [Kubernetes](../install/kubernetes.md)
- [Enterprise](./enterprise.md)
5 changes: 5 additions & 0 deletions docs/images/icons/hydra.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 19 additions & 12 deletions docs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@
"children": [
{
"title": "Install script",
"description": "One-line install script for macOS and Linux.",
"description": "One-line install script for macOS and Linux",
"path": "./install/install.sh.md"
},
{
"title": "System packages",
"description": "System packages for Debian, Ubuntu, Fedora, CentOS, RHEL, SUSE, and Alpine.",
"description": "System packages for Debian, Ubuntu, Fedora, CentOS, RHEL, SUSE, and Alpine",
"path": "./install/packages.md"
},
{
"title": "Kubernetes",
"description": "Install Coder with Kubernetes via Helm.",
"description": "Install Coder with Kubernetes via Helm",
"path": "./install/kubernetes.md"
},
{
Expand All @@ -47,12 +47,12 @@
},
{
"title": "Standalone binaries",
"description": "Download binaries for macOS, Windows, and Linux.",
"description": "Download binaries for macOS, Windows, and Linux",
"path": "./install/binary.md"
},
{
"title": "Uninstall",
"description": "Learn how to uninstall Coder.",
"description": "Learn how to uninstall Coder",
"path": "./install/uninstall.md"
}
]
Expand Down Expand Up @@ -182,7 +182,7 @@
"children": [
{
"title": "Authentication",
"description": "Learn how to set up authentication using GitHub or OpenID Connect.",
"description": "Learn how to set up authentication using GitHub or OpenID Connect",
"icon_path": "./images/icons/key.svg",
"path": "./admin/auth.md"
},
Expand All @@ -208,13 +208,13 @@
},
{
"title": "Configuration",
"description": "Learn how to configure Coder.",
"description": "Learn how to configure Coder",
"path": "./admin/configure.md",
"icon_path": "./images/icons/toggle_on.svg"
},
{
"title": "Upgrading",
"description": "Learn how to upgrade Coder.",
"description": "Learn how to upgrade Coder",
"icon_path": "./images/icons/upgrade.svg",
"path": "./admin/upgrade.md"
},
Expand All @@ -226,27 +226,34 @@
},
{
"title": "Audit Logs",
"description": "Learn how to use Audit Logs in your Coder deployment.",
"description": "Learn how to use Audit Logs in your Coder deployment",
"icon_path": "./images/icons/radar.svg",
"path": "./admin/audit-logs.md",
"state": "enterprise"
},
{
"title": "Quotas",
"description": "Learn how to use Workspace Quotas in Coder.",
"description": "Learn how to use Workspace Quotas in Coder",
"icon_path": "./images/icons/dollar.svg",
"path": "./admin/quotas.md",
"state": "enterprise"
},
{
"title": "High Availability",
"description": "Learn how to configure Coder for High Availability",
"icon_path": "./images/icons/hydra.svg",
"path": "./admin/high-availability.md",
"state": "enterprise"
},
{
"title": "Enterprise",
"description": "Learn how to enable Enterprise features.",
"description": "Learn how to enable Enterprise features",
"icon_path": "./images/icons/group.svg",
"path": "./admin/enterprise.md"
},
{
"title": "Telemetry",
"description": "Learn what usage telemetry Coder collects.",
"description": "Learn what usage telemetry Coder collects",
"icon_path": "./images/icons/science.svg",
"path": "./admin/telemetry.md"
}
Expand Down
2 changes: 1 addition & 1 deletion helm/templates/coder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: CODER_DERP_SERVER_RELAY_ADDRESS
- name: CODER_DERP_SERVER_RELAY_URL
value: "{{ include "coder.portName" . }}://$(KUBE_POD_IP):{{ include "coder.port" . }}"
{{- include "coder.tlsEnv" . | nindent 12 }}
{{- with .Values.coder.env -}}
Expand Down