# Install with Helm

Source: https://dropshelf.ai/docs/self-host/install/helm

Install dropshelf on Kubernetes from the Helm chart, with a Secret, a values file from the minimal example and a check that it works.

Install dropshelf on a Kubernetes cluster with its Helm chart. Use this for a production instance or
any install with more than one replica.

## Prerequisites [#prerequisites]

- Everything on [Requirements](/docs/self-host/install/requirements): the two DNS records, a way to
  get the wildcard certificate, a Postgres database, a bucket and an OIDC client.
- Kubernetes 1.29 or later, with an ingress controller.
- `kubectl` and `helm` pointed at the cluster.
- `openssl`, to generate the session secret.

## Create the namespace and the Secret [#create-the-namespace-and-the-secret]

The chart creates no namespace and no Secret. It reads every secret setting from a Secret named
`dropshelf-secrets`, and each key in it becomes an environment variable in the pods.

1. Create the namespace:

   ```bash
   kubectl create namespace dropshelf
   ```

2. Create the Secret with the three keys every install needs:

   ```bash
   kubectl -n dropshelf create secret generic dropshelf-secrets \
     --from-literal=DROPSHELF_DATABASE_URL='postgres://dropshelf:<password>@<postgres-host>:5432/dropshelf?sslmode=require' \
     --from-literal=DROPSHELF_AUTH_OIDC_CLIENT_SECRET='<client-secret>' \
     --from-literal=DROPSHELF_AUTH_SESSION_SECRETS="$(openssl rand -hex 32)"
   ```

   Replace `<password>`, `<postgres-host>` and `<client-secret>` with your values.

The keys hold the following:

| Key | Holds |
| --- | --- |
| `DROPSHELF_DATABASE_URL` | The Postgres connection URL, with its password. |
| `DROPSHELF_AUTH_OIDC_CLIENT_SECRET` | The client secret from your identity provider. |
| `DROPSHELF_AUTH_SESSION_SECRETS` | The keys that encrypt session cookies, comma separated, each at least 32 bytes. |

`openssl rand -hex 32` prints 64 characters, which is above the 32-byte minimum. A shorter secret
stops the server at startup. To rotate it later, see [Rotate secrets](/docs/self-host/operate/rotate-secrets).

If your cluster has no workload identity for the bucket, add `AWS_ACCESS_KEY_ID` and
`AWS_SECRET_ACCESS_KEY` to the same Secret. [Object storage](/docs/self-host/configure/storage) covers
the credentials for each driver.

## Write a values file [#write-a-values-file]

Start from the chart's minimal example. It sets the values every install needs: your two addresses,
your bucket, your identity provider and the first admin.

Save this as `values.yaml` and replace each value with yours:

```yaml
config:
  server:
    baseDomain: drop.example.com
    publicBaseURL: https://drop.example.com
    trustedProxies: ["10.0.0.0/8"]
  storage:
    driver: s3
    s3:
      bucket: example-dropshelf
      region: eu-north-1
  auth:
    provider: oidc
    oidc:
      issuer: https://example.eu.auth0.com/
      clientId: <client-id>
    admins:
      emails: [admin@example.com]
```

Set `trustedProxies` to your ingress controller's pod range, so the logs record client addresses.
Everyone listed in `admins.emails` is an admin when they sign in.

The `config` block is the server's configuration file, and every key is in the
[configuration reference](/docs/reference/configuration). The chart's defaults cover the rest: two
replicas, an Ingress and a wildcard certificate from a cert-manager `ClusterIssuer` named
`letsencrypt-dns`. To change these, see [Helm chart values](/docs/reference/helm-values).

The chart ships example files for common platforms, which you add with a second `-f` flag:

- Amazon EKS with IRSA: `aws-eks.yaml`.
- Google Kubernetes Engine with Workload Identity: `gke.yaml`.
- Azure Kubernetes Service with Workload Identity: `aks.yaml`.
- Your own certificate instead of cert-manager: `existing-certificate.yaml`.

Each one is on [Helm chart values](/docs/reference/helm-values#example-values-files).

## Choose how migrations run [#choose-how-migrations-run]

dropshelf migrates its database schema when the version changes. `migrations.mode` chooses where that
happens:

- `startup`, the default: every server pod migrates at startup, under a database lock, so pods
  starting together are safe.
- `job`: a Job runs `dropshelf-server migrate` before each install and upgrade, and the server pods do
  not migrate. Schema changes stay out of the serving path.

To run migrations as a Job, add this to `values.yaml`:

```yaml
migrations:
  mode: job
```

## Install the chart [#install-the-chart]

Install the chart from its registry, with the release name `dropshelf`:

```bash
helm install dropshelf oci://ghcr.io/dropshelf/charts/dropshelf --version <version> -n dropshelf -f values.yaml
```

Replace `<version>` with a release, such as `0.1.0`. The chart runs the image of the same release,
`ghcr.io/dropshelf/dropshelf:v0.1.0`.

Helm prints the dashboard address, the drop address pattern and two commands to check the install.

## Install the demo drops [#install-the-demo-drops]

The chart can install demo drops on the first install, never on an upgrade. They are open to every
member and kept Forever, or as long as the instance's retention allows. A disabled system user owns
them, so nobody can sign in as their owner.

To install them, add this to `values.yaml` before you run `helm install`:

```yaml
demo:
  install: true
```

The demos you get depend on the features you turn on:

- `demo-welcome`, a page that greets the visitor by name, always.
- `demo-all-hands`, a live Q&A board, with `config.platform.db.enabled`.
- `demo-photo-wall`, a shared photo wall, with `config.platform.assets.enabled` as well.
- `demo-signups`, signups per channel, with `config.connectors.enabled` and `demo.warehouseURL` set.

The demos need an object store, so the chart refuses `demo.install` with the `fs` storage driver. An
admin deletes a demo from its page in the dashboard, and a deleted demo stays deleted.

## Confirm it worked [#confirm-it-worked]

1. Wait for the rollout:

   ```bash
   kubectl -n dropshelf rollout status deployment/dropshelf
   ```

   The output ends with:

   ```text
   deployment "dropshelf" successfully rolled out
   ```

2. Run the chart's test, which asks the Service for `/readyz`:

   ```bash
   helm test dropshelf -n dropshelf
   ```

3. Ask the dashboard address for readiness through the Ingress:

   ```bash
   curl https://drop.example.com/readyz
   ```

   ```text
   ready
   ```

   Any other answer names the dependency that failed, such as `not ready: store: ...` for Postgres or
   `not ready: blob: ...` for the bucket. See [Troubleshooting](/docs/self-host/operate/troubleshooting).

4. Open `https://drop.example.com` and sign in as an address from `auth.admins.emails`. Your account
   menu shows **Admin**.

## Next steps [#next-steps]

- [Production checklist](/docs/self-host/install/production-checklist)
- [Identity provider](/docs/self-host/configure/identity-provider)
- [Turn on features](/docs/self-host/configure/features)
- [Upgrade](/docs/self-host/operate/upgrade)
- [Back up and restore](/docs/self-host/operate/backup)
