plausible on kubernetes
Plausible CE, self-hosted, on k8s.
│ 18:39:36.041 [notice] Application tzdata exited: exited in: Tzdata.App.start(:normal, []) │
│ ** (EXIT) an exception was raised: │
│ ** (MatchError) no match of right hand side value: {:error, {:shutdown, {:failed_to_start_child, Tzdata.EtsHolder, {\%File.Error{re │
│ (tzdata 1.1.2) lib/tzdata/tzdata_app.ex:13: Tzdata.App.start/2 │
│ (kernel 10.0) application_master.erl:295: :application_master.start_it_old/4 │
│ Runtime terminating during boot (terminating)
Crash dump is being written to: ...
If you’re seeing this, I’m so sorry. But somehow you’ve ended up here, so maybe this is the end of your struggles.
Your pod is dying immediately, so you probably can’t even investigate this. Use this to put the pod into a sort of “manual” mode.
containers:
- args:
- sh
- -c
- "while true; do echo 'yo' && sleep 5; done;"
# /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh run
Once the pod starts now, it will just say “yo.” Shell into it
kubectl exec -it pod/plausible-XXX -- sh
manually run the args we commented out.
cd /
./entrypoint.sh db createdb
./entrypoint.sh db migrate
./entrypoint.sh run
Now you can see the error, but your pod doesn’t die.
The Big Reveal
The plausible runtime writes some files to the data dir. You know, this one.
volumeMounts:
- mountPath: /var/lib/plausible
name: plausible-data
Check your user and its group.
id
uid=999(plausible) gid=65533(nogroup) groups=65533(nogroup)
Check if this user can write to the mountPath plausible-data
.
ls -ld /var/lib/plausible
# this means only root can write
drwxr-xr-x 3 root root 4096 Oct 24 18:39 /var/lib/plausible/
# this means nogroup can write
drwxrwsr-x 4 root nogroup 4096 Oct 24 18:12 /var/lib/plausible
If plausible
can write to this dir, you’re facing a different issue. If not,
give it access and try again.
securityContext:
fsGroup: 65533 # nogroup, user 999 needs access to /var/lib/plausible
This is definitely not the correct way to assign this group, but you’ll figure it out.
I couldn’t find jack shit on the internet for this. Hopefully this helps you a bit.