mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add helm README, install guide, linters (#3268)
This commit is contained in:
+125
@@ -103,6 +103,131 @@ grep /etc/group -e "docker"
|
||||
sudo systemctl restart coder.service
|
||||
```
|
||||
|
||||
## Kubernetes via Helm
|
||||
|
||||
Before proceeding, please ensure that you have both Helm 3.5+ and the
|
||||
[latest version of Coder](https://github.com/coder/coder/releases) installed.
|
||||
You will also need to have a Kubernetes cluster running K8s 1.19+.
|
||||
|
||||
> See our [Helm README](https://github.com/coder/coder/blob/main/helm#readme)
|
||||
> file for additional information. Check the
|
||||
> [values.yaml](https://github.com/coder/coder/blob/main/helm/values.yaml) file
|
||||
> for a list of supported Helm values and their defaults.
|
||||
|
||||
> ⚠️ **Warning**: Helm support is new and not yet complete. There may be changes
|
||||
> to the Helm chart between releases which require manual values updates. Please
|
||||
> file an issue if you run into any issues.
|
||||
>
|
||||
> Additionally, the Helm chart does not currently automatically configure a
|
||||
> Service Account and workspace template for use in Coder. See
|
||||
> [#3265](https://github.com/coder/coder/issues/3265).
|
||||
|
||||
1. Create a namespace for Coder, such as `coder`:
|
||||
|
||||
```console
|
||||
$ kubectl create namespace coder
|
||||
```
|
||||
|
||||
1. Create a PostgreSQL deployment. Coder does not manage a database server for
|
||||
you.
|
||||
|
||||
- If you're in a public cloud such as
|
||||
[Google Cloud](https://cloud.google.com/sql/docs/postgres/),
|
||||
[AWS](https://aws.amazon.com/rds/postgresql/),
|
||||
[Azure](https://docs.microsoft.com/en-us/azure/postgresql/), or
|
||||
[DigitalOcean](https://www.digitalocean.com/products/managed-databases-postgresql),
|
||||
you can use the managed PostgreSQL offerings they provide. Make sure that
|
||||
the PostgreSQL service is running and accessible from your cluster. It
|
||||
should be in the same network, same project, etc.
|
||||
|
||||
- You can install Postgres manually on your cluster using the
|
||||
[Bitnami PostgreSQL Helm chart](https://github.com/bitnami/charts/tree/master/bitnami/postgresql#readme). There are some
|
||||
[helpful guides](https://phoenixnap.com/kb/postgresql-kubernetes) on the
|
||||
internet that explain sensible configurations for this chart. Example:
|
||||
|
||||
```console
|
||||
$ helm repo add bitnami https://charts.bitnami.com/bitnami
|
||||
$ helm install postgres bitnami/postgresql \
|
||||
--namespace coder \
|
||||
--set auth.username=coder \
|
||||
--set auth.password=coder \
|
||||
--set auth.database=coder \
|
||||
--set persistence.size=10Gi
|
||||
```
|
||||
|
||||
The cluster-internal DB URL for the above database is:
|
||||
```
|
||||
postgres://coder:coder@postgres-postgresql.coder.svc.cluster.local:5432/coder?sslmode=disable
|
||||
```
|
||||
|
||||
> Ensure you set up periodic backups so you don't lose data.
|
||||
|
||||
- You can use
|
||||
[Postgres operator](https://github.com/zalando/postgres-operator) to
|
||||
manage PostgreSQL deployments on your Kubernetes cluster.
|
||||
|
||||
1. Download the latest `coder_helm` package from
|
||||
[GitHub releases](https://github.com/coder/coder/releases).
|
||||
|
||||
1. Create a `values.yaml` with the configuration settings you'd like for your
|
||||
deployment. For example:
|
||||
|
||||
```yaml
|
||||
coder:
|
||||
# You can specify any environment variables you'd like to pass to Coder
|
||||
# here. Coder consumes environment variables listed in
|
||||
# `coder server --help`, and these environment variables are also passed
|
||||
# to the workspace provisioner (so you can consume them in your Terraform
|
||||
# templates for auth keys etc.).
|
||||
#
|
||||
# Please keep in mind that you should not set `CODER_ADDRESS`,
|
||||
# `CODER_TLS_ENABLE`, `CODER_TLS_CERT_FILE` or `CODER_TLS_KEY_FILE` as
|
||||
# they are already set by the Helm chart and will cause conflicts.
|
||||
env:
|
||||
- name: CODER_ACCESS_URL
|
||||
value: "https://coder.example.com"
|
||||
- name: CODER_PG_CONNECTION_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
# You'll need to create a secret called coder-db-url with your
|
||||
# Postgres connection URL like:
|
||||
# postgres://coder:password@postgres:5432/coder?sslmode=disable
|
||||
name: coder-db-url
|
||||
key: url
|
||||
|
||||
tls:
|
||||
secretName: my-tls-secret-name
|
||||
```
|
||||
|
||||
> You can view our
|
||||
> [Helm README](https://github.com/coder/coder/blob/main/helm#readme) for
|
||||
> details on the values that are available, or you can view the
|
||||
> [values.yaml](https://github.com/coder/coder/blob/main/helm/values.yaml)
|
||||
> file directly.
|
||||
|
||||
1. Run the following commands to install the chart in your cluster.
|
||||
|
||||
```console
|
||||
$ helm install coder ./coder_helm_x.y.z.tgz \
|
||||
--namespace coder \
|
||||
--values values.yaml
|
||||
```
|
||||
|
||||
You can watch Coder start up by running `kubectl get pods`. Once Coder has
|
||||
started, the `coder-*` pods should enter the `Running` state.
|
||||
|
||||
You can view Coder's logs by getting the pod name from `kubectl get pods` and
|
||||
then running `kubectl logs <pod name>`. You can also view these logs in your
|
||||
Cloud's log management system if you are using managed Kubernetes.
|
||||
|
||||
To upgrade Coder in the future, you can run the following command with a new `coder_helm_x.y.z.tgz` file from GitHub releases:
|
||||
|
||||
```console
|
||||
$ helm upgrade coder ./coder_helm_x.y.z.tgz \
|
||||
--namespace coder \
|
||||
-f values.yaml
|
||||
```
|
||||
|
||||
## Manual
|
||||
|
||||
We publish self-contained .zip and .tar.gz archives in [GitHub releases](https://github.com/coder/coder/releases). The archives bundle `coder` binary.
|
||||
|
||||
Reference in New Issue
Block a user