|
| 1 | +# static-webhost |
| 2 | + |
| 3 | +Helm chart for hosting static sites at GEWIS. Each release pairs a Caddy web |
| 4 | +server with an in-browser code-server editor, sharing an RWX volume so files |
| 5 | +can be edited live. |
| 6 | + |
| 7 | +## What gets deployed |
| 8 | + |
| 9 | +- `PersistentVolumeClaim` — RWX, size from `storage.size`, cluster default storage class. |
| 10 | +- `Deployment` + `Service` — Caddy serving the volume at `/srv` (read-only). |
| 11 | +- `Deployment` + `Service` — code-server mounting the same volume read-write. |
| 12 | +- `IngressRoute` (Traefik) — every entry in `domains` routes to Caddy. |
| 13 | + The first domain additionally exposes `/admin` → code-server, gated by OIDC. |
| 14 | +- `Middleware` ×2 — `traefik-oidc-auth` and `stripPrefix /admin`. |
| 15 | +- `Secret oidc-secret` — empty shell annotated for reflection from |
| 16 | + `shared-secrets/oidc-auth` by the emberstack reflector. |
| 17 | + |
| 18 | +## Install via Flux |
| 19 | + |
| 20 | +```yaml |
| 21 | +apiVersion: source.toolkit.fluxcd.io/v1 |
| 22 | +kind: HelmRepository |
| 23 | +metadata: |
| 24 | + name: gewis-webhost |
| 25 | + namespace: flux-system |
| 26 | +spec: |
| 27 | + interval: 10m |
| 28 | + url: https://gewis.github.io/webhost-helm-chart |
| 29 | +--- |
| 30 | +apiVersion: helm.toolkit.fluxcd.io/v2 |
| 31 | +kind: HelmRelease |
| 32 | +metadata: |
| 33 | + name: myapp |
| 34 | + namespace: flux-system |
| 35 | +spec: |
| 36 | + interval: 10m |
| 37 | + releaseName: myapp |
| 38 | + targetNamespace: webhost-myapp |
| 39 | + install: |
| 40 | + createNamespace: true |
| 41 | + chart: |
| 42 | + spec: |
| 43 | + chart: static-webhost |
| 44 | + version: 0.1.0 |
| 45 | + sourceRef: |
| 46 | + kind: HelmRepository |
| 47 | + name: gewis-webhost |
| 48 | + namespace: flux-system |
| 49 | + values: |
| 50 | + storage: |
| 51 | + size: 20Gi |
| 52 | + domains: |
| 53 | + - myapp.gewis.nl |
| 54 | + oidc: |
| 55 | + groups: |
| 56 | + - CBC - Application Hosting Team (ADM) |
| 57 | +``` |
| 58 | +
|
| 59 | +By convention, target namespaces are `webhost-<release>`; the chart no longer |
| 60 | +enforces this so `targetNamespace` is yours to set. |
| 61 | + |
| 62 | +## Standalone helm install |
| 63 | + |
| 64 | +```sh |
| 65 | +helm repo add gewis-webhost https://gewis.github.io/webhost-helm-chart |
| 66 | +helm install myapp gewis-webhost/static-webhost \ |
| 67 | + --create-namespace --namespace webhost-myapp \ |
| 68 | + --set 'domains={myapp.gewis.nl}' |
| 69 | +``` |
| 70 | + |
| 71 | +## Key values |
| 72 | + |
| 73 | +| Key | Description | Default | |
| 74 | +| --- | --- | --- | |
| 75 | +| `storage.size` | Size of the shared RWX volume | `10Gi` | |
| 76 | +| `domains` | List of hosts routed to Caddy; first also serves `/admin` (code-server) | `[example.gewis.nl]` | |
| 77 | +| `oidc.groups` | Group names allowed through the OIDC middleware | `[CBC - Application Hosting Team (ADM)]` | |
| 78 | +| `oidc.provider.url` | OIDC issuer URL | GEWISWG realm | |
| 79 | +| `oidc.secretReflectsFrom` | Source for the reflected OIDC secret | `shared-secrets/oidc-auth` | |
| 80 | +| `codeServer.image` / `caddy.image` | Container images | upstream `latest` / `2-alpine` | |
| 81 | + |
| 82 | +See [`values.yaml`](./values.yaml) for the full schema. |
| 83 | + |
| 84 | +## Releasing |
| 85 | + |
| 86 | +The `release-chart` workflow publishes to `gh-pages` whenever a new chart |
| 87 | +version is pushed to `main`. To cut a release: |
| 88 | + |
| 89 | +1. Edit templates/values as needed. |
| 90 | +2. Bump `version:` in `Chart.yaml` (semver). |
| 91 | +3. Merge to `main`. CI packages the chart and updates the Helm repo index. |
| 92 | + |
| 93 | +If the version on `main` is already in `index.yaml`, the workflow skips |
| 94 | +publishing — no clobbering of existing releases. |
| 95 | + |
| 96 | +## Local development |
| 97 | + |
| 98 | +A Nix flake provides Helm: |
| 99 | + |
| 100 | +```sh |
| 101 | +nix develop |
| 102 | +helm lint . |
| 103 | +helm template demo . --set 'domains={demo.gewis.nl}' |
| 104 | +``` |
0 commit comments