mastodon / chart

Helm chart for Mastodon deployment in Kubernetes
GNU Affero General Public License v3.0
154 stars 89 forks source link

depend on a pg operator instead? #4

Closed KlavsKlavsen closed 1 year ago

KlavsKlavsen commented 1 year ago

I would recommend depending on a postgres operator - like https://github.com/zalando/postgres-operator - that will enable you to easily have DB backups, and DB scaling / HA managed by the operator (and the mastodon chart can then just define a pg instance per the operators CRD) - and it would be much easier to start getting horizontal scaling working with Mastodon.

deepy commented 1 year ago

Using the pg operator instead of the bitnami postgres subchart is perfectly possible, just set enabled: false and use existingSecret :-)

I'm using the zalando postgres operator for my cluster, but I wouldn't recommend bundling it with this chart as the documentation is sparse and support can be pretty slow

KlavsKlavsen commented 1 year ago

Still its a better option IMHO and should be mentionened - and yeah - with open source I would not expect much in way of support - except perhaps a community somewhere to talk to :)

SISheogorath commented 1 year ago

As someone who currently uses and has previously built helm charts with the zalando postgres operator: I would stick with the bitnami charts as depenency. It's less complex from a technological perspective, and one who can debug helm, can debug this as well, and most important it allows to install the chart without special privileges.

While the operator once installed also works for namespace admins, one still needs to install it, and this might not always be possible.

KlavsKlavsen commented 1 year ago

I would just add this to templates - and add option to choose which.

Below template could then in future be adjusted to enable HA or other features for scaling mastodon - making it much easier for the user to get a scalable setup from this chart (if they want it).

 apiVersion: "acid.zalan.do/v1"
 kind: postgresql
 metadata:
   name: mastodon-pgsql
   namespace: {{ .Release.Namespace }}
 spec:
   teamId: mastodon
   volume:
     size: {{ .Values.postgresql.size }}
     {{- if .Values.postgresql.storageClass }}
     storageClass: {{ .Values.postgresql.storageClass }}
     {{- end }}
   numberOfInstances: 1
   users:
     mastodon_admin:
       - superuser
       - createdb
   databases:
     mastodon: mastodon_admin
   postgresql:
     version: "14"
   enableMasterLoadBalancer: false
KlavsKlavsen commented 1 year ago

I'll gladly make a PR if you agree above would be useful?

deepy commented 1 year ago

The problem with adding the template is that you'd have to add a bunch of other variables to be able to use it in production, and while the three of us swear by Zalando's postgres-operator we also have people who swear by the Crunchy Data one. And the more functionality we stuff into the chart the more we have to test and maintain.

If you've deployed an operator it's likely that you already know how to deploy postgresql with it and if you don't this is not the best place to learn. I think the documentation should strongly urge you towards using an operator (and setting up backups), but we shouldn't put any additional logic into the chart.

KlavsKlavsen commented 1 year ago

Fair enough. I'll close this then.