You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
(fixesTriliumNext/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).
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.
4
4
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/).
6
6
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
8
8
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
Below are some examples of what you could provide for the chart's values, for additional examples, please check out [the examples folder](./examples/).
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`.
57
31
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
59
33
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:
- 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`.
85
41
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.
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.
103
60
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
105
62
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):
107
64
108
65
```yaml
109
-
serviceAccount:
110
-
create: true
66
+
persistence:
67
+
data:
68
+
size: 20Gi
69
+
# storageClass: my-storage-class
111
70
```
112
71
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:
114
75
115
76
```yaml
116
-
controllers:
117
-
main:
118
-
type: daemonset
119
-
```
77
+
persistence:
78
+
data:
79
+
existingClaim: my-existing-claim
80
+
```
120
81
121
-
## Modifying the `config.ini`
82
+
## Configuration
122
83
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:
124
87
125
88
```yaml
126
89
configini:
127
90
general:
128
91
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)
130
94
noAuthentication: false
131
-
# Disable backups of the database?
95
+
# Disable automatic database backups
132
96
noBackup: false
133
97
network:
134
98
host: "0.0.0.0"
@@ -139,14 +103,129 @@ configini:
139
103
trustedReverseProxy: true
140
104
```
141
105
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`:
143
121
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):
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.
0 commit comments