Backup restore recommendations of mongodb

Hi Sebastian

I’m trying to replicate your kubernettes setup with mongodb and squidex in our local azure cloud.

I’m lacking some best practice input on terms of mongodb backup and restore procedure when not using on mongodb as PaaS.

Do you have any experience or input from your current setup that you could share?

I have created my own backup application: https://github.com/SebastianStehle/MongoBackup/blob/master/MongoBackup/Program.cs

And then I use the following job

apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: mongodb-backup
spec:
  schedule: "0 1 * * *"
  jobTemplate:
    spec:
      template:
        spec:
          volumes:
          - name: k8user-key
            secret:
              secretName: k8user-key
          containers:
            - name: mongodb-backup
              image: sebastianstehle/mongodb-backup
              imagePullPolicy: Always
              env:
                - name: MONGODB__URI
                  value: "mongodb://mongo-0.mongo,mongo-1.mongo,mongo-2.mongo:27017/"
                - name: GOOGLESTORAGE__BUCKETNAME
                  value: squidex-backups
                - name: GOOGLE_APPLICATION_CREDENTIALS
                  value: /var/secrets/google/key.json
              volumeMounts:
              - name: k8user-key
                mountPath: /var/secrets/google
          restartPolicy: Never
      backoffLimit: 4

You could create a PR to also support azure storage as a target.

Thanks a lot ! :slight_smile:

Hi Sebastian,

I’m working on a backup strategy for Squidex and I was wondering if https://github.com/SebastianStehle/MongoBackup is what you still use in your production clusters?

Yes, I do, but I don’t support other storage providers yet. But I have extracted the squidex asset storage to its own nuget component, so it should be possible to integrate it.