Skip to content

Commit 68d5458

Browse files
committed
feat!: migrate chart to bjw-s common 5.0.1 and Trilium v0.104.0
Modernizes the chart onto the bjw-s common library 5.0.1 and absorbs the open community PRs and issues: - Probes now target GET /api/health-check instead of /login, which is rate limited as of Trilium v0.104.0 and caused restart loops (fixes TriliumNext/Trilium#10617) - Image renamed from triliumnext/notes to triliumnext/trilium and bumped to v0.104.0 (supersedes #12), Chart.yaml URL and icon fixes included - UID/GID, fsGroup and the fixperms init container are configurable via the permissions block (supersedes #7) - Trilium TRILIUM_* environment variable configuration is documented in values.yaml and the README (closes #9) - The chart creates a retained 20Gi PVC by default; existingClaim is still supported but no longer required - The fragile hardcodedValues merge template is gone: all defaults live in values.yaml, so user overrides now take precedence as expected; the config.ini ConfigMap is chart-managed and rolls the pod on change BREAKING CHANGE: The chart now uses the bjw-s common library 5.0.1. The Deployment selector labels changed, so the existing Deployment must be deleted before upgrading (kubectl delete deployment <release-name>). The image moved from triliumnext/notes to triliumnext/trilium (v0.104.0), probes moved to /api/health-check, and the chart now creates a PVC by default (persistence.data.existingClaim is still supported and no longer required).
1 parent 04189c7 commit 68d5458

18 files changed

Lines changed: 434 additions & 301 deletions

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Ignore the debugging output
22
charts/trilium/charts/
3-
charts/trilium/Chart.lock
43

54
# Testing
65
__snapshot__/

README.md

Lines changed: 176 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,134 +1,98 @@
11
# Trilium Helm Chart
22

3-
This is the Helm Chart for Trilium, to easily deploy Trilium on your Kubernetes cluster. This chart leverages the [bjw-s common library](https://github.com/bjw-s/helm-charts/blob/common-3.3.2/charts/library/common/values.yaml) which inherits all the possible [values](https://github.com/bjw-s/helm-charts/blob/common-3.3.2/charts/library/common/values.yaml) of that template.
3+
The Helm chart for [Trilium Notes](https://github.com/TriliumNext/Trilium), a hierarchical note taking application with a focus on building large personal knowledge bases.
44

5-
Please refer to the section "Modifying Deployed Resources" below on how to customize the deployment, or refer to the examples in [the examples folder](./examples/)
5+
The chart is built on the [bjw-s common library](https://github.com/bjw-s-labs/helm-charts/blob/common-5.0.1/charts/library/common/values.yaml), so every value the library supports can be set directly in this chart's values. See [Customizing the deployment](#customizing-the-deployment) below and the [examples folder](./examples/).
66

7-
Aside from the [values.yaml](./charts/trilium/values.yaml), please also view the additional files in the [templates](./charts/trilium/templates/) folder to see the additional values that are provided to Helm, to create the Kubernetes release. These values can also be overridden, and the defaults should be completely unobtrusive to any changes that are commonly made.
7+
## Installing
88

9-
If you find that a value in your release is inconsistent with those found in the [values.yaml](./charts/trilium/values.yaml) and the [bjw-s common library](https://github.com/bjw-s/helm-charts/blob/common-3.3.2/charts/library/common/values.yaml), then they are being modified in the [templates](./charts/trilium/templates/) folder. Any value changes specified by the user override any values defined within this chart.
10-
11-
## Requirements
12-
13-
- A working Kubernetes cluster.
14-
- A PVC provisioner.
15-
- If you don't have one, but have something that serves an NFS share, take a look at the following
16-
- [nfs-subdir-external-provisioner](https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner)
17-
- [democratic-csi](https://github.com/democratic-csi/democratic-csi)
18-
19-
## Deploying
9+
From the classic Helm repository:
2010

2111
```bash
2212
helm repo add trilium https://triliumnext.github.io/helm-charts
23-
helm install --create-namespace --namespace trilium trilium trilium/trilium -f values.yaml
13+
helm install trilium trilium/trilium --namespace trilium --create-namespace
2414
```
2515

26-
### Example values
27-
28-
Below are some examples of what you could provide for the chart's values, for additional examples, please check out [the examples folder](./examples/).
16+
Or from the OCI registry:
2917

30-
```yaml
31-
controllers:
32-
main:
33-
containers:
34-
trilium:
35-
image:
36-
repository: triliumnext/notes
37-
tag: v0.90.8
38-
pullPolicy: IfNotPresent
39-
env:
40-
key: "value"
41-
42-
persistence:
43-
data:
44-
enabled: true
45-
type: persistentVolumeClaim
46-
existingClaim: trilium-data-pvc
18+
```bash
19+
helm install trilium oci://ghcr.io/triliumnext/helm-charts/trilium --namespace trilium --create-namespace
4720
```
4821

49-
## Using Helm CLI
22+
Charts published to the OCI registry are signed with cosign. Verify a version with:
5023

5124
```bash
52-
helm repo add trilium https://triliumnext.github.io/helm-charts
53-
helm install --create-namespace --namespace trilium trilium trilium/trilium
25+
cosign verify ghcr.io/triliumnext/helm-charts/trilium:<version> \
26+
--certificate-identity-regexp 'https://github.com/TriliumNext/helm-charts/.*' \
27+
--certificate-oidc-issuer https://token.actions.githubusercontent.com
5428
```
5529

56-
## Using GitOps
30+
By default the chart creates a 20Gi PersistentVolumeClaim for your notes, so all you need is a working PVC provisioner in the cluster. The PVC is annotated so it survives `helm uninstall`.
5731

58-
If you want to use GitOps, essentially using a Git repository as the single source of truth for the applications in your cluster, you can use tools such as ArgoCD or Flux. Below is an example of what an "Application" that creates a Helm release in ArgoCD looks like:
32+
## Upgrading from 1.x to 2.0.0
5933

60-
```yaml
61-
apiVersion: argoproj.io/v1alpha1
62-
kind: Application
63-
metadata:
64-
name: trilium
65-
namespace: argocd
34+
Version 2.0.0 is a breaking release. What changed:
6635

67-
spec:
68-
project: default
69-
source:
70-
chart: trilium
71-
repoURL: https://trilium-next.github.io/helm-charts
72-
targetRevision: 1.3.0
73-
helm:
74-
values: |
75-
controllers:
76-
main:
77-
containers:
78-
trilium:
79-
image:
80-
repository: triliumnext/notes
81-
tag: v0.92.4
82-
pullPolicy: IfNotPresent
83-
env:
84-
key: "value"
36+
- The bjw-s common library was upgraded from 3.3.2 to 5.0.1. The Deployment selector labels changed, and selector labels are immutable in Kubernetes, so the old Deployment has to be deleted once before upgrading.
37+
- The container image moved from `triliumnext/notes` to `triliumnext/trilium` (the old image name no longer receives updates), and the default version is now v0.104.0.
38+
- Health probes now use `GET /api/health-check` instead of `/login`. Trilium v0.104.0 rate limits `/login`, which made the old probes restart-loop the pod ([TriliumNext/Trilium#10617](https://github.com/TriliumNext/Trilium/issues/10617)).
39+
- The chart now creates its own PVC by default. `persistence.data.existingClaim` is still fully supported, it is just no longer required. All 1.x installs used an existing claim, and upgrades keep using it, so your data is untouched.
40+
- A dedicated ServiceAccount is now created for the pod, with `automountServiceAccountToken: false`.
8541

86-
persistence:
87-
data:
88-
enabled: true
89-
type: persistentVolumeClaim
90-
existingClaim: my-claim-1
91-
destination:
92-
server: "https://kubernetes.default.svc"
93-
namespace: apps
94-
syncPolicy:
95-
automated:
96-
prune: true
97-
selfHeal: true
42+
Steps to upgrade:
43+
44+
```bash
45+
# 1. Take a backup of your Trilium data (always a good idea before upgrades).
46+
47+
# 2. Delete the old Deployment. Your PVC and data are not affected.
48+
kubectl --namespace <namespace> delete deployment <release-name>
49+
50+
# 3. Upgrade the release.
51+
helm repo update
52+
helm upgrade <release-name> trilium/trilium --namespace <namespace> -f your-values.yaml
9853
```
9954

100-
### Modifying Deployed Resources
55+
Notes:
10156

102-
Often times, modifications need to be made to a Helm chart to allow it to operate in your Kubernetes cluster. By utilizing bjw-s's `common` library, there are quite a few options that can be easily modified.
57+
- If your values pin `triliumnext/notes` as the image repository, remove that override. The image name changed upstream.
58+
- Trilium migrates its database format on the first start of v0.104.0. The migration is automatic, but it is one more reason to take the backup in step 1.
59+
- Your values file keeps the same flat shape as before. The `configini` block, `persistence.data.existingClaim`, ingress definitions, and other common library overrides all keep working.
10360

104-
Anything you see [here](https://github.com/bjw-s/helm-charts/blob/d9e8c23df242dd9a2dda7c3738360928526d7a20/charts/library/common/values.yaml), including the top-level keys, can be added and subtracted from this chart's `values.yaml`.
61+
## Persistence
10562

106-
For example, if you wished to create a `serviceAccount`, refer to the values [here](https://github.com/bjw-s/helm-charts/blob/d9e8c23df242dd9a2dda7c3738360928526d7a20/charts/library/common/values.yaml#L364-L376), and override them as needed. So, to create a `serviceAccount`, you would want to add YAML below to your Helm release values:
63+
The chart provisions a `ReadWriteOnce` PVC by default (Trilium uses SQLite, so the volume must not be shared between nodes):
10764

10865
```yaml
109-
serviceAccount:
110-
create: true
66+
persistence:
67+
data:
68+
size: 20Gi
69+
# storageClass: my-storage-class
11170
```
11271

113-
Then, (for some reason), if you wished to change the Deployment type to `DaemonSet`, ([referencing the values here](https://github.com/bjw-s/helm-charts/blob/d9e8c23df242dd9a2dda7c3738360928526d7a20/charts/library/common/values.yaml#L96)), you could do the following:
72+
The PVC carries the `helm.sh/resource-policy: keep` annotation, so uninstalling the release leaves your notes in place.
73+
74+
To bring your own PVC instead:
11475

11576
```yaml
116-
controllers:
117-
main:
118-
type: daemonset
119-
```
77+
persistence:
78+
data:
79+
existingClaim: my-existing-claim
80+
```
12081
121-
## Modifying the `config.ini`
82+
## Configuration
12283
123-
Trilium also has a `config.ini` that allows you to [modify some values](https://github.com/TriliumNext/Notes/blob/7ca4cddc5868f4a80b8804ad93a35bf4bc8cc812/config-sample.ini). The values you set within them are mostly self-explanatory, but if you need to change any of the values, modify the following section within the `values.yaml` to the value you want them to be.
84+
### config.ini
85+
86+
The `configini` block renders Trilium's `config.ini` into a ConfigMap. Changing it automatically restarts the pod so the new settings take effect:
12487

12588
```yaml
12689
configini:
12790
general:
12891
instanceName: ""
129-
# Disable authentication to Trilium? (if you're running it on a private network, or have authentication handled by another component)
92+
# Disable authentication (for private networks, or when auth is handled
93+
# by another component in front of Trilium)
13094
noAuthentication: false
131-
# Disable backups of the database?
95+
# Disable automatic database backups
13296
noBackup: false
13397
network:
13498
host: "0.0.0.0"
@@ -139,14 +103,129 @@ configini:
139103
trustedReverseProxy: true
140104
```
141105

142-
## Development
106+
### Environment variables
107+
108+
Trilium can also be configured through environment variables named `TRILIUM_<SECTION>_<KEY>`, which override the corresponding `config.ini` values:
109+
110+
```yaml
111+
controllers:
112+
main:
113+
containers:
114+
trilium:
115+
env:
116+
TRILIUM_GENERAL_INSTANCENAME: my-trilium
117+
TRILIUM_NETWORK_TRUSTEDREVERSEPROXY: "true"
118+
```
119+
120+
For secret values, prefer a Kubernetes Secret loaded with `envFrom`:
143121

144-
To use Helm in order to create the individual Kubernetes manifests needed to deploy it "by hand", you can use the following commands:
122+
```yaml
123+
controllers:
124+
main:
125+
containers:
126+
trilium:
127+
envFrom:
128+
- secret: trilium-secrets
129+
```
130+
131+
## Permissions (UID/GID)
132+
133+
Trilium runs as UID/GID 1000 by default. An init container fixes the ownership of the data directory before Trilium starts, and the image entrypoint drops to the same UID/GID. To run as a different user:
134+
135+
```yaml
136+
permissions:
137+
uid: 568
138+
gid: 568
139+
140+
defaultPodOptions:
141+
securityContext:
142+
fsGroup: 568
143+
```
144+
145+
If your storage already handles ownership (or you do not want a root init container), disable it:
146+
147+
```yaml
148+
controllers:
149+
main:
150+
initContainers:
151+
fixperms:
152+
enabled: false
153+
```
154+
155+
## Exposing Trilium
156+
157+
An ingress example in the common library 5.x shape:
158+
159+
```yaml
160+
ingress:
161+
main:
162+
enabled: true
163+
className: nginx
164+
annotations:
165+
# remove the request body size limit for large file uploads
166+
nginx.ingress.kubernetes.io/proxy-body-size: "0"
167+
hosts:
168+
- host: trilium.example.com
169+
paths:
170+
- path: /
171+
pathType: Prefix
172+
service:
173+
identifier: main
174+
port: http
175+
```
176+
177+
## Customizing the deployment
178+
179+
Anything from the [common library values](https://github.com/bjw-s-labs/helm-charts/blob/common-5.0.1/charts/library/common/values.yaml) can be set at the top level of this chart's values and is merged with the chart defaults. For example, to run as a DaemonSet:
180+
181+
```yaml
182+
controllers:
183+
main:
184+
type: daemonset
185+
```
186+
187+
The chart's health probes target Trilium's unauthenticated `GET /api/health-check` endpoint. If you run an older Trilium version that lacks it, override `controllers.main.containers.trilium.probes` in your values.
188+
189+
## GitOps
190+
191+
An ArgoCD Application using this chart (see [examples/argocd-application.yaml](./examples/argocd-application.yaml) for the full file):
192+
193+
```yaml
194+
apiVersion: argoproj.io/v1alpha1
195+
kind: Application
196+
metadata:
197+
name: trilium
198+
namespace: argocd
199+
spec:
200+
project: default
201+
source:
202+
chart: trilium
203+
repoURL: https://triliumnext.github.io/helm-charts
204+
targetRevision: 2.0.0
205+
helm:
206+
values: |
207+
persistence:
208+
data:
209+
size: 20Gi
210+
destination:
211+
server: https://kubernetes.default.svc
212+
namespace: trilium
213+
syncPolicy:
214+
automated:
215+
prune: true
216+
selfHeal: true
217+
syncOptions:
218+
- CreateNamespace=true
219+
```
220+
221+
## Development
145222

146223
```bash
147224
git clone https://github.com/TriliumNext/helm-charts
148-
cd helm-chart/charts/trilium
149-
helm dependency update
150-
helm package .
151-
helm template test1 . --namespace testing -f values.yaml --debug > output.yaml
225+
cd helm-charts
226+
helm dependency update charts/trilium
227+
helm lint charts/trilium
228+
helm template trilium charts/trilium > output.yaml
152229
```
230+
231+
Releases are automated with [release-please](https://github.com/googleapis/release-please): pull request titles follow [Conventional Commits](https://www.conventionalcommits.org/) (they become the squash commit messages), and merging the generated release PR tags the release, publishes the chart to the GitHub release, the `https://triliumnext.github.io/helm-charts` index, and `oci://ghcr.io/triliumnext/helm-charts`, and signs the OCI artifact with cosign.

charts/trilium/.helmignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,7 @@ OWNERS
2727
*.gotmpl
2828

2929
# helm unit tests
30-
tests/
30+
tests/
31+
32+
# CI values files
33+
ci/

charts/trilium/Chart.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
dependencies:
2+
- name: common
3+
repository: https://bjw-s-labs.github.io/helm-charts
4+
version: 5.0.1
5+
digest: sha256:99ecf11b32f1a7153194a31a68856534e02ed6c961d736780d28af920254e179
6+
generated: "2026-07-22T10:04:50.306229669-07:00"

0 commit comments

Comments
 (0)